{"version":3,"file":"PandaVideo.BecpXoXZ.mjs","names":["useRef","useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/uojvIFOeJVwC0UJKpLi0/9laI4qBUd6uuLrlKcLld/PandaVideo.js"],"sourcesContent":["// Componente responsivo para vídeos Panda Video HLS com controles personalizáveis\nimport{jsx as _jsx,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function PandaVideo(props){const{videoUrl=\"\",showControls=true,loop=false,muted=false,autoplay=false,startTime=0,fit=\"cover\",positionX=50,positionY=50,scale=100,borderRadius=\"0px\"}=props;const videoRef=useRef(null);const[isLoaded,setIsLoaded]=useState(false);const[error,setError]=useState(null);const[hlsReady,setHlsReady]=useState(false);// Carrega o HLS.js se necessário\nuseEffect(()=>{if(typeof window===\"undefined\")return;const video=document.createElement(\"video\");const canPlayHLS=video.canPlayType(\"application/vnd.apple.mpegurl\");// Se o navegador suporta HLS nativamente, não precisa do HLS.js\nif(canPlayHLS){startTransition(()=>setHlsReady(true));return;}// Verifica se HLS.js já está carregado\nif(\"Hls\"in window){startTransition(()=>setHlsReady(true));return;}// Carrega o HLS.js\nconst script=document.createElement(\"script\");script.src=\"https://cdn.jsdelivr.net/npm/hls.js@latest\";script.async=true;script.onload=()=>{startTransition(()=>setHlsReady(true));};script.onerror=()=>{startTransition(()=>{setError(\"Erro ao carregar HLS.js\");});};document.head.appendChild(script);return()=>{if(script.parentNode){script.parentNode.removeChild(script);}};},[]);useEffect(()=>{if(typeof window===\"undefined\"||!videoRef.current||!videoUrl||!hlsReady)return;const video=videoRef.current;// Verifica se o navegador suporta HLS nativamente\nif(video.canPlayType(\"application/vnd.apple.mpegurl\")){video.src=videoUrl;startTransition(()=>setIsLoaded(true));}else if(\"Hls\"in window){// Usa HLS.js para navegadores que não suportam HLS nativamente\nconst Hls=window.Hls;if(Hls.isSupported()){const hls=new Hls({enableWorker:true,lowLatencyMode:true});hls.loadSource(videoUrl);hls.attachMedia(video);hls.on(Hls.Events.MANIFEST_PARSED,()=>{startTransition(()=>setIsLoaded(true));});hls.on(Hls.Events.ERROR,(_event,data)=>{if(data.fatal){startTransition(()=>{setError(\"Erro ao carregar o v\\xeddeo\");});}});return()=>{hls.destroy();};}}else{startTransition(()=>{setError(\"HLS n\\xe3o \\xe9 suportado neste navegador\");});}},[videoUrl,hlsReady]);useEffect(()=>{if(!videoRef.current||!isLoaded)return;const video=videoRef.current;// Define o tempo inicial\nif(startTime>0){video.currentTime=startTime;}// Autoplay se configurado\nif(autoplay){video.play().catch(()=>{// Ignora erros de autoplay\n});}},[isLoaded,startTime,autoplay]);if(!videoUrl){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",backgroundColor:\"#000\",color:\"#fff\",fontSize:\"14px\",fontFamily:\"sans-serif\"},children:\"Adicione a URL do v\\xeddeo HLS (.m3u8)\"});}if(error){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",backgroundColor:\"#000\",color:\"#ff5555\",fontSize:\"14px\",fontFamily:\"sans-serif\"},children:error});}return /*#__PURE__*/_jsx(_Fragment,{children:/*#__PURE__*/_jsx(\"video\",{ref:videoRef,style:{width:\"100%\",height:\"100%\",objectFit:fit,backgroundColor:\"#000\",objectPosition:`${positionX}% ${positionY}%`,transform:`scale(${scale/100})`,borderRadius:borderRadius},controls:showControls,loop:loop,muted:muted,playsInline:true})});}addPropertyControls(PandaVideo,{videoUrl:{type:ControlType.String,title:\"URL do V\\xeddeo\",placeholder:\"https://exemplo.com/video.m3u8\",defaultValue:\"\"},fit:{type:ControlType.Enum,title:\"Fit\",options:[\"cover\",\"fill\",\"contain\",\"scale-down\",\"none\"],optionTitles:[\"Cover\",\"Fill\",\"Contain\",\"Scale Down\",\"None\"],defaultValue:\"cover\"},showControls:{type:ControlType.Boolean,title:\"Mostrar Controles\",defaultValue:true,enabledTitle:\"Sim\",disabledTitle:\"N\\xe3o\"},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:false,enabledTitle:\"Sim\",disabledTitle:\"N\\xe3o\"},muted:{type:ControlType.Boolean,title:\"Mudo\",defaultValue:false,enabledTitle:\"Sim\",disabledTitle:\"N\\xe3o\"},autoplay:{type:ControlType.Boolean,title:\"Autoplay\",defaultValue:false,enabledTitle:\"Sim\",disabledTitle:\"N\\xe3o\"},startTime:{type:ControlType.Number,title:\"Tempo Inicial\",defaultValue:0,min:0,step:1,unit:\"s\",displayStepper:true},positionX:{type:ControlType.Number,title:\"Posi\\xe7\\xe3o X\",defaultValue:50,min:0,max:100,step:1,unit:\"%\"},positionY:{type:ControlType.Number,title:\"Posi\\xe7\\xe3o Y\",defaultValue:50,min:0,max:100,step:1,unit:\"%\"},scale:{type:ControlType.Number,title:\"Zoom\",defaultValue:100,min:100,max:200,step:1,unit:\"%\"},borderRadius:{type:ControlType.BorderRadius,title:\"Radius\",defaultValue:\"0px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PandaVideo\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PandaVideo.map"],"mappings":"oNAIG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,WAAS,GAAG,eAAa,GAAK,OAAK,GAAM,QAAM,GAAM,WAAS,GAAM,YAAU,EAAE,MAAI,QAAQ,YAAU,GAAG,YAAU,GAAG,QAAM,IAAI,eAAa,OAAO,EAAY,EAASA,EAAO,KAAK,CAAM,CAAC,EAAS,GAAaC,EAAS,GAAM,CAAM,CAAC,EAAM,GAAUA,EAAS,KAAK,CAAM,CAAC,EAA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