{"version":3,"file":"LecteurVideo.CVRPHzIR.mjs","names":["useState","_Fragment","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","init_npm_react_dom_18_3_1","l","_e","Ha","p","c","init_jsx_runtime","ce","RenderTarget","init_framer_B6PCHH0A","addPropertyControls","ControlType","LecteurVideo","props","ouvert","setOuvert","lecture","setLecture","surTouche","debordement","idYoutube","m","youtube","ouvrir","video","mode","image","affiche","style","titre","fond","icone","init_LecteurVideo"],"sources":["https:/framerusercontent.com/modules/VBh4JfHDHs325TWX33EK/odnYhwL30uAChZsyZ0gz/LecteurVideo.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";import{createPortal}from\"react-dom\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\r\n * Bouton lecture : ouvre la vidéo en grand, avec le son, par-dessus la page.\r\n * Échap, la croix ou un clic à côté la referment.\r\n * Mode « Lecteur intégré » : l'affiche et un bouton lecture remplissent le cadre ;\r\n * au clic, la vidéo se lit sur place, avec ses contrôles (utile pour une vidéo verticale).\r\n * @framerSupportedLayoutWidth any\r\n * @framerSupportedLayoutHeight any\r\n */export default function LecteurVideo(props){const{video,youtube,mode,affiche,titre,fond,icone,style}=props;const[ouvert,setOuvert]=useState(false);const[lecture,setLecture]=useState(false);useEffect(()=>{if(!ouvert)return;const surTouche=e=>e.key===\"Escape\"&&setOuvert(false);const debordement=document.body.style.overflow;document.body.style.overflow=\"hidden\";window.addEventListener(\"keydown\",surTouche);return()=>{document.body.style.overflow=debordement;window.removeEventListener(\"keydown\",surTouche);};},[ouvert]);const idYoutube=(()=>{const m=(youtube||\"\").match(/(?:youtu\\.be\\/|v=|embed\\/|shorts\\/)([\\w-]{11})/);return m?m[1]:null;})();const ouvrir=()=>{if(RenderTarget.current()===RenderTarget.canvas)return;if(video||youtube)setOuvert(true);};if(mode===\"integre\"){const image=affiche?.src||affiche;return /*#__PURE__*/_jsx(\"div\",{style:{...style,position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",background:\"#1F3136\"},children:lecture&&video?/*#__PURE__*/_jsx(\"video\",{src:video,controls:true,autoPlay:true,playsInline:true,style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:\"cover\",display:\"block\"}}):/*#__PURE__*/_jsxs(_Fragment,{children:[image&&/*#__PURE__*/_jsx(\"img\",{src:image,alt:\"\",style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:\"cover\",display:\"block\"}}),/*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-label\":titre,title:titre,onClick:()=>RenderTarget.current()!==RenderTarget.canvas&&video&&setLecture(true),style:{position:\"absolute\",left:\"50%\",top:\"50%\",width:88,height:88,marginLeft:-44,marginTop:-44,border:\"none\",borderRadius:\"50%\",background:fond,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",cursor:\"pointer\",padding:0,boxShadow:\"0px 20px 40px 0px rgba(31, 48, 54, 0.25)\"},children:/*#__PURE__*/_jsx(\"svg\",{width:\"36%\",height:\"36%\",viewBox:\"0 0 24 24\",\"aria-hidden\":\"true\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M8 5.5v13l10.5-6.5z\",fill:icone,stroke:icone,strokeWidth:\"1.5\",strokeLinejoin:\"round\"})})})]})});}return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-label\":titre,title:titre,onClick:ouvrir,style:{...style,width:\"100%\",height:\"100%\",border:\"none\",borderRadius:mode===\"zone\"?0:\"50%\",background:mode===\"zone\"?\"transparent\":fond,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",cursor:\"pointer\",padding:0,boxShadow:mode===\"zone\"?\"none\":\"0px 20px 40px 0px rgba(31, 48, 54, 0.25)\",transition:\"transform 0.25s ease\"},onMouseEnter:e=>mode!==\"zone\"&&(e.currentTarget.style.transform=\"scale(1.06)\"),onMouseLeave:e=>e.currentTarget.style.transform=\"scale(1)\",children:mode!==\"zone\"&&/*#__PURE__*/_jsx(\"svg\",{width:\"36%\",height:\"36%\",viewBox:\"0 0 24 24\",\"aria-hidden\":\"true\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M8 5.5v13l10.5-6.5z\",fill:icone,stroke:icone,strokeWidth:\"1.5\",strokeLinejoin:\"round\"})})}),ouvert&&typeof document!==\"undefined\"&&/*#__PURE__*/createPortal(/*#__PURE__*/_jsxs(\"div\",{role:\"dialog\",\"aria-modal\":\"true\",\"aria-label\":titre,onClick:()=>setOuvert(false),style:{position:\"fixed\",inset:0,zIndex:9999,background:\"rgba(31, 49, 54, 0.92)\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",padding:\"56px 16px 24px\",boxSizing:\"border-box\"},children:[/*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-label\":\"Fermer la vid\\xe9o\",onClick:()=>setOuvert(false),style:{position:\"absolute\",top:14,right:14,width:44,height:44,borderRadius:\"50%\",border:\"1px solid rgba(255,255,255,0.4)\",background:\"transparent\",color:\"#fff\",fontSize:26,lineHeight:\"40px\",cursor:\"pointer\"},children:\"\\xd7\"}),video?/*#__PURE__*/_jsx(\"video\",{src:video,poster:affiche?.src,controls:true,autoPlay:true,playsInline:true,onClick:e=>e.stopPropagation(),style:{maxWidth:\"100%\",maxHeight:\"100%\",borderRadius:16,background:\"#000\",boxShadow:\"0 30px 80px rgba(0,0,0,0.4)\"}}):idYoutube&&/*#__PURE__*/_jsx(\"iframe\",{src:`https://www.youtube-nocookie.com/embed/${idYoutube}?autoplay=1&rel=0&modestbranding=1&playsinline=1`,title:titre,allow:\"autoplay; encrypted-media; picture-in-picture; fullscreen\",allowFullScreen:true,referrerPolicy:\"strict-origin-when-cross-origin\",onClick:e=>e.stopPropagation(),style:{width:\"min(92vw, calc((100vh - 96px) * 16 / 9))\",aspectRatio:\"16 / 9\",border:\"none\",borderRadius:16,background:\"#000\",boxShadow:\"0 30px 80px rgba(0,0,0,0.4)\"}})]}),document.body)]});}LecteurVideo.defaultProps={titre:\"Lire la vid\\xe9o\",mode:\"bouton\",fond:\"#E1FCAD\",icone:\"#1F3136\"};addPropertyControls(LecteurVideo,{video:{type:ControlType.File,title:\"Vid\\xe9o\",allowedFileTypes:[\"mp4\",\"webm\",\"mov\"]},youtube:{type:ControlType.String,title:\"Ou lien YouTube\",placeholder:\"https://youtu.be/…\"},mode:{type:ControlType.Enum,title:\"Apparence\",options:[\"bouton\",\"zone\",\"integre\"],optionTitles:[\"Bouton rond\",\"Zone invisible\",\"Lecteur int\\xe9gr\\xe9\"],defaultValue:\"bouton\"},affiche:{type:ControlType.ResponsiveImage,title:\"Affiche\"},titre:{type:ControlType.String,title:\"Titre (accessibilit\\xe9)\",defaultValue:\"Lire la vid\\xe9o\"},fond:{type:ControlType.Color,title:\"Fond\",defaultValue:\"#E1FCAD\"},icone:{type:ControlType.Color,title:\"Ic\\xf4ne\",defaultValue:\"#1F3136\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LecteurVideo\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LecteurVideo.map"],"mappings":"A,mOAOG,SAAwBkB,EAAa,EAAM,CAAC,GAAK,CAAC,QAAM,UAAQ,OAAK,UAAQ,QAAM,OAAK,QAAM,SAAOC,EAAW,CAACC,EAAOC,GAAWrB,EAAS,EAAK,EAAO,CAACsB,EAAQC,GAAYvB,EAAS,EAAK,EAAEa,MAAc,CAAC,GAAG,CAACO,EAAO,OAAO,IAAMI,EAAU,GAAG,EAAE,MAAM,UAAUH,EAAU,EAAK,EAAQI,EAAY,SAAS,KAAK,MAAM,SAA4F,MAAnF,UAAS,KAAK,MAAM,SAAS,SAASpB,EAAO,iBAAiB,UAAUmB,CAAS,M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