import{j as e,r as t}from"./react-B_SyE9nW.js";import{o,N as r,n as i,S as n,j as s,s as a,i as l,B as c,G as h}from"./index-Flm6m8Wj.js";import{E as d}from"./EditIco-baVWUWBE.js";import{T as u}from"./TrashIco-CShefd42.js";import{B as p}from"./RatingReviewTitle-Bqj_kx7V.js";import{U as x}from"./ItemLoading-wir9MCjq.js";import{M as m,G as j}from"./styles-BKX5ijFq.js";import{I as g}from"./index-C6Ujt1Uk.js";import{M as f}from"./DownIco-uXp5N5Ip.js";import{B as M}from"./BtnShadow-BEdKMB6u.js";import{C as b}from"./CircleCheckIco-BFSVh3im.js";import{F as y}from"./FacebookIco-CKxniypy.js";import{T as C}from"./TwitterIco-PdpxZu2n.js";const k=o((function(){return e.jsx(r,{size:"mini",color:"red",weight:500,children:i("lottery")})}));function v({fill:t="currentcolor",opacity:o=".3",...r}){return e.jsxs(n,{...r,children:[e.jsx("path",{d:"m7 17.97 5-2.15 5 2.15V5H7z",opacity:o,fill:t}),e.jsx("path",{d:"M17 3H7a2 2 0 0 0-2 2v16l7-3 7 3V5a2 2 0 0 0-2-2zm0 14.97-5-2.14-5 2.14V5h10v12.97z"})]})}function w(t){return e.jsx(n,{...t,children:e.jsx("path",{d:"M10 4h4v4h-4zM10 10h4v4h-4zM10 16h4v4h-4z"})})}const I={width:"28px",height:"28px",position:"absolute",top:"5px",right:"5px",bgcolor:`${s.black36}!important`,"& .MuiSvgIcon-root":{color:s.white,width:"auto",height:"22px"}},S=a(m)`
  &.MuiMenu-root .MuiMenu-paper {
    & .MuiPaper-root {
      border-radius: 18px 0 18px 18px;
    }
  }
`;const z=o((function({is_bookmarked:o,sx:r,cb:n,fromMyProfile:a,item_identifier:c,isDetails:h,dataTest:m,...M}){const b=t.useContext(x),y=t.useContext(p),[C,k]=t.useState(null),z=Boolean(C),T=t.useMemo((()=>z?"true":void 0),[z]),R=()=>k(null);return e.jsxs(e.Fragment,{children:[e.jsx(g,{"data-test":m,sx:{...I,...r},onClick:e=>{e.stopPropagation(),e.preventDefault(),a?k(e.currentTarget):y.onClickBookmark({...M,item_identifier:c}),y.setCb(n)},id:"enj-btn-edit-list-id","aria-controls":"enj-btn-edit-icon-menu","aria-haspopup":"true","aria-expanded":T,children:a?e.jsx(w,{}):e.jsx(v,{fill:o?s.yellow:void 0,opacity:o?"1":void 0})}),a?e.jsxs(S,{id:"enj-btn-edit-icon-menu",MenuListProps:{"aria-labelledby":"enj-btn-edit-list-id"},anchorEl:C,open:z,onClose:()=>R(),TransitionComponent:j,style:{marginLeft:-10,marginTop:10},sx:{"& .MuiPaper-root":{borderRadius:"18px 0 18px 18px"},"& .MuiSvgIcon-root":{marginRight:"12px"},"& li.MuiButtonBase-root":{color:s.red,fontSize:l.micro}},children:[e.jsxs(f,{onClick:()=>{R(),y.onClickBookmark({...M,item_identifier:c},!0,h)},style:{minHeight:28},children:[e.jsx(d,{})," ",i("edit")]}),e.jsxs(f,{onClick:()=>{R(),b.onClickRemoveList(M.refUuid||c||"",h)},style:{minHeight:28},children:[e.jsx(u,{}),i("remove")]})]}):e.jsx(e.Fragment,{})]})}));function T(t){return e.jsx(n,{...t,children:e.jsx("path",{d:"M16 1H4a2 2 0 0 0-2 2v14h2V3h12V1zm3 4H8a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2zm0 16H8V7h11v14z"})})}function R({...t}){return e.jsx(n,{...t,children:e.jsx("path",{d:"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4-8 5-8-5V6l8 5 8-5v2z"})})}function P(t){return e.jsx(n,{...t,children:e.jsx("path",{d:"M14.4 7.8V3l8.6 8.4-8.6 8.4v-4.9C8.3 14.9 4.1 16.8 1 21 2.2 15 5.9 9 14.4 7.8z"})})}const B=t.createContext({text:"",url:""}),L=o((function({href:o,Ico:r=t.Fragment,intlId:n}){return e.jsxs(c,{component:"a",rel:"noopener",target:"_blank",sx:{cursor:"pointer",minHeight:"20px",textDecoration:"none",display:"block!important"},href:o,children:[e.jsx(r,{})," ",i(n)]})})),V=o((function({onClick:o,url:r}){const[n,a]=t.useState(!1);return t.useEffect((()=>{n&&setTimeout((()=>null==o?void 0:o()),500)}),[n]),e.jsxs(f,{onClick:async()=>{await navigator.clipboard.writeText(String(r)),a(!0)},sx:{"&":{display:"flex",alignItems:"center","& .MuiSvgIcon-root":{width:"24px",height:"24px",marginRight:"5px"}}},children:[n?e.jsx(b,{sx:{color:s.yellow},height:"24px",width:"24px"}):e.jsx(T,{height:"24px",width:"24px"}),i("shareCopy")]})}));const $=o((function({asIco:o,hasShadow:r=!0,isMap:n,dataTest:a,encodeUrl:c=!1,...d}){const{text:u,title:p="none",url:x=window.location.href}=t.useContext(B),[b,k]=t.useState(null),v=Boolean(b),w=()=>k(null),{type:I,g:S,dataTestMenu:z}=t.useMemo((()=>{switch(p){case"shareBusiness":return{type:"srdBusiness",g:1};case"shareProduct":return{type:"srdProduct",g:1};case"shareImage":return{type:"srdImage",g:0};case"shareMenu":return{type:"srdMenu",g:0};case"shareList":return{type:"srdList",g:0,dataTestMenu:"enj-lists-share-menu"};case"shareSearch":return{type:"srdSearch",g:0};default:return{type:"srdUser",g:0}}}),[p]),T=t.useMemo((()=>{if("shareBusiness"!==p)return x;let e=x;return x.endsWith("/")&&(e=x.slice(0,-1)),e.endsWith(i("r.menu"))?e:`${e}/${i("r.menu")}`}),[x,p]),$=t.useMemo((()=>c?encodeURIComponent(T):T),[c,T]),H=e=>{(e=>{k(e.currentTarget)})(e)},E={left:n?"-20px":"0",backgroundColor:"white",border:`1px solid ${s.grayLighter}`,"&:hover":{backgroundColor:"white",border:`1px solid ${s.black36}`},"&.Mui-focusVisible":{backgroundColor:"white"}};return e.jsxs(e.Fragment,{children:[o?e.jsx(P,{onClick:H,sx:{cursor:"pointer"}}):r?e.jsx(M,{...d,"data-test":a,onClick:H,children:e.jsx(P,{color:"secondary"})}):e.jsx(g,{"data-test":a,sx:E,onClick:H,children:e.jsx(P,{fontSize:"small"})}),h.isDesktop?e.jsxs(m,{PaperProps:{"data-test":z},id:"enj-phones-menu",sx:{"& .MuiMenuItem-root, & .MuiMenuItem-root a":{fontSize:l.micro,color:s.gray},"& .MuiPaper-root":{borderTopRightRadius:0}},MenuListProps:{"aria-labelledby":"enj-phone-button-rounded"},anchorEl:b,open:v,onClose:()=>w(),TransitionComponent:j,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"right"},children:[e.jsx(V,{onClick:w,url:T}),e.jsxs(f,{onClick:w,children:[e.jsx(R,{style:{marginRight:"5px"}}),e.jsx(L,{intlId:"shareMail",href:`mailto:?body=${String(null==u?void 0:u.concat(" ",$))}&subject=${i("shareSubject",{type:i(I),g:S})}`})]}),e.jsxs(f,{onClick:w,children:[e.jsx(C,{style:{marginRight:"5px"}}),e.jsx(L,{intlId:"shareTwitter",href:`https://twitter.com/intent/tweet?text=${String(null==u?void 0:u.concat(" ",$))}`})]}),e.jsxs(f,{onClick:w,children:[e.jsx(y,{style:{marginRight:"5px"}}),e.jsx(L,{intlId:"shareFacebook",href:`https://www.facebook.com/sharer.php?u=${String($)}`})]})]}):e.jsxs(m,{PaperProps:{"data-test":z},id:"enj-phones-menu",sx:{"& .MuiMenuItem-root, & .MuiMenuItem-root a":{fontSize:l.micro,color:s.gray},"& .MuiPaper-root":{borderTopRightRadius:0}},MenuListProps:{"aria-labelledby":"enj-phone-button-rounded"},anchorEl:b,open:v,onClose:()=>w(),TransitionComponent:j,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"right"},children:[e.jsx(V,{onClick:w,url:T}),e.jsxs(f,{onClick:async()=>{var e;const t=null==(e=navigator.share)?void 0:e.bind(navigator);try{t?await(null==t?void 0:t({text:u,title:i(p),url:T})):console.log("SharedIsNotSupported")}catch(o){console.log("Error: ",o)}w()},children:[e.jsx(P,{style:{marginRight:"5px"}}),e.jsx(L,{intlId:"share"})]})]})]})}));export{z as B,T as C,k as L,R as M,P as R,B as S,$ as a,w as b};