{"version":3,"file":"LiteVideo.CbobdpLi.mjs","names":["p","useState","useRef","_Fragment"],"sources":["https:/framerusercontent.com/modules/jXLwzV4PKR4VbINGrxtX/DdCwKoxJqVdMmR1EXnqU/LiteVideo.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";// Accepts watch, youtu.be, shorts and embed URLs, or a bare id.\nfunction videoId(input){const s=(input||\"\").trim();if(!s)return\"\";if(/^[\\w-]{11}$/.test(s))return s;try{const u=new URL(s);if(u.hostname.includes(\"youtu.be\"))return u.pathname.slice(1).split(\"/\")[0];const v=u.searchParams.get(\"v\");if(v)return v;const m=u.pathname.match(/\\/(embed|shorts|v)\\/([\\w-]{11})/);if(m)return m[2];}catch{// fall through\n}return\"\";}// Keyboard focus ring for the play button, drawn on the disc because the box clips\n// anything outside the button. Colours are the site's Black and Ground tokens. The\n// transparent outline only shows in forced colours, where box-shadow is removed.\nconst FOCUS_CSS=`\n.jr-litevideo-play:focus-visible { outline: none; }\n.jr-litevideo-play:focus-visible .jr-litevideo-disc {\n    box-shadow: 0 0 0 3px var(--token-defa5673-66e2-43d3-8b9b-6e1dc311aa53, #000000),\n        0 0 0 7px var(--token-08c77452-4a69-47a4-92f3-43f109bc2c3c, #EFDBB2),\n        0 8px 24px rgba(0, 0, 0, 0.25) !important;\n    outline: 3px solid transparent;\n    outline-offset: 4px;\n}\n`;// Sent on window when a video starts; detail.id names the instance that started.\nconst PLAY_EVENT=\"jr-litevideo-play\";// Sent on window when a video starts and when it stops (back to its poster or gone):\n// detail.id names the instance, detail.playing is true or false.\nconst STATE_EVENT=\"jr-litevideo-state\";// The nearest ancestor that scrolls sideways (a carousel track), or null.\nfunction sidewaysScroller(el){let node=el.parentElement;while(node&&node!==document.body){const overflowX=getComputedStyle(node).overflowX;if(overflowX===\"auto\"||overflowX===\"scroll\")return node;node=node.parentElement;}return null;}export default function LiteVideo(props){const p={...LiteVideo.defaultProps,...props};const isStatic=useIsStaticRenderer();const[playing,setPlaying]=useState(false);const frameRef=useRef(null);const boxRef=useRef(null);const selfRef=useRef(\"\");if(!selfRef.current)selfRef.current=`lv-${Math.random().toString(36).slice(2,10)}`;const id=videoId(p.videoUrl);// Once the player exists, hand it focus so keyboard users land on it.\nuseEffect(()=>{if(playing&&frameRef.current)frameRef.current.focus();},[playing]);// A changed video resets to the poster.\nuseEffect(()=>{setPlaying(false);},[id]);// In a carousel, back to the poster once the slide is mostly out of view.\nuseEffect(()=>{if(!playing||typeof IntersectionObserver===\"undefined\")return;const box=boxRef.current;if(!box)return;const root=sidewaysScroller(box);if(!root)return;const observer=new IntersectionObserver(entries=>{for(const entry of entries){if(entry.intersectionRatio<.5)setPlaying(false);}},{root,threshold:[0,.5,1]});observer.observe(box);return()=>observer.disconnect();},[playing]);// One at a time: tell the others this one started, and go back to the poster\n// when another one starts. A link with no usable id plays nothing, so it sends\n// nothing. Start and stop are also announced for the carousel's autoplay.\nuseEffect(()=>{if(!playing||!id||typeof window===\"undefined\")return;const self=selfRef.current;window.dispatchEvent(new CustomEvent(PLAY_EVENT,{detail:{id:self}}));window.dispatchEvent(new CustomEvent(STATE_EVENT,{detail:{id:self,playing:true}}));const onPlay=event=>{const detail=event.detail;if(detail&&detail.id!==self)setPlaying(false);};window.addEventListener(PLAY_EVENT,onPlay);return()=>{window.removeEventListener(PLAY_EVENT,onPlay);window.dispatchEvent(new CustomEvent(STATE_EVENT,{detail:{id:self,playing:false}}));};},[playing]);const name=p.title||\"video\";const src=id?`https://www.youtube-nocookie.com/embed/${id}?autoplay=1&rel=0&modestbranding=1&playsinline=1`:\"\";return /*#__PURE__*/_jsxs(\"figure\",{style:{margin:0,width:\"100%\",display:\"flex\",flexDirection:\"column\",gap:16},children:[/*#__PURE__*/_jsx(\"style\",{children:FOCUS_CSS}),/*#__PURE__*/_jsx(\"div\",{ref:boxRef,style:{position:\"relative\",width:\"100%\",aspectRatio:\"16 / 9\",overflow:\"hidden\",borderRadius:p.radius,background:\"#000\"},children:playing&&!isStatic&&src?/*#__PURE__*/_jsx(\"iframe\",{ref:frameRef,title:name,src:src,allow:\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture; fullscreen\",allowFullScreen:true,style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",border:0}}):/*#__PURE__*/_jsxs(_Fragment,{children:[p.poster?// loading and decoding come before src: when React creates the\n// img in the browser (the homepage carousel's slides are drawn\n// there, not taken from the server markup) it sets attributes in\n// this order, and Chrome starts the fetch the moment src is set\n// unless it already reads lazy (Wave 2, 2026-09-30).\n/*#__PURE__*/_jsx(\"img\",{loading:p.loadEarly?\"eager\":\"lazy\",decoding:\"async\",src:p.poster,alt:\"\",draggable:false,style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:\"cover\"}}):null,/*#__PURE__*/_jsx(\"button\",{type:\"button\",className:\"jr-litevideo-play\",\"aria-label\":`${p.playLabel} ${name}`.trim(),onClick:()=>setPlaying(true),style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",margin:0,padding:0,border:0,background:\"transparent\",cursor:\"pointer\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",className:\"jr-litevideo-disc\",style:{width:84,height:84,borderRadius:999,background:p.buttonFill,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",boxShadow:\"0 8px 24px rgba(0,0,0,0.25)\"},children:/*#__PURE__*/_jsx(\"svg\",{width:\"30\",height:\"34\",viewBox:\"0 0 30 34\",\"aria-hidden\":\"true\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M3 2 L28 17 L3 32 Z\",fill:p.buttonInk})})})})]})}),p.showText?/*#__PURE__*/_jsxs(\"figcaption\",{style:{display:\"flex\",flexDirection:\"column\",gap:6},children:[/*#__PURE__*/_jsx(\"span\",{style:{fontFamily:p.titleFont,fontSize:p.titleSize,lineHeight:1.15,color:p.titleColor},children:p.title}),p.line?/*#__PURE__*/_jsx(\"span\",{style:{fontFamily:p.lineFont,fontSize:p.lineSize,lineHeight:1.45,color:p.lineColor},children:p.line}):null]}):null]});}LiteVideo.defaultProps={videoUrl:\"\",poster:\"\",title:\"\",line:\"\",playLabel:\"Play\",buttonFill:\"#F2623B\",buttonInk:\"#000000\",titleColor:\"#EFDBB2\",lineColor:\"#EFDBB2\",titleFont:\"'Free Lunch Regular', 'Cooper Black', serif\",titleSize:32,lineFont:\"Lora, Georgia, serif\",lineSize:20,radius:0,showText:true,loadEarly:false};addPropertyControls(LiteVideo,{videoUrl:{type:ControlType.String,title:\"Video URL\",defaultValue:\"\",description:\"A YouTube watch or youtu.be link, or the video id.\"},poster:{type:ControlType.Image,title:\"Poster\",description:\"Upload the still to Framer; nothing loads from YouTube until play.\"},loadEarly:{type:ControlType.Boolean,title:\"Load Early\",defaultValue:false,description:\"On only for the first big image on a page. Off, the poster loads as it nears the screen.\"},title:{type:ControlType.String,title:\"Title\",defaultValue:\"\"},line:{type:ControlType.String,title:\"Line\",defaultValue:\"\",description:\"One factual line under the title.\"},showText:{type:ControlType.Boolean,title:\"Show Text\",defaultValue:true},playLabel:{type:ControlType.String,title:\"Play Label\",defaultValue:\"Play\",description:\"Read to screen readers before the title.\"},buttonFill:{type:ControlType.Color,title:\"Button Fill\",defaultValue:\"#F2623B\"},buttonInk:{type:ControlType.Color,title:\"Button Ink\",defaultValue:\"#000000\"},titleColor:{type:ControlType.Color,title:\"Title Color\",defaultValue:\"#EFDBB2\"},lineColor:{type:ControlType.Color,title:\"Line Color\",defaultValue:\"#EFDBB2\"},titleFont:{type:ControlType.String,title:\"Title Font\",defaultValue:\"'Free Lunch Regular', 'Cooper Black', serif\"},titleSize:{type:ControlType.Number,title:\"Title Size\",min:12,max:96,defaultValue:32,unit:\"px\"},lineFont:{type:ControlType.String,title:\"Line Font\",defaultValue:\"Lora, Georgia, serif\"},lineSize:{type:ControlType.Number,title:\"Line Size\",min:12,max:40,defaultValue:20,unit:\"px\"},radius:{type:ControlType.Number,title:\"Radius\",min:0,max:40,defaultValue:0,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LiteVideo\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LiteVideo.map"],"mappings":"4NACA,SAAS,EAAQ,EAAM,CAAC,IAAM,GAAG,GAAO,GAAA,CAAI,KAAK,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG,cAAc,KAAK,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,IAAM,EAAE,IAAI,IAAI,CAAC,EAAE,GAAG,EAAE,SAAS,SAAS,UAAU,EAAE,OAAO,EAAE,SAAS,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAM,EAAE,EAAE,aAAa,IAAI,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,IAAM,EAAE,EAAE,SAAS,MAAM,iCAAiC,EAAE,GAAG,EAAE,OAAO,EAAE,EAAG,MAAM,CACxU,CAAC,MAAM,EAAG,CAgBV,SAAS,EAAiB,EAAG,CAAC,IAAI,EAAK,EAAG,cAAc,KAAM,GAAM,IAAO,SAAS,MAAK,CAAC,IAAM,EAAU,iBAAiB,CAAI,CAAC,CAAC,UAAU,GAAG,IAAY,QAAQ,IAAY,SAAS,OAAO,EAAK,EAAK,EAAK,aAAc,CAAC,OAAO,IAAK,CAAC,SAAwB,EAAU,EAAM,CAAC,IAAMA,EAAE,CAAC,GAAG,EAAU,aAAa,GAAG,CAAK,EAAQ,EAAS,EAAoB,EAAO,CAAC,EAAQ,GAAYC,EAAS,EAAK,EAAQ,EAASC,EAAO,IAAI,EAAQ,EAAOA,EAAO,IAAI,EAAQ,EAAQA,EAAO,EAAE,EAAE,AAAoB,EAAQ,UAAQ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