{"version":3,"file":"Dynamic_Lightbox.DLEDqzsg.mjs","names":["React.useMemo"],"sources":["https:/framerusercontent.com/modules/PNSaD2T0x3XEdOgI7KlD/dBQJQwqzfmzNH2jkgMyG/Dynamic_Lightbox.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function CMSFancybox(props){const{image,thumb,videoUrl=\"\",galleryID=\"gallery\",caption=\"\",fit=\"cover\",radius=0,showPlayIcon=true,captionFont,captionColor=\"#FFFFFF\",style}=props;// 1. Resolve Font properties carefully from the Framer Font Object\nconst fontStyles=React.useMemo(()=>{if(!captionFont)return{family:\"inherit\",size:\"14px\",weight:400};// Framer's Font control returns different formats; this handles both\nconst family=captionFont.fontFamily||\"inherit\";const size=typeof captionFont.fontSize===\"number\"?`${captionFont.fontSize}px`:captionFont.fontSize||\"14px\";const weight=captionFont.fontWeight||400;const lHeight=captionFont.lineHeight||\"1.4em\";const lSpacing=captionFont.letterSpacing||\"0em\";const fStyle=captionFont.fontStyle||\"normal\";return{family,size,weight,lHeight,lSpacing,fStyle};},[captionFont]);// 2. FORCE STYLES into the head to override Fancybox defaults\nReact.useEffect(()=>{const styleId=`fancybox-custom-style-${galleryID}`;let styleElement=document.getElementById(styleId);if(!styleElement){styleElement=document.createElement(\"style\");styleElement.id=styleId;document.head.appendChild(styleElement);}// We use !important on every property to ensure the Framer UI wins\nstyleElement.innerHTML=`\n            .fancybox__caption {\n                font-family: ${fontStyles.family} !important;\n                font-size: ${fontStyles.size} !important;\n                font-weight: ${fontStyles.weight} !important;\n                font-style: ${fontStyles.fStyle} !important;\n                line-height: ${fontStyles.lHeight} !important;\n                letter-spacing: ${fontStyles.lSpacing} !important;\n                color: ${captionColor} !important;\n                background: transparent !important;\n                text-align: center !important;\n            }\n        `;return()=>{if(styleElement)styleElement.innerHTML=\"\";};},[fontStyles,captionColor,galleryID]);// 3. Asset Loading & Initialization\nReact.useEffect(()=>{const linkId=\"fancybox-css\";if(!document.getElementById(linkId)){const link=document.createElement(\"link\");link.id=linkId;link.rel=\"stylesheet\";link.href=\"https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.css\";document.head.appendChild(link);}const scriptId=\"fancybox-js\";if(!document.getElementById(scriptId)){const script=document.createElement(\"script\");script.id=scriptId;script.src=\"https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.umd.js\";script.async=true;script.onload=()=>initFancybox();document.head.appendChild(script);}else{initFancybox();}function initFancybox(){const w=window;if(w.Fancybox){w.Fancybox.bind(`[data-fancybox=\"${galleryID}\"]`,{Carousel:{infinite:false},Html:{video:{autoplay:true}}});}}return()=>{const w=window;if(w.Fancybox)w.Fancybox.unbind(`[data-fancybox=\"${galleryID}\"]`);};},[galleryID]);const getImageSrc=img=>{if(!img)return\"\";return typeof img===\"string\"?img:img.src;};const imageSrc=getImageSrc(image);if(!imageSrc)return /*#__PURE__*/_jsx(\"div\",{style:placeholderStyle,children:\"Connect Image\"});const hasVideo=videoUrl&&videoUrl.length>0;const lightboxTarget=hasVideo?videoUrl:imageSrc;const thumbnailSrc=getImageSrc(thumb)||imageSrc;return /*#__PURE__*/_jsxs(\"a\",{href:lightboxTarget,\"data-fancybox\":galleryID,\"data-caption\":caption,style:{...containerStyle,...style},children:[/*#__PURE__*/_jsx(\"img\",{src:thumbnailSrc,alt:caption,style:{width:\"100%\",height:\"100%\",objectFit:fit,borderRadius:`${radius}px`,display:\"block\"}}),hasVideo&&showPlayIcon&&/*#__PURE__*/_jsx(\"div\",{style:playIconContainer,children:/*#__PURE__*/_jsx(\"svg\",{viewBox:\"0 0 24 24\",width:\"48\",height:\"48\",fill:\"white\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M8 5v14l11-7z\"})})})]});}// Minimal Styles\nconst containerStyle={width:\"100%\",height:\"100%\",display:\"block\",position:\"relative\"};const placeholderStyle={width:\"100%\",height:\"100%\",background:\"rgba(0,0,0,0.05)\",border:\"1px dashed #ccc\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"};const playIconContainer={position:\"absolute\",top:\"50%\",left:\"50%\",transform:\"translate(-50%, -50%)\",width:64,height:64,backgroundColor:\"rgba(0,0,0,0.3)\",borderRadius:\"50%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",backdropFilter:\"blur(4px)\"};// Controls\naddPropertyControls(CMSFancybox,{image:{type:ControlType.ResponsiveImage,title:\"Thumbnail\"},thumb:{type:ControlType.ResponsiveImage,title:\"Thumb (Opt)\"},videoUrl:{type:ControlType.String,title:\"Video Link\"},caption:{type:ControlType.String,title:\"Caption\"},// Grouping Font and Color for a clean UI\ncaptionFont:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultValue:{fontSize:16,fontWeight:400,fontFamily:\"Inter\"}},captionColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#FFFFFF\"},galleryID:{type:ControlType.String,title:\"Group Name\",defaultValue:\"gallery\"},fit:{type:ControlType.Enum,options:[\"cover\",\"contain\"],defaultValue:\"cover\"},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:0},showPlayIcon:{type:ControlType.Boolean,title:\"Play Icon\",defaultValue:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CMSFancybox\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Dynamic_Lightbox.map"],"mappings":"sMAAyI,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,QAAM,QAAM,WAAS,GAAG,YAAU,UAAU,UAAQ,GAAG,MAAI,QAAQ,SAAO,EAAE,eAAa,GAAK,cAAY,eAAa,UAAU,SAAO,EAC5T,EAAWA,MAAuB,EAC4S,CAAC,OAAxU,EAAY,YAAY,UAAuT,KAAlS,OAAO,EAAY,UAAW,SAAS,GAAG,EAAY,SAAS,IAAI,EAA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