@glitchlab/vue-video-player 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,2 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),q=require("hls.js");function re(n,l,r){const t=n==null?void 0:n.trim();if(t)return t;if(l){try{const a=new Intl.DisplayNames(void 0,{type:"language"}).of(l);if(a&&a!==l)return a}catch{}return l}return`Audio ${r+1}`}const he={index:-1,height:0,label:"Auto"};function ye(n,l){return n>0?`${n}p`:`Level ${l+1}`}const Ce=["muted","loop","controls","autoplay","playsinline","preload","poster"],ie=e.defineComponent({__name:"HLSPlayer",props:{src:{},hlsConfig:{},isHls:{type:Boolean},muted:{type:Boolean,default:!0},loop:{type:Boolean,default:!1},controls:{type:Boolean,default:!1},autoPlay:{type:Boolean,default:!1},playsInline:{type:Boolean,default:!0},preload:{default:"metadata"},poster:{},class:{},audioTrackIndex:{default:-1},qualityLevelIndex:{default:-1}},emits:["play","pause","audio-tracks","quality-levels","current-level"],setup(n,{expose:l,emit:r}){const t=n,v=r,a=e.ref(null),k=e.ref(null);let p,b;const E=globalThis.window!==void 0&&q.isSupported(),C=i=>!!t.isHls||E&&i.endsWith(".m3u8");function V(){b==null||b(),b=void 0,p==null||p(),p=void 0,k.value&&(k.value.destroy(),k.value=null);const i=a.value;if(i){for(i.pause(),i.removeAttribute("src");i.firstChild;)i.firstChild.remove();i.load(),v("audio-tracks",[]),v("quality-levels",[]),v("current-level",-1)}}function g(i){var D,x,T;const h=a.value;if(!h||!i)return;V();const N=()=>{t.autoPlay&&h.play().catch(()=>{})};if(C(i)){const f=new q(t.hlsConfig);k.value=f;const B=()=>{const _=f.audioTracks.map((L,z)=>({index:z,label:re(L.name,L.lang,z),lang:L.lang||void 0}));v("audio-tracks",_)},$=()=>{const _=f.levels.map((L,z)=>({index:z,height:L.height||0,label:ye(L.height||0,z)}));v("quality-levels",_)};f.on(q.Events.MANIFEST_PARSED,N),f.on(q.Events.MANIFEST_PARSED,$),f.on(q.Events.LEVELS_UPDATED,$),f.on(q.Events.LEVEL_SWITCHED,(_,L)=>{v("current-level",L.level)}),f.on(q.Events.AUDIO_TRACKS_UPDATED,B),f.on(q.Events.AUDIO_TRACK_SWITCHED,B),f.on(q.Events.ERROR,(_,L)=>{L.fatal&&(f.destroy(),k.value=null)}),f.attachMedia(h),f.loadSource(i)}else{h.src=i,h.load(),h.addEventListener("loadedmetadata",N,{once:!0}),b=()=>{h.removeEventListener("loadedmetadata",N)};const f=h.audioTracks;if(f){const B=()=>{const $=[];for(let _=0;_<f.length;_++){const L=f[_];$.push({index:_,label:re(L.label,L.language,_),lang:L.language||void 0})}v("audio-tracks",$)};(D=f.addEventListener)==null||D.call(f,"addtrack",B),(x=f.addEventListener)==null||x.call(f,"removetrack",B),(T=f.addEventListener)==null||T.call(f,"change",B),f.length>0&&B(),p=()=>{var $,_,L;($=f.removeEventListener)==null||$.call(f,"addtrack",B),(_=f.removeEventListener)==null||_.call(f,"removetrack",B),(L=f.removeEventListener)==null||L.call(f,"change",B)}}}}function m(i){var D;if(i==null||i<0)return;const h=k.value;if(h){h.audioTrack!==i&&(h.audioTrack=i);return}const N=(D=a.value)==null?void 0:D.audioTracks;if(N)for(let x=0;x<N.length;x++)N[x].enabled=x===i}function y(i){if(i==null)return;const h=k.value;h&&h.currentLevel!==i&&(h.currentLevel=i)}return e.onMounted(()=>{t.src&&g(t.src)}),e.watch(()=>t.src,i=>{i&&g(i)}),e.watch(()=>t.audioTrackIndex,i=>m(i)),e.watch(()=>t.qualityLevelIndex,i=>y(i)),e.onBeforeUnmount(V),l({videoEl:a}),(i,h)=>(e.openBlock(),e.createElementBlock("video",{ref_key:"videoEl",ref:a,muted:n.muted,loop:n.loop,controls:n.controls,autoplay:n.autoPlay,playsinline:n.playsInline,preload:n.preload,poster:n.poster,class:e.normalizeClass(t.class),onPlay:h[0]||(h[0]=N=>v("play")),onPause:h[1]||(h[1]=N=>v("pause"))},[e.renderSlot(i.$slots,"default")],42,Ce))}}),Ee={name:"IconAudio"},we=e.defineComponent({...Ee,props:{class:{}},setup(n){const l=n;return(r,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M3 14V10C3 9.44772 3.44772 9 4 9H6.58579C6.851 9 7.10536 8.89464 7.29289 8.70711L11.2929 4.70711C11.9229 4.07714 13 4.52331 13 5.41421V18.5858C13 19.4767 11.9229 19.9229 11.2929 19.2929L7.29289 15.2929C7.10536 15.1054 6.851 15 6.58579 15H4C3.44772 15 3 14.5523 3 14Z",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"},null,-1),e.createElementVNode("path",{d:"M16.5 8C17.5 9 18 10.5 18 12C18 13.5 17.5 15 16.5 16M19 5.5C20.5 7 21.5 9.5 21.5 12C21.5 14.5 20.5 17 19 18.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),be={name:"IconChevron"},ce=e.defineComponent({...be,props:{class:{}},setup(n){const l=n;return(r,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M6 9L12 15L18 9",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))}}),Be=["aria-expanded"],xe={class:"gvp-audio-label"},_e={key:0,class:"gvp-audio-menu",role:"listbox","aria-label":"Audio tracks"},Le=["aria-selected","onClick"],Ve=e.defineComponent({__name:"AudioTrackSwitcher",props:{tracks:{},activeIndex:{}},emits:["select"],setup(n,{emit:l}){const r=n,t=l,v=e.ref(!1),a=e.ref(null),k=e.computed(()=>r.tracks.find(C=>C.index===r.activeIndex)??r.tracks[0]);function p(C){a.value&&!a.value.contains(C.target)&&(v.value=!1)}function b(C){C.key==="Escape"&&(v.value=!1)}e.watch(v,C=>{C?(document.addEventListener("mousedown",p),document.addEventListener("keydown",b)):(document.removeEventListener("mousedown",p),document.removeEventListener("keydown",b))}),e.onBeforeUnmount(()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",b)});function E(C){t("select",C),v.value=!1}return(C,V)=>{var g;return e.openBlock(),e.createElementBlock("div",{ref_key:"rootEl",ref:a,class:"gvp-audio"},[e.createElementVNode("button",{type:"button",class:"gvp-audio-btn","aria-haspopup":"listbox","aria-expanded":v.value,"aria-label":"Audio track",onClick:V[0]||(V[0]=m=>v.value=!v.value)},[e.createVNode(we),e.createElementVNode("span",xe,e.toDisplayString((g=k.value)==null?void 0:g.label),1),e.createVNode(ce)],8,Be),v.value?(e.openBlock(),e.createElementBlock("ul",_e,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.tracks,m=>(e.openBlock(),e.createElementBlock("li",{key:m.index},[e.createElementVNode("button",{type:"button",role:"option","aria-selected":m.index===n.activeIndex,class:e.normalizeClass(["gvp-audio-menu-item",{"is-active":m.index===n.activeIndex}]),onClick:y=>E(m.index)},e.toDisplayString(m.label),11,Le)]))),128))])):e.createCommentVNode("",!0)],512)}}}),Ne={name:"IconSpeed"},ue=e.defineComponent({...Ne,props:{class:{}},setup(n){const l=n;return(r,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2Z",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("path",{d:"M12 8V12L14.5 14.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))}}),$e=["aria-expanded"],Pe={class:"gvp-speed-label"},Me={key:0,class:"gvp-speed-menu",role:"listbox","aria-label":"Playback speed"},Se=["aria-selected","onClick"],Te=e.defineComponent({__name:"SpeedSwitcher",props:{speed:{}},emits:["select"],setup(n,{emit:l}){const r=[.5,.75,1,1.25,1.5,2],t=l,v=e.ref(!1),a=e.ref(null);function k(E){a.value&&!a.value.contains(E.target)&&(v.value=!1)}function p(E){E.key==="Escape"&&(v.value=!1)}e.watch(v,E=>{E?(document.addEventListener("mousedown",k),document.addEventListener("keydown",p)):(document.removeEventListener("mousedown",k),document.removeEventListener("keydown",p))}),e.onBeforeUnmount(()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",p)});function b(E){t("select",E),v.value=!1}return(E,C)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootEl",ref:a,class:"gvp-speed"},[e.createElementVNode("button",{type:"button",class:"gvp-speed-btn","aria-haspopup":"listbox","aria-expanded":v.value,"aria-label":"`Playback speed: ${speed === 1 ? '1×' : speed + '×'}`",onClick:C[0]||(C[0]=V=>v.value=!v.value)},[e.createVNode(ue),e.createElementVNode("span",Pe,e.toDisplayString(n.speed===1?"1×":`${n.speed}×`),1),e.createVNode(ce)],8,$e),v.value?(e.openBlock(),e.createElementBlock("ul",Me,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(r,V=>e.createElementVNode("li",{key:V},[e.createElementVNode("button",{type:"button",role:"option","aria-selected":V===n.speed,class:e.normalizeClass(["gvp-speed-menu-item",{"is-active":V===n.speed}]),onClick:g=>b(V)},e.toDisplayString(V===1?"Normal":`${V}×`),11,Se)])),64))])):e.createCommentVNode("",!0)],512))}}),Ie={name:"IconCaptions"},de=e.defineComponent({...Ie,props:{class:{}},setup(n){const l=n;return(r,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("rect",{x:"2",y:"5",width:"20",height:"14",rx:"3",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("path",{d:"M7 12H11M13 12H17M7 15H9M11 15H13M15 15H17",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),De=["aria-expanded","aria-pressed"],ze={key:0,class:"gvp-captions-menu",role:"listbox","aria-label":"Captions"},He=["aria-selected"],Ae=["aria-selected","onClick"],qe=e.defineComponent({__name:"CaptionsSwitcher",props:{video:{}},setup(n){const l=n,r=e.ref([]),t=e.ref(-1),v=e.ref(!1),a=e.ref(null);function k(g){const m=[];for(let i=0;i<g.length;i++){const h=g[i];(h.kind==="subtitles"||h.kind==="captions")&&m.push({index:i,label:h.label||h.language||`Track ${i+1}`})}r.value=m;let y=-1;for(let i=0;i<g.length;i++)if(g[i].mode==="showing"){y=i;break}t.value=y}let p=null;e.watch(()=>l.video,g=>{if(p==null||p(),p=null,!g){r.value=[],t.value=-1;return}const m=g.textTracks;k(m);const y=()=>k(m);typeof m.addEventListener=="function"&&(m.addEventListener("addtrack",y),m.addEventListener("removetrack",y),m.addEventListener("change",y),p=()=>{m.removeEventListener("addtrack",y),m.removeEventListener("removetrack",y),m.removeEventListener("change",y)})},{immediate:!0}),e.onBeforeUnmount(()=>{p==null||p(),document.removeEventListener("mousedown",b),document.removeEventListener("keydown",E)});function b(g){a.value&&!a.value.contains(g.target)&&(v.value=!1)}function E(g){g.key==="Escape"&&(v.value=!1)}e.watch(v,g=>{g?(document.addEventListener("mousedown",b),document.addEventListener("keydown",E)):(document.removeEventListener("mousedown",b),document.removeEventListener("keydown",E))});function C(){if(!l.video)return;const g=l.video.textTracks;for(let m=0;m<g.length;m++)g[m].mode="hidden";t.value=-1,v.value=!1}function V(g){if(!l.video)return;const m=l.video.textTracks;for(let y=0;y<m.length;y++)m[y].mode=y===g?"showing":"hidden";t.value=g,v.value=!1}return(g,m)=>r.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"rootEl",ref:a,class:"gvp-captions"},[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["gvp-captions-btn",{"is-active":t.value>=0}]),"aria-haspopup":"listbox","aria-expanded":v.value,"aria-pressed":t.value>=0,"aria-label":"Captions",onClick:m[0]||(m[0]=y=>v.value=!v.value)},[e.createVNode(de)],10,De),v.value?(e.openBlock(),e.createElementBlock("ul",ze,[e.createElementVNode("li",null,[e.createElementVNode("button",{type:"button",role:"option","aria-selected":t.value===-1,class:e.normalizeClass(["gvp-captions-menu-item",{"is-active":t.value===-1}]),onClick:C}," Off ",10,He)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,y=>(e.openBlock(),e.createElementBlock("li",{key:y.index},[e.createElementVNode("button",{type:"button",role:"option","aria-selected":y.index===t.value,class:e.normalizeClass(["gvp-captions-menu-item",{"is-active":y.index===t.value}]),onClick:i=>V(y.index)},e.toDisplayString(y.label),11,Ae)]))),128))])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0)}}),Re={name:"IconPause"},Fe=e.defineComponent({...Re,props:{class:{}},setup(n){const l=n;return(r,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("rect",{x:"6",y:"5",width:"4",height:"14",rx:"1",fill:"currentColor"},null,-1),e.createElementVNode("rect",{x:"14",y:"5",width:"4",height:"14",rx:"1",fill:"currentColor"},null,-1)])],2))}}),Ue={name:"IconPlaySolid"},Oe=e.defineComponent({...Ue,props:{class:{}},setup(n){const l=n;return(r,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M7 5.5V18.5C7 19.2659 7.84856 19.7261 8.4899 19.3071L19.0801 12.4014C19.6644 12.0204 19.6644 11.9796 19.0801 11.5986L8.4899 4.69288C7.84856 4.27388 7 4.73408 7 5.5Z",fill:"currentColor"},null,-1)])],2))}}),je={name:"IconVolumeHigh"},Ze=e.defineComponent({...je,props:{class:{}},setup(n){const l=n;return(r,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M3 14V10C3 9.44772 3.44772 9 4 9H6.58579C6.851 9 7.10536 8.89464 7.29289 8.70711L11.2929 4.70711C11.9229 4.07714 13 4.52331 13 5.41421V18.5858C13 19.4767 11.9229 19.9229 11.2929 19.2929L7.29289 15.2929C7.10536 15.1054 6.851 15 6.58579 15H4C3.44772 15 3 14.5523 3 14Z",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"},null,-1),e.createElementVNode("path",{d:"M16.5 8C17.5 9 18 10.5 18 12C18 13.5 17.5 15 16.5 16M19 5.5C20.5 7 21.5 9.5 21.5 12C21.5 14.5 20.5 17 19 18.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),Qe={name:"IconVolumeLow"},We=e.defineComponent({...Qe,props:{class:{}},setup(n){const l=n;return(r,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M3 14V10C3 9.44772 3.44772 9 4 9H6.58579C6.851 9 7.10536 8.89464 7.29289 8.70711L11.2929 4.70711C11.9229 4.07714 13 4.52331 13 5.41421V18.5858C13 19.4767 11.9229 19.9229 11.2929 19.2929L7.29289 15.2929C7.10536 15.1054 6.851 15 6.58579 15H4C3.44772 15 3 14.5523 3 14Z",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"},null,-1),e.createElementVNode("path",{d:"M16.5 8C17.5 9 18 10.5 18 12C18 13.5 17.5 15 16.5 16",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),Ye={name:"IconVolumeMuted"},Ke=e.defineComponent({...Ye,props:{class:{}},setup(n){const l=n;return(r,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M3 14V10C3 9.44772 3.44772 9 4 9H6.58579C6.851 9 7.10536 8.89464 7.29289 8.70711L11.2929 4.70711C11.9229 4.07714 13 4.52331 13 5.41421V18.5858C13 19.4767 11.9229 19.9229 11.2929 19.2929L7.29289 15.2929C7.10536 15.1054 6.851 15 6.58579 15H4C3.44772 15 3 14.5523 3 14Z",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"},null,-1),e.createElementVNode("path",{d:"M16 9L22 15M22 9L16 15",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),Je={name:"IconQuality"},Xe=e.defineComponent({...Je,props:{class:{}},setup(n){const l=n;return(r,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15Z",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("path",{d:"M3 12C3 12.6 3.08 13.18 3.23 13.73L4.6 14.5C4.86 14.65 5.02 14.94 5 15.24C4.98 15.58 4.96 15.92 5.07 16.24C5.18 16.56 5.39 16.83 5.62 17.08C5.83 17.3 6.13 17.4 6.42 17.36L7.99 17.13C8.28 17.09 8.57 17.21 8.74 17.45C9.07 17.93 9.49 18.34 9.97 18.66C10.21 18.83 10.34 19.11 10.31 19.4L10.13 20.97C10.1 21.26 10.21 21.55 10.43 21.74C10.91 22.16 11.45 22 12 22C12.55 22 13.09 22.16 13.57 21.74C13.79 21.55 13.9 21.26 13.87 20.97L13.69 19.4C13.66 19.11 13.79 18.83 14.03 18.66",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),Ge={name:"IconPiP"},ve=e.defineComponent({...Ge,props:{class:{}},setup(n){const l=n;return(r,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"12",y:"12",width:"8",height:"5",rx:"1",fill:"currentColor"},null,-1)])],2))}}),et={name:"IconFullscreen"},tt=e.defineComponent({...et,props:{class:{}},setup(n){const l=n;return(r,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M4 9V4H9M15 4H20V9M20 15V20H15M9 20H4V15",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))}}),nt={name:"IconFullscreenExit"},ot=e.defineComponent({...nt,props:{class:{}},setup(n){const l=n;return(r,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M9 4V9H4M15 9V4H20M15 20V15H20M9 15H4V20",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))}});function se(n){if(!Number.isFinite(n)||n<0)return"--:--";const l=Math.floor(n),r=Math.floor(l/3600),t=Math.floor(l%3600/60),a=(l%60).toString().padStart(2,"0");if(r>0){const k=t.toString().padStart(2,"0");return`${r}:${k}:${a}`}return`${t}:${a}`}const lt={class:"gvp-controls-row"},at=["aria-label","aria-pressed"],rt={class:"gvp-seek"},st={class:"gvp-seek-track"},it=["value","disabled","aria-valuemax","aria-valuenow"],ct={class:"gvp-time","aria-live":"off"},ut=["aria-expanded","aria-label"],dt={class:"gvp-speed-label"},vt={key:0,class:"gvp-speed-menu",role:"listbox","aria-label":"Playback speed"},pt=["aria-selected","onClick"],mt=["aria-expanded","aria-label"],ft={class:"gvp-quality-label"},kt={key:0,class:"gvp-quality-menu",role:"listbox","aria-label":"Quality"},gt=["aria-selected"],ht=["aria-selected","onClick"],yt=["aria-expanded","aria-pressed"],Ct={key:0,class:"gvp-captions-menu",role:"listbox","aria-label":"Captions"},Et=["aria-selected"],wt=["aria-selected","onClick"],bt=["aria-label","aria-pressed"],Bt={key:0,class:"gvp-volume-slider-wrap"},xt={class:"gvp-volume-track"},_t=["value","aria-valuenow"],Lt=["aria-label","aria-pressed"],Vt=["aria-label","aria-pressed"],Nt=3e3,$t=e.defineComponent({__name:"ControlBar",props:{video:{},isPlaying:{type:Boolean},container:{},onTogglePlay:{},qualityLevels:{default:()=>[]},currentLevel:{default:-1},selectedLevel:{default:-1}},emits:["select-level"],setup(n,{emit:l}){const r=(()=>{if(typeof navigator>"u")return!1;const o=navigator.userAgent;return/iPad|iPhone|iPod/.test(o)||o.includes("Mac")&&navigator.maxTouchPoints>1})(),t=typeof navigator>"u"?!1:/iPhone|iPod/.test(navigator.userAgent),v=[.5,.75,1,1.25,1.5,2],a=n,k=l,p=e.ref(!0);let b=null;function E(){b!==null&&(clearTimeout(b),b=null)}function C(){E(),a.isPlaying&&(b=setTimeout(()=>{p.value=!1},Nt))}function V(){p.value=!0,C()}e.watch(()=>a.isPlaying,o=>{o?C():(E(),p.value=!0)},{immediate:!0}),e.watch(()=>a.container,o=>{if(!o)return;const s=()=>V();o.addEventListener("mousemove",s),o.addEventListener("touchstart",s),o.addEventListener("focusin",s)},{immediate:!0});const g=e.ref(0),m=e.ref(0),y=e.ref(0);e.watch(()=>a.video,o=>{if(!o)return;const s=()=>{g.value=o.currentTime},d=()=>{m.value=Number.isFinite(o.duration)?o.duration:0},w=()=>{const P=o.buffered;if(!P||P.length===0){y.value=0;return}let ae=P.end(P.length-1);for(let Z=0;Z<P.length;Z++)if(P.start(Z)<=o.currentTime&&o.currentTime<=P.end(Z)){ae=P.end(Z);break}y.value=ae};s(),d(),w(),o.addEventListener("timeupdate",s),o.addEventListener("durationchange",d),o.addEventListener("loadedmetadata",d),o.addEventListener("progress",w),o.addEventListener("timeupdate",w)},{immediate:!0});const i=()=>m.value>0,h=()=>i()?g.value/m.value*100:0,N=()=>i()?y.value/m.value*100:0;function D(o){const s=a.video;if(!s||!i())return;const d=Number(o.target.value)/100*m.value;s.currentTime=d,g.value=d}const x=e.ref(1),T=e.ref(!1);e.watch(()=>a.video,o=>{if(!o)return;const s=()=>{x.value=o.volume,T.value=o.muted};s(),o.addEventListener("volumechange",s)},{immediate:!0});function f(){a.video&&(a.video.muted=!a.video.muted)}function B(o){const s=a.video;if(!s)return;const d=Number(o.target.value)/100;s.volume=d,d>0&&s.muted&&(s.muted=!1)}const $=e.ref(1),_=e.ref(!1),L=e.ref(null);e.watch(()=>a.video,o=>{if(!o)return;const s=()=>{$.value=o.playbackRate};s(),o.addEventListener("ratechange",s)},{immediate:!0});function z(o){a.video&&(a.video.playbackRate=o),$.value=o,_.value=!1}const R=e.ref(!1),Q=e.ref(null),ne=e.computed(()=>a.qualityLevels.length>=2),I=e.computed(()=>[...a.qualityLevels].sort((o,s)=>s.height-o.height)),U=e.computed(()=>a.qualityLevels.find(o=>o.index===a.currentLevel)),j=e.computed(()=>{if(a.selectedLevel<0)return U.value?`Auto (${U.value.label})`:"Auto";const o=a.qualityLevels.find(s=>s.index===a.selectedLevel);return(o==null?void 0:o.label)??"Auto"});function W(o){k("select-level",o),R.value=!1}const O=e.ref([]),S=e.ref(-1),H=e.ref(!1),Y=e.ref(null);function K(o){const s=[];for(let w=0;w<o.length;w++){const P=o[w];(P.kind==="subtitles"||P.kind==="captions")&&s.push({index:w,label:P.label||P.language||`Track ${w+1}`})}O.value=s;let d=-1;for(let w=0;w<o.length;w++)if(o[w].mode==="showing"){d=w;break}S.value=d}e.watch(()=>a.video,o=>{if(!o){O.value=[],S.value=-1;return}const s=o.textTracks;K(s);const d=()=>K(s);typeof s.addEventListener=="function"&&(s.addEventListener("addtrack",d),s.addEventListener("removetrack",d),s.addEventListener("change",d))},{immediate:!0});function J(o){var d;const s=(d=a.video)==null?void 0:d.textTracks;if(s){for(let w=0;w<s.length;w++)s[w].mode=w===o?"showing":"hidden";S.value=o,H.value=!1}}function X(){var s;const o=(s=a.video)==null?void 0:s.textTracks;if(o){for(let d=0;d<o.length;d++)o[d].mode="hidden";S.value=-1,H.value=!1}}const c=e.ref(!1),u=typeof document<"u"&&!!document.pictureInPictureEnabled;e.watch(()=>a.video,o=>{o&&(o.addEventListener("enterpictureinpicture",()=>{c.value=!0}),o.addEventListener("leavepictureinpicture",()=>{c.value=!1}))},{immediate:!0});function M(){a.video&&(document.pictureInPictureElement?document.exitPictureInPicture().catch(()=>{}):a.video.requestPictureInPicture().catch(()=>{}))}const A=e.ref(!1),G=typeof document>"u"?!1:!!(document.fullscreenEnabled||document.webkitFullscreenEnabled);function ee(){return document.fullscreenElement??document.webkitFullscreenElement??null}function oe(o){const s=o.requestFullscreen??o.webkitRequestFullscreen;return s?s.call(o):Promise.reject(new Error("unsupported"))}function te(){const o=document.exitFullscreen??document.webkitExitFullscreen;return o?o.call(document):Promise.reject(new Error("unsupported"))}function F(){A.value=ee()===a.container}e.onMounted(()=>{document.addEventListener("fullscreenchange",F),document.addEventListener("webkitfullscreenchange",F)}),e.onBeforeUnmount(()=>{E(),document.removeEventListener("fullscreenchange",F),document.removeEventListener("webkitfullscreenchange",F)});function ke(){var o,s;if(t){(s=(o=a.video)==null?void 0:o.webkitEnterFullscreen)==null||s.call(o);return}A.value?te().catch(()=>{}):a.container&&oe(a.container).catch(()=>{})}const ge=G||t&&a.video!==null&&typeof a.video.webkitEnterFullscreen=="function";function le(o,s){function d(P){s.value&&!s.value.contains(P.target)&&(o.value=!1)}function w(P){P.key==="Escape"&&(o.value=!1)}e.watch(o,P=>{P?(document.addEventListener("mousedown",d),document.addEventListener("keydown",w)):(document.removeEventListener("mousedown",d),document.removeEventListener("keydown",w))}),e.onBeforeUnmount(()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",w)})}return le(_,L),le(H,Y),le(R,Q),(o,s)=>(e.openBlock(),e.createElementBlock("div",{role:"toolbar","aria-label":"Video controls",class:e.normalizeClass(["gvp-controls",!p.value&&"is-hidden"]),onMouseenter:E,onMouseleave:C},[e.createElementVNode("div",lt,[e.createElementVNode("button",{type:"button",class:"gvp-ctrl-btn","aria-label":n.isPlaying?"Pause":"Play","aria-pressed":n.isPlaying,onClick:s[0]||(s[0]=(...d)=>n.onTogglePlay&&n.onTogglePlay(...d))},[n.isPlaying?(e.openBlock(),e.createBlock(Fe,{key:0})):(e.openBlock(),e.createBlock(Oe,{key:1}))],8,at),e.createElementVNode("div",rt,[e.createElementVNode("div",st,[e.createElementVNode("div",{class:"gvp-seek-buffered",style:e.normalizeStyle({width:`${N()}%`})},null,4),e.createElementVNode("div",{class:"gvp-seek-progress",style:e.normalizeStyle({width:`${h()}%`})},null,4)]),e.createElementVNode("input",{type:"range",class:"gvp-seek-input",min:0,max:100,step:.1,value:h(),disabled:!i(),"aria-label":"Seek","aria-valuemin":0,"aria-valuemax":Math.floor(m.value),"aria-valuenow":Math.floor(g.value),onInput:D},null,40,it)]),e.createElementVNode("span",ct,e.toDisplayString(e.unref(se)(g.value))+" / "+e.toDisplayString(e.unref(se)(m.value)),1),e.createElementVNode("div",{ref_key:"speedRootEl",ref:L,class:"gvp-speed"},[e.createElementVNode("button",{type:"button",class:"gvp-ctrl-btn gvp-speed-btn","aria-haspopup":"listbox","aria-expanded":_.value,"aria-label":`Playback speed: ${$.value===1?"1×":$.value+"×"}`,onClick:s[1]||(s[1]=d=>_.value=!_.value)},[e.createVNode(ue),e.createElementVNode("span",dt,e.toDisplayString($.value===1?"1×":`${$.value}×`),1)],8,ut),_.value?(e.openBlock(),e.createElementBlock("ul",vt,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(v,d=>e.createElementVNode("li",{key:d},[e.createElementVNode("button",{type:"button",role:"option","aria-selected":d===$.value,class:e.normalizeClass(["gvp-speed-menu-item",{"is-active":d===$.value}]),onClick:w=>z(d)},e.toDisplayString(d===1?"Normal":`${d}×`),11,pt)])),64))])):e.createCommentVNode("",!0)],512),ne.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"qualityRootEl",ref:Q,class:"gvp-quality"},[e.createElementVNode("button",{type:"button",class:"gvp-ctrl-btn gvp-quality-btn","aria-haspopup":"listbox","aria-expanded":R.value,"aria-label":`Quality: ${j.value}`,onClick:s[2]||(s[2]=d=>R.value=!R.value)},[e.createVNode(Xe),e.createElementVNode("span",ft,e.toDisplayString(j.value),1)],8,mt),R.value?(e.openBlock(),e.createElementBlock("ul",kt,[e.createElementVNode("li",null,[e.createElementVNode("button",{type:"button",role:"option","aria-selected":n.selectedLevel<0,class:e.normalizeClass(["gvp-quality-menu-item",{"is-active":n.selectedLevel<0}]),onClick:s[3]||(s[3]=d=>W(e.unref(he).index))},e.toDisplayString(U.value?`Auto (${U.value.label})`:"Auto"),11,gt)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(I.value,d=>(e.openBlock(),e.createElementBlock("li",{key:d.index},[e.createElementVNode("button",{type:"button",role:"option","aria-selected":d.index===n.selectedLevel,class:e.normalizeClass(["gvp-quality-menu-item",{"is-active":d.index===n.selectedLevel}]),onClick:w=>W(d.index)},e.toDisplayString(d.label),11,ht)]))),128))])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),O.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"captionsRootEl",ref:Y,class:"gvp-captions"},[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["gvp-ctrl-btn",S.value>=0&&"is-active"]),"aria-haspopup":"listbox","aria-expanded":H.value,"aria-label":"Captions","aria-pressed":S.value>=0,onClick:s[4]||(s[4]=d=>H.value=!H.value)},[e.createVNode(de)],10,yt),H.value?(e.openBlock(),e.createElementBlock("ul",Ct,[e.createElementVNode("li",null,[e.createElementVNode("button",{type:"button",role:"option","aria-selected":S.value===-1,class:e.normalizeClass(["gvp-captions-menu-item",{"is-active":S.value===-1}]),onClick:X},"Off",10,Et)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(O.value,d=>(e.openBlock(),e.createElementBlock("li",{key:d.index},[e.createElementVNode("button",{type:"button",role:"option","aria-selected":d.index===S.value,class:e.normalizeClass(["gvp-captions-menu-item",{"is-active":d.index===S.value}]),onClick:w=>J(d.index)},e.toDisplayString(d.label),11,wt)]))),128))])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["gvp-volume",!e.unref(r)&&"is-expandable"])},[e.createElementVNode("button",{type:"button",class:"gvp-ctrl-btn","aria-label":T.value?"Unmute":"Mute","aria-pressed":T.value,onClick:f},[T.value||x.value===0?(e.openBlock(),e.createBlock(Ke,{key:0})):x.value<.5?(e.openBlock(),e.createBlock(We,{key:1})):(e.openBlock(),e.createBlock(Ze,{key:2}))],8,bt),e.unref(r)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Bt,[e.createElementVNode("div",xt,[e.createElementVNode("div",{class:"gvp-volume-fill",style:e.normalizeStyle({width:`${T.value?0:Math.round(x.value*100)}%`})},null,4)]),e.createElementVNode("input",{type:"range",class:"gvp-volume-input",min:0,max:100,step:1,value:T.value?0:Math.round(x.value*100),"aria-label":"Volume","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":T.value?0:Math.round(x.value*100),onInput:B},null,40,_t)]))],2),e.unref(u)?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",class:e.normalizeClass(["gvp-ctrl-btn",c.value&&"is-active"]),"aria-label":c.value?"Exit picture-in-picture":"Picture-in-picture","aria-pressed":c.value,onClick:M},[e.createVNode(ve)],10,Lt)):e.createCommentVNode("",!0),e.unref(ge)?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",class:e.normalizeClass(["gvp-ctrl-btn",A.value&&"is-active"]),"aria-label":A.value?"Exit fullscreen":"Enter fullscreen","aria-pressed":A.value,onClick:ke},[A.value?(e.openBlock(),e.createBlock(ot,{key:0})):(e.openBlock(),e.createBlock(tt,{key:1}))],10,Vt)):e.createCommentVNode("",!0)])],34))}}),Pt={name:"IconDesktop"},Mt=e.defineComponent({...Pt,props:{class:{}},setup(n){const l=n;return(r,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M14 2H10C6.72077 2 5.08116 2 3.91891 2.81382C3.48891 3.1149 3.1149 3.48891 2.81382 3.91891C2 5.08116 2 6.72077 2 10C2 13.2792 2 14.9188 2.81382 16.0811C3.1149 16.5111 3.48891 16.8851 3.91891 17.1862C5.08116 18 6.72077 18 10 18H14C17.2792 18 18.9188 18 20.0811 17.1862C20.5111 16.8851 20.8851 16.5111 21.1862 16.0811C22 14.9188 22 13.2792 22 10C22 6.72077 22 5.08116 21.1862 3.91891C20.8851 3.48891 20.5111 3.1149 20.0811 2.81382C18.9188 2 17.2792 2 14 2Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1),e.createElementVNode("path",{d:"M11 15H13",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),e.createElementVNode("path",{d:"M14.5 22L14.1845 21.5811C13.4733 20.6369 13.2969 19.1944 13.7468 18M9.5 22L9.8155 21.5811C10.5267 20.6369 10.7031 19.1944 10.2532 18",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1),e.createElementVNode("path",{d:"M7 22H17",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),St={name:"IconMobile"},Tt=e.defineComponent({...St,props:{class:{}},setup(n){const l=n;return(r,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M5 9C5 5.70017 5 4.05025 6.02513 3.02513C7.05025 2 8.70017 2 12 2C15.2998 2 16.9497 2 17.9749 3.02513C19 4.05025 19 5.70017 19 9V15C19 18.2998 19 19.9497 17.9749 20.9749C16.9497 22 15.2998 22 12 22C8.70017 22 7.05025 22 6.02513 20.9749C5 19.9497 5 18.2998 5 15V9Z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1),e.createElementVNode("path",{d:"M11 19H13",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),e.createElementVNode("path",{d:"M9 2L9.089 2.53402C9.28188 3.69129 9.37832 4.26993 9.77519 4.62204C10.1892 4.98934 10.7761 5 12 5C13.2239 5 13.8108 4.98934 14.2248 4.62204C14.6217 4.26993 14.7181 3.69129 14.911 2.53402L15 2",stroke:"currentColor","stroke-width":"2","stroke-linejoin":"round"},null,-1)])],2))}}),It={name:"IconPlay"},Dt=e.defineComponent({...It,props:{class:{}},setup(n){const l=n;return(r,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"22",height:"22",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M5.3335 11.45V4.54997C5.3335 4.36108 5.40016 4.20275 5.5335 4.07497C5.66683 3.94719 5.82238 3.8833 6.00016 3.8833C6.05572 3.8833 6.11405 3.89163 6.17516 3.9083C6.23627 3.92497 6.29461 3.94997 6.35016 3.9833L11.7835 7.4333C11.8835 7.49997 11.9585 7.5833 12.0085 7.6833C12.0585 7.7833 12.0835 7.88886 12.0835 7.99997C12.0835 8.11108 12.0585 8.21663 12.0085 8.31663C11.9585 8.41663 11.8835 8.49997 11.7835 8.56663L6.35016 12.0166C6.29461 12.05 6.23627 12.075 6.17516 12.0916C6.11405 12.1083 6.05572 12.1166 6.00016 12.1166C5.82238 12.1166 5.66683 12.0527 5.5335 11.925C5.40016 11.7972 5.3335 11.6389 5.3335 11.45Z",fill:"currentColor"},null,-1)])],2))}}),zt={name:"IconX"},Ht=e.defineComponent({...zt,props:{class:{}},setup(n){const l=n;return(r,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M6.94994 5.53594L12.1929 0.292938C12.5834 -0.0975275 13.2165 -0.0975279 13.6069 0.292938C13.9974 0.683403 13.9974 1.31647 13.6069 1.70694L8.36394 6.94994L13.6069 12.1929C13.9974 12.5834 13.9974 13.2165 13.6069 13.6069C13.2165 13.9974 12.5834 13.9974 12.1929 13.6069L6.94994 8.36394L1.70694 13.6069C1.31647 13.9974 0.683403 13.9974 0.292938 13.6069C-0.0975279 13.2165 -0.0975277 12.5834 0.292938 12.1929L5.53594 6.94994L0.292938 1.70694C-0.0975279 1.31647 -0.0975279 0.683403 0.292938 0.292938C0.683403 -0.0975279 1.31647 -0.0975277 1.70694 0.292938L6.94994 5.53594Z",fill:"currentColor"},null,-1)])],2))}});function pe(n){if(!n)return null;if(/^[A-Za-z0-9_-]{11}$/.test(n))return n;let l;try{l=new URL(n)}catch{return null}const r=l.hostname.replace(/^www\./,"");if(r==="youtu.be"){const t=l.pathname.slice(1).split("/")[0];return/^[A-Za-z0-9_-]{11}$/.test(t)?t:null}if(r==="youtube.com"||r==="m.youtube.com"||r==="music.youtube.com"||r==="youtube-nocookie.com"){const t=l.searchParams.get("v");if(t&&/^[A-Za-z0-9_-]{11}$/.test(t))return t;const v=/^\/(?:embed|shorts|v|live)\/([A-Za-z0-9_-]{11})/.exec(l.pathname);if(v)return v[1]}return null}function me(n){try{const l=new URL(n),r=l.searchParams.get("t")??l.searchParams.get("start");if(!r)return null;if(/^\d+s?$/.test(r))return Number.parseInt(r,10);const t=/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/.exec(r);if(t){const v=Number.parseInt(t[1]??"0",10),a=Number.parseInt(t[2]??"0",10),k=Number.parseInt(t[3]??"0",10),p=v*3600+a*60+k;return p>0?p:null}}catch{}return null}function fe(n,l={}){const{autoPlay:r=!1,muted:t=!0,loop:v=!1,controls:a=!0,startSeconds:k}=l,p=new URLSearchParams({rel:"0",modestbranding:"1",playsinline:"1",controls:a?"1":"0"});return r?(p.set("autoplay","1"),p.set("mute","1")):t&&p.set("mute","1"),v&&(p.set("loop","1"),p.set("playlist",n)),k&&k>0&&p.set("start",String(k)),`https://www.youtube-nocookie.com/embed/${n}?${p.toString()}`}const At=["src"],qt={key:2,class:"gvp-vignette"},Rt={key:3,class:"gvp-toggle"},Ft={class:"gvp-toggle-pill"},Ut=["aria-pressed"],Ot=["aria-pressed"],jt=["aria-label","aria-pressed"],Zt=["aria-label"],Qt={key:10,class:"gvp-play-wrap"},Wt={key:0,class:"gvp-tooltip",role:"tooltip"},Yt={key:12,class:"gvp-bottom-fade"},Kt=e.defineComponent({__name:"VideoPlayer",props:{src:{},poster:{},showDeviceToggle:{type:Boolean,default:!0},defaultDevice:{default:"desktop"},hoverPlay:{type:Boolean,default:!1},tooltipText:{},muted:{type:Boolean,default:!0},loop:{type:Boolean,default:!1},controls:{type:[Boolean,String],default:!0},autoPlay:{type:Boolean,default:!1},frameMaxWidth:{},aspectRatio:{},hlsConfig:{},isHls:{type:Boolean},class:{default:""},closable:{type:Boolean,default:!1}},emits:["close","play","pause"],setup(n,{emit:l}){const r=n,t=l,v=e.ref(null),a=e.ref(r.defaultDevice),k=e.ref(!1),p=e.ref(!1),b=e.ref(null),E=e.ref([]),C=e.ref(-1),V=e.ref([]),g=e.ref(-1),m=e.ref(-1),y=e.ref(1),i=e.ref(!1),h=e.ref(!1),N=e.ref(null),D=typeof document<"u"&&!!document.pictureInPictureEnabled,x=e.computed(()=>r.controls===!0||r.controls==="custom"),T=e.computed(()=>r.controls==="native"),f=e.computed(()=>pe(r.src)),B=e.computed(()=>f.value!==null),$=e.computed(()=>f.value?fe(f.value,{autoPlay:r.autoPlay,muted:r.muted,loop:r.loop,controls:x.value?!0:T.value,startSeconds:me(r.src)}):null);function _(c){E.value=c,C.value=-1}function L(c){V.value=c,m.value=-1}const z=e.computed(()=>!B.value&&E.value.length>1),R=e.computed(()=>{var c;return C.value>=0?C.value:((c=E.value[0])==null?void 0:c.index)??-1}),Q=e.computed(()=>{var c,u;return a.value==="mobile"?((c=r.aspectRatio)==null?void 0:c.mobile)??"9/16":((u=r.aspectRatio)==null?void 0:u.desktop)??"16/9"}),ne=e.computed(()=>{var c,u;return a.value==="mobile"?((c=r.frameMaxWidth)==null?void 0:c.mobile)??"420px":((u=r.frameMaxWidth)==null?void 0:u.desktop)??"960px"}),I=e.computed(()=>{var c;return((c=v.value)==null?void 0:c.videoEl)??null});async function U(){const c=I.value;if(c)try{c.readyState<2&&c.load();const u=c.play();b.value=u,await u,k.value=!0}catch{k.value=!1}finally{b.value=null}}async function j(){const c=I.value;if(c){if(b.value)try{await b.value}catch{}c.pause()}}async function W(){!r.hoverPlay||B.value||await U()}async function O(){!r.hoverPlay||B.value||(await j(),k.value=!1)}async function S(){const c=I.value;c&&(c.paused?await U():(await j(),k.value=!1))}function H(){p.value=!0,W()}function Y(){p.value=!1,O()}function K(c){y.value=c;const u=I.value;u&&(u.playbackRate=c)}e.watch(I,c=>{c&&(c.addEventListener("ratechange",()=>{y.value=c.playbackRate}),c.addEventListener("enterpictureinpicture",()=>{i.value=!0}),c.addEventListener("leavepictureinpicture",()=>{i.value=!1}))});function J(){const c=I.value;c&&(document.pictureInPictureElement?document.exitPictureInPicture().catch(()=>{}):c.requestPictureInPicture().catch(()=>{}))}function X(c){var A,G,ee;const u=I.value;if(!(!u||!h.value&&!((A=N.value)!=null&&A.contains(document.activeElement))||c.target.tagName==="INPUT"&&c.key!==" "))switch(c.key){case" ":case"k":c.preventDefault(),S();break;case"ArrowLeft":c.preventDefault(),u.currentTime=Math.max(0,u.currentTime-5);break;case"ArrowRight":c.preventDefault(),u.currentTime=Math.min(u.duration||0,u.currentTime+5);break;case"ArrowUp":c.preventDefault(),u.volume=Math.min(1,u.volume+.1),u.muted&&(u.muted=!1);break;case"ArrowDown":c.preventDefault(),u.volume=Math.max(0,u.volume-.1);break;case"m":u.muted=!u.muted;break;case"f":{const oe=document.fullscreenElement??document.webkitFullscreenElement??null,te=((G=N.value)==null?void 0:G.requestFullscreen)??((ee=N.value)==null?void 0:ee.webkitRequestFullscreen),F=document.exitFullscreen??document.webkitExitFullscreen;oe===N.value?F==null||F.call(document).catch(()=>{}):te&&N.value&&te.call(N.value).catch(()=>{});break}case"p":D&&J();break}}return e.onMounted(()=>{document.addEventListener("keydown",X)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",X)}),(c,u)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootEl",ref:N,class:e.normalizeClass(["gvp-root",r.class]),style:e.normalizeStyle({width:ne.value,aspectRatio:Q.value}),onMouseenter:u[10]||(u[10]=M=>{h.value=!0,H()}),onMouseleave:u[11]||(u[11]=M=>{h.value=!1,Y()})},[B.value?(e.openBlock(),e.createElementBlock("iframe",{key:0,class:"gvp-video gvp-youtube",src:$.value??void 0,title:"YouTube video player",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowfullscreen:"",referrerpolicy:"strict-origin-when-cross-origin"},null,8,At)):(e.openBlock(),e.createBlock(ie,{key:1,ref_key:"hlsPlayerRef",ref:v,controls:T.value,"hls-config":n.hlsConfig,"is-hls":n.isHls,loop:n.loop,muted:n.muted,"auto-play":n.autoPlay,"audio-track-index":C.value,"quality-level-index":m.value,"plays-inline":!0,poster:n.poster,src:n.src,class:"gvp-video",preload:"metadata",onAudioTracks:_,onQualityLevels:L,onCurrentLevel:u[0]||(u[0]=M=>g.value=M),onPause:u[1]||(u[1]=M=>{k.value=!1,t("pause")}),onPlay:u[2]||(u[2]=M=>{k.value=!0,t("play")})},{default:e.withCtx(()=>[e.renderSlot(c.$slots,"default")]),_:3},8,["controls","hls-config","is-hls","loop","muted","auto-play","audio-track-index","quality-level-index","poster","src"])),B.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",qt)),n.showDeviceToggle?(e.openBlock(),e.createElementBlock("div",Rt,[e.createElementVNode("div",Ft,[e.createElementVNode("button",{"aria-pressed":a.value==="desktop",class:e.normalizeClass(["gvp-toggle-btn",{"is-active":a.value==="desktop"}]),"aria-label":"Desktop view",type:"button",onClick:u[3]||(u[3]=M=>a.value="desktop")},[e.createVNode(Mt)],10,Ut),u[12]||(u[12]=e.createElementVNode("div",{class:"gvp-toggle-divider"},null,-1)),e.createElementVNode("button",{"aria-pressed":a.value==="mobile",class:e.normalizeClass(["gvp-toggle-btn",{"is-active":a.value==="mobile"}]),"aria-label":"Mobile view",type:"button",onClick:u[4]||(u[4]=M=>a.value="mobile")},[e.createVNode(Tt)],10,Ot)])])):e.createCommentVNode("",!0),n.closable?(e.openBlock(),e.createElementBlock("button",{key:4,"aria-label":"Close",class:"gvp-close",type:"button",onClick:u[5]||(u[5]=M=>t("close"))},[e.createVNode(Ht)])):e.createCommentVNode("",!0),z.value&&!x.value?(e.openBlock(),e.createBlock(Ve,{key:5,tracks:E.value,"active-index":R.value,onSelect:u[6]||(u[6]=M=>C.value=M)},null,8,["tracks","active-index"])):e.createCommentVNode("",!0),!B.value&&!x.value?(e.openBlock(),e.createBlock(Te,{key:6,speed:y.value,onSelect:K},null,8,["speed"])):e.createCommentVNode("",!0),!B.value&&!x.value?(e.openBlock(),e.createBlock(qe,{key:7,video:I.value},null,8,["video"])):e.createCommentVNode("",!0),!B.value&&e.unref(D)&&!x.value?(e.openBlock(),e.createElementBlock("button",{key:8,type:"button",class:e.normalizeClass(["gvp-pip-btn",{"is-active":i.value}]),"aria-label":i.value?"Exit picture-in-picture":"Picture-in-picture","aria-pressed":i.value,onClick:J},[e.createVNode(ve)],10,jt)):e.createCommentVNode("",!0),!B.value&&x.value?(e.openBlock(),e.createElementBlock("button",{key:9,type:"button",class:"gvp-click-layer","aria-label":k.value?"Pause":"Play",onClick:S},null,8,Zt)):e.createCommentVNode("",!0),!B.value&&!x.value&&!k.value?(e.openBlock(),e.createElementBlock("div",Qt,[e.createElementVNode("button",{"aria-label":"Play",class:"gvp-play",type:"button",onClick:S,onMouseenter:u[7]||(u[7]=M=>p.value=!0),onMouseleave:u[8]||(u[8]=M=>p.value=!1)},[e.createVNode(Dt),n.tooltipText&&p.value?(e.openBlock(),e.createElementBlock("span",Wt,e.toDisplayString(n.tooltipText),1)):e.createCommentVNode("",!0)],32)])):e.createCommentVNode("",!0),!B.value&&x.value?(e.openBlock(),e.createBlock($t,{key:11,video:I.value,"is-playing":k.value,container:N.value,"on-toggle-play":S,"quality-levels":V.value,"current-level":g.value,"selected-level":m.value,onSelectLevel:u[9]||(u[9]=M=>m.value=M)},null,8,["video","is-playing","container","quality-levels","current-level","selected-level"])):e.createCommentVNode("",!0),!B.value&&!x.value?(e.openBlock(),e.createElementBlock("div",Yt)):e.createCommentVNode("",!0)],38))}});exports.HLSPlayer=ie;exports.VueVideoPlayer=Kt;exports.parseYouTubeId=pe;exports.parseYouTubeStart=me;exports.youTubeEmbedUrl=fe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),U=require("hls.js");function Ce(n,a,o){const t=n==null?void 0:n.trim();if(t)return t;if(a){try{const r=new Intl.DisplayNames(void 0,{type:"language"}).of(a);if(r&&r!==a)return r}catch{}return a}return`Audio ${o+1}`}const Se={index:-1,height:0,label:"Auto"};function Te(n,a){return n>0?`${n}p`:`Level ${a+1}`}const Ie=["muted","loop","controls","autoplay","playsinline","preload","poster"],be=e.defineComponent({__name:"HLSPlayer",props:{src:{},hlsConfig:{},isHls:{type:Boolean},muted:{type:Boolean,default:!0},loop:{type:Boolean,default:!1},controls:{type:Boolean,default:!1},autoPlay:{type:Boolean,default:!1},playsInline:{type:Boolean,default:!0},preload:{default:"metadata"},poster:{},class:{},audioTrackIndex:{default:-1},qualityLevelIndex:{default:-1}},emits:["play","pause","ended","audio-tracks","quality-levels","current-level"],setup(n,{expose:a,emit:o}){const t=n,u=o,r=e.ref(null),m=e.ref(null);let f,E;const w=globalThis.window!==void 0&&U.isSupported(),b=v=>!!t.isHls||w&&v.endsWith(".m3u8");function B(){E==null||E(),E=void 0,f==null||f(),f=void 0,m.value&&(m.value.destroy(),m.value=null);const v=r.value;if(v){for(v.pause(),v.removeAttribute("src");v.firstChild;)v.firstChild.remove();v.load(),u("audio-tracks",[]),u("quality-levels",[]),u("current-level",-1)}}function h(v){var D,V,q;const y=r.value;if(!y||!v)return;B();const _=()=>{t.autoPlay&&y.play().catch(()=>{})};if(b(v)){const k=new U(t.hlsConfig);m.value=k;const N=()=>{const L=k.audioTracks.map(($,T)=>({index:T,label:Ce($.name,$.lang,T),lang:$.lang||void 0}));u("audio-tracks",L)},M=()=>{const L=k.levels.map(($,T)=>({index:T,height:$.height||0,label:Te($.height||0,T)}));u("quality-levels",L)};k.on(U.Events.MANIFEST_PARSED,_),k.on(U.Events.MANIFEST_PARSED,M),k.on(U.Events.LEVELS_UPDATED,M),k.on(U.Events.LEVEL_SWITCHED,(L,$)=>{u("current-level",$.level)}),k.on(U.Events.AUDIO_TRACKS_UPDATED,N),k.on(U.Events.AUDIO_TRACK_SWITCHED,N),k.on(U.Events.ERROR,(L,$)=>{$.fatal&&(k.destroy(),m.value=null)}),k.attachMedia(y),k.loadSource(v)}else{y.src=v,y.load(),y.addEventListener("loadedmetadata",_,{once:!0}),E=()=>{y.removeEventListener("loadedmetadata",_)};const k=y.audioTracks;if(k){const N=()=>{const M=[];for(let L=0;L<k.length;L++){const $=k[L];M.push({index:L,label:Ce($.label,$.language,L),lang:$.language||void 0})}u("audio-tracks",M)};(D=k.addEventListener)==null||D.call(k,"addtrack",N),(V=k.addEventListener)==null||V.call(k,"removetrack",N),(q=k.addEventListener)==null||q.call(k,"change",N),k.length>0&&N(),f=()=>{var M,L,$;(M=k.removeEventListener)==null||M.call(k,"addtrack",N),(L=k.removeEventListener)==null||L.call(k,"removetrack",N),($=k.removeEventListener)==null||$.call(k,"change",N)}}}}function p(v){var D;if(v==null||v<0)return;const y=m.value;if(y){y.audioTrack!==v&&(y.audioTrack=v);return}const _=(D=r.value)==null?void 0:D.audioTracks;if(_)for(let V=0;V<_.length;V++)_[V].enabled=V===v}function g(v){if(v==null)return;const y=m.value;y&&y.currentLevel!==v&&(y.currentLevel=v)}return e.onMounted(()=>{t.src&&h(t.src)}),e.watch(()=>t.src,v=>{v&&h(v)}),e.watch(()=>t.audioTrackIndex,v=>p(v)),e.watch(()=>t.qualityLevelIndex,v=>g(v)),e.onBeforeUnmount(B),a({videoEl:r}),(v,y)=>(e.openBlock(),e.createElementBlock("video",{ref_key:"videoEl",ref:r,muted:n.muted,loop:n.loop,controls:n.controls,autoplay:n.autoPlay,playsinline:n.playsInline,preload:n.preload,poster:n.poster,class:e.normalizeClass(t.class),onPlay:y[0]||(y[0]=_=>u("play")),onPause:y[1]||(y[1]=_=>u("pause")),onEnded:y[2]||(y[2]=_=>u("ended"))},[e.renderSlot(v.$slots,"default")],42,Ie))}}),ze={name:"IconAudio"},Ae=e.defineComponent({...ze,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M3 14V10C3 9.44772 3.44772 9 4 9H6.58579C6.851 9 7.10536 8.89464 7.29289 8.70711L11.2929 4.70711C11.9229 4.07714 13 4.52331 13 5.41421V18.5858C13 19.4767 11.9229 19.9229 11.2929 19.2929L7.29289 15.2929C7.10536 15.1054 6.851 15 6.58579 15H4C3.44772 15 3 14.5523 3 14Z",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"},null,-1),e.createElementVNode("path",{d:"M16.5 8C17.5 9 18 10.5 18 12C18 13.5 17.5 15 16.5 16M19 5.5C20.5 7 21.5 9.5 21.5 12C21.5 14.5 20.5 17 19 18.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),De={name:"IconChevron"},xe=e.defineComponent({...De,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M6 9L12 15L18 9",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))}}),He=["aria-expanded"],Fe={class:"gvp-audio-label"},qe={key:0,class:"gvp-audio-menu",role:"listbox","aria-label":"Audio tracks"},Re=["aria-selected","onClick"],Ue=e.defineComponent({__name:"AudioTrackSwitcher",props:{tracks:{},activeIndex:{}},emits:["select"],setup(n,{emit:a}){const o=n,t=a,u=e.ref(!1),r=e.ref(null),m=e.computed(()=>o.tracks.find(b=>b.index===o.activeIndex)??o.tracks[0]);function f(b){r.value&&!r.value.contains(b.target)&&(u.value=!1)}function E(b){b.key==="Escape"&&(u.value=!1)}e.watch(u,b=>{b?(document.addEventListener("mousedown",f),document.addEventListener("keydown",E)):(document.removeEventListener("mousedown",f),document.removeEventListener("keydown",E))}),e.onBeforeUnmount(()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",E)});function w(b){t("select",b),u.value=!1}return(b,B)=>{var h;return e.openBlock(),e.createElementBlock("div",{ref_key:"rootEl",ref:r,class:"gvp-audio"},[e.createElementVNode("button",{type:"button",class:"gvp-audio-btn","aria-haspopup":"listbox","aria-expanded":u.value,"aria-label":"Audio track",onClick:B[0]||(B[0]=p=>u.value=!u.value)},[e.createVNode(Ae),e.createElementVNode("span",Fe,e.toDisplayString((h=m.value)==null?void 0:h.label),1),e.createVNode(xe)],8,He),u.value?(e.openBlock(),e.createElementBlock("ul",qe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.tracks,p=>(e.openBlock(),e.createElementBlock("li",{key:p.index},[e.createElementVNode("button",{type:"button",role:"option","aria-selected":p.index===n.activeIndex,class:e.normalizeClass(["gvp-audio-menu-item",{"is-active":p.index===n.activeIndex}]),onClick:g=>w(p.index)},e.toDisplayString(p.label),11,Re)]))),128))])):e.createCommentVNode("",!0)],512)}}}),Oe={name:"IconSpeed"},Be=e.defineComponent({...Oe,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2Z",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("path",{d:"M12 8V12L14.5 14.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))}}),je=["aria-expanded"],Ze={class:"gvp-speed-label"},Qe={key:0,class:"gvp-speed-menu",role:"listbox","aria-label":"Playback speed"},We=["aria-selected","onClick"],Ye=e.defineComponent({__name:"SpeedSwitcher",props:{speed:{}},emits:["select"],setup(n,{emit:a}){const o=[.5,.75,1,1.25,1.5,2],t=a,u=e.ref(!1),r=e.ref(null);function m(w){r.value&&!r.value.contains(w.target)&&(u.value=!1)}function f(w){w.key==="Escape"&&(u.value=!1)}e.watch(u,w=>{w?(document.addEventListener("mousedown",m),document.addEventListener("keydown",f)):(document.removeEventListener("mousedown",m),document.removeEventListener("keydown",f))}),e.onBeforeUnmount(()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",f)});function E(w){t("select",w),u.value=!1}return(w,b)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootEl",ref:r,class:"gvp-speed"},[e.createElementVNode("button",{type:"button",class:"gvp-speed-btn","aria-haspopup":"listbox","aria-expanded":u.value,"aria-label":"`Playback speed: ${speed === 1 ? '1×' : speed + '×'}`",onClick:b[0]||(b[0]=B=>u.value=!u.value)},[e.createVNode(Be),e.createElementVNode("span",Ze,e.toDisplayString(n.speed===1?"1×":`${n.speed}×`),1),e.createVNode(xe)],8,je),u.value?(e.openBlock(),e.createElementBlock("ul",Qe,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(o,B=>e.createElementVNode("li",{key:B},[e.createElementVNode("button",{type:"button",role:"option","aria-selected":B===n.speed,class:e.normalizeClass(["gvp-speed-menu-item",{"is-active":B===n.speed}]),onClick:h=>E(B)},e.toDisplayString(B===1?"Normal":`${B}×`),11,We)])),64))])):e.createCommentVNode("",!0)],512))}}),Ke={name:"IconCaptions"},Ne=e.defineComponent({...Ke,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("rect",{x:"2",y:"5",width:"20",height:"14",rx:"3",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("path",{d:"M7 12H11M13 12H17M7 15H9M11 15H13M15 15H17",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),Xe=["aria-expanded","aria-pressed"],Je={key:0,class:"gvp-captions-menu",role:"listbox","aria-label":"Captions"},Ge=["aria-selected"],et=["aria-selected","onClick"],tt=e.defineComponent({__name:"CaptionsSwitcher",props:{video:{}},setup(n){const a=n,o=e.ref([]),t=e.ref(-1),u=e.ref(!1),r=e.ref(null);function m(h){const p=[];for(let v=0;v<h.length;v++){const y=h[v];(y.kind==="subtitles"||y.kind==="captions")&&p.push({index:v,label:y.label||y.language||`Track ${v+1}`})}o.value=p;let g=-1;for(let v=0;v<h.length;v++)if(h[v].mode==="showing"){g=v;break}t.value=g}let f=null;e.watch(()=>a.video,h=>{if(f==null||f(),f=null,!h){o.value=[],t.value=-1;return}const p=h.textTracks;m(p);const g=()=>m(p);typeof p.addEventListener=="function"&&(p.addEventListener("addtrack",g),p.addEventListener("removetrack",g),p.addEventListener("change",g),f=()=>{p.removeEventListener("addtrack",g),p.removeEventListener("removetrack",g),p.removeEventListener("change",g)})},{immediate:!0}),e.onBeforeUnmount(()=>{f==null||f(),document.removeEventListener("mousedown",E),document.removeEventListener("keydown",w)});function E(h){r.value&&!r.value.contains(h.target)&&(u.value=!1)}function w(h){h.key==="Escape"&&(u.value=!1)}e.watch(u,h=>{h?(document.addEventListener("mousedown",E),document.addEventListener("keydown",w)):(document.removeEventListener("mousedown",E),document.removeEventListener("keydown",w))});function b(){if(!a.video)return;const h=a.video.textTracks;for(let p=0;p<h.length;p++)h[p].mode="hidden";t.value=-1,u.value=!1}function B(h){if(!a.video)return;const p=a.video.textTracks;for(let g=0;g<p.length;g++)p[g].mode=g===h?"showing":"hidden";t.value=h,u.value=!1}return(h,p)=>o.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"rootEl",ref:r,class:"gvp-captions"},[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["gvp-captions-btn",{"is-active":t.value>=0}]),"aria-haspopup":"listbox","aria-expanded":u.value,"aria-pressed":t.value>=0,"aria-label":"Captions",onClick:p[0]||(p[0]=g=>u.value=!u.value)},[e.createVNode(Ne)],10,Xe),u.value?(e.openBlock(),e.createElementBlock("ul",Je,[e.createElementVNode("li",null,[e.createElementVNode("button",{type:"button",role:"option","aria-selected":t.value===-1,class:e.normalizeClass(["gvp-captions-menu-item",{"is-active":t.value===-1}]),onClick:b}," Off ",10,Ge)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,g=>(e.openBlock(),e.createElementBlock("li",{key:g.index},[e.createElementVNode("button",{type:"button",role:"option","aria-selected":g.index===t.value,class:e.normalizeClass(["gvp-captions-menu-item",{"is-active":g.index===t.value}]),onClick:v=>B(g.index)},e.toDisplayString(g.label),11,et)]))),128))])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0)}}),nt={name:"IconPause"},ot=e.defineComponent({...nt,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("rect",{x:"6",y:"5",width:"4",height:"14",rx:"1",fill:"currentColor"},null,-1),e.createElementVNode("rect",{x:"14",y:"5",width:"4",height:"14",rx:"1",fill:"currentColor"},null,-1)])],2))}}),lt={name:"IconPlaySolid"},at=e.defineComponent({...lt,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M7 5.5V18.5C7 19.2659 7.84856 19.7261 8.4899 19.3071L19.0801 12.4014C19.6644 12.0204 19.6644 11.9796 19.0801 11.5986L8.4899 4.69288C7.84856 4.27388 7 4.73408 7 5.5Z",fill:"currentColor"},null,-1)])],2))}}),rt={name:"IconPrev"},st=e.defineComponent({...rt,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M16.5 18.5V5.5C16.5 4.73408 15.6514 4.27388 15.0101 4.69288L6.91993 9.98432C6.33563 10.3653 6.33563 11.0347 6.91993 11.4157L15.0101 16.7071C15.6514 17.1261 16.5 16.6659 16.5 15.9V18.5Z",fill:"currentColor"},null,-1),e.createElementVNode("path",{d:"M6 5V19",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1)])],2))}}),it={name:"IconNext"},ct=e.defineComponent({...it,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M7.5 5.5V18.5C7.5 19.2659 8.34856 19.7261 8.98990 19.3071L17.0801 14.0157C17.6644 13.6347 17.6644 12.9653 17.0801 12.5843L8.98990 7.29288C8.34856 6.87388 7.5 7.33408 7.5 8.1V5.5Z",fill:"currentColor"},null,-1),e.createElementVNode("path",{d:"M18 5V19",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1)])],2))}}),ut={name:"IconVolumeHigh"},dt=e.defineComponent({...ut,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M3 14V10C3 9.44772 3.44772 9 4 9H6.58579C6.851 9 7.10536 8.89464 7.29289 8.70711L11.2929 4.70711C11.9229 4.07714 13 4.52331 13 5.41421V18.5858C13 19.4767 11.9229 19.9229 11.2929 19.2929L7.29289 15.2929C7.10536 15.1054 6.851 15 6.58579 15H4C3.44772 15 3 14.5523 3 14Z",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"},null,-1),e.createElementVNode("path",{d:"M16.5 8C17.5 9 18 10.5 18 12C18 13.5 17.5 15 16.5 16M19 5.5C20.5 7 21.5 9.5 21.5 12C21.5 14.5 20.5 17 19 18.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),vt={name:"IconVolumeLow"},pt=e.defineComponent({...vt,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M3 14V10C3 9.44772 3.44772 9 4 9H6.58579C6.851 9 7.10536 8.89464 7.29289 8.70711L11.2929 4.70711C11.9229 4.07714 13 4.52331 13 5.41421V18.5858C13 19.4767 11.9229 19.9229 11.2929 19.2929L7.29289 15.2929C7.10536 15.1054 6.851 15 6.58579 15H4C3.44772 15 3 14.5523 3 14Z",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"},null,-1),e.createElementVNode("path",{d:"M16.5 8C17.5 9 18 10.5 18 12C18 13.5 17.5 15 16.5 16",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),mt={name:"IconVolumeMuted"},ft=e.defineComponent({...mt,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M3 14V10C3 9.44772 3.44772 9 4 9H6.58579C6.851 9 7.10536 8.89464 7.29289 8.70711L11.2929 4.70711C11.9229 4.07714 13 4.52331 13 5.41421V18.5858C13 19.4767 11.9229 19.9229 11.2929 19.2929L7.29289 15.2929C7.10536 15.1054 6.851 15 6.58579 15H4C3.44772 15 3 14.5523 3 14Z",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"},null,-1),e.createElementVNode("path",{d:"M16 9L22 15M22 9L16 15",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),kt={name:"IconQuality"},ht=e.defineComponent({...kt,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15Z",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("path",{d:"M3 12C3 12.6 3.08 13.18 3.23 13.73L4.6 14.5C4.86 14.65 5.02 14.94 5 15.24C4.98 15.58 4.96 15.92 5.07 16.24C5.18 16.56 5.39 16.83 5.62 17.08C5.83 17.3 6.13 17.4 6.42 17.36L7.99 17.13C8.28 17.09 8.57 17.21 8.74 17.45C9.07 17.93 9.49 18.34 9.97 18.66C10.21 18.83 10.34 19.11 10.31 19.4L10.13 20.97C10.1 21.26 10.21 21.55 10.43 21.74C10.91 22.16 11.45 22 12 22C12.55 22 13.09 22.16 13.57 21.74C13.79 21.55 13.9 21.26 13.87 20.97L13.69 19.4C13.66 19.11 13.79 18.83 14.03 18.66",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),gt={name:"IconPiP"},Ve=e.defineComponent({...gt,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"12",y:"12",width:"8",height:"5",rx:"1",fill:"currentColor"},null,-1)])],2))}}),yt={name:"IconFullscreen"},Ct=e.defineComponent({...yt,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M4 9V4H9M15 4H20V9M20 15V20H15M9 20H4V15",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))}}),Et={name:"IconFullscreenExit"},wt=e.defineComponent({...Et,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M9 4V9H4M15 9V4H20M15 20V15H20M9 15H4V20",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))}});function ge(n){if(!Number.isFinite(n)||n<0)return"--:--";const a=Math.floor(n),o=Math.floor(a/3600),t=Math.floor(a%3600/60),r=(a%60).toString().padStart(2,"0");if(o>0){const m=t.toString().padStart(2,"0");return`${o}:${m}:${r}`}return`${t}:${r}`}function Ee(n){const a=n.trim().split(":");if(a.length<2||a.length>3)return NaN;const o=a.map(Number);return o.some(t=>!Number.isFinite(t))?NaN:o.length===3?o[0]*3600+o[1]*60+o[2]:o[0]*60+o[1]}function bt(n,a){try{return new URL(n,a).href}catch{return n}}function xt(n,a){const o=[],t=n.replace(/\r/g,"").split(`
2
+ `);for(let u=0;u<t.length;u++){const r=t[u].indexOf("-->");if(r===-1)continue;const m=Ee(t[u].slice(0,r)),f=Ee(t[u].slice(r+3));if(!Number.isFinite(m)||!Number.isFinite(f))continue;const E=(t[u+1]??"").trim();if(!E)continue;const w=E.indexOf("#xywh=");let b=E,B=0,h=0,p=0,g=0;if(w!==-1){b=E.slice(0,w);const v=E.slice(w+6).split(",").map(Number);v.length===4&&v.every(Number.isFinite)&&([B,h,p,g]=v)}o.push({start:m,end:f,url:bt(b,a),x:B,y:h,w:p,h:g})}return o.sort((u,r)=>u.start-r.start),o}function Bt(n){return{cues:n,cueAt(a){if(n.length===0)return null;let o=0,t=n.length-1,u=n[0];for(;o<=t;){const r=o+t>>1,m=n[r];if(a<m.start)t=r-1;else if(a>m.end)u=m,o=r+1;else return m}return u}}}function we(n){const a=n.trim().split(":");if(a.length<2||a.length>3)return NaN;const o=a.map(Number);return o.some(t=>!Number.isFinite(t))?NaN:o.length===3?o[0]*3600+o[1]*60+o[2]:o[0]*60+o[1]}function Nt(n){const a=[],o=n.replace(/\r/g,"").split(`
3
+ `);for(let t=0;t<o.length;t++){const u=o[t].indexOf("-->");if(u===-1)continue;const r=we(o[t].slice(0,u)),m=we(o[t].slice(u+3));if(!Number.isFinite(r)||!Number.isFinite(m))continue;const f=(o[t+1]??"").trim();f&&a.push({start:r,end:m,title:f})}return a.sort((t,u)=>t.start-u.start),a}function Vt(n,a){const o=n.filter(t=>Number.isFinite(t.start)&&t.start>=0&&t.title).sort((t,u)=>t.start-u.start);return o.map((t,u)=>{var r;return{start:t.start,end:Number.isFinite(t.end)?t.end:((r=o[u+1])==null?void 0:r.start)??a,title:t.title}})}function Lt(n,a){for(const o of n)if(a>=o.start&&a<o.end)return o;return null}const _t={class:"gvp-controls-row"},$t=["disabled"],Pt=["aria-label","aria-pressed"],Mt=["disabled"],St={key:1,class:"gvp-seek-preview-chapter"},Tt={class:"gvp-seek-preview-time"},It=["value","disabled","aria-valuemax","aria-valuenow"],zt={class:"gvp-time","aria-live":"off"},At=["aria-expanded","aria-label"],Dt={class:"gvp-speed-label"},Ht={key:0,class:"gvp-speed-menu",role:"listbox","aria-label":"Playback speed"},Ft=["aria-selected","onClick"],qt=["aria-expanded","aria-label"],Rt={class:"gvp-quality-label"},Ut={key:0,class:"gvp-quality-menu",role:"listbox","aria-label":"Quality"},Ot=["aria-selected"],jt=["aria-selected","onClick"],Zt=["aria-expanded","aria-pressed"],Qt={key:0,class:"gvp-captions-menu",role:"listbox","aria-label":"Captions"},Wt=["aria-selected"],Yt=["aria-selected","onClick"],Kt=["aria-label","aria-pressed"],Xt={key:0,class:"gvp-volume-slider-wrap"},Jt={class:"gvp-volume-track"},Gt=["value","aria-valuenow"],en=["aria-label","aria-pressed"],tn=["aria-label","aria-pressed"],nn=3e3,on=e.defineComponent({__name:"ControlBar",props:{video:{},isPlaying:{type:Boolean},container:{},onTogglePlay:{},qualityLevels:{default:()=>[]},currentLevel:{default:-1},selectedLevel:{default:-1},thumbnails:{},chapters:{},hasPrev:{type:Boolean,default:!1},hasNext:{type:Boolean,default:!1}},emits:["select-level","prev","next"],setup(n,{emit:a}){const o=(()=>{if(typeof navigator>"u")return!1;const l=navigator.userAgent;return/iPad|iPhone|iPod/.test(l)||l.includes("Mac")&&navigator.maxTouchPoints>1})(),t=typeof navigator>"u"?!1:/iPhone|iPod/.test(navigator.userAgent),u=[.5,.75,1,1.25,1.5,2],r=n,m=a,f=e.ref(!0);let E=null;function w(){E!==null&&(clearTimeout(E),E=null)}function b(){w(),r.isPlaying&&(E=setTimeout(()=>{f.value=!1},nn))}function B(){f.value=!0,b()}e.watch(()=>r.isPlaying,l=>{l?b():(w(),f.value=!0)},{immediate:!0}),e.watch(()=>r.container,l=>{if(!l)return;const s=()=>B();l.addEventListener("mousemove",s),l.addEventListener("touchstart",s),l.addEventListener("focusin",s)},{immediate:!0});const h=e.ref(0),p=e.ref(0),g=e.ref(0);e.watch(()=>r.video,l=>{if(!l)return;const s=()=>{h.value=l.currentTime},i=()=>{p.value=Number.isFinite(l.duration)?l.duration:0},C=()=>{const S=l.buffered;if(!S||S.length===0){g.value=0;return}let ye=S.end(S.length-1);for(let oe=0;oe<S.length;oe++)if(S.start(oe)<=l.currentTime&&l.currentTime<=S.end(oe)){ye=S.end(oe);break}g.value=ye};s(),i(),C(),l.addEventListener("timeupdate",s),l.addEventListener("durationchange",i),l.addEventListener("loadedmetadata",i),l.addEventListener("progress",C),l.addEventListener("timeupdate",C)},{immediate:!0});const v=()=>p.value>0,y=()=>v()?h.value/p.value*100:0,_=()=>v()?g.value/p.value*100:0;function D(l){const s=r.video;if(!s||!v())return;const i=Number(l.target.value)/100*p.value;s.currentTime=i,h.value=i}const V=e.ref(null),q=e.ref(null),k=e.ref(0),N=e.ref(0),M=e.ref(!1);e.watch(()=>r.thumbnails,l=>{if(V.value=null,!l)return;let s=!1;fetch(l).then(i=>i.ok?i.text():Promise.reject(new Error("fetch failed"))).then(i=>{if(s)return;const C=xt(i,new URL(l,location.href).href);V.value=C.length>0?Bt(C):null}).catch(()=>{s||(V.value=null)}),e.onBeforeUnmount(()=>{s=!0})},{immediate:!0});function L(l){const s=q.value;if(!s||!v())return;const i=s.getBoundingClientRect(),C=Math.min(Math.max(l.clientX-i.left,0),i.width);N.value=C,k.value=C/i.width*p.value,M.value=!0}function $(){M.value=!1}const T=e.computed(()=>{var l;return M.value?((l=V.value)==null?void 0:l.cueAt(k.value))??null:null}),G=e.computed(()=>{const l=T.value;return l!==null&&l.w>0&&l.h>0}),ve=e.computed(()=>{var C;const l=T.value,s=((C=q.value)==null?void 0:C.clientWidth)??0;if(!G.value||!l||s===0)return N.value;const i=l.w/2;return Math.min(Math.max(N.value,i),s-i)}),Z=e.ref([]);e.watch(()=>r.chapters,l=>{if(Z.value=[],typeof l!="string"||!l)return;let s=!1;fetch(l).then(i=>i.ok?i.text():Promise.reject(new Error("fetch failed"))).then(i=>{s||(Z.value=Nt(i))}).catch(()=>{s||(Z.value=[])}),e.onBeforeUnmount(()=>{s=!0})},{immediate:!0});const W=e.computed(()=>typeof r.chapters=="string"?Z.value:Array.isArray(r.chapters)?Vt(r.chapters,p.value):[]),Y=e.computed(()=>M.value?Lt(W.value,k.value):null),H=e.ref(1),P=e.ref(!1);e.watch(()=>r.video,l=>{if(!l)return;const s=()=>{H.value=l.volume,P.value=l.muted};s(),l.addEventListener("volumechange",s)},{immediate:!0});function pe(){r.video&&(r.video.muted=!r.video.muted)}function me(l){const s=r.video;if(!s)return;const i=Number(l.target.value)/100;s.volume=i,i>0&&s.muted&&(s.muted=!1)}const F=e.ref(1),O=e.ref(!1),le=e.ref(null);e.watch(()=>r.video,l=>{if(!l)return;const s=()=>{F.value=l.playbackRate};s(),l.addEventListener("ratechange",s)},{immediate:!0});function fe(l){r.video&&(r.video.playbackRate=l),F.value=l,O.value=!1}const j=e.ref(!1),z=e.ref(null),ee=e.computed(()=>r.qualityLevels.length>=2),ae=e.computed(()=>[...r.qualityLevels].sort((l,s)=>s.height-l.height)),K=e.computed(()=>r.qualityLevels.find(l=>l.index===r.currentLevel)),re=e.computed(()=>{if(r.selectedLevel<0)return K.value?`Auto (${K.value.label})`:"Auto";const l=r.qualityLevels.find(s=>s.index===r.selectedLevel);return(l==null?void 0:l.label)??"Auto"});function Q(l){m("select-level",l),j.value=!1}const X=e.ref([]),A=e.ref(-1),R=e.ref(!1),se=e.ref(null);function te(l){const s=[];for(let C=0;C<l.length;C++){const S=l[C];(S.kind==="subtitles"||S.kind==="captions")&&s.push({index:C,label:S.label||S.language||`Track ${C+1}`})}X.value=s;let i=-1;for(let C=0;C<l.length;C++)if(l[C].mode==="showing"){i=C;break}A.value=i}e.watch(()=>r.video,l=>{if(!l){X.value=[],A.value=-1;return}const s=l.textTracks;te(s);const i=()=>te(s);typeof s.addEventListener=="function"&&(s.addEventListener("addtrack",i),s.addEventListener("removetrack",i),s.addEventListener("change",i))},{immediate:!0});function ie(l){var i;const s=(i=r.video)==null?void 0:i.textTracks;if(s){for(let C=0;C<s.length;C++)s[C].mode=C===l?"showing":"hidden";A.value=l,R.value=!1}}function c(){var s;const l=(s=r.video)==null?void 0:s.textTracks;if(l){for(let i=0;i<l.length;i++)l[i].mode="hidden";A.value=-1,R.value=!1}}const d=e.ref(!1),x=typeof document<"u"&&!!document.pictureInPictureEnabled;e.watch(()=>r.video,l=>{l&&(l.addEventListener("enterpictureinpicture",()=>{d.value=!0}),l.addEventListener("leavepictureinpicture",()=>{d.value=!1}))},{immediate:!0});function J(){r.video&&(document.pictureInPictureElement?document.exitPictureInPicture().catch(()=>{}):r.video.requestPictureInPicture().catch(()=>{}))}const I=e.ref(!1),ce=typeof document>"u"?!1:!!(document.fullscreenEnabled||document.webkitFullscreenEnabled);function ke(){return document.fullscreenElement??document.webkitFullscreenElement??null}function ue(l){const s=l.requestFullscreen??l.webkitRequestFullscreen;return s?s.call(l):Promise.reject(new Error("unsupported"))}function ne(){const l=document.exitFullscreen??document.webkitExitFullscreen;return l?l.call(document):Promise.reject(new Error("unsupported"))}function de(){I.value=ke()===r.container}e.onMounted(()=>{document.addEventListener("fullscreenchange",de),document.addEventListener("webkitfullscreenchange",de)}),e.onBeforeUnmount(()=>{w(),document.removeEventListener("fullscreenchange",de),document.removeEventListener("webkitfullscreenchange",de)});function Pe(){var l,s;if(t){(s=(l=r.video)==null?void 0:l.webkitEnterFullscreen)==null||s.call(l);return}I.value?ne().catch(()=>{}):r.container&&ue(r.container).catch(()=>{})}const Me=ce||t&&r.video!==null&&typeof r.video.webkitEnterFullscreen=="function";function he(l,s){function i(S){s.value&&!s.value.contains(S.target)&&(l.value=!1)}function C(S){S.key==="Escape"&&(l.value=!1)}e.watch(l,S=>{S?(document.addEventListener("mousedown",i),document.addEventListener("keydown",C)):(document.removeEventListener("mousedown",i),document.removeEventListener("keydown",C))}),e.onBeforeUnmount(()=>{document.removeEventListener("mousedown",i),document.removeEventListener("keydown",C)})}return he(O,le),he(R,se),he(j,z),(l,s)=>(e.openBlock(),e.createElementBlock("div",{role:"toolbar","aria-label":"Video controls",class:e.normalizeClass(["gvp-controls",!f.value&&"is-hidden"]),onMouseenter:w,onMouseleave:b},[e.createElementVNode("div",_t,[n.hasPrev||n.hasNext?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"gvp-ctrl-btn","aria-label":"Previous video",disabled:!n.hasPrev,onClick:s[0]||(s[0]=i=>m("prev"))},[e.createVNode(st)],8,$t)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"gvp-ctrl-btn","aria-label":n.isPlaying?"Pause":"Play","aria-pressed":n.isPlaying,onClick:s[1]||(s[1]=(...i)=>n.onTogglePlay&&n.onTogglePlay(...i))},[n.isPlaying?(e.openBlock(),e.createBlock(ot,{key:0})):(e.openBlock(),e.createBlock(at,{key:1}))],8,Pt),n.hasPrev||n.hasNext?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"gvp-ctrl-btn","aria-label":"Next video",disabled:!n.hasNext,onClick:s[2]||(s[2]=i=>m("next"))},[e.createVNode(ct)],8,Mt)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"gvp-seek",onPointermove:L,onPointerleave:$},[e.createElementVNode("div",{ref_key:"seekTrackEl",ref:q,class:"gvp-seek-track"},[e.createElementVNode("div",{class:"gvp-seek-buffered",style:e.normalizeStyle({width:`${_()}%`})},null,4),e.createElementVNode("div",{class:"gvp-seek-progress",style:e.normalizeStyle({width:`${y()}%`})},null,4),v()?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(W.value,i=>e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:`${i.start}-${i.title}`,class:"gvp-seek-chapter-tick",style:e.normalizeStyle({left:`${i.start/p.value*100}%`})},null,4)),[[e.vShow,i.start>0&&i.start<p.value]])),128)):e.createCommentVNode("",!0)],512),M.value&&v()?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["gvp-seek-preview",{"has-thumb":G.value}]),style:e.normalizeStyle({left:`${ve.value}px`})},[G.value&&T.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"gvp-seek-preview-thumb",style:e.normalizeStyle({width:`${T.value.w}px`,height:`${T.value.h}px`,backgroundImage:`url(${JSON.stringify(T.value.url)})`,backgroundPosition:`-${T.value.x}px -${T.value.y}px`})},null,4)):e.createCommentVNode("",!0),Y.value?(e.openBlock(),e.createElementBlock("span",St,e.toDisplayString(Y.value.title),1)):e.createCommentVNode("",!0),e.createElementVNode("span",Tt,e.toDisplayString(e.unref(ge)(k.value)),1)],6)):e.createCommentVNode("",!0),e.createElementVNode("input",{type:"range",class:"gvp-seek-input",min:0,max:100,step:.1,value:y(),disabled:!v(),"aria-label":"Seek","aria-valuemin":0,"aria-valuemax":Math.floor(p.value),"aria-valuenow":Math.floor(h.value),onInput:D},null,40,It)],32),e.createElementVNode("span",zt,e.toDisplayString(e.unref(ge)(h.value))+" / "+e.toDisplayString(e.unref(ge)(p.value)),1),e.createElementVNode("div",{ref_key:"speedRootEl",ref:le,class:"gvp-speed"},[e.createElementVNode("button",{type:"button",class:"gvp-ctrl-btn gvp-speed-btn","aria-haspopup":"listbox","aria-expanded":O.value,"aria-label":`Playback speed: ${F.value===1?"1×":F.value+"×"}`,onClick:s[3]||(s[3]=i=>O.value=!O.value)},[e.createVNode(Be),e.createElementVNode("span",Dt,e.toDisplayString(F.value===1?"1×":`${F.value}×`),1)],8,At),O.value?(e.openBlock(),e.createElementBlock("ul",Ht,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(u,i=>e.createElementVNode("li",{key:i},[e.createElementVNode("button",{type:"button",role:"option","aria-selected":i===F.value,class:e.normalizeClass(["gvp-speed-menu-item",{"is-active":i===F.value}]),onClick:C=>fe(i)},e.toDisplayString(i===1?"Normal":`${i}×`),11,Ft)])),64))])):e.createCommentVNode("",!0)],512),ee.value?(e.openBlock(),e.createElementBlock("div",{key:2,ref_key:"qualityRootEl",ref:z,class:"gvp-quality"},[e.createElementVNode("button",{type:"button",class:"gvp-ctrl-btn gvp-quality-btn","aria-haspopup":"listbox","aria-expanded":j.value,"aria-label":`Quality: ${re.value}`,onClick:s[4]||(s[4]=i=>j.value=!j.value)},[e.createVNode(ht),e.createElementVNode("span",Rt,e.toDisplayString(re.value),1)],8,qt),j.value?(e.openBlock(),e.createElementBlock("ul",Ut,[e.createElementVNode("li",null,[e.createElementVNode("button",{type:"button",role:"option","aria-selected":n.selectedLevel<0,class:e.normalizeClass(["gvp-quality-menu-item",{"is-active":n.selectedLevel<0}]),onClick:s[5]||(s[5]=i=>Q(e.unref(Se).index))},e.toDisplayString(K.value?`Auto (${K.value.label})`:"Auto"),11,Ot)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(ae.value,i=>(e.openBlock(),e.createElementBlock("li",{key:i.index},[e.createElementVNode("button",{type:"button",role:"option","aria-selected":i.index===n.selectedLevel,class:e.normalizeClass(["gvp-quality-menu-item",{"is-active":i.index===n.selectedLevel}]),onClick:C=>Q(i.index)},e.toDisplayString(i.label),11,jt)]))),128))])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),X.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:3,ref_key:"captionsRootEl",ref:se,class:"gvp-captions"},[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["gvp-ctrl-btn",A.value>=0&&"is-active"]),"aria-haspopup":"listbox","aria-expanded":R.value,"aria-label":"Captions","aria-pressed":A.value>=0,onClick:s[6]||(s[6]=i=>R.value=!R.value)},[e.createVNode(Ne)],10,Zt),R.value?(e.openBlock(),e.createElementBlock("ul",Qt,[e.createElementVNode("li",null,[e.createElementVNode("button",{type:"button",role:"option","aria-selected":A.value===-1,class:e.normalizeClass(["gvp-captions-menu-item",{"is-active":A.value===-1}]),onClick:c},"Off",10,Wt)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(X.value,i=>(e.openBlock(),e.createElementBlock("li",{key:i.index},[e.createElementVNode("button",{type:"button",role:"option","aria-selected":i.index===A.value,class:e.normalizeClass(["gvp-captions-menu-item",{"is-active":i.index===A.value}]),onClick:C=>ie(i.index)},e.toDisplayString(i.label),11,Yt)]))),128))])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["gvp-volume",!e.unref(o)&&"is-expandable"])},[e.createElementVNode("button",{type:"button",class:"gvp-ctrl-btn","aria-label":P.value?"Unmute":"Mute","aria-pressed":P.value,onClick:pe},[P.value||H.value===0?(e.openBlock(),e.createBlock(ft,{key:0})):H.value<.5?(e.openBlock(),e.createBlock(pt,{key:1})):(e.openBlock(),e.createBlock(dt,{key:2}))],8,Kt),e.unref(o)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Xt,[e.createElementVNode("div",Jt,[e.createElementVNode("div",{class:"gvp-volume-fill",style:e.normalizeStyle({width:`${P.value?0:Math.round(H.value*100)}%`})},null,4)]),e.createElementVNode("input",{type:"range",class:"gvp-volume-input",min:0,max:100,step:1,value:P.value?0:Math.round(H.value*100),"aria-label":"Volume","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":P.value?0:Math.round(H.value*100),onInput:me},null,40,Gt)]))],2),e.unref(x)?(e.openBlock(),e.createElementBlock("button",{key:4,type:"button",class:e.normalizeClass(["gvp-ctrl-btn",d.value&&"is-active"]),"aria-label":d.value?"Exit picture-in-picture":"Picture-in-picture","aria-pressed":d.value,onClick:J},[e.createVNode(Ve)],10,en)):e.createCommentVNode("",!0),e.unref(Me)?(e.openBlock(),e.createElementBlock("button",{key:5,type:"button",class:e.normalizeClass(["gvp-ctrl-btn",I.value&&"is-active"]),"aria-label":I.value?"Exit fullscreen":"Enter fullscreen","aria-pressed":I.value,onClick:Pe},[I.value?(e.openBlock(),e.createBlock(wt,{key:0})):(e.openBlock(),e.createBlock(Ct,{key:1}))],10,tn)):e.createCommentVNode("",!0)])],34))}}),ln={name:"IconDesktop"},an=e.defineComponent({...ln,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M14 2H10C6.72077 2 5.08116 2 3.91891 2.81382C3.48891 3.1149 3.1149 3.48891 2.81382 3.91891C2 5.08116 2 6.72077 2 10C2 13.2792 2 14.9188 2.81382 16.0811C3.1149 16.5111 3.48891 16.8851 3.91891 17.1862C5.08116 18 6.72077 18 10 18H14C17.2792 18 18.9188 18 20.0811 17.1862C20.5111 16.8851 20.8851 16.5111 21.1862 16.0811C22 14.9188 22 13.2792 22 10C22 6.72077 22 5.08116 21.1862 3.91891C20.8851 3.48891 20.5111 3.1149 20.0811 2.81382C18.9188 2 17.2792 2 14 2Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1),e.createElementVNode("path",{d:"M11 15H13",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),e.createElementVNode("path",{d:"M14.5 22L14.1845 21.5811C13.4733 20.6369 13.2969 19.1944 13.7468 18M9.5 22L9.8155 21.5811C10.5267 20.6369 10.7031 19.1944 10.2532 18",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1),e.createElementVNode("path",{d:"M7 22H17",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),rn={name:"IconMobile"},sn=e.defineComponent({...rn,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M5 9C5 5.70017 5 4.05025 6.02513 3.02513C7.05025 2 8.70017 2 12 2C15.2998 2 16.9497 2 17.9749 3.02513C19 4.05025 19 5.70017 19 9V15C19 18.2998 19 19.9497 17.9749 20.9749C16.9497 22 15.2998 22 12 22C8.70017 22 7.05025 22 6.02513 20.9749C5 19.9497 5 18.2998 5 15V9Z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1),e.createElementVNode("path",{d:"M11 19H13",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),e.createElementVNode("path",{d:"M9 2L9.089 2.53402C9.28188 3.69129 9.37832 4.26993 9.77519 4.62204C10.1892 4.98934 10.7761 5 12 5C13.2239 5 13.8108 4.98934 14.2248 4.62204C14.6217 4.26993 14.7181 3.69129 14.911 2.53402L15 2",stroke:"currentColor","stroke-width":"2","stroke-linejoin":"round"},null,-1)])],2))}}),cn={name:"IconPlay"},un=e.defineComponent({...cn,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"22",height:"22",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M5.3335 11.45V4.54997C5.3335 4.36108 5.40016 4.20275 5.5335 4.07497C5.66683 3.94719 5.82238 3.8833 6.00016 3.8833C6.05572 3.8833 6.11405 3.89163 6.17516 3.9083C6.23627 3.92497 6.29461 3.94997 6.35016 3.9833L11.7835 7.4333C11.8835 7.49997 11.9585 7.5833 12.0085 7.6833C12.0585 7.7833 12.0835 7.88886 12.0835 7.99997C12.0835 8.11108 12.0585 8.21663 12.0085 8.31663C11.9585 8.41663 11.8835 8.49997 11.7835 8.56663L6.35016 12.0166C6.29461 12.05 6.23627 12.075 6.17516 12.0916C6.11405 12.1083 6.05572 12.1166 6.00016 12.1166C5.82238 12.1166 5.66683 12.0527 5.5335 11.925C5.40016 11.7972 5.3335 11.6389 5.3335 11.45Z",fill:"currentColor"},null,-1)])],2))}}),dn={name:"IconX"},vn=e.defineComponent({...dn,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M6.94994 5.53594L12.1929 0.292938C12.5834 -0.0975275 13.2165 -0.0975279 13.6069 0.292938C13.9974 0.683403 13.9974 1.31647 13.6069 1.70694L8.36394 6.94994L13.6069 12.1929C13.9974 12.5834 13.9974 13.2165 13.6069 13.6069C13.2165 13.9974 12.5834 13.9974 12.1929 13.6069L6.94994 8.36394L1.70694 13.6069C1.31647 13.9974 0.683403 13.9974 0.292938 13.6069C-0.0975279 13.2165 -0.0975277 12.5834 0.292938 12.1929L5.53594 6.94994L0.292938 1.70694C-0.0975279 1.31647 -0.0975279 0.683403 0.292938 0.292938C0.683403 -0.0975279 1.31647 -0.0975277 1.70694 0.292938L6.94994 5.53594Z",fill:"currentColor"},null,-1)])],2))}});function Le(n){if(!n)return null;if(/^[A-Za-z0-9_-]{11}$/.test(n))return n;let a;try{a=new URL(n)}catch{return null}const o=a.hostname.replace(/^www\./,"");if(o==="youtu.be"){const t=a.pathname.slice(1).split("/")[0];return/^[A-Za-z0-9_-]{11}$/.test(t)?t:null}if(o==="youtube.com"||o==="m.youtube.com"||o==="music.youtube.com"||o==="youtube-nocookie.com"){const t=a.searchParams.get("v");if(t&&/^[A-Za-z0-9_-]{11}$/.test(t))return t;const u=/^\/(?:embed|shorts|v|live)\/([A-Za-z0-9_-]{11})/.exec(a.pathname);if(u)return u[1]}return null}function _e(n){try{const a=new URL(n),o=a.searchParams.get("t")??a.searchParams.get("start");if(!o)return null;if(/^\d+s?$/.test(o))return Number.parseInt(o,10);const t=/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/.exec(o);if(t){const u=Number.parseInt(t[1]??"0",10),r=Number.parseInt(t[2]??"0",10),m=Number.parseInt(t[3]??"0",10),f=u*3600+r*60+m;return f>0?f:null}}catch{}return null}function $e(n,a={}){const{autoPlay:o=!1,muted:t=!0,loop:u=!1,controls:r=!0,startSeconds:m}=a,f=new URLSearchParams({rel:"0",modestbranding:"1",playsinline:"1",controls:r?"1":"0"});return o?(f.set("autoplay","1"),f.set("mute","1")):t&&f.set("mute","1"),u&&(f.set("loop","1"),f.set("playlist",n)),m&&m>0&&f.set("start",String(m)),`https://www.youtube-nocookie.com/embed/${n}?${f.toString()}`}const pn=["src"],mn={key:2,class:"gvp-vignette"},fn={key:3,class:"gvp-toggle"},kn={class:"gvp-toggle-pill"},hn=["aria-pressed"],gn=["aria-pressed"],yn=["aria-label","aria-pressed"],Cn=["aria-label"],En={key:10,class:"gvp-play-wrap"},wn={key:0,class:"gvp-tooltip",role:"tooltip"},bn={key:12,class:"gvp-bottom-fade"},xn=e.defineComponent({__name:"VideoPlayer",props:{src:{},poster:{},playlist:{},defaultIndex:{default:0},autoAdvance:{type:Boolean,default:!0},showDeviceToggle:{type:Boolean,default:!0},defaultDevice:{default:"desktop"},hoverPlay:{type:Boolean,default:!1},tooltipText:{},muted:{type:Boolean,default:!0},loop:{type:Boolean,default:!1},controls:{type:[Boolean,String],default:!0},autoPlay:{type:Boolean,default:!1},frameMaxWidth:{},aspectRatio:{},hlsConfig:{},isHls:{type:Boolean},thumbnails:{},chapters:{},class:{default:""},closable:{type:Boolean,default:!1}},emits:["close","play","pause","ended","time-update","seeked","volume-change","milestone","error","playlist-change"],setup(n,{emit:a}){const o=n,t=a,u=e.ref(null),r=e.ref(o.defaultDevice),m=e.ref(!1),f=e.ref(!1),E=e.ref(null),w=e.ref([]),b=e.ref(-1),B=e.ref([]),h=e.ref(-1),p=e.ref(-1),g=e.ref(1),v=e.ref(!1),y=e.ref(!1),_=e.ref(null),D=typeof document<"u"&&!!document.pictureInPictureEnabled,V=e.computed(()=>o.controls===!0||o.controls==="custom"),q=e.computed(()=>o.controls==="native"),k=e.computed(()=>Array.isArray(o.playlist)&&o.playlist.length>0),N=e.ref(k.value?Math.min(Math.max(o.defaultIndex,0),o.playlist.length-1):0),M=e.computed(()=>k.value?o.playlist[Math.min(N.value,o.playlist.length-1)]:null),L=e.computed(()=>{var c;return((c=M.value)==null?void 0:c.src)??o.src??""}),$=e.computed(()=>{var c;return((c=M.value)==null?void 0:c.poster)??o.poster}),T=e.computed(()=>{var c;return((c=M.value)==null?void 0:c.thumbnails)??o.thumbnails}),G=e.computed(()=>{var c;return((c=M.value)==null?void 0:c.chapters)??o.chapters}),ve=e.computed(()=>k.value&&N.value>0),Z=e.computed(()=>k.value&&N.value<o.playlist.length-1);let W=!1;function Y(c,d=!1){if(!k.value)return;const x=Math.min(Math.max(c,0),o.playlist.length-1);x!==N.value&&(W=d,N.value=x,t("playlist-change",x,o.playlist[x]))}const H=e.computed(()=>Le(L.value)),P=e.computed(()=>H.value!==null),pe=e.computed(()=>H.value?$e(H.value,{autoPlay:o.autoPlay,muted:o.muted,loop:o.loop,controls:V.value?!0:q.value,startSeconds:_e(L.value)}):null);function me(c){w.value=c,b.value=-1}function F(c){B.value=c,p.value=-1}const O=e.computed(()=>!P.value&&w.value.length>1),le=e.computed(()=>{var c;return b.value>=0?b.value:((c=w.value[0])==null?void 0:c.index)??-1}),fe=e.computed(()=>{var c,d;return r.value==="mobile"?((c=o.aspectRatio)==null?void 0:c.mobile)??"9/16":((d=o.aspectRatio)==null?void 0:d.desktop)??"16/9"}),j=e.computed(()=>{var c,d;return r.value==="mobile"?((c=o.frameMaxWidth)==null?void 0:c.mobile)??"420px":((d=o.frameMaxWidth)==null?void 0:d.desktop)??"960px"}),z=e.computed(()=>{var c;return((c=u.value)==null?void 0:c.videoEl)??null});async function ee(){const c=z.value;if(c)try{c.readyState<2&&c.load();const d=c.play();E.value=d,await d,m.value=!0}catch{m.value=!1}finally{E.value=null}}async function ae(){const c=z.value;if(c){if(E.value)try{await E.value}catch{}c.pause()}}async function K(){!o.hoverPlay||P.value||await ee()}async function re(){!o.hoverPlay||P.value||(await ae(),m.value=!1)}async function Q(){const c=z.value;c&&(c.paused?await ee():(await ae(),m.value=!1))}function X(){m.value=!1,t("ended"),k.value&&o.autoAdvance&&Z.value&&Y(N.value+1,!0)}e.watch(L,()=>{W&&(W=!1,ee())});function A(){f.value=!0,K()}function R(){f.value=!1,re()}function se(c){g.value=c;const d=z.value;d&&(d.playbackRate=c)}e.watch(z,c=>{if(!c)return;c.addEventListener("ratechange",()=>{g.value=c.playbackRate}),c.addEventListener("enterpictureinpicture",()=>{v.value=!0}),c.addEventListener("leavepictureinpicture",()=>{v.value=!1});const d=new Set;c.addEventListener("timeupdate",()=>{const x=c.duration;if(t("time-update",c.currentTime,Number.isFinite(x)?x:0),!Number.isFinite(x)||x<=0)return;const J=c.currentTime/x*100;for(const I of[25,50,75,100])J>=I&&!d.has(I)&&(d.add(I),t("milestone",I))}),c.addEventListener("seeked",()=>{t("seeked",c.currentTime)}),c.addEventListener("volumechange",()=>{t("volume-change",c.volume,c.muted)}),c.addEventListener("error",()=>{t("error")})});function te(){const c=z.value;c&&(document.pictureInPictureElement?document.exitPictureInPicture().catch(()=>{}):c.requestPictureInPicture().catch(()=>{}))}function ie(c){var J,I,ce;const d=z.value;if(!(!d||!y.value&&!((J=_.value)!=null&&J.contains(document.activeElement))||c.target.tagName==="INPUT"&&c.key!==" "))switch(c.key){case" ":case"k":c.preventDefault(),Q();break;case"ArrowLeft":c.preventDefault(),d.currentTime=Math.max(0,d.currentTime-5);break;case"ArrowRight":c.preventDefault(),d.currentTime=Math.min(d.duration||0,d.currentTime+5);break;case"ArrowUp":c.preventDefault(),d.volume=Math.min(1,d.volume+.1),d.muted&&(d.muted=!1);break;case"ArrowDown":c.preventDefault(),d.volume=Math.max(0,d.volume-.1);break;case"m":d.muted=!d.muted;break;case"f":{const ke=document.fullscreenElement??document.webkitFullscreenElement??null,ue=((I=_.value)==null?void 0:I.requestFullscreen)??((ce=_.value)==null?void 0:ce.webkitRequestFullscreen),ne=document.exitFullscreen??document.webkitExitFullscreen;ke===_.value?ne==null||ne.call(document).catch(()=>{}):ue&&_.value&&ue.call(_.value).catch(()=>{});break}case"p":D&&te();break}}return e.onMounted(()=>{document.addEventListener("keydown",ie)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",ie)}),(c,d)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootEl",ref:_,class:e.normalizeClass(["gvp-root",o.class]),style:e.normalizeStyle({width:j.value,aspectRatio:fe.value}),onMouseenter:d[12]||(d[12]=x=>{y.value=!0,A()}),onMouseleave:d[13]||(d[13]=x=>{y.value=!1,R()})},[P.value?(e.openBlock(),e.createElementBlock("iframe",{key:0,class:"gvp-video gvp-youtube",src:pe.value??void 0,title:"YouTube video player",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowfullscreen:"",referrerpolicy:"strict-origin-when-cross-origin"},null,8,pn)):(e.openBlock(),e.createBlock(be,{ref_key:"hlsPlayerRef",ref:u,key:L.value,controls:q.value,"hls-config":n.hlsConfig,"is-hls":n.isHls,loop:n.loop,muted:n.muted,"auto-play":n.autoPlay,"audio-track-index":b.value,"quality-level-index":p.value,"plays-inline":!0,poster:$.value,src:L.value,class:"gvp-video",preload:"metadata",onAudioTracks:me,onQualityLevels:F,onCurrentLevel:d[0]||(d[0]=x=>h.value=x),onEnded:X,onPause:d[1]||(d[1]=x=>{m.value=!1,t("pause")}),onPlay:d[2]||(d[2]=x=>{m.value=!0,t("play")})},{default:e.withCtx(()=>[e.renderSlot(c.$slots,"default")]),_:3},8,["controls","hls-config","is-hls","loop","muted","auto-play","audio-track-index","quality-level-index","poster","src"])),P.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",mn)),n.showDeviceToggle?(e.openBlock(),e.createElementBlock("div",fn,[e.createElementVNode("div",kn,[e.createElementVNode("button",{"aria-pressed":r.value==="desktop",class:e.normalizeClass(["gvp-toggle-btn",{"is-active":r.value==="desktop"}]),"aria-label":"Desktop view",type:"button",onClick:d[3]||(d[3]=x=>r.value="desktop")},[e.createVNode(an)],10,hn),d[14]||(d[14]=e.createElementVNode("div",{class:"gvp-toggle-divider"},null,-1)),e.createElementVNode("button",{"aria-pressed":r.value==="mobile",class:e.normalizeClass(["gvp-toggle-btn",{"is-active":r.value==="mobile"}]),"aria-label":"Mobile view",type:"button",onClick:d[4]||(d[4]=x=>r.value="mobile")},[e.createVNode(sn)],10,gn)])])):e.createCommentVNode("",!0),n.closable?(e.openBlock(),e.createElementBlock("button",{key:4,"aria-label":"Close",class:"gvp-close",type:"button",onClick:d[5]||(d[5]=x=>t("close"))},[e.createVNode(vn)])):e.createCommentVNode("",!0),O.value&&!V.value?(e.openBlock(),e.createBlock(Ue,{key:5,tracks:w.value,"active-index":le.value,onSelect:d[6]||(d[6]=x=>b.value=x)},null,8,["tracks","active-index"])):e.createCommentVNode("",!0),!P.value&&!V.value?(e.openBlock(),e.createBlock(Ye,{key:6,speed:g.value,onSelect:se},null,8,["speed"])):e.createCommentVNode("",!0),!P.value&&!V.value?(e.openBlock(),e.createBlock(tt,{key:7,video:z.value},null,8,["video"])):e.createCommentVNode("",!0),!P.value&&e.unref(D)&&!V.value?(e.openBlock(),e.createElementBlock("button",{key:8,type:"button",class:e.normalizeClass(["gvp-pip-btn",{"is-active":v.value}]),"aria-label":v.value?"Exit picture-in-picture":"Picture-in-picture","aria-pressed":v.value,onClick:te},[e.createVNode(Ve)],10,yn)):e.createCommentVNode("",!0),!P.value&&V.value?(e.openBlock(),e.createElementBlock("button",{key:9,type:"button",class:"gvp-click-layer","aria-label":m.value?"Pause":"Play",onClick:Q},null,8,Cn)):e.createCommentVNode("",!0),!P.value&&!V.value&&!m.value?(e.openBlock(),e.createElementBlock("div",En,[e.createElementVNode("button",{"aria-label":"Play",class:"gvp-play",type:"button",onClick:Q,onMouseenter:d[7]||(d[7]=x=>f.value=!0),onMouseleave:d[8]||(d[8]=x=>f.value=!1)},[e.createVNode(un),n.tooltipText&&f.value?(e.openBlock(),e.createElementBlock("span",wn,e.toDisplayString(n.tooltipText),1)):e.createCommentVNode("",!0)],32)])):e.createCommentVNode("",!0),!P.value&&V.value?(e.openBlock(),e.createBlock(on,{key:11,video:z.value,"is-playing":m.value,container:_.value,"on-toggle-play":Q,"quality-levels":B.value,"current-level":h.value,"selected-level":p.value,thumbnails:T.value,chapters:G.value,"has-prev":ve.value,"has-next":Z.value,onSelectLevel:d[9]||(d[9]=x=>p.value=x),onPrev:d[10]||(d[10]=x=>Y(N.value-1,!0)),onNext:d[11]||(d[11]=x=>Y(N.value+1,!0))},null,8,["video","is-playing","container","quality-levels","current-level","selected-level","thumbnails","chapters","has-prev","has-next"])):e.createCommentVNode("",!0),!P.value&&!V.value?(e.openBlock(),e.createElementBlock("div",bn)):e.createCommentVNode("",!0)],38))}});exports.HLSPlayer=be;exports.VueVideoPlayer=xn;exports.parseYouTubeId=Le;exports.parseYouTubeStart=_e;exports.youTubeEmbedUrl=$e;
2
4
  //# sourceMappingURL=index.cjs.map