{"version":3,"file":"CopyLink_project.CBQE7yZT.mjs","names":["useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/cPIYgknZtZdls5WYO6Ps/SG7FR5sa5efvyHJbCWG2/CopyLink_project.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useState}from\"react\";export function withCopyLink(Component){return props=>{const[showTooltip,setShowTooltip]=useState(false);const[tooltipPosition,setTooltipPosition]=useState({x:0,y:0});const[tooltipBelow,setTooltipBelow]=useState(false);const handleClick=event=>{const tooltipWidth=150;const tooltipHeight=40;const padding=16;const offset=50;const headerHeight=80;let x=event.clientX;let y=event.clientY;if(x-tooltipWidth/2<padding){x=tooltipWidth/2+padding;}if(x+tooltipWidth/2>window.innerWidth-padding){x=window.innerWidth-tooltipWidth/2-padding;}if(y-tooltipHeight-offset<headerHeight+padding){setTooltipBelow(true);}else{setTooltipBelow(false);}setTooltipPosition({x:x,y:y});const linkToCopy=window.location.href;navigator.clipboard.writeText(linkToCopy).then(()=>{setShowTooltip(true);setTimeout(()=>{setShowTooltip(false);},2e3);});};return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(Component,{...props,onClick:handleClick,style:{cursor:\"pointer\"}}),showTooltip&&/*#__PURE__*/_jsx(\"div\",{style:{position:\"fixed\",top:tooltipBelow?`${tooltipPosition.y+20}px`:`${tooltipPosition.y-50}px`,left:`${tooltipPosition.x}px`,transform:\"translateX(-50%)\",padding:\"8px 8px\",background:\"#000\",color:\"white\",borderRadius:\"0px\",fontSize:\"13px\",whiteSpace:\"nowrap\",zIndex:9999,pointerEvents:\"none\"},children:\"Ссылка скопирована\"})]});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withCopyLink\":{\"type\":\"reactHoc\",\"name\":\"withCopyLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CopyLink_project.map"],"mappings":"qJAA2G,SAAgB,EAAa,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,EAAY,GAAgBA,EAAS,GAAM,CAAM,CAAC,EAAgB,GAAoBA,EAAS,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAM,CAAC,EAAa,GAAiBA,EAAS,GAAM,CAAO,EAAY,GAAO,CAAC,IAAyG,EAAE,EAAM,QAAY,EAAE,EAAM,QAAW,EAAE,IAAa,EAAE,KAAS,EAAE,IAA2B,EAAE,IAAa,EAAE,EAAO,WAAW,KAAS,EAAE,EAAO,WAAW,IAAa,EAAE,IAAY,EAAE,GAAc,GAAO,GAAsB,EAAgB,GAAK,CAAO,EAAgB,GAAM,CAAE,EAAmB,CAAG,IAAI,IAAE,CAAC,CAAC,IAAM,EAAW,EAAO,SAAS,KAAK,EAAU,UAAU,UAAU,EAAW,CAAC,SAAS,CAAC,EAAe,GAAK,CAAC,eAAe,CAAC,EAAe,GAAM,EAAG,IAAI,EAAG,EAAG,OAAoB,EAAMC,EAAU,CAAC,SAAS,CAAc,EAAK,EAAU,CAAC,GAAG,EAAM,QAAQ,EAAY,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,GAA0B,EAAK,MAAM,CAAC,MAAM,CAAC,SAAS,QAAQ,IAAI,EAAa,GAAG,EAAgB,EAAE,GAAG,IAAI,GAAG,EAAgB,EAAE,GAAG,IAAI,KAAK,GAAG,EAAgB,EAAE,IAAI,UAAU,mBAAmB,QAAQ,UAAU,WAAW,OAAO,MAAM,QAAQ,aAAa,MAAM,SAAS,OAAO,WAAW,SAAS,OAAO,KAAK,cAAc,OAAO,CAAC,SAAS,qBAAqB,CAAC,CAAC,CAAC,CAAC,uBAAt0C,IAA4B"}