{"version":3,"file":"ShareButton.BMPXLxSu.mjs","names":["useState","startTransition"],"sources":["https:/framerusercontent.com/modules/n499JLXlb4FooyOIEPQ8/Vme1LX9Dn2Ay4Lq0wwZ5/ShareButton.js"],"sourcesContent":["// Share Button that shares the current webpage link\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,startTransition}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";function isFramerPreviewUrl(urlString){try{const parsed=new URL(urlString);const host=parsed.hostname.toLowerCase();const pathname=parsed.pathname.toLowerCase();const hasPreviewParam=parsed.searchParams.has(\"experiment\")||parsed.searchParams.has(\"siteId\");return host.includes(\"framercanvas.com\")||pathname.includes(\"preview-module\")||hasPreviewParam;}catch{return true;}}function sanitizePublicUrl(urlString){try{const parsed=new URL(urlString);if(!/^https?:$/i.test(parsed.protocol))return\"\";parsed.hash=\"\";parsed.searchParams.delete(\"experiment\");parsed.searchParams.delete(\"siteId\");parsed.searchParams.delete(\"mode\");return parsed.toString();}catch{return\"\";}}function resolveCleanPageUrl(explicitUrl){const explicitTrimmed=explicitUrl?.trim();if(explicitTrimmed){return sanitizePublicUrl(explicitTrimmed);}if(typeof window===\"undefined\")return\"\";const currentUrl=window.location.href;const currentIsPreview=isFramerPreviewUrl(currentUrl);if(!currentIsPreview){return sanitizePublicUrl(currentUrl);}if(typeof document!==\"undefined\"){const referrer=document.referrer;if(referrer&&!isFramerPreviewUrl(referrer)){return sanitizePublicUrl(referrer);}}return\"\";}/**\n * Share Button\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function ShareButton(props){const{label,icon,url,iconOnly,background,color,borderRadius,font,style}=props;const[copied,setCopied]=useState(false);function handleShare(){if(typeof window===\"undefined\")return;const resolvedUrl=resolveCleanPageUrl(url);const fallbackText=label||\"Share\";const textToCopy=resolvedUrl||fallbackText;if(navigator.share){const shareData=resolvedUrl?{url:resolvedUrl}:{text:fallbackText};navigator.share(shareData).catch(()=>{});}else if(navigator.clipboard){navigator.clipboard.writeText(textToCopy).then(()=>{startTransition(()=>setCopied(true));setTimeout(()=>startTransition(()=>setCopied(false)),1200);});}else{// fallback\nconst input=document.createElement(\"input\");input.value=textToCopy;document.body.appendChild(input);input.select();document.execCommand(\"copy\");document.body.removeChild(input);startTransition(()=>setCopied(true));setTimeout(()=>startTransition(()=>setCopied(false)),1200);}}if(RenderTarget.current()===RenderTarget.thumbnail)return null;return /*#__PURE__*/_jsxs(\"button\",{type:\"button\",\"aria-label\":\"Share this page\",onClick:handleShare,style:{...style,display:\"flex\",alignItems:\"center\",gap:iconOnly?0:10,background,color,border:\"none\",borderRadius,padding:\"12px 24px\",cursor:\"pointer\",boxShadow:\"0 2px 8px rgba(0,0,0,0.06)\",transition:\"background 0.15s, color 0.15s\",width:\"100%\",height:\"100%\",justifyContent:\"center\",...font},children:[(iconOnly||icon)&&/*#__PURE__*/_jsx(\"svg\",{width:\"19\",height:\"19\",viewBox:\"0 0 24 24\",\"aria-hidden\":\"true\",focusable:\"false\",children:/*#__PURE__*/_jsx(\"path\",{fill:\"currentColor\",d:\"M16 3a3 3 0 0 0-2.83 4.01l-4.9 2.45a3 3 0 1 0 0 5.08l4.9 2.45A3 3 0 1 0 14 15.5l-4.9-2.45a3 3 0 0 0 0-2.1L14 8.5A3 3 0 1 0 16 3Zm0 2a1 1 0 1 1 0 2 1 1 0 0 1 0-2ZM6 11a1 1 0 1 1 0 2 1 1 0 0 1 0-2Zm10 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2Z\"})}),!iconOnly&&/*#__PURE__*/_jsx(\"span\",{style:{fontWeight:600},children:copied?\"Copied!\":label})]});}addPropertyControls(ShareButton,{label:{type:ControlType.String,title:\"Label\",defaultValue:\"Share\"},icon:{type:ControlType.String,title:\"Icon\",defaultValue:\"🔗\",placeholder:\"Emoji or leave blank\"},url:{type:ControlType.String,title:\"Page URL\",defaultValue:\"\"},iconOnly:{type:ControlType.Boolean,title:\"Icon Only\",defaultValue:false,enabledTitle:\"Yes\",disabledTitle:\"No\"},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"#111\"},color:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#fff\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:8,min:0,max:32},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"16px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ShareButton\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ShareButton.map"],"mappings":"qNACsK,SAAS,EAAmB,EAAU,CAAC,GAAG,CAAC,IAAM,EAAO,IAAI,IAAI,EAAU,CAAO,EAAK,EAAO,SAAS,aAAa,CAAO,EAAS,EAAO,SAAS,aAAa,CAAO,EAAgB,EAAO,aAAa,IAAI,aAAa,EAAE,EAAO,aAAa,IAAI,SAAS,CAAC,OAAO,EAAK,SAAS,mBAAmB,EAAE,EAAS,SAAS,iBAAiB,EAAE,OAAsB,CAAC,MAAO,IAAO,SAAS,EAAkB,EAAU,CAAC,GAAG,CAAC,IAAM,EAAO,IAAI,IAAI,EAAU,CAAiL,MAA5K,aAAa,KAAK,EAAO,SAAS,EAAU,EAAO,KAAK,GAAG,EAAO,aAAa,OAAO,aAAa,CAAC,EAAO,aAAa,OAAO,SAAS,CAAC,EAAO,aAAa,OAAO,OAAO,CAAQ,EAAO,UAAU,EAA3J,QAAkK,CAAC,MAAM,IAAK,SAAS,EAAoB,EAAY,CAAC,IAAM,EAAgB,GAAa,MAAM,CAAC,GAAG,EAAiB,OAAO,EAAkB,EAAgB,CAAE,GAAU,IAAS,OAAY,MAAM,GAAG,IAAM,EAAW,EAA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