{"version":3,"file":"ImageLightbox.o9EIaMCB.mjs","names":["useState","useRef","useCallback","_Fragment"],"sources":["https:/framerusercontent.com/modules/muZPa7UC0zVt9qAJVicd/jyW1T0uRh4VNx44g9tHD/ImageLightbox.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{forwardRef,useCallback,useEffect,useRef,useState}from\"react\";import{createPortal}from\"react-dom\";// Pull a full-resolution image URL out of the frame's image fill.\nfunction fullResolution(url){return url.replace(/\\?.*$/,\"\");}function readImageUrl(props,element){const fill=props.background;if(fill&&typeof fill===\"object\"&&fill.src)return fullResolution(fill.src);if(typeof fill===\"string\"&&/^https?:/.test(fill))return fullResolution(fill);// Fall back to what this frame actually rendered.\nif(element){const img=element.querySelector(\"img\");if(img&&img.src)return fullResolution(img.src);const nodes=[element,...Array.from(element.querySelectorAll(\"*\"))];for(const node of nodes){const match=/url\\([\"']?([^\"')]+)[\"']?\\)/.exec(getComputedStyle(node).backgroundImage);if(match)return fullResolution(match[1]);}}return null;}function Lightbox({src,onClose}){const[visible,setVisible]=useState(false);useEffect(()=>{const frame=requestAnimationFrame(()=>setVisible(true));const onKey=event=>{if(event.key===\"Escape\")onClose();};const previousOverflow=document.body.style.overflow;document.body.style.overflow=\"hidden\";window.addEventListener(\"keydown\",onKey);return()=>{cancelAnimationFrame(frame);window.removeEventListener(\"keydown\",onKey);document.body.style.overflow=previousOverflow;};},[onClose]);return /*#__PURE__*/createPortal(/*#__PURE__*/_jsxs(\"div\",{role:\"dialog\",\"aria-modal\":\"true\",\"aria-label\":\"Enlarged image\",onClick:onClose,style:{position:\"fixed\",inset:0,zIndex:99999,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",padding:24,boxSizing:\"border-box\",background:\"rgba(255, 255, 255, 0.96)\",cursor:\"zoom-out\",opacity:visible?1:0,transition:\"opacity 0.25s ease\"},children:[/*#__PURE__*/_jsx(\"img\",{src:src,alt:\"\",style:{maxWidth:\"100%\",maxHeight:\"100%\",objectFit:\"contain\",borderRadius:8,boxShadow:\"0 8px 40px rgba(0, 0, 0, 0.18)\",transform:visible?\"scale(1)\":\"scale(0.97)\",transition:\"transform 0.25s ease\"}}),/*#__PURE__*/_jsx(\"button\",{\"aria-label\":\"Close\",onClick:onClose,style:{position:\"absolute\",top:16,right:16,width:40,height:40,borderRadius:999,border:\"none\",background:\"#000\",color:\"#fff\",fontSize:20,lineHeight:\"40px\",cursor:\"pointer\"},children:\"\\xd7\"})]}),document.body);}export function withLightbox(Component){return /*#__PURE__*/forwardRef(function WithLightbox(props,ref){const[src,setSrc]=useState(null);const localRef=useRef(null);const setRefs=useCallback(node=>{localRef.current=node;if(typeof ref===\"function\")ref(node);else if(ref)ref.current=node;},[ref]);const close=useCallback(()=>setSrc(null),[]);const open=useCallback(()=>{const url=readImageUrl(props,localRef.current);if(url)setSrc(url);},[props]);return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(Component,{ref:setRefs,...props,onClick:open,style:{...props.style,cursor:\"zoom-in\"}}),src?/*#__PURE__*/_jsx(Lightbox,{src:src,onClose:close}):null]});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withLightbox\":{\"type\":\"reactHoc\",\"name\":\"withLightbox\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ImageLightbox.map"],"mappings":"8KACA,SAAS,EAAe,EAAI,CAAC,OAAO,EAAI,QAAQ,QAAQ,EAAE,CAAE,CAAC,SAAS,EAAa,EAAM,EAAQ,CAAC,IAAM,EAAK,EAAM,WAAW,GAAG,GAAM,OAAO,GAAO,UAAU,EAAK,IAAI,OAAO,EAAe,EAAK,GAAG,EAAE,GAAG,OAAO,GAAO,UAAU,WAAW,KAAK,CAAI,EAAE,OAAO,EAAe,CAAI,EACnR,GAAG,EAAQ,CAAC,IAAM,EAAI,EAAQ,cAAc,KAAK,EAAE,GAAG,GAAK,EAAI,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