import{j as e,aj as p,ak as u,al as x,M as w,t as h}from"./vendor-laZsiqLO.js";import{B as f}from"./button-B8f8jW4H.js";import{D as j,a as k,b as C,c as n}from"./dropdown-menu-CpMN0BZ0.js";import{u as N}from"./useTranslation-BW0o-tkY.js";import"./utils-RgT4yCq8.js";const b=({className:a})=>e.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:a,fill:"currentColor",children:e.jsx("path",{d:"M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z"})});function D({postUrl:a,postTitle:d}){const{t:s}=N(),o=a||(typeof window<"u"?window.location.href:""),m=()=>{if(!o){h.error(s("_link_copy_failed","Failed to copy link"));return}navigator.clipboard.writeText(o),h.success(s("_link_copied","Link copied to clipboard"))},r=i=>{if(!o)return;const t=encodeURIComponent(o),c=encodeURIComponent(d||"Read this article");let l="";if(i==="facebook")l=`https://www.facebook.com/sharer/sharer.php?u=${t}`;else if(i==="x")l=`https://x.com/intent/tweet?url=${t}&text=${c}`;else if(i==="mail"){window.location.href=`mailto:?subject=${c}&body=Check this out: ${t}`;return}window.open(l,"_blank","width=600,height=400")};return e.jsxs(j,{modal:!1,children:[e.jsx(k,{asChild:!0,children:e.jsxs(f,{variant:"outline",size:"sm",className:"h-9 gap-2",children:[e.jsx(p,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:s("_share","Share")})]})}),e.jsxs(C,{align:"end",className:"w-48 z-[200]",children:[e.jsxs(n,{onClick:m,className:"cursor-pointer",children:[e.jsx(u,{className:"mr-2 h-4 w-4"})," ",s("_copy_link","Copy Link")]}),e.jsxs(n,{onClick:()=>r("facebook"),className:"cursor-pointer",children:[e.jsx(x,{className:"mr-2 h-4 w-4"})," Facebook"]}),e.jsxs(n,{onClick:()=>r("x"),className:"cursor-pointer",children:[e.jsx(b,{className:"mr-2 h-4 w-4"})," X"]}),e.jsxs(n,{onClick:()=>r("mail"),className:"cursor-pointer",children:[e.jsx(w,{className:"mr-2 h-4 w-4"})," Mail"]})]})]})}export{D as default};
