{"version":3,"file":"LoopVisual.DF6gBER-.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/pePk7CIPAQSmPMNBHxvi/aFPlY0bwCsInuSP1PDlW/LoopVisual.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";const isVid=(u=\"\")=>/\\.(mp4|webm|mov|m4v)(\\?|$)/i.test(u);const isLot=(u=\"\")=>/\\.(json|lottie)(\\?|$)/i.test(u);/**\n * Loop Visual — plays a video (mp4/webm) or Lottie (json) on autoplay loop with\n * no controls, sat on the deep-midnight gradient at a fixed 3:2 ratio. Feed it\n * the same asset the matching services-carousel card uses.\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function LoopVisual(props){const{visual,gradientFrom=\"#2B3EAF\",gradientTo=\"#03082D\",radius=16,fit=\"contain\",style}=props;const src=visual||\"\";const isStatic=useIsStaticRenderer();const vidRef=useRef(null);const lotRef=useRef(null);// video — reload + autoplay whenever the source changes (avoids stale clip)\nuseEffect(()=>{if(isStatic||!isVid(src)||!vidRef.current)return;const v=vidRef.current;v.load();const p=v.play();if(p&&p.catch)p.catch(()=>{});},[src,isStatic]);// lottie — lottie-web from esm.sh at runtime (static imports restricted)\nuseEffect(()=>{if(isStatic||!isLot(src)||!lotRef.current)return;let anim;let cancelled=false;(async()=>{try{const mod=await new Function(\"u\",\"return import(u)\")(\"https://esm.sh/lottie-web@5.12.2\");if(cancelled||!lotRef.current)return;const lottie=mod.default||mod;anim=lottie.loadAnimation({container:lotRef.current,renderer:\"svg\",loop:true,autoplay:true,path:src,rendererSettings:{preserveAspectRatio:fit===\"cover\"?\"xMidYMid slice\":\"xMidYMid meet\"}});}catch(e){/* noop */}})();return()=>{cancelled=true;if(anim)anim.destroy();};},[src,isStatic,fit]);const box={width:\"100%\",aspectRatio:\"3 / 2\",borderRadius:radius,overflow:\"hidden\",background:`linear-gradient(155deg, ${gradientFrom} 0%, ${gradientTo} 100%)`,position:\"relative\",...style};return /*#__PURE__*/_jsxs(\"div\",{style:box,children:[isLot(src)&&/*#__PURE__*/_jsx(\"div\",{ref:lotRef,style:{position:\"absolute\",inset:0}}),isVid(src)&&/*#__PURE__*/_jsx(\"video\",{ref:vidRef,autoPlay:true,loop:true,muted:true,playsInline:true,preload:\"auto\",style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:fit},children:/*#__PURE__*/_jsx(\"source\",{src:src})})]});}addPropertyControls(LoopVisual,{visual:{type:ControlType.File,allowedFileTypes:[\"mp4\",\"webm\",\"mov\",\"json\",\"lottie\"],title:\"Visual\"},gradientFrom:{type:ControlType.Color,title:\"From\",defaultValue:\"#2B3EAF\"},gradientTo:{type:ControlType.Color,title:\"To\",defaultValue:\"#03082D\"},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:16,min:0,max:48,unit:\"px\"},fit:{type:ControlType.Enum,title:\"Fit\",defaultValue:\"contain\",options:[\"contain\",\"cover\"],optionTitles:[\"Contain\",\"Cover\"],displaySegmentedControl:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LoopVisual\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LoopVisual.map"],"mappings":"2LAOG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,SAAO,eAAa,UAAU,aAAW,UAAU,SAAO,GAAG,MAAI,UAAU,SAAO,EAAY,EAAI,GAAQ,GAAS,EAAS,EAAoB,EAAQ,EAAOA,EAAO,IAAI,EAAQ,EAAOA,EAAO,IAAI,EAE6e,OADpuB,MAAc,CAAC,GAAG,GAAU,CAAC,EAAM,CAAG,GAAG,CAA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