{"version":3,"file":"ArticleVideo.BMPbGBTK.mjs","names":["_Fragment","React.useState","React.useRef","__exportAll","window","init_ssg_sandbox_shims","_e","de","l","p","init_jsx_runtime","init_npm_react_18_3_1","ce","addPropertyControls","RenderTarget","ControlType","init_framer_BkYB2Gqq","ArticleVideo_exports","__FramerMetadata__","ArticleVideo","SoundIcon","muted","useHoverCapable","hover","setHover","videoFile","posterProp","props","video","videoUrl","bunny","BUNNY_MP4","poster","posterUrl","BUNNY_THUMBNAIL","ref","vid","hoverCapable","isCanvas","active","setActive","pinned","setPinned","setMuted","on","playing","io","IN_VIEW_RATIO","v","toggle","style","radius","DARK","title","next","PILL_HOVER","PILL","FONT","label","init_ArticleVideo","__esmMin","\"exports\"","\"default\"","\"type\"","\"name\"","\"slots\"","\"annotations\"","\"framerContractVersion\"","\"framerSupportedLayoutHeight\"","\"framerSupportedLayoutWidth\"","\"__FramerMetadata__\""],"sources":["https:/framerusercontent.com/modules/s0ipXJCtYnOrg1WGMzak/iKj2rYiWV2PlgQWwHRDL/ArticleVideo.js"],"sourcesContent":["// Article video that plays like the homepage customer video cards (CustomerVideos_1.tsx): a poster with a\n// centred \"Watch video\" pill, a muted preview on hover (while in view on touch devices), and a click that plays it\n// from the start with sound. A second click stops it. The sound toggle shows while it plays.\n// The pill is darker than on the cards because this poster is a light product frame, not a dark photo.\nimport{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";const FONT='\"ABC Diatype Regular\", \"ABC Diatype\", sans-serif';const DARK=\"#121315\";const PILL=\"rgba(18,19,21,0.62)\";const PILL_HOVER=\"rgba(18,19,21,0.8)\";const IN_VIEW_RATIO=.6;// Bunny Stream serves a thumbnail next to each MP4 rendition.\nconst BUNNY_MP4=/^(https:\\/\\/[^/]+\\.b-cdn\\.net\\/[0-9a-f-]+\\/)play_\\d+p\\.mp4$/;const BUNNY_THUMBNAIL=\"thumbnail.jpg\";function SoundIcon({muted}){return /*#__PURE__*/_jsxs(\"svg\",{width:\"16\",height:\"16\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"currentColor\",strokeWidth:\"1.8\",strokeLinecap:\"round\",strokeLinejoin:\"round\",\"aria-hidden\":\"true\",children:[/*#__PURE__*/_jsx(\"path\",{d:\"M11 5 6 9H3v6h3l5 4V5z\"}),muted?/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"line\",{x1:\"16\",y1:\"9\",x2:\"22\",y2:\"15\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"22\",y1:\"9\",x2:\"16\",y2:\"15\"})]}):/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"path\",{d:\"M15.5 8.5a5 5 0 0 1 0 7\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M18.5 5.5a9 9 0 0 1 0 13\"})]})]});}function useHoverCapable(){const[hover,setHover]=React.useState(true);React.useEffect(()=>{if(typeof window===\"undefined\"||!window.matchMedia)return;setHover(window.matchMedia(\"(hover: hover)\").matches);},[]);return hover;}/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function ArticleVideo(props){const{video:videoFile,videoUrl=\"\",poster:posterProp,posterUrl=\"\",label=\"Watch video\",title=\"\",radius=0,style}=props;const video=videoFile||videoUrl;const bunny=typeof video===\"string\"?video.match(BUNNY_MP4):null;const poster=(typeof posterProp===\"string\"?posterProp:posterProp?.src)||posterUrl||(bunny?bunny[1]+BUNNY_THUMBNAIL:undefined);const ref=React.useRef(null);const vid=React.useRef(null);const hoverCapable=useHoverCapable();const isCanvas=RenderTarget.current()===RenderTarget.canvas;const[active,setActive]=React.useState(false);const[pinned,setPinned]=React.useState(false);const[muted,setMuted]=React.useState(true);const[hover,setHover]=React.useState(false);const on=!isCanvas&&(active||pinned);const playing=on&&!!video;React.useEffect(()=>{if(isCanvas||hoverCapable||!ref.current||typeof IntersectionObserver===\"undefined\")return;const io=new IntersectionObserver(([e])=>setActive(e.intersectionRatio>IN_VIEW_RATIO),{threshold:[0,IN_VIEW_RATIO,1]});io.observe(ref.current);return()=>io.disconnect();},[hoverCapable,isCanvas]);React.useEffect(()=>{const v=vid.current;if(v)v.muted=muted;},[muted]);React.useEffect(()=>{const v=vid.current;if(!v)return;if(on){const p=v.play();if(p&&p.catch)p.catch(()=>{});}else{v.pause();v.currentTime=0;v.muted=true;setMuted(true);}},[on]);const toggle=()=>{const v=vid.current;if(!video||!v)return;if(pinned){setPinned(false);setActive(false);return;}// Unmute and play inside the click itself, so browsers allow the sound.\nv.muted=false;v.currentTime=0;const p=v.play();if(p&&p.catch)p.catch(()=>{});setMuted(false);setPinned(true);};return /*#__PURE__*/_jsxs(\"div\",{ref:ref,onMouseEnter:()=>{setHover(true);if(hoverCapable)setActive(true);},onMouseLeave:()=>{setHover(false);if(hoverCapable)setActive(false);},onClick:toggle,style:{...style,position:\"relative\",width:\"100%\",aspectRatio:\"16 / 9\",borderRadius:radius,overflow:\"hidden\",cursor:\"pointer\",background:poster?`${DARK} center / cover no-repeat url(${poster})`:DARK},children:[video?/*#__PURE__*/_jsx(\"video\",{ref:vid,src:video,poster:poster,muted:true,loop:true,playsInline:true,preload:\"metadata\",\"aria-label\":title||undefined,style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:\"cover\",opacity:playing?1:0,transition:\"opacity 0.3s\"}}):null,playing?/*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-label\":muted?\"Turn sound on\":\"Turn sound off\",onClick:e=>{e.preventDefault();e.stopPropagation();const v=vid.current;const next=!muted;if(v)v.muted=next;setMuted(next);},style:{position:\"absolute\",top:20,right:20,width:36,height:36,borderRadius:999,border:\"1.5px solid rgba(255,255,255,0.85)\",background:\"rgba(0,0,0,0.25)\",color:\"#FFFFFF\",cursor:\"pointer\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",padding:0},children:/*#__PURE__*/_jsx(SoundIcon,{muted:muted})}):null,/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",inset:0,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",pointerEvents:\"none\"},children:/*#__PURE__*/_jsxs(\"button\",{type:\"button\",\"aria-label\":title?`Play ${title} with sound`:\"Play the video with sound\",onClick:e=>{e.preventDefault();e.stopPropagation();toggle();},style:{pointerEvents:playing?\"none\":\"auto\",cursor:\"pointer\",display:\"inline-flex\",alignItems:\"center\",gap:8,padding:\"10px 18px\",borderRadius:999,border:`1px solid ${hover?\"rgba(255,255,255,0.3)\":\"rgba(255,255,255,0.16)\"}`,background:hover?PILL_HOVER:PILL,backdropFilter:\"blur(8px)\",WebkitBackdropFilter:\"blur(8px)\",color:\"#FFFFFF\",fontFamily:FONT,fontSize:14,lineHeight:\"18px\",fontWeight:450,whiteSpace:\"nowrap\",opacity:playing?0:1,transition:\"background 0.25s, border-color 0.25s, opacity 0.3s\"},children:[/*#__PURE__*/_jsx(\"svg\",{width:\"12\",height:\"12\",viewBox:\"0 0 12 12\",\"aria-hidden\":\"true\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M2.5 1.2v9.6L10.5 6z\",fill:\"currentColor\"})}),label]})})]});}addPropertyControls(ArticleVideo,{video:{type:ControlType.File,allowedFileTypes:[\"mp4\",\"webm\",\"mov\"],title:\"Video\"},poster:{type:ControlType.ResponsiveImage,title:\"Poster\"},videoUrl:{type:ControlType.String,title:\"Video URL\",defaultValue:\"\"},posterUrl:{type:ControlType.String,title:\"Poster URL\",defaultValue:\"\"},title:{type:ControlType.String,title:\"Title\",defaultValue:\"\"},label:{type:ControlType.String,title:\"Label\",defaultValue:\"Watch video\"},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:0,min:0,max:40}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ArticleVideo\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSup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