{"version":3,"file":"AutoPauseVideo.C8S2udTf.mjs","names":["useRef","useState","pe","__esmMin","init_npm_react_18_3_1","window","init_ssg_sandbox_shims","ce","init_jsx_runtime","c","p","_e","de","ControlType","RenderTarget","init_framer_DKgW_P28","addPropertyControls","AutoPauseVideo","props","videoRef","wrapperRef","posterImgRef","uid","onCanvas","posterImageSrc","posterImage","posterSrc","posterUrl","posterLoaded","setPosterLoaded","posterSizesPx","setPosterSizesPx","rangeRef","audioRef","trimStart","round1","startTime","trimEnd","endTime","cropped","fadeIn","fadeOut","fade","fadeDuration","ratio","setRatio","ratioGuessRef","posterRatio","setPosterRatio","inOverlay","setInOverlay","showPoster","setShowPoster","near","setNear","ratioParsed","ratioOverride","ratioFixed","bentoRatio","ratioSource","bentoActive","bento","posterSrcSet","framerSrcSet","posterIsLandscape","known","framerImageSize","posterCapPx","posterWidth","posterSizes","videoPoster","hasVideo","stopPlayback","v","wrapper","unmountTimer","cancelUnmount","io","e","entries","UNMOUNT_DELAY_MS","MOUNT_MARGIN","found","OVERLAY_SELECTOR","debug","videoUrl","read","fallback","r","alive","img","update","w","estimate","next","prev","ro","id","styleTag","touched","clear","el","apply","base","vw","vh","onPhone","PHONE_MAX","phoneMargin","clamp","overlayPhoneMargin","maxByHeight","overlayHeight","cap","overlayMaxWidth","desired","overlayWidth","delta","chain","css","key","i","target","clickThrough","ancestors","end","a","path","attr","cell","grid","name","bentoGrid","g","gs","BENTO_ROW","rowGap","raf","layout","tracks","t","n","cols","span","bentoMinCols","wrapH","cellH","h","rows","sig","queue","left","setVolume","x","ensureAudio","webAudioFade","Ctx","ctx","src","gain","compute","d","s","rawEnd","volumeAt","vol","start","tick","loop","startLoop","stopLoop","onSeeking","hide","onPause","posterOnPause","onEnded","restore","muted","autoplay","onVisibility","playOnHover","scrollAutoplay","soloPlayback","announce","PLAY_EVENT","onOther","who","pauseOnOverlay","subscribeOverlay","open","inside","enter","reg","getRegistry","schedule","err","leave","entry","onScroll","describe","onClick","depth","handlePosterClick","autoSize","ratioSized","wrapperStyle","style","radius","LOADING_BG","url","SRCSET_STEPS","isOverlayOpen","MIN_VISIBLE","runSchedule","getOverlayWatcher","init_AutoPauseVideo","min","max","u","size","longest","parts","step","nodes","st","winner","best","hovered","candidates","b","previous","ow","cb","run","fn"],"sources":["https:/framerusercontent.com/modules/BZIXWzxr2ZIBiGcHSnf6/oFDAELGH52fgzVBOEhrW/AutoPauseVideo.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useRef,useEffect,useState}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";const clamp=(n,min,max)=>Math.max(min,Math.min(max,n));const round1=n=>isFinite(n)?Math.round(n*10)/10:0;// broadcast channel used so only one instance plays at a time\nconst PLAY_EVENT=\"autopausevideo:play\";// selector for a Framer overlay container\nconst OVERLAY_SELECTOR='#overlay, [data-framer-name=\"Overlay\"]';// Phone breakpoint (matches Framer's Phone breakpoint, same as HideOnPhone).\n// At or below this viewport width a landscape video in an overlay fills the\n// screen width minus \"Phone Margin\" on each side instead of the relative\n// \"Overlay Width\" %, which made it tiny on phones (62% of 375px ≈ 232px).\nconst PHONE_MAX=809;// bento grid: height of one implicit row in px. Small rows let every card\n// get a row span that matches its real height, so the grid packs tightly.\nconst BENTO_ROW=4;// Background shown behind a card before its poster or first video frame has\n// painted. A plain #000 made every not-yet-loaded card read as a black hole\n// while scrolling fast on mobile; a slightly lifted dark neutral reads as a\n// placeholder tile against the page instead. The overlay (a deliberate\n// full-screen view) keeps pure black.\nconst PLACEHOLDER_BG=\"#16171c\";// Loading placeholder shown behind a card until its poster still or first\n// video frame has painted. One shared, cached image, drawn as a CSS cover\n// background so it fills both landscape and portrait cards (and is clipped\n// to the card's rounded corners). The poster <img> and video paint on top.\nconst LOADING_IMG=\"https://assets.masterhooks.com/image/gridloading.webp\";const LOADING_BG=`${PLACEHOLDER_BG} url(\"${LOADING_IMG}\") center / cover no-repeat`;// Poster sizing (2026-11-03, rev 2). Framer's image CDN serves any size\n// through ?scale-down-to=N, where N caps the LONGEST side. For grid cards\n// (Bento on) the poster <img> gets a srcset of scaled copies plus a `sizes`\n// that is a single plain length (no media conditions): Framer prefixes its\n// own breakpoint conditions to `sizes` on publish, which only stays valid\n// when our value has no condition of its own. The browser then picks the\n// right copy while it parses the HTML, before any script runs. (Swapping the\n// URL from script after hydration was too late: the browser had already\n// started every poster at full size, so it only added a second download.)\nconst SRCSET_STEPS=[256,384,512,640,768,1024,1280,1536,2048,3072];// Intrinsic size of a Framer-hosted image, read from its ?width=&height=\n// query params. Null for anything not on framerusercontent.com/images.\nconst framerImageSize=src=>{if(!src)return null;try{const u=new URL(src);if(u.hostname!==\"framerusercontent.com\")return null;if(!u.pathname.startsWith(\"/images/\"))return null;if(u.searchParams.has(\"scale-down-to\"))return null;const w=parseFloat(u.searchParams.get(\"width\")||\"\");const h=parseFloat(u.searchParams.get(\"height\")||\"\");if(!(w>0)||!(h>0))return null;return{w,h};}catch(e){return null;}};// srcset of scaled copies of a Framer-hosted image (plus the original as the\n// largest entry). Undefined for any other host, so those keep a plain src.\nconst framerSrcSet=src=>{const size=framerImageSize(src);if(!src||!size)return undefined;const longest=Math.max(size.w,size.h);const parts=[];for(const step of SRCSET_STEPS){if(step>=longest)break;try{const u=new URL(src);u.searchParams.set(\"scale-down-to\",String(step));const w=Math.round(size.w*step/longest);parts.push(`${u.toString()} ${w}w`);}catch(e){}}parts.push(`${src} ${Math.round(size.w)}w`);return parts.join(\", \");};// Lazy-mount margin: a card mounts its <video> once it comes within this many\n// px of the viewport (top and bottom), and unmounts it again once it leaves\n// that band. On a long grid this keeps only ~15-25 <video> elements alive at\n// once instead of one per card. Safari/WebKit caps simultaneous media\n// elements and charges real memory per <video> even when it is display:none\n// or preload=none, so a page with ~150 of them pushes its web process past\n// 1GB and gets the tab killed (the \"blank page\" seen on iPhone/Safari). The\n// poster <img> always stays, so an unmounted card still shows its still.\nconst MOUNT_MARGIN=\"800px 0px 800px 0px\";// How long a card keeps its <video> after scrolling out of the mount band.\n// A fast scroll that passes a card and comes back within this window never\n// unmounts and remounts it, which avoids thrashing React and the media\n// element on every scroll pass while still freeing memory when a card is\n// left behind for good.\nconst UNMOUNT_DELAY_MS=1200;// an overlay counts as open only when it is actually painted, because Framer\n// keeps the node mounted and just hides it on close\nconst isOverlayOpen=()=>{const nodes=document.querySelectorAll(OVERLAY_SELECTOR);for(let i=0;i<nodes.length;i++){const el=nodes[i];const r=el.getBoundingClientRect();if(r.width<1||r.height<1)continue;const st=window.getComputedStyle(el);if(st.display===\"none\")continue;if(st.visibility===\"hidden\")continue;if(parseFloat(st.opacity||\"1\")<.05)continue;return true;}return false;};const getRegistry=()=>{const w=window;if(!w.__apvScrollRegistry){w.__apvScrollRegistry={items:new Map,raf:null,current:null,hover:null};}return w.__apvScrollRegistry;};// a card needs at least this much of itself on screen before it may play\nconst MIN_VISIBLE=.45;const runSchedule=debug=>{const reg=getRegistry();reg.raf=null;let winner=null;let best=0;if(!isOverlayOpen()){// a hovered card always wins, the pointer beats visibility\nconst hovered=reg.hover&&reg.items.get(reg.hover);if(hovered){winner=reg.hover;best=hovered.ratio;}}if(!winner&&!isOverlayOpen()){// most visible wins, a tie goes to whichever sits higher on the page\nconst candidates=[];reg.items.forEach((entry,key)=>{if(entry.ratio>=MIN_VISIBLE)candidates.push({key,entry});});candidates.sort((a,b)=>{const d=b.entry.ratio-a.entry.ratio;if(Math.abs(d)>.02)return d;return a.entry.top-b.entry.top;});if(candidates.length){winner=candidates[0].key;best=candidates[0].entry.ratio;}}if(winner===reg.current)return;const previous=reg.current;reg.current=winner;if(previous)reg.items.get(previous)?.stop();if(winner)reg.items.get(winner)?.play();if(debug)console.log(\"[AutoPauseVideo] grid autoplay switched:\",previous,\"->\",winner,\"visible:\",best.toFixed(2));};const schedule=debug=>{const reg=getRegistry();if(reg.raf!==null)return;reg.raf=requestAnimationFrame(()=>runSchedule(debug));};const getOverlayWatcher=()=>{const w=window;if(!w.__apvOverlayWatcher){w.__apvOverlayWatcher={subs:new Set,mo:null,raf:null,last:false};}return w.__apvOverlayWatcher;};const subscribeOverlay=cb=>{const ow=getOverlayWatcher();ow.subs.add(cb);// tell the new subscriber the current state right away\ncb(isOverlayOpen());if(!ow.mo){const run=()=>{ow.raf=null;const open=isOverlayOpen();if(open===ow.last)return;ow.last=open;ow.subs.forEach(fn=>fn(open));};const queue=()=>{if(ow.raf===null)ow.raf=requestAnimationFrame(run);};ow.last=isOverlayOpen();ow.mo=new MutationObserver(queue);ow.mo.observe(document.body,{childList:true,subtree:true,attributes:true,attributeFilter:[\"style\",\"class\",\"hidden\",\"data-framer-name\"]});}return()=>{ow.subs.delete(cb);if(ow.subs.size===0&&ow.mo){ow.mo.disconnect();ow.mo=null;if(ow.raf!==null){cancelAnimationFrame(ow.raf);ow.raf=null;}}};};/**\n * AutoPauseVideo\n *\n * Video that automatically pauses, resets and mutes as soon as it leaves the\n * screen. Built to work around Framer's native Overlay on mobile, which only\n * hides the video when the overlay closes instead of unmounting it, leaving\n * the audio running in the background.\n *\n * Lazy mount\n * The <video> element is only rendered while the card is within MOUNT_MARGIN\n * of the viewport (and always in an overlay or on the canvas). Off-screen\n * cards show just the poster <img>; their <video> is removed from the DOM so\n * the page never holds more than a couple of dozen media elements at once.\n * Safari charges memory per <video> even when it is hidden or preload=none,\n * and caps simultaneous media elements, so a grid of ~150 of them would blow\n * past the tab's memory limit and go blank. The unmount is delayed by\n * UNMOUNT_DELAY_MS so a fast scroll past a card and back does not tear down\n * and rebuild it. The grid layout does not depend on the video existing: the\n * wrapper carries the aspect ratio (data-apv-ratio) and a stable key\n * (data-apv-key) so withBentoGrid can size and order every card whether or not\n * its video is mounted.\n *\n * Loading placeholder\n * Until a card's poster still or first video frame has painted, the card shows\n * LOADING_IMG as a cover background (filling both landscape and portrait\n * cards). The poster <img> and the video paint on top of it.\n *\n * Playback triggers\n * \"Autoplay\" starts the video as soon as it enters the screen.\n * \"Play on Hover\" starts it on mouse enter and resets it on mouse leave, and\n * takes priority over Autoplay. Touch pointers are ignored, so on phones the\n * video waits for a tap instead.\n *\n * Stopping background playback\n * An IntersectionObserver cannot tell that an element got covered by an\n * overlay, only that it left the viewport, so a card behind an open overlay\n * would keep playing. Two guards handle that. \"Solo Playback\" stops every\n * other instance as soon as one starts playing. \"Pause on Overlay\" watches the\n * DOM and stops any instance that sits outside an overlay while one is open.\n *\n * Poster\n * Two sources, best first: \"Poster Image\" (an image picker that can be bound\n * to a CMS Image field, hosted by Framer) and then \"Poster URL\" (a plain text\n * URL). If Poster Image is empty the component falls back to Poster URL, so\n * existing instances keep working unchanged.\n * Grid cards (Bento on) with a Framer-hosted poster get a srcset of scaled\n * copies and a `sizes` estimate from \"Card Width\", so the browser loads a\n * copy sized to the card from the start (see framerSrcSet). If the card turns\n * out wider than the estimate, `sizes` is raised to the measured width; it is\n * never lowered, so nothing is fetched twice. The <video> poster attribute\n * uses whatever copy the <img> actually loaded (currentSrc), a cache hit.\n * The native poster attribute is not enough on its own. Browsers swap the\n * poster for the first video frame once metadata loads or after a seek, and it\n * never comes back once the video has played. So the poster is rendered as its\n * own <img> layer above the video. That layer hides on play and returns when\n * the video ends or gets reset (optionally on every pause as well). The poster\n * <img> is loading=\"lazy\" + decoding=\"async\": on a page with many cards this\n * stops every poster from being requested at once (which on mobile left cards\n * blank while scrolling fast) and keeps decoding off the main thread.\n *\n * Crop playback\n * \"Start Time\" is how many SECONDS are trimmed off the beginning.\n * \"End Time\" is how many SECONDS are trimmed off the end.\n * Both accept one decimal place (for example 3.5) and 0 means no trim.\n * On a 20 second video with start 2 and end 3, playback runs from 2s to 17s.\n * Seeking outside the range is clamped back in. When trimmed, native loop is\n * disabled and looping is handled manually so it returns to start, not to 0.\n *\n * Audio fade\n * Start Time above 0 fades the audio in at the beginning of the clip.\n * End Time above 0 fades the audio out at the end of the clip.\n * Fade length is set through \"Fade\".\n *\n * iOS note: video.volume is read-only in iOS Safari, so the default fade has\n * no effect there. Turn on \"iOS Fade\" to route audio through a Web Audio\n * GainNode instead. That mode needs correct CORS headers on the video host\n * (R2 for example), otherwise the audio can disappear entirely.\n *\n * Overlay auto size\n * When rendered inside a Framer overlay, every parent that wraps the video\n * tightly (the Overlay frame plus the instance wrapper) is widened through\n * CSS !important based on the video's real orientation read from metadata.\n * The size is relative to the viewport (\"Overlay Width\" % of the screen width\n * for landscape, \"Overlay Height\" % of the screen height for portrait), so it\n * keeps the same proportion from a laptop to a 4K monitor. On phones\n * (viewport ≤ PHONE_MAX) a landscape video instead fills the screen width\n * minus \"Phone Margin\" px on each side (still bounded by the height limit, so\n * a rotated phone keeps it on screen). Outside an overlay\n * (a card in a grid) it fills the parent at 100%. Full-screen layers (the\n * overlay's portal root, a fixed backdrop, anything as wide as the screen)\n * are never resized, so the overlay stays centered on phones.\n *\n * Click Through\n * Framer only closes a dismissible overlay when the click lands on its own\n * backdrop. Anything the overlay content puts on top of that backdrop eats the\n * click: the widened parents above, and especially a full-screen frame inside\n * the overlay (e.g. a \"BG blur\" layer with a backdrop blur). With \"Click\n * Through\" on, EVERY ancestor of the video up to the overlay's portal root\n * ignores pointer events, so a click on empty space falls through to Framer's\n * backdrop and closes the overlay. The video wrapper itself, and any sibling\n * layer that is not on that ancestor path (a close button, a CTA), stays\n * clickable.\n *\n * Bento grid\n * With \"Bento\" on, the card sizes itself from the video's ratio (the wrapper\n * gets an aspect-ratio). With \"Bento Grid\" set to a layer name this\n * component also reshapes that grid itself (legacy per-card mode); set it to\n * a name that does not exist (e.g. __off__) when the grid is owned by the\n * withBentoGrid override instead.\n *\n * Ratio source, best first: \"Aspect Ratio\" (set it from the CMS and the\n * layout is correct on the very first paint), then real video metadata, then\n * the poster image, then a 9:16 guess. With lazy mount the video metadata is\n * not available until the card is on screen, so set the CMS ratio for a\n * correct layout from the start.\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function AutoPauseVideo(props){const{videoUrl,posterImage,posterUrl,posterOnPause=false,controls=true,autoplay=true,playOnHover=false,soloPlayback=true,scrollAutoplay=false,pauseOnOverlay=true,clickThrough=true,muted=false,loop=false,startTime=0,endTime=0,fadeDuration=.8,webAudioFade=false,objectFit=\"cover\",radius=16,overlayWidth=62,overlayHeight=75,overlayMaxWidth=0,overlayPhoneMargin=16,bento=false,bentoGrid=\"VideoLibraries\",bentoMinCols=3,posterWidth=210,ratioOverride=0,preload=\"metadata\",debug=false,style}=props;const videoRef=useRef(null);const wrapperRef=useRef(null);const posterImgRef=useRef(null);const uid=useRef(`apv${Math.random().toString(36).slice(2,8)}`);const onCanvas=RenderTarget.current()===RenderTarget.canvas;// Poster source, best first: the Poster Image (CMS Image field, hosted by\n// Framer), then the plain Poster URL string.\nconst posterImageSrc=typeof posterImage?.src===\"string\"?posterImage.src.trim()||undefined:undefined;const posterSrc=posterImageSrc||posterUrl?.trim()||undefined;// URL the poster <img> actually loaded (its currentSrc), reused for the\n// <video> poster attribute so that is a cache hit, not a second download.\nconst[posterLoaded,setPosterLoaded]=useState(null);// measured card width in px once it is wider than the sizes estimate\nconst[posterSizesPx,setPosterSizesPx]=useState(null);// playback range in seconds, filled in once metadata is available\nconst rangeRef=useRef({start:0,end:Infinity});// Web Audio nodes, created only once per video element\nconst audioRef=useRef(null);// seconds input, rounded to one decimal place\nconst trimStart=Math.max(0,round1(startTime))// trimmed off the start\n;const trimEnd=Math.max(0,round1(endTime))// trimmed off the end\n;const cropped=trimStart>0||trimEnd>0;const fadeIn=trimStart>0;const fadeOut=trimEnd>0;const fade=Math.max(0,fadeDuration);// native video ratio (width / height), null until metadata is read\nconst[ratio,setRatio]=useState(null);// true while ratio only holds the timeout guess, not real metadata\nconst ratioGuessRef=useRef(false);// ratio read from the poster image, an early guess for bento sizing\nconst[posterRatio,setPosterRatio]=useState(null);const[inOverlay,setInOverlay]=useState(false);// whether the poster layer is visible\nconst[showPoster,setShowPoster]=useState(true);// lazy mount: true while the card is near the viewport (see MOUNT_MARGIN)\nconst[near,setNear]=useState(false);// An authored ratio beats every measurement, it is known before paint.\n// Framer can hand this over as a string rather than a number (a Transform\n// on a CMS enum does exactly that), so parse it instead of trusting the\n// declared type. A string would otherwise sail through the comparisons\n// below by coercion and then blow up on .toFixed().\nconst ratioParsed=typeof ratioOverride===\"number\"?ratioOverride:parseFloat(String(ratioOverride??\"\"));const ratioFixed=isFinite(ratioParsed)&&ratioParsed>0?ratioParsed:null;// Best known ratio for bento sizing, and a label for where it came from\n// so the debug log can point at a miswired binding instead of leaving it\n// to guesswork.\nlet bentoRatio;let ratioSource;if(ratioFixed!==null){bentoRatio=ratioFixed;ratioSource=\"cms\";}else if(ratio!==null&&!ratioGuessRef.current){bentoRatio=ratio;ratioSource=\"video\";}else if(posterRatio!==null){bentoRatio=posterRatio;ratioSource=\"poster\";}else{bentoRatio=ratio??9/16;ratioSource=\"guess\";}const bentoActive=bento&&!inOverlay&&!onCanvas;// Poster srcset for grid cards only (Bento on, not in an overlay). The\n// sizes estimate: one column = \"Card Width\", a landscape card spans two\n// columns; on narrow screens a column is about 45% of the viewport.\nconst posterSrcSet=bento&&!inOverlay?framerSrcSet(posterSrc):undefined;const posterIsLandscape=(()=>{if(ratioFixed!==null)return ratioFixed>1.05;const known=framerImageSize(posterSrc);return known?known.w/known.h>1.05:false;})();const posterCapPx=Math.max(40,Math.round(posterIsLandscape?posterWidth*2+20:posterWidth));const posterSizes=posterSrcSet?posterSizesPx?`${posterSizesPx}px`:`min(45vw, ${posterCapPx}px)`:undefined;const videoPoster=posterLoaded&&posterLoaded.src===posterSrc?posterLoaded.url:posterSrcSet?undefined:posterSrc;// whether the <video> element should be in the DOM right now\nconst hasVideo=onCanvas||inOverlay||near;// shared stop routine used by every guard below\nconst stopPlayback=()=>{const v=videoRef.current;if(!v)return;try{v.pause();v.currentTime=rangeRef.current.start;v.muted=true;}catch(e){}setShowPoster(true);};// 0. lazy mount. Mount the <video> only while the card is near the\n// viewport; unmount it again when it leaves. Driven off the wrapper, which\n// is always present, so it works before any video exists. On the canvas we\n// skip the observer and keep the element so the editor preview is stable.\nuseEffect(()=>{if(onCanvas){setNear(true);return;}const wrapper=wrapperRef.current;if(!wrapper)return;if(typeof IntersectionObserver===\"undefined\"){setNear(true);return;}// Mount immediately when the card enters the band, but delay the\n// unmount: a fast scroll that passes a card and scrolls back within\n// UNMOUNT_DELAY_MS keeps the same <video> instead of tearing it down\n// and rebuilding it, which is the costly part during scrolling.\nlet unmountTimer=null;const cancelUnmount=()=>{if(unmountTimer!==null){clearTimeout(unmountTimer);unmountTimer=null;}};const io=new IntersectionObserver(entries=>{for(const e of entries){if(e.isIntersecting){cancelUnmount();setNear(true);}else if(unmountTimer===null){unmountTimer=window.setTimeout(()=>{unmountTimer=null;setNear(false);},UNMOUNT_DELAY_MS);}}},{root:null,rootMargin:MOUNT_MARGIN,threshold:0});io.observe(wrapper);return()=>{io.disconnect();cancelUnmount();};},[onCanvas]);// 1. detect whether we sit inside an overlay. Read from the wrapper (always\n// present) rather than the video, which may not be mounted yet, and reset\n// the poster whenever the source changes.\nuseEffect(()=>{if(onCanvas)return;const wrapper=wrapperRef.current;if(!wrapper)return;const found=!!wrapper.closest(OVERLAY_SELECTOR);setInOverlay(found);setShowPoster(true)// new video source, go back to the poster\n;if(debug)console.log(\"[AutoPauseVideo] inOverlay:\",found);},[onCanvas,videoUrl,debug]);// 1a. read the real video orientation once the video is mounted. Only a\n// fallback: an authored ratio (ratioFixed) is used before this ever runs.\nuseEffect(()=>{if(onCanvas||!hasVideo)return;const v=videoRef.current;if(!v)return;setRatio(null);ratioGuessRef.current=false;const read=()=>{if(v.videoWidth&&v.videoHeight){ratioGuessRef.current=false;setRatio(v.videoWidth/v.videoHeight);if(debug)console.log(\"[AutoPauseVideo] video size:\",v.videoWidth,\"x\",v.videoHeight);}};read();v.addEventListener(\"loadedmetadata\",read);// Fallback when metadata never arrives. It only fills in a guess, the\n// loadedmetadata listener stays attached so the real ratio still wins\n// whenever it shows up later. With an authored ratio there is nothing\n// to guess, so the timer is skipped entirely.\nconst fallback=ratioFixed!==null?0:window.setTimeout(()=>{setRatio(r=>{if(r!==null)return r;if(debug)console.warn(\"[AutoPauseVideo] metadata timeout, assuming portrait\");ratioGuessRef.current=true;return 9/16;});},3e3);return()=>{v.removeEventListener(\"loadedmetadata\",read);if(fallback)window.clearTimeout(fallback);};},[onCanvas,hasVideo,videoUrl,ratioFixed,debug]);// 1b. bento only: read the poster ratio, it usually loads before the\n// video metadata and gives the grid the right shape from the start.\n// Skipped when the ratio is authored, there is nothing left to guess. A\n// Framer-hosted poster carries its size in the URL, so it needs no fetch.\nuseEffect(()=>{if(onCanvas||!bento||!posterSrc||ratioFixed!==null)return;const known=framerImageSize(posterSrc);if(known){setPosterRatio(known.w/known.h);return;}let alive=true;const img=new Image;img.onload=()=>{if(!alive||!img.naturalWidth||!img.naturalHeight)return;setPosterRatio(img.naturalWidth/img.naturalHeight);};img.src=posterSrc;return()=>{alive=false;};},[onCanvas,bento,posterSrc,ratioFixed]);// 1c. poster sizing. If the card is wider than the sizes estimate (an\n// unusual screen size), raise sizes to the measured width so the browser\n// picks a big enough copy. Only ever raised, never lowered, so a copy that\n// is already loaded is never replaced by a smaller one.\nuseEffect(()=>{if(onCanvas||!posterSrcSet||typeof window===\"undefined\")return;const wrapper=wrapperRef.current;if(!wrapper)return;const update=()=>{const w=wrapper.getBoundingClientRect().width;if(w<1)return;const estimate=Math.min(window.innerWidth*.45,posterCapPx);if(w<=estimate+8)return;const next=Math.ceil(w);setPosterSizesPx(prev=>prev&&prev>=next?prev:next);if(debug)console.log(\"[AutoPauseVideo] poster sizes raised to\",next,\"px (estimate\",Math.round(estimate),\")\");};update();if(typeof ResizeObserver===\"undefined\")return;const ro=new ResizeObserver(update);ro.observe(wrapper);return()=>ro.disconnect();},[onCanvas,posterSrcSet,posterCapPx,debug]);// 1d. a poster that finished loading before hydration never fires onLoad,\n// so read the copy it loaded straight from the element.\nuseEffect(()=>{const img=posterImgRef.current;if(img&&img.complete&&img.currentSrc&&posterSrc)setPosterLoaded({src:posterSrc,url:img.currentSrc});},[posterSrc,posterSrcSet]);// 2. inside an overlay, widen every parent that wraps the video tightly.\n// Pointer events are NOT handled here any more, see 2c.\nuseEffect(()=>{if(onCanvas||!inOverlay||ratio===null)return;const wrapper=wrapperRef.current;if(!wrapper)return;const id=uid.current;const styleTag=document.createElement(\"style\");styleTag.setAttribute(\"data-apv-style\",id);document.head.appendChild(styleTag);let touched=[];const clear=()=>{styleTag.textContent=\"\";touched.forEach(el=>el.removeAttribute(`data-${id}`));touched=[];};const apply=()=>{clear()// reset to the design size first so measurements stay true\n;const base=wrapper.getBoundingClientRect().width;if(!base)return;// Sized relative to the viewport, so the overlay keeps the same\n// proportion on a laptop and on a 4K monitor. Landscape takes a\n// share of the viewport WIDTH, portrait a share of its HEIGHT,\n// and both are bounded by the height share so a short, wide\n// window never pushes the video off screen. \"Overlay Max\" is an\n// optional absolute cap in px (0 = none).\n// On phones a landscape video fills the screen width minus\n// \"Phone Margin\" on each side instead of the relative share.\nconst vw=window.innerWidth;const vh=window.innerHeight;const onPhone=vw<=PHONE_MAX;const phoneMargin=clamp(overlayPhoneMargin,0,200);const maxByHeight=vh*clamp(overlayHeight,20,100)/100*ratio;const cap=overlayMaxWidth>0?overlayMaxWidth:Infinity;const desired=ratio>1?onPhone?Math.min(vw-phoneMargin*2,maxByHeight,cap):Math.min(vw*clamp(overlayWidth,20,100)/100,vw-60-20,maxByHeight,cap):Math.min(maxByHeight,vw-60-20,cap);const delta=desired-base;if(debug)console.log(\"[AutoPauseVideo] ratio:\",ratio.toFixed(3),ratio>1?\"(landscape)\":\"(portrait)\",onPhone?\"phone\":\"\",\"base:\",base,\"desired:\",desired);if(Math.abs(delta)<2)return;// collect parents whose width hugs the video. The climb only\n// stops at the outermost #overlay container, never at a frame\n// merely named \"Overlay\", because that frame usually still needs\n// to be widened itself.\nconst chain=[];let el=wrapper.parentElement;while(el&&el.id!==\"overlay\"&&el!==document.body){// Never resize a full-screen layer: the overlay's portal root\n// (e.g. a \"BG blur\" backdrop) or anything as wide as the\n// screen. On a phone such a layer is barely wider than the\n// card, so it passed the width test below, got shrunk along\n// with the card and pulled the whole overlay off center.\nif(el.hasAttribute(\"data-framer-portal-id\"))break;if(window.getComputedStyle(el).position===\"fixed\")break;const w=el.getBoundingClientRect().width;if(w>=window.innerWidth-1)break;if(w>base+80)break;if(w>=base-1)chain.push({el,w});el=el.parentElement;}let css=\"\";chain.forEach(({el,w},i)=>{const key=`${id}-${i}`;el.setAttribute(`data-${id}`,key);touched.push(el);const target=Math.round(w+delta);css+=`[data-${id}=\"${key}\"]{width:${target}px !important;min-width:${target}px !important;max-width:none !important;flex:none !important;}`;});styleTag.textContent=css;if(debug)console.log(\"[AutoPauseVideo] widened parents:\",chain.length,chain.map(c=>c.el));};apply();window.addEventListener(\"resize\",apply);return()=>{window.removeEventListener(\"resize\",apply);clear();styleTag.remove();};},[onCanvas,inOverlay,ratio,overlayWidth,overlayHeight,overlayMaxWidth,overlayPhoneMargin,debug]);// 2c. click through. Every ancestor of the video, up to the overlay's\n// portal root, ignores pointer events so a click on empty space reaches\n// Framer's own backdrop and closes the overlay. A layer that is NOT on\n// that path (a close button, a CTA) stays clickable, and so does the\n// video wrapper itself (its inline style sets pointer-events:auto).\nuseEffect(()=>{if(onCanvas||!inOverlay||!clickThrough)return;const wrapper=wrapperRef.current;if(!wrapper)return;// ancestors up to body or the #overlay container\nconst ancestors=[];let el=wrapper.parentElement;while(el&&el!==document.body&&el.id!==\"overlay\"){ancestors.push(el);el=el.parentElement;}// Framer stamps data-framer-portal-id on the overlay content root and\n// on its backdrop (a sibling, never an ancestor). Stop at the\n// outermost ancestor carrying it, so nothing outside the overlay is\n// touched. Without one, fall back to the frame named \"Overlay\".\nlet end=-1;ancestors.forEach((a,i)=>{if(a.hasAttribute(\"data-framer-portal-id\"))end=i;});if(end<0)ancestors.forEach((a,i)=>{if(end<0&&a.getAttribute(\"data-framer-name\")===\"Overlay\")end=i;});if(end<0){if(debug)console.log(\"[AutoPauseVideo] click through: no overlay root\");return;}const path=ancestors.slice(0,end+1);const id=uid.current;const attr=`data-apv-ct`;path.forEach(a=>a.setAttribute(attr,id));const styleTag=document.createElement(\"style\");styleTag.setAttribute(\"data-apv-ct-style\",id);styleTag.textContent=`[${attr}=\"${id}\"]{pointer-events:none !important;}`+`[${attr}=\"${id}\"] > :not([${attr}=\"${id}\"]){pointer-events:auto !important;}`;document.head.appendChild(styleTag);if(debug)console.log(\"[AutoPauseVideo] click through:\",path.length,path);return()=>{path.forEach(a=>{if(a.getAttribute(attr)===id)a.removeAttribute(attr);});styleTag.remove();};},[onCanvas,inOverlay,clickThrough,debug]);// 2b. bento grid (legacy per-card mode). Disabled when bentoGrid is set to\n// a name that does not exist (the withBentoGrid override owns the grid).\nuseEffect(()=>{if(!bentoActive)return;const wrapper=wrapperRef.current;if(!wrapper)return;// climb until the parent is a CSS grid, that child is the grid cell\nlet cell=wrapper;let grid=null;while(cell&&cell.parentElement&&cell.parentElement!==document.body){const p=cell.parentElement;if(window.getComputedStyle(p).display===\"grid\"){grid=p;break;}cell=p;}if(!grid||!cell){if(debug)console.log(\"[AutoPauseVideo] bento: no grid parent\");return;}const name=grid.getAttribute(\"data-framer-name\")||\"\";if(bentoGrid.trim()&&name!==bentoGrid.trim()){if(debug)console.log(\"[AutoPauseVideo] bento: grid name mismatch\",name);return;}const g=grid;const c=cell;const w=wrapper;// prepare the grid once, remembering the designed row gap so it can\n// be rebuilt as spacing inside each card's row span\nif(!g.dataset.apvBentoGap){const gs=window.getComputedStyle(g);g.dataset.apvBentoGap=String(parseFloat(gs.rowGap)||parseFloat(gs.columnGap)||20);g.style.setProperty(\"grid-template-rows\",\"none\",\"important\");g.style.setProperty(\"grid-auto-rows\",`${BENTO_ROW}px`,\"important\");g.style.setProperty(\"grid-auto-flow\",\"row dense\",\"important\");g.style.setProperty(\"row-gap\",\"0px\",\"important\");g.style.setProperty(\"align-items\",\"start\",\"important\");}g.dataset.apvBentoCount=String((parseInt(g.dataset.apvBentoCount||\"0\")||0)+1);const rowGap=parseFloat(g.dataset.apvBentoGap)||20;let raf=null;const layout=()=>{raf=null;const gs=window.getComputedStyle(g);const tracks=gs.gridTemplateColumns.split(\" \").map(t=>parseFloat(t)).filter(n=>n>0);const cols=Math.max(1,tracks.length);const r=bentoRatio;const span=r>1.05&&cols>=bentoMinCols?2:1;// Pass 1: claim the columns, and stop the cell from filling the\n// row span we are about to give it.\nc.style.setProperty(\"grid-column\",`span ${span}`,\"important\");c.style.setProperty(\"align-self\",\"start\",\"important\");c.style.setProperty(\"height\",\"auto\",\"important\");// Pass 2: measure the WRAPPER, never the cell (the cell stretches\n// to its row span and would feed its own output back in).\nconst wrapH=w.getBoundingClientRect().height;const cellH=c.getBoundingClientRect().height;const h=cellH>0&&cellH<=wrapH+200?Math.max(cellH,wrapH):wrapH;if(!h)return;const rows=Math.max(1,Math.ceil((h+rowGap)/BENTO_ROW));const sig=`${span}:${rows}`;if(c.dataset.apvSpan===sig)return;c.dataset.apvSpan=sig;c.style.setProperty(\"grid-row\",`span ${rows}`,\"important\");if(debug)console.log(\"[AutoPauseVideo] bento:\",Number(r).toFixed(3),\"src:\",ratioSource,\"cols:\",cols,\"span:\",span,\"wrap:\",Math.round(wrapH),\"rows:\",rows);};const queue=()=>{if(raf===null)raf=requestAnimationFrame(layout);};layout();const ro=new ResizeObserver(queue);ro.observe(g);ro.observe(w);return()=>{ro.disconnect();if(raf!==null)cancelAnimationFrame(raf);c.style.removeProperty(\"grid-column\");c.style.removeProperty(\"grid-row\");c.style.removeProperty(\"align-self\");c.style.removeProperty(\"height\");delete c.dataset.apvSpan;const left=(parseInt(g.dataset.apvBentoCount||\"1\")||1)-1;g.dataset.apvBentoCount=String(left);if(left<=0){g.style.removeProperty(\"grid-template-rows\");g.style.removeProperty(\"grid-auto-rows\");g.style.removeProperty(\"grid-auto-flow\");g.style.removeProperty(\"row-gap\");g.style.removeProperty(\"align-items\");delete g.dataset.apvBentoGap;delete g.dataset.apvBentoCount;}};},[bentoActive,bentoRatio,ratioSource,bentoGrid,bentoMinCols,debug]);// 3. crop playback and fade audio\nuseEffect(()=>{if(onCanvas||!hasVideo)return;const v=videoRef.current;if(!v)return;let raf=null;// set volume through the GainNode when present, else video.volume\nconst setVolume=x=>{const a=audioRef.current;if(a){a.gain.gain.value=x;return;}try{v.volume=x;}catch(e){}};const ensureAudio=()=>{if(!webAudioFade||audioRef.current)return;try{const Ctx=window.AudioContext||window.webkitAudioContext;if(!Ctx)return;const ctx=new Ctx;const src=ctx.createMediaElementSource(v);const gain=ctx.createGain();src.connect(gain);gain.connect(ctx.destination);audioRef.current={ctx,gain};try{v.volume=1;}catch(e){}if(debug)console.log(\"[AutoPauseVideo] web audio active\");}catch(e){if(debug)console.warn(\"[AutoPauseVideo] web audio failed\",e);}};const compute=()=>{const d=v.duration;if(!isFinite(d)||d<=0)return;// keep the start inside the clip so there is always room to play\nconst s=clamp(trimStart,0,Math.max(0,d-.1));// trimEnd is seconds cut off the end, 0 means no trim\nconst rawEnd=trimEnd>0?d-trimEnd:d;const e=clamp(rawEnd,s+.05,d);rangeRef.current={start:s,end:e};if(debug)console.log(\"[AutoPauseVideo] range:\",s.toFixed(2),e.toFixed(2));if(v.currentTime<s-.05||v.currentTime>e+.05){try{v.currentTime=s;}catch(err){}}};const volumeAt=t=>{const{start,end}=rangeRef.current;if(fade<=0)return 1;let vol=1;if(fadeIn)vol=Math.min(vol,(t-start)/fade);if(fadeOut)vol=Math.min(vol,(end-t)/fade);return clamp(vol,0,1);};const tick=()=>{const{start,end}=rangeRef.current;const t=v.currentTime;if(cropped&&t>=end){if(loop){try{v.currentTime=start;}catch(e){}setVolume(volumeAt(start));}else{v.pause();try{v.currentTime=start;}catch(e){}setVolume(volumeAt(start));// clip finished, bring the poster back\nsetShowPoster(true);raf=null;return;}}else{setVolume(volumeAt(t));}raf=requestAnimationFrame(tick);};const startLoop=()=>{ensureAudio();const a=audioRef.current;if(a&&a.ctx.state===\"suspended\")a.ctx.resume().catch(()=>{});if(raf===null)raf=requestAnimationFrame(tick);};const stopLoop=()=>{if(raf!==null)cancelAnimationFrame(raf);raf=null;};const onSeeking=()=>{if(!cropped)return;const{start,end}=rangeRef.current;if(v.currentTime<start-.05){try{v.currentTime=start;}catch(e){}}else if(v.currentTime>end){try{v.currentTime=Math.max(start,end-.05);}catch(e){}}};v.addEventListener(\"loadedmetadata\",compute);v.addEventListener(\"play\",startLoop);v.addEventListener(\"pause\",stopLoop);v.addEventListener(\"seeking\",onSeeking);compute();setVolume(volumeAt(v.currentTime));if(!v.paused)startLoop();return()=>{stopLoop();v.removeEventListener(\"loadedmetadata\",compute);v.removeEventListener(\"play\",startLoop);v.removeEventListener(\"pause\",stopLoop);v.removeEventListener(\"seeking\",onSeeking);};},[onCanvas,hasVideo,videoUrl,trimStart,trimEnd,fade,fadeIn,fadeOut,cropped,loop,webAudioFade,debug]);// 4. control when the poster layer shows and hides\nuseEffect(()=>{if(onCanvas||!hasVideo)return;const v=videoRef.current;if(!v)return;const hide=()=>setShowPoster(false);const onPause=()=>{if(posterOnPause)setShowPoster(true);};const onEnded=()=>setShowPoster(true);v.addEventListener(\"play\",hide);v.addEventListener(\"playing\",hide);v.addEventListener(\"pause\",onPause);v.addEventListener(\"ended\",onEnded);return()=>{v.removeEventListener(\"play\",hide);v.removeEventListener(\"playing\",hide);v.removeEventListener(\"pause\",onPause);v.removeEventListener(\"ended\",onEnded);};},[onCanvas,hasVideo,posterOnPause,videoUrl]);// 5. pause and restore as the video enters or leaves the screen\nuseEffect(()=>{// Skip the observer and autoplay inside the Framer editor.\nif(onCanvas||!hasVideo)return;const v=videoRef.current;if(!v)return;const restore=()=>{// hover mode waits for the pointer, never starts by itself\nif(playOnHover)return;// grid autoplay mode has its own scheduler deciding who plays\nif(scrollAutoplay)return;try{v.muted=muted;if(autoplay){v.currentTime=rangeRef.current.start;// start from zero volume when fading in so it never pops\nconst a=audioRef.current;if(a)a.gain.gain.value=fadeIn&&fade>0?0:1;else if(fadeIn&&fade>0)v.volume=0;// unmuted autoplay can be blocked, swallow it and let the\n// user hit play instead (controls are on).\nv.play().catch(()=>{});}}catch(e){}};const io=new IntersectionObserver(entries=>{for(const e of entries){if(e.isIntersecting)restore();else stopPlayback();}},{threshold:.01});io.observe(v);const onVisibility=()=>{if(document.hidden)v.pause();};document.addEventListener(\"visibilitychange\",onVisibility);return()=>{stopPlayback();io.disconnect();document.removeEventListener(\"visibilitychange\",onVisibility);};// depends on playback settings so behaviour follows prop changes\n},[onCanvas,hasVideo,autoplay,playOnHover,scrollAutoplay,muted,videoUrl,fadeIn,fade]);// 6. solo playback, only one instance on the page may run at a time\nuseEffect(()=>{if(onCanvas||!hasVideo||!soloPlayback)return;const v=videoRef.current;if(!v)return;const announce=()=>{window.dispatchEvent(new CustomEvent(PLAY_EVENT,{detail:uid.current}));};const onOther=e=>{const who=e.detail;if(who===uid.current)return;if(v.paused)return;if(debug)console.log(\"[AutoPauseVideo] stopped by another instance:\",who);stopPlayback();};v.addEventListener(\"play\",announce);window.addEventListener(PLAY_EVENT,onOther);return()=>{v.removeEventListener(\"play\",announce);window.removeEventListener(PLAY_EVENT,onOther);};},[onCanvas,hasVideo,soloPlayback,debug]);// 7. stop instances sitting outside an overlay while one is open, since\n// an IntersectionObserver cannot detect that the card got covered. One\n// shared watcher on document.body (see subscribeOverlay above) notifies\n// every card, instead of each card installing its own MutationObserver.\nuseEffect(()=>{if(onCanvas||!hasVideo||!pauseOnOverlay||inOverlay)return;const v=videoRef.current;if(!v)return;const onChange=open=>{if(debug)console.log(\"[AutoPauseVideo] overlay open:\",open);if(open&&!v.paused)stopPlayback();};return subscribeOverlay(onChange);},[onCanvas,hasVideo,pauseOnOverlay,inOverlay,debug]);// 8. hover to play. Only runs on devices that really have a hovering\n// pointer, so a phone never triggers it by tapping.\nuseEffect(()=>{if(onCanvas||!hasVideo||!playOnHover)return;const wrapper=wrapperRef.current;const v=videoRef.current;if(!wrapper||!v)return;const canHover=typeof window.matchMedia===\"function\"?window.matchMedia(\"(hover: hover) and (pointer: fine)\").matches:true;if(!canHover){if(debug)console.log(\"[AutoPauseVideo] hover skipped, device has no hover\");return;}let inside=false;const enter=e=>{const pe=e;if(pe.pointerType===\"touch\")return;if(inside)return;inside=true;if(debug)console.log(\"[AutoPauseVideo] hover enter\",e.type);// In grid mode the scheduler owns playback, so claim priority\n// and let it decide. It stops whichever card was playing before.\nif(scrollAutoplay){const reg=getRegistry();reg.hover=uid.current;schedule(debug);return;}try{v.muted=muted;if(v.currentTime<rangeRef.current.start)v.currentTime=rangeRef.current.start;const a=audioRef.current;if(a)a.gain.gain.value=fadeIn&&fade>0?0:1;else if(fadeIn&&fade>0)v.volume=0;v.play().catch(err=>{if(debug)console.warn(\"[AutoPauseVideo] hover play blocked\",err);});}catch(err){}};const leave=e=>{const pe=e;if(pe.pointerType===\"touch\")return;if(!inside)return;inside=false;if(debug)console.log(\"[AutoPauseVideo] hover leave\",e.type);// hand control back, the most visible card takes over again\nif(scrollAutoplay){const reg=getRegistry();if(reg.hover===uid.current)reg.hover=null;schedule(debug);return;}stopPlayback();};// pointer events are the modern path, mouse events are the fallback\n// for cases where something upstream swallows pointer events\nwrapper.addEventListener(\"pointerenter\",enter);wrapper.addEventListener(\"pointerleave\",leave);wrapper.addEventListener(\"mouseenter\",enter);wrapper.addEventListener(\"mouseleave\",leave);if(debug)console.log(\"[AutoPauseVideo] hover listeners attached\",wrapper);return()=>{wrapper.removeEventListener(\"pointerenter\",enter);wrapper.removeEventListener(\"pointerleave\",leave);wrapper.removeEventListener(\"mouseenter\",enter);wrapper.removeEventListener(\"mouseleave\",leave);const reg=getRegistry();if(reg.hover===uid.current){reg.hover=null;schedule(debug);}};},[onCanvas,hasVideo,playOnHover,scrollAutoplay,muted,fadeIn,fade,debug]);// 9. close the AudioContext only on a real unmount\nuseEffect(()=>{return()=>{const a=audioRef.current;if(a){a.ctx.close().catch(()=>{});audioRef.current=null;}};},[]);// 10. grid autoplay. Every instance reports how much of itself is on\n// screen and a shared scheduler lets exactly one of them play, so the\n// page always has a single moving video that follows the scroll.\nuseEffect(()=>{if(onCanvas||!hasVideo||!scrollAutoplay)return;const v=videoRef.current;if(!v)return;const key=uid.current;const reg=getRegistry();const play=()=>{try{v.muted=muted;v.currentTime=rangeRef.current.start;const a=audioRef.current;if(a)a.gain.gain.value=fadeIn&&fade>0?0:1;else if(fadeIn&&fade>0)v.volume=0;v.play().catch(err=>{if(debug)console.warn(\"[AutoPauseVideo] grid autoplay blocked, try Muted on\",err);});}catch(e){}};reg.items.set(key,{ratio:0,top:0,play,stop:stopPlayback});const io=new IntersectionObserver(entries=>{for(const e of entries){const entry=reg.items.get(key);if(!entry)continue;entry.ratio=e.intersectionRatio;entry.top=e.boundingClientRect.top;}schedule(debug);},// a fine grained threshold list so the ratio updates while\n// scrolling instead of only at the edges\n{threshold:[0,.1,.25,.4,.5,.6,.75,.9,1]});io.observe(v);// scrolling inside a tall card changes how much is visible without\n// crossing a threshold, so nudge the scheduler on scroll too\nconst onScroll=()=>schedule(debug);window.addEventListener(\"scroll\",onScroll,{passive:true});window.addEventListener(\"resize\",onScroll);return()=>{io.disconnect();window.removeEventListener(\"scroll\",onScroll);window.removeEventListener(\"resize\",onScroll);reg.items.delete(key);if(reg.current===key)reg.current=null;stopPlayback();schedule(debug);};},[onCanvas,hasVideo,scrollAutoplay,muted,videoUrl,fadeIn,fade,debug]);// 11. debug only. Logs which element actually receives a click, so a\n// close button or a dismissible backdrop that refuses to fire can be\n// traced to the element sitting on top of it. Only one instance on the\n// page installs it, the window flag keeps the console readable.\nuseEffect(()=>{if(onCanvas||!debug)return;const w=window;if(w.__apvClickTracer)return;w.__apvClickTracer=true;const describe=el=>{if(!el)return\"none\";const name=el.getAttribute?.(\"data-framer-name\");const id=el.id;return`${el.tagName.toLowerCase()}${id?\"#\"+id:\"\"}${name?` [${name}]`:\"\"}`;};const onClick=e=>{const target=e.target;const chain=[];let el=target;let depth=0;while(el&&depth<8){chain.push(describe(el));el=el.parentElement;depth++;}console.log(\"[AutoPauseVideo] click hit:\",describe(target),\"\\n  chain:\",chain.join(\" < \"),\"\\n  node:\",target);};document.addEventListener(\"click\",onClick,true);return()=>{document.removeEventListener(\"click\",onClick,true);w.__apvClickTracer=false;};},[onCanvas,debug]);// clicking the poster starts playback and counts as the user gesture\n// needed to allow unmuted audio. If the card is scrolled far off screen\n// its video is not mounted; the mount flag flips on the next frame, so\n// schedule the play once the element exists.\nconst handlePosterClick=()=>{if(onCanvas)return;setNear(true);const start=()=>{const v=videoRef.current;if(!v){requestAnimationFrame(start);return;}try{v.muted=muted;if(v.currentTime<rangeRef.current.start)v.currentTime=rangeRef.current.start;v.play().catch(()=>{});}catch(e){}setShowPoster(false);};requestAnimationFrame(start);};const autoSize=inOverlay&&!onCanvas;// overlay and bento both size the wrapper from a ratio\nconst ratioSized=autoSize||bentoActive;// In an overlay the width fills the parent (widened through CSS) and the\n// height comes from the real video ratio. In bento mode the height comes\n// from the best known ratio so the grid row span always matches. Outside\n// both it fills the parent at 100% as before.\nconst wrapperStyle=autoSize?{...style,position:\"relative\",width:\"100%\",height:\"auto\",aspectRatio:`${ratioFixed??ratio??9/16}`,// stay hidden until the ratio is known to avoid a size jump\nopacity:ratioFixed===null&&ratio===null?0:1,borderRadius:radius,overflow:\"hidden\",background:\"#000\",// parents may be click through, this one never is\npointerEvents:\"auto\"}:bentoActive?{...style,position:\"relative\",width:\"100%\",height:\"auto\",aspectRatio:`${bentoRatio}`,borderRadius:radius,overflow:\"hidden\",background:LOADING_BG,pointerEvents:\"auto\"}:{...style,position:\"relative\",width:\"100%\",height:\"100%\",borderRadius:radius,overflow:\"hidden\",background:LOADING_BG,pointerEvents:\"auto\"};const videoStyle=ratioSized?{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:objectFit,display:\"block\"}:{width:\"100%\",height:\"100%\",objectFit:objectFit,display:\"block\"};const posterVisible=!!posterSrc&&(showPoster||!hasVideo);return /*#__PURE__*/_jsxs(\"div\",{ref:wrapperRef,style:wrapperStyle,// markers so withBentoGrid can find and size this card and keep a\n// stable shuffle order even while the <video> is lazily unmounted.\n// The key is always the ORIGINAL poster URL, never a scaled copy,\n// so the grid order does not depend on which copy was loaded.\n\"data-apv-card\":\"\",\"data-apv-ratio\":String(bentoRatio),\"data-apv-key\":posterSrc||videoUrl||\"\",children:[hasVideo&&/*#__PURE__*/_jsx(\"video\",{ref:videoRef,src:videoUrl||undefined,// the copy the poster <img> loaded, so it is a cache hit\nposter:videoPoster,controls:controls,// native loop is off when trimmed, looping is handled manually\nloop:loop&&!cropped,muted:onCanvas?true:muted,autoPlay:onCanvas||playOnHover||scrollAutoplay?false:autoplay,playsInline:true,preload:preload,// crossOrigin is only set when Web Audio is used, because a\n// wrong CORS setup on the host would break loading entirely\ncrossOrigin:webAudioFade?\"anonymous\":undefined,style:videoStyle}),posterVisible&&/*#__PURE__*/_jsx(\"div\",{onClick:handlePosterClick,style:{position:\"absolute\",inset:0,background:\"transparent\",cursor:onCanvas?\"default\":\"pointer\",zIndex:2},children:/*#__PURE__*/_jsx(\"img\",{ref:posterImgRef,src:posterSrc,// grid cards: scaled copies, picked by the browser\nsrcSet:posterSrcSet,sizes:posterSizes,onLoad:e=>{const url=e.currentTarget.currentSrc;if(url&&posterSrc)setPosterLoaded({src:posterSrc,url});},alt:posterImageSrc?posterImage?.alt||\"\":\"\",draggable:false,// lazy + async so a grid of many cards does not request\n// and decode every poster at once (which left cards\n// blank while scrolling fast on mobile)\nloading:\"lazy\",decoding:\"async\",style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:objectFit,display:\"block\",userSelect:\"none\"}})})]});}addPropertyControls(AutoPauseVideo,{videoUrl:{type:ControlType.String,title:\"Video URL\",placeholder:\"https://assets.masterhooks.com/ads/....webm\"},posterImage:{type:ControlType.ResponsiveImage,title:\"Poster Image\",description:\"Bind to a CMS Image field. Used first; falls back to Poster URL when empty\"},posterUrl:{type:ControlType.String,title:\"Poster URL\",placeholder:\"https://assets.masterhooks.com/ads/....jpg\"},ratioOverride:{type:ControlType.Number,title:\"Aspect Ratio\",description:\"Width / height, e.g. 1.778 landscape, 0.5625 portrait, 1 square. Bind it to a CMS field so the layout is right on first paint. 0 means measure it instead\",min:0,max:4,step:1e-4,displayStepper:false,defaultValue:0},preload:{type:ControlType.Enum,title:\"Preload\",description:\"Only set to None once every card logs src: cms, it drops one request per card on load\",options:[\"none\",\"metadata\",\"auto\"],optionTitles:[\"None\",\"Metadata\",\"Auto\"],defaultValue:\"metadata\"},posterOnPause:{type:ControlType.Boolean,title:\"Poster\",enabledTitle:\"On Pause\",disabledTitle:\"Start Only\",defaultValue:false},controls:{type:ControlType.Boolean,title:\"Controls\",defaultValue:true},autoplay:{type:ControlType.Boolean,title:\"Autoplay\",description:\"Ignored when Play on Hover or Grid Autoplay is on\",defaultValue:true},playOnHover:{type:ControlType.Boolean,title:\"Play on Hover\",description:\"Mouse only, phones still wait for a tap. Works together with Grid Autoplay, a hovered card takes over\",defaultValue:false},scrollAutoplay:{type:ControlType.Boolean,title:\"Grid Autoplay\",enabledTitle:\"One at a Time\",disabledTitle:\"Off\",description:\"Only the most visible card plays, it follows the scroll. Overrides Autoplay\",defaultValue:false},soloPlayback:{type:ControlType.Boolean,title:\"Solo Playback\",description:\"Stop other instances when this one plays\",defaultValue:true},pauseOnOverlay:{type:ControlType.Boolean,title:\"Pause on Overlay\",description:\"Stop this video while an overlay is open\",defaultValue:true},clickThrough:{type:ControlType.Boolean,title:\"Click Through\",description:\"Clicks on empty space inside the overlay (including a full-screen blur layer) reach the backdrop, so the overlay closes\",defaultValue:true},muted:{type:ControlType.Boolean,title:\"Muted\",defaultValue:false},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:false},startTime:{type:ControlType.Number,title:\"Start Time\",description:\"Seconds trimmed off the start. Decimals allowed, e.g. 3.5\",min:0,max:3600,step:.1,unit:\"s\",displayStepper:false,defaultValue:0},endTime:{type:ControlType.Number,title:\"End Time\",description:\"Seconds trimmed off the end. Set 0 to play to the end\",min:0,max:3600,step:.1,unit:\"s\",displayStepper:false,defaultValue:0},fadeDuration:{type:ControlType.Number,title:\"Fade\",description:\"Audio fade length for the trimmed start and end\",min:0,max:10,step:.1,unit:\"s\",displayStepper:false,defaultValue:.8},webAudioFade:{type:ControlType.Boolean,title:\"iOS Fade\",description:\"Needs CORS headers on the video host\",enabledTitle:\"Web Audio\",disabledTitle:\"Off\",defaultValue:false},objectFit:{type:ControlType.Enum,title:\"Fit\",options:[\"cover\",\"contain\"],optionTitles:[\"Cover\",\"Contain\"],defaultValue:\"cover\"},radius:{type:ControlType.Number,title:\"Radius\",min:0,max:100,defaultValue:16},overlayWidth:{type:ControlType.Number,title:\"Overlay Width\",description:\"Landscape width in the overlay, as % of the screen width (tablet and up; phones use Phone Margin)\",min:20,max:100,step:1,unit:\"%\",defaultValue:62},overlayHeight:{type:ControlType.Number,title:\"Overlay Height\",description:\"Portrait height in the overlay, as % of the screen height. Also the height limit for landscape\",min:20,max:100,step:1,unit:\"%\",defaultValue:75},overlayMaxWidth:{type:ControlType.Number,title:\"Overlay Max\",description:\"Optional absolute width cap in px. 0 means no cap\",min:0,max:4e3,step:10,unit:\"px\",defaultValue:0},overlayPhoneMargin:{type:ControlType.Number,title:\"Phone Margin\",description:\"Phones (≤809px): landscape overlay fills the screen width minus this margin on each side\",min:0,max:200,step:1,unit:\"px\",defaultValue:16},bento:{type:ControlType.Boolean,title:\"Bento\",description:\"Sizes the card from its ratio. Live site only\",defaultValue:false},bentoGrid:{type:ControlType.String,title:\"Bento Grid\",description:\"Layer name of a grid this card should reshape itself (legacy). Use a name that does not exist, e.g. __off__, when withBentoGrid owns the grid\",defaultValue:\"VideoLibraries\",hidden:p=>!p.bento},posterWidth:{type:ControlType.Number,title:\"Card Width\",description:\"Bento only. Rough width of a one-column card in px, used to load a poster sized to the card. Landscape cards count as two columns\",min:80,max:800,step:10,unit:\"px\",defaultValue:210,hidden:p=>!p.bento},bentoMinCols:{type:ControlType.Number,title:\"Bento Min Cols\",description:\"Below this column count landscape stays 1 column\",min:1,max:6,step:1,displayStepper:true,defaultValue:3,hidden:p=>!p.bento},debug:{type:ControlType.Boolean,title:\"Debug log\",defaultValue:false}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AutoPauseVideo\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AutoPauseVideo.map"],"mappings":"A,sNAuKG,SAAwBiB,EAAe,EAAM,CAAC,GAAK,CAAC,WAAS,cAAY,YAAU,gBAAc,GAAM,WAAS,GAAK,WAAS,GAAK,cAAY,GAAM,eAAa,GAAK,iBAAe,GAAM,iBAAe,GAAK,eAAa,GAAK,QAAM,GAAM,OAAK,GAAM,aAAU,EAAE,WAAQ,EAAE,gBAAa,GAAG,gBAAa,GAAM,aAAU,QAAQ,UAAO,GAAG,gBAAa,GAAG,iBAAc,GAAG,mBAAgB,EAAE,sBAAmB,GAAG,QAAM,GAAM,aAAU,iBAAiB,gBAAa,EAAE,eAAY,IAAI,iBAAc,EAAE,WAAQ,WAAW,QAAM,GAAM,UAAOC,EAAYC,EAASnB,EAAO,IAAI,EAAQoB,EAAWpB,EAAO,IAAI,EAAQqB,GAAarB,EAAO,IAAI,EAAQsB,EAAItB,EAAO,MAAM,KAAK,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAQuB,EAAST,EAAa,QAAQ,IAAIA,EAAa,OAEruBU,GAAe,OAAOC,GAAa,KAAM,UAASA,EAAY,IAAI,KAAK,GAAG,IAAA,GAA0BC,EAAUF,IAAgBG,GAAW,KAAK,GAAG,IAAA,GAElJ,CAACC,GAAaC,IAAiB5B,EAAS,IAAI,EAC5C,CAAC6B,GAAcC,IAAkB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