{"version":3,"file":"ShareButton.CC2i9ddB.mjs","names":["useState","useRef","useCallback","shareError","useMemo","_Fragment","startTransition","__esmMin","window","pe","te","init_ssg_sandbox_shims","init_npm_react_18_3_1","l","_e","ne","c","init_jsx_runtime","ce","de","navigator","init_framer_B1b760uK","addPropertyControls","ControlType","ShareButton","props","isPressed","setIsPressed","isHovered","setIsHovered","isCopied","setIsCopied","resetTimerRef","startCopiedFeedback","fallbackCopyWithTextarea","textarea","text","copied","handleClick","title","url","error","label","buttonText","buttonStyle","paddingY","paddingX","gap","borderRadius","backgroundColor","textColor","fontSize","fontWeight","iconSize","init_ShareButton"],"sources":["https:/framerusercontent.com/modules/YzfUdyRbCGmi8UPjp1D6/IYe02cYC6pPt5HdzZROF/ShareButton.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useCallback,useEffect,useMemo,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function ShareButton(props){const{buttonText,fontSize,fontWeight,iconSize,gap,paddingX,paddingY,borderRadius,backgroundColor,textColor}=props;const[isPressed,setIsPressed]=useState(false);const[isHovered,setIsHovered]=useState(false);const[isCopied,setIsCopied]=useState(false);const resetTimerRef=useRef(null);useEffect(()=>{return()=>{if(typeof window!==\"undefined\"&&resetTimerRef.current!==null){window.clearTimeout(resetTimerRef.current);}};},[]);const startCopiedFeedback=useCallback(()=>{if(typeof window!==\"undefined\"&&resetTimerRef.current!==null){window.clearTimeout(resetTimerRef.current);}startTransition(()=>setIsCopied(true));if(typeof window!==\"undefined\"){resetTimerRef.current=window.setTimeout(()=>{startTransition(()=>setIsCopied(false));resetTimerRef.current=null;},1800);}},[]);const fallbackCopyWithTextarea=useCallback(text=>{if(typeof document===\"undefined\")return false;if(typeof document.execCommand!==\"function\")return false;try{const textarea=document.createElement(\"textarea\");textarea.value=text;textarea.setAttribute(\"readonly\",\"\");textarea.setAttribute(\"aria-hidden\",\"true\");textarea.style.position=\"fixed\";textarea.style.top=\"-9999px\";textarea.style.left=\"-9999px\";textarea.style.opacity=\"0\";document.body.appendChild(textarea);textarea.focus();textarea.select();const copied=document.execCommand(\"copy\");document.body.removeChild(textarea);return copied;}catch{return false;}},[]);const handleClick=useCallback(async()=>{if(typeof window===\"undefined\"||typeof document===\"undefined\"||typeof navigator===\"undefined\"){return;}const title=document.title||\"\";const url=window.location.href||\"\";try{if(typeof navigator.share===\"function\"){await navigator.share({title,url});return;}}catch(error){const shareError=error;if(shareError?.name===\"AbortError\"){return;}}try{if(navigator.clipboard&&typeof navigator.clipboard.writeText===\"function\"){await navigator.clipboard.writeText(url);startCopiedFeedback();return;}}catch{// Continue to execCommand fallback\n}const copied=fallbackCopyWithTextarea(url);if(copied){startCopiedFeedback();}},[fallbackCopyWithTextarea,startCopiedFeedback]);const label=isCopied?\"Kopiert!\":buttonText;const buttonStyle=useMemo(()=>({position:\"relative\",display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",width:\"fit-content\",minWidth:\"max-content\",minHeight:40,padding:`${paddingY}px ${paddingX}px`,gap:`${gap}px`,border:\"none\",borderRadius:`${borderRadius}px`,background:backgroundColor,color:textColor,cursor:\"pointer\",userSelect:\"none\",WebkitTapHighlightColor:\"transparent\",fontFamily:\"Satoshi, Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",fontSize:`${fontSize}px`,fontWeight,lineHeight:1,transform:isPressed?\"scale(0.98)\":\"scale(1)\",transition:\"transform 120ms ease, filter 120ms ease, opacity 120ms ease\",opacity:isHovered?.94:1,filter:isHovered?\"brightness(0.98)\":\"none\",appearance:\"none\",WebkitAppearance:\"none\"}),[paddingY,paddingX,gap,borderRadius,backgroundColor,textColor,fontSize,fontWeight,isPressed,isHovered]);return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                .share-button:focus-visible {\n                    outline: 2px solid rgba(255, 255, 255, 0.9);\n                    outline-offset: 2px;\n                }\n                @media (hover: none) {\n                    .share-button {\n                        opacity: 1 !important;\n                        filter: none !important;\n                    }\n                }\n            `}),/*#__PURE__*/_jsxs(\"button\",{type:\"button\",className:\"share-button\",\"aria-label\":\"Del denne artikkelen\",style:buttonStyle,onClick:handleClick,onMouseEnter:()=>{if(typeof window!==\"undefined\"&&window.matchMedia&&window.matchMedia(\"(hover: hover)\").matches){startTransition(()=>setIsHovered(true));}},onMouseLeave:()=>{startTransition(()=>setIsHovered(false));startTransition(()=>setIsPressed(false));},onMouseDown:()=>startTransition(()=>setIsPressed(true)),onMouseUp:()=>startTransition(()=>setIsPressed(false)),onTouchStart:()=>startTransition(()=>setIsPressed(true)),onTouchEnd:()=>startTransition(()=>setIsPressed(false)),onTouchCancel:()=>startTransition(()=>setIsPressed(false)),children:[/*#__PURE__*/_jsxs(\"svg\",{width:iconSize*1.3*.858,height:iconSize*1.3,viewBox:\"0 0 461.2 537.3\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\",\"aria-hidden\":\"true\",style:{display:\"block\",color:\"currentColor\",flexShrink:0},children:[/*#__PURE__*/_jsx(\"path\",{d:\"M230.6,231c-45.9,1.4-87.9,23.4-115.1,57.4-30.2,37.7-40.5,86.1-29.2,132.1,15.9,64.9,70.6,109.8,136.8,116.8C96.4,534-2.1,427.5,0,303.3,2.2,178.1,104.9,76.4,230.8,76.9V0c-.1,0,230.4,153.6,230.4,153.6l-230.4,153.5-.2-76.2Z\",fill:\"#FFFFFF\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M230.6,231l.2,76.2,230.4-153.5L230.7,0v76.9C104.9,76.4,2.2,178.1,0,303.3c-2.2,124.2,96.4,230.6,223,234-66.2-7-120.9-51.9-136.8-116.8-11.3-46-.9-94.4,29.2-132.1,27.2-34,69.2-56,115.1-57.4Z\",fill:\"#FFFFFF\"})]}),/*#__PURE__*/_jsx(\"span\",{style:{display:\"inline-block\",minWidth:\"max-content\"},children:label})]})]});}addPropertyControls(ShareButton,{buttonText:{type:ControlType.String,title:\"Text\",defaultValue:\"Del\"},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:14,min:11,max:24,step:1,unit:\"px\"},fontWeight:{type:ControlType.Enum,title:\"Weight\",defaultValue:600,options:[400,500,600,700],optionTitles:[\"400\",\"500\",\"600\",\"700\"]},iconSize:{type:ControlType.Number,title:\"Icon\",defaultValue:18,min:12,max:24,step:1,unit:\"px\"},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:7,min:4,max:16,step:1,unit:\"px\"},paddingX:{type:ControlType.Number,title:\"Pad X\",defaultValue:12,min:6,max:24,step:1,unit:\"px\"},paddingY:{type:ControlType.Number,title:\"Pad Y\",defaultValue:9,min:6,max:20,step:1,unit:\"px\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:10,min:0,max:20,step:1},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"var(--token-5e232d3a-da8f-41c5-80f0-8d98fe037fa3, rgb(124, 54, 181))\"},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#FFFFFF\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ShareButton\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ShareButton.map"],"mappings":"A,2OAGG,SAAwBwB,EAAY,EAAM,CAAC,GAAK,CAAC,aAAW,WAAS,aAAW,WAAS,MAAI,WAAS,WAAS,eAAa,kBAAgB,aAAWC,EAAW,CAACC,EAAUC,GAAc3B,EAAS,EAAK,EAAO,CAAC4B,EAAUC,GAAc7B,EAAS,EAAK,EAAO,CAAC8B,EAASC,GAAa/B,EAAS,EAAK,EAAQgC,EAAc/B,EAAO,IAAI,EAAEiB,UAAyB,CAAWV,IAAS,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