"use strict";(globalThis.webpackChunk_flippingbook_publication=globalThis.webpackChunk_flippingbook_publication||[]).push([[11],{167:(e,t,i)=>{i.r(t),i.d(t,{VideoProvider:()=>v});var n=i(7895),s=i(3607),r=i(4449),o=i(2681),c=i(4003);class a{#e;#t;constructor(e,t){this.#e=e,this.#t=t,e.textTracks.onaddtrack=this.#i.bind(this),(0,n.uG)(this.#n.bind(this))}#i(e){const t=e.track;if(!t||d(this.#e,t))return;const i=new c.n8({id:t.id,kind:t.kind,label:t.label??"",language:t.language,type:"vtt"});i[c.kA.native]={track:t},i[c.kA.readyState]=2,i[c.kA.nativeHLS]=!0;let n=0;const s=e=>{if(t.cues)for(let s=n;s<t.cues.length;s++)i.addCue(t.cues[s],e),n++};s(e),t.oncuechange=s,this.#t.textTracks.add(i,e),i.setMode(t.mode,e)}#n(){this.#e.textTracks.onaddtrack=null;for(const e of this.#t.textTracks){const t=e[c.kA.native]?.track;t?.oncuechange&&(t.oncuechange=null)}}}function d(e,t){return Array.from(e.children).find((e=>e.track===t))}class h{#e;#s;constructor(e,t){this.#e=e,this.#s=t,new n.Xs(e).add("enterpictureinpicture",this.#r.bind(this)).add("leavepictureinpicture",this.#o.bind(this))}get active(){return document.pictureInPictureElement===this.#e}get supported(){return(0,s.zG)(this.#e)}async enter(){return this.#e.requestPictureInPicture()}exit(){return document.exitPictureInPicture()}#r(e){this.#c(!0,e)}#o(e){this.#c(!1,e)}#c=(e,t)=>{this.#s.notify("picture-in-picture-change",e,t)}}class u{#e;#s;#a="inline";get mode(){return this.#a}constructor(e,t){this.#e=e,this.#s=t,(0,n.yl)(e,"webkitpresentationmodechanged",this.#d.bind(this))}get supported(){return(0,s.bv)(this.#e)}async setPresentationMode(e){this.#a!==e&&this.#e.webkitSetPresentationMode(e)}#d(e){const t=this.#a;this.#a=this.#e.webkitPresentationMode,this.#s.player?.dispatch(new n.yb("video-presentation-change",{detail:this.#a,trigger:e})),["fullscreen","picture-in-picture"].forEach((i=>{this.#a!==i&&t!==i||this.#s.notify(`${i}-change`,this.#a===i,e)}))}}class p{#h;get active(){return"fullscreen"===this.#h.mode}get supported(){return this.#h.supported}constructor(e){this.#h=e}async enter(){this.#h.setPresentationMode("fullscreen")}async exit(){this.#h.setPresentationMode("inline")}}class l{#h;get active(){return"picture-in-picture"===this.#h.mode}get supported(){return this.#h.supported}constructor(e){this.#h=e}async enter(){this.#h.setPresentationMode("picture-in-picture")}async exit(){this.#h.setPresentationMode("inline")}}class v extends r.F{$$PROVIDER_TYPE="VIDEO";get type(){return"video"}airPlay;fullscreen;pictureInPicture;constructor(e,t){super(e,t),(0,n.Yn)((()=>{if(this.airPlay=new o.f(e,t),(0,s.bv)(e)){const i=new u(e,t);this.fullscreen=new p(i),this.pictureInPicture=new l(i)}else(0,s.zG)(e)&&(this.pictureInPicture=new h(e,t))}),this.scope)}setup(){super.setup(),(0,s.O6)(this.video)&&new a(this.video,this.ctx),this.ctx.textRenderers.attachVideo(this.video),(0,n.uG)((()=>{this.ctx.textRenderers.attachVideo(null)})),"video"===this.type&&this.ctx.notify("provider-setup",this)}get video(){return this.media}}}}]);