{"version":3,"file":"LoopVideo.XC2obIEB.mjs","names":["useRef","useState","p","__esmMin","init_ssg_sandbox_shims","window","_e","de","p","init_npm_react_18_3_1","ce","useTransform","useMotionValue","useScroll","useSpring","init_framer_motion_DhsWWWsN","motion","addPropertyControls","init_framer_B6PCHH0A","useIsStaticRenderer","ControlType","LoopVideo","props","isStatic","root","ref","reduced","setReduced","ready","setReady","hover","setHover","inView","setInView","fine","setFine","mq","on","el","io","entries","p$1","parallax","y","scrollYProgress","v","mx","my","sx","sy","move","label","r","shouldPlay","video","playOnHover","pr","pos","position","fill","showVideo","zoomOn","zoom","poster","hoverPoster","EASE","labelFill","labelText","init_LoopVideo","init_jsx_runtime"],"sources":["https:/framerusercontent.com/modules/JUYsRIeb7WgPZO49coix/gqWdR7eHqpfzP4APxAur/LoopVideo.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useMotionValue,useScroll,useSpring,useTransform}from\"framer-motion\";import{useEffect,useRef,useState}from\"react\";const EASE=[.33,1,.68,1];/**\n * Card media: poster image plus an optional muted looping video, with soft scroll parallax,\n * a gentle zoom inside the frame on hover and an optional cursor label. The frame never scales.\n * Reduced motion keeps the poster still. Bind Video and Poster to CMS fields.\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 500\n */export default function LoopVideo(props){const{video=\"\",poster,hoverPoster,position=\"center top\",playOnHover=false,parallax=8,zoom=1.04,label=\"\",labelFill=\"#F40000\",labelText=\"#FFFFFF\"}=props;const isStatic=useIsStaticRenderer();const root=useRef(null);const ref=useRef(null);const[reduced,setReduced]=useState(false);const[ready,setReady]=useState(false);const[hover,setHover]=useState(false);const[inView,setInView]=useState(false);const[fine,setFine]=useState(false);useEffect(()=>{if(typeof window===\"undefined\")return;const mq=window.matchMedia(\"(prefers-reduced-motion: reduce)\");setReduced(mq.matches);setFine(!!window.matchMedia(\"(hover: hover) and (pointer: fine)\").matches);const on=()=>setReduced(mq.matches);mq.addEventListener?.(\"change\",on);return()=>mq.removeEventListener?.(\"change\",on);},[]);useEffect(()=>{const el=root.current;if(!el||typeof IntersectionObserver===\"undefined\")return;const io=new IntersectionObserver(entries=>setInView(entries[0]?.isIntersecting??false),{threshold:.1});io.observe(el);return()=>io.disconnect();},[]);// Parallax: the media box is taller than the frame by `parallax` percent and travels inside it.\nconst p=isStatic||reduced?0:Math.max(0,Math.min(20,parallax));const{scrollYProgress}=useScroll({target:root,offset:[\"start end\",\"end start\"]});const y=useTransform(scrollYProgress,v=>`${(v-.5)*p/(1+p/100)}%`);// Cursor label follows the pointer, clamped so it never leaves the frame.\nconst mx=useMotionValue(0);const my=useMotionValue(0);const sx=useSpring(mx,{stiffness:380,damping:34,mass:.6});const sy=useSpring(my,{stiffness:380,damping:34,mass:.6});const R=40;function move(e){const el=root.current;if(!el||!label)return;const r=el.getBoundingClientRect();mx.set(Math.min(r.width-R,Math.max(R,e.clientX-r.left))-R);my.set(Math.min(r.height-R,Math.max(R,e.clientY-r.top))-R);}const shouldPlay=!!video&&!reduced&&inView&&(!playOnHover||hover);useEffect(()=>{const el=ref.current;if(el&&el.readyState>=2)setReady(true);},[video,reduced]);useEffect(()=>{const el=ref.current;if(!el)return;if(shouldPlay){const pr=el.play();if(pr&&typeof pr.catch===\"function\")pr.catch(()=>{});}else el.pause();},[shouldPlay]);const pos=position||\"center top\";const fill={position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:\"cover\",objectPosition:pos,display:\"block\"};const showVideo=!isStatic&&!!video&&!reduced;const zoomOn=!isStatic&&!reduced&&fine&&hover&&zoom>1;return /*#__PURE__*/_jsxs(\"div\",{ref:root,style:{...props.style,position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",cursor:label&&fine?\"none\":undefined},onMouseEnter:e=>{setHover(true);move(e);sx.jump(mx.get());sy.jump(my.get());},onMouseLeave:()=>setHover(false),onMouseMove:label?move:undefined,children:[/*#__PURE__*/_jsx(motion.div,{style:{position:\"absolute\",left:0,right:0,top:`${-p/2}%`,height:`${100+p}%`,y:p?y:0},children:/*#__PURE__*/_jsxs(\"div\",{style:{position:\"absolute\",inset:0,transformOrigin:pos.endsWith(\"bottom\")?\"50% 100%\":pos.endsWith(\"center\")?\"50% 50%\":\"50% 0%\",transform:zoomOn?`scale(${zoom})`:\"scale(1)\",transition:\"transform .7s cubic-bezier(.33,1,.68,1)\"},children:[poster?.src&&/*#__PURE__*/_jsx(\"img\",{src:poster.src,srcSet:poster.srcSet,sizes:\"(max-width: 810px) 100vw, 50vw\",alt:poster.alt||\"\",loading:\"lazy\",decoding:\"async\",style:fill}),hoverPoster?.src&&!isStatic&&/*#__PURE__*/_jsx(\"img\",{src:hoverPoster.src,srcSet:hoverPoster.srcSet,sizes:\"(max-width: 810px) 100vw, 50vw\",alt:\"\",\"aria-hidden\":\"true\",loading:\"lazy\",decoding:\"async\",style:{...fill,opacity:hover&&fine?1:0,transition:\"opacity .45s cubic-bezier(.33,1,.68,1)\"}}),showVideo&&/*#__PURE__*/_jsx(\"video\",{ref:ref,src:video,muted:true,loop:true,playsInline:true,preload:\"metadata\",\"aria-hidden\":\"true\",onLoadedData:()=>setReady(true),onCanPlay:()=>setReady(true),onPlaying:()=>setReady(true),style:{...fill,opacity:ready&&(!playOnHover||hover)?1:0,transition:\"opacity .6s cubic-bezier(.33,1,.68,1)\"}})]})}),label&&fine&&!isStatic&&/*#__PURE__*/_jsx(motion.div,{\"aria-hidden\":\"true\",initial:false,animate:{opacity:hover?1:0},transition:{duration:.25,ease:EASE},style:{position:\"absolute\",left:0,top:0,x:sx,y:sy,width:R*2,height:R*2,borderRadius:\"50%\",background:labelFill,color:labelText,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",font:'500 13px \"Inter\", \"Inter Placeholder\", system-ui, sans-serif',letterSpacing:\"-0.01em\",pointerEvents:\"none\",zIndex:2},children:label})]});}addPropertyControls(LoopVideo,{video:{type:ControlType.File,title:\"Video\",allowedFileTypes:[\"mp4\",\"webm\",\"mov\"]},poster:{type:ControlType.ResponsiveImage,title:\"Poster\"},hoverPoster:{type:ControlType.ResponsiveImage,title:\"Hover image\"},position:{type:ControlType.Enum,title:\"Focus\",options:[\"center top\",\"center center\",\"center bottom\"],optionTitles:[\"Top\",\"Center\",\"Bottom\"],defaultValue:\"center top\"},playOnHover:{type:ControlType.Boolean,title:\"On hover\",defaultValue:false,description:\"Show and play the video only while hovered.\"},parallax:{type:ControlType.Number,title:\"Parallax\",defaultValue:8,min:0,max:20,step:1,unit:\"%\"},zoom:{type:ControlType.Number,title:\"Hover zoom\",defaultValue:1.04,min:1,max:1.15,step:.01},label:{type:ControlType.String,title:\"Cursor label\",defaultValue:\"\"},labelFill:{type:ControlType.Color,title:\"Label fill\",defaultValue:\"#F40000\",hidden:p=>!p.label},labelText:{type:ControlType.Color,title:\"Label text\",defaultValue:\"#FFFFFF\",hidden:p=>!p.label}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LoopVideo\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"400\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerIntrinsicHeight\":\"500\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LoopVideo.map"],"mappings":"A,wRASG,SAAwBqB,EAAU,EAAM,CAAC,GAAK,CAAC,QAAM,GAAG,SAAO,cAAY,WAAS,aAAa,cAAY,GAAM,WAAS,EAAE,OAAK,KAAK,QAAM,GAAG,YAAU,UAAU,YAAU,WAAWC,EAAYC,EAASJ,EAAoB,EAAQK,EAAKxB,EAAO,IAAI,EAAQyB,EAAIzB,EAAO,IAAI,EAAO,CAAC0B,EAAQC,GAAY1B,EAAS,EAAK,EAAO,CAAC2B,EAAMC,GAAU5B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