@netless/window-manager 1.0.0-canary.38 → 1.0.0-canary.40
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.js +8 -8
- package/dist/index.es.js +62 -45
- package/dist/index.umd.js +8 -8
- package/dist/src/Utils/error.d.ts +1 -1
- package/dist/src/callback.d.ts +3 -2
- package/dist/src/index.d.ts +4 -3
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/pnpm-lock.yaml +4 -4
- package/src/App/AppProxy.ts +2 -2
- package/src/BoxManager.ts +6 -2
- package/src/Utils/error.ts +2 -2
- package/src/callback.ts +4 -3
- package/src/index.ts +19 -63
package/dist/index.cjs.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
"use strict";var Co=Object.defineProperty,Io=Object.defineProperties;var _o=Object.getOwnPropertyDescriptors;var oi=Object.getOwnPropertySymbols;var
|
2
|
-
;return ${e}`)();return typeof i=="undefined"&&(i=window[e]),i},Fo=async(t,e,i)=>{const s=i||Uo+e;Q.emit("loadApp",{kind:e,status:"start"});try{const r=await Ho(t);if(!r||r.length===0){Q.emit("loadApp",{kind:e,status:"failed",reason:"script is empty."});return}try{const a=Mr(r,s);return Q.emit("loadApp",{kind:e,status:"success"}),a}catch(a){if(a.message.includes("Can only have one anonymous define call per script file")){const n=window.define;typeof n=="function"&&n.amd&&delete n.amd;const o=Mr(r,s);return Q.emit("loadApp",{kind:e,status:"success"}),o}Q.emit("loadApp",{kind:e,status:"failed",reason:a.message})}}catch(r){Q.emit("loadApp",{kind:e,status:"failed",reason:r.message})}};async function Zo(t,e){const{timeout:i=1e4}=e,s=new AbortController,r=setTimeout(()=>s.abort(),i),a=await fetch(t,he(R({},e),{signal:s.signal,headers:{"content-type":"text/plain"}}));return clearTimeout(r),a}class Yo{constructor(){this.kindEmitters=new Map,this.registered=new Map,this.appClassesCache=new Map,this.appClasses=new Map,this.syncRegisterApp=null,this.onSyncRegisterAppChange=e=>{this.register({kind:e.kind,src:e.src})}}setSyncRegisterApp(e){this.syncRegisterApp=e}async register(e){this.appClassesCache.delete(e.kind),this.registered.set(e.kind,e);const i=e.src;let s;if(typeof i=="string"?(s=async()=>{let r=await Fo(i,e.kind,e.name);if(r)return r.__esModule&&(r=r.default),r;throw new Error(`[WindowManager]: load remote script failed, ${i}`)},this.syncRegisterApp&&this.syncRegisterApp({kind:e.kind,src:i,name:e.name})):typeof i=="function"?s=i:s=async()=>i,this.appClasses.set(e.kind,async()=>{let r=this.appClassesCache.get(e.kind);return r||(r=s(),this.appClassesCache.set(e.kind,r)),r}),e.addHooks){const r=this.createKindEmitter(e.kind);r&&e.addHooks(r)}}unregister(e){this.appClasses.delete(e),this.appClassesCache.delete(e),this.registered.delete(e);const i=this.kindEmitters.get(e);i&&(i.clearListeners(),this.kindEmitters.delete(e))}async notifyApp(e,i,s){const r=this.kindEmitters.get(e);await(r==null?void 0:r.emit(i,s))}createKindEmitter(e){if(!this.kindEmitters.has(e)){const i=new rt.default;this.kindEmitters.set(e,i)}return this.kindEmitters.get(e)}}const pe=new Yo,Qo=async t=>{var i,s;const e=await((i=pe.appClasses.get(t))==null?void 0:i());return e&&((s=e.config)==null?void 0:s.singleton)?t:`${t}-${To.v4().replace("-","").slice(0,8)}`},dt=(t,e)=>{if(!t.didRelease&&t.focusScenePath!==e)return t.focusScenePath=e,t},Cr=t=>{t.didRelease||t.release()},Yt=(t,e)=>{if(t&&t.isWritable&&t.state.sceneState.scenePath!==e){const i=e==="/"?"":e;t.setScenePath(i)}},Go=(t,e,i)=>{var s;if(t&&e){const a=(s=ut(t)[e])==null?void 0:s[i];if(a)return`${e}/${a.name}`}},gs=(t,e,i)=>{t&&t.scenePathType(e)!==S.ScenePathType.None&&t.removeScenes(e,i)},qo=(t,e)=>{P.once(t).then(e)};I.debounce((t,e)=>{t.emit("mainViewModeChange",e)},200);const Jo=(t,e,i=0)=>{const s=ut(t)[e];if(!s)return;const r=s[i];if(!r)return;const a=r.name;return e===we?`/${a}`:`${e}/${a}`},ut=t=>t.entireScenes(),vt=(t,e,i,s)=>t==null?void 0:t.putScenes(e,i,s),Xo=t=>t.startsWith("/"),Ji=t=>{const e=t.split("/");e.pop();let i=e.join("/");return i===""&&(i="/"),i},Ko=t=>t.endsWith("/")?t.slice(0,-1):t,Ir=t=>{const e=t.split(".").map(i=>i.padStart(2,"0")).join("");return parseInt(e)},Si=t=>new Promise(e=>setTimeout(e,t)),el=t=>t.split("").reduce((i,s)=>(s===we&&(i+=1),i),0)===1;class tl{constructor(e){this.saveCamera=e,this.setRect=i=>{this.rect=i,this.remoteCamera&&this.remoteSize&&this.onRemoteUpdate(this.remoteCamera,this.remoteSize)},this.onRemoteUpdate=I.throttle((i,s)=>{if(this.remoteCamera=i,this.remoteSize=s,this.remoteSize&&this.rect){const a={scale:i.scale*Ei(s,this.rect)};i.centerX!==null&&(a.centerX=i.centerX),i.centerY!==null&&(a.centerY=i.centerY),this.moveCamera(a)}},10)}setView(e){this.view=e}onRemoteSizeUpdate(e){var s;this.remoteSize=e;const i=!I.isEqual(I.pick(this.rect,["width","height"]),I.pick(e,["width","height"]));if(this.rect&&this.remoteCamera&&i){if(!this.view)return;const r=this.view.camera;(s=this.view)==null||s.moveCameraToContain({width:e.width,height:e.height,originX:r.centerX-e.width/2,originY:r.centerY-e.height/2})}}onLocalCameraUpdate(e){this.saveCamera(e),this.remoteCamera=e}moveCamera(e){var i;(i=this.view)==null||i.moveCamera(he(R({},e),{animationMode:S.AnimationMode.Immediately}))}}const Ei=(t,e)=>{const i=e.width/t.width,s=e.height/t.height;return Math.min(i,s)};class il{constructor(e){this.manager=e,this.displayer=this.manager.displayer,this.mainMagixEventListener=i=>{if(i.authorId!==this.displayer.observerId){const s=i.payload;switch(s.eventName){case Y.AppMove:{this.appMoveHandler(s.payload);break}case Y.AppResize:{this.appResizeHandler(s.payload);break}case Y.AppBoxStateChange:{this.boxStateChangeHandler(s.payload);break}case Y.SetMainViewScenePath:{this.setMainViewScenePathHandler(s.payload);break}case Y.CursorMove:{this.cursorMoveHandler(s.payload);break}case Y.RootDirRemoved:{this.rootDirRemovedHandler();break}case Y.Refresh:{this.refreshHandler();break}case Y.InitMainViewCamera:{this.initMainViewCameraHandler();break}case Y.SetAppFocusIndex:{this.setAppFocusViewIndexHandler(s.payload);break}case Y.InvokeAttributesUpdateCallback:{this.manager.attributesUpdateCallback(this.manager.attributes.apps);break}case Y.MoveCamera:{this.moveCameraHandler(s.payload);break}case Y.MoveCameraToContain:{this.moveCameraToContainHandler(s.payload);break}}}},this.appMoveHandler=i=>{var s;(s=this.boxManager)==null||s.moveBox(i)},this.appResizeHandler=i=>{var s,r;(s=this.boxManager)==null||s.resizeBox(Object.assign(i,{skipUpdate:!0})),(r=this.manager.room)==null||r.refreshViewSize()},this.boxStateChangeHandler=i=>{Q.emit("boxStateChange",i)},this.setMainViewScenePathHandler=({nextScenePath:i})=>{dt(this.manager.mainView,i),Q.emit("mainViewScenePathChange",i)},this.cursorMoveHandler=i=>{P.emit("cursorMove",i)},this.rootDirRemovedHandler=()=>{this.manager.createRootDirScenesCallback(),this.manager.mainViewProxy.rebind(),P.emit("rootDirRemoved")},this.refreshHandler=()=>{this.manager.windowManger._refresh()},this.initMainViewCameraHandler=()=>{this.manager.mainViewProxy.addCameraReaction()},this.setAppFocusViewIndexHandler=i=>{if(i.type==="main")this.manager.setSceneIndexWithoutSync(i.index);else if(i.type==="app"&&i.appID){const s=this.manager.appProxies.get(i.appID);s&&s.setSceneIndexWithoutSync(i.index)}},this.moveCameraHandler=i=>{var r;const s=i;if(i.scale){const a=this.manager.mainViewProxy.size$.value,n=(r=this.manager.boxManager)==null?void 0:r.stageRect;a&&n&&(s.scale=i.scale*Ei(a,n))}this.manager.mainView.moveCamera(s)},this.moveCameraToContainHandler=i=>{this.manager.mainView.moveCameraToContain(i)}}get boxManager(){return this.manager.boxManager}addListeners(){this.displayer.addMagixEventListener(us,this.mainMagixEventListener)}removeListeners(){this.displayer.removeMagixEventListener(us,this.mainMagixEventListener)}}class ma extends Error{constructor(){super(...arguments);this.message="[WindowManager]: app duplicate exists and cannot be created again"}}class sl extends Error{constructor(e){super(`[WindowManager]: app ${e} need register or provide src`)}}class de extends Error{constructor(){super(...arguments);this.message="[WindowManager]: AppManager must be initialized"}}class fa extends Error{constructor(e){super(`[WindowManager]: white-web-sdk version must large than ${e}`)}}class ba extends Error{constructor(){super(...arguments);this.message="[WindowManager]: kind must be a valid string"}}class ya extends Error{constructor(){super(...arguments);this.message="[WindowManager]: box need created"}}class wa extends Error{constructor(){super(...arguments);this.message='[WindowManager]: ScenePath should start with "/"'}}class va extends Error{constructor(){super(...arguments);this.message="[WindowManager]: boxManager not found"}}class xa extends Error{constructor(){super(...arguments);this.message="[WindowManager]: room phase only Connected can be bindContainer"}}const Sa=t=>(e,i)=>{if(e!==void 0)if(S.listenUpdated){const s=r=>{r.map(n=>n.kind).includes(t)&&i()};return S.listenUpdated(e,s),i(),()=>S.unlistenUpdated(e,s)}else return S.reaction(()=>e,()=>{i()},{fireImmediately:!0})},Ma=(t,e,i)=>{let s=null;const r=S.reaction(t,()=>{s&&(s(),s=null);const a=t();I.isObject(a)?(s=()=>S.unlistenUpdated(a,e),S.listenUpdated(a,e)):i==null||i(a)},{fireImmediately:!0});return()=>{s==null||s(),r()}},rl=Sa(S.UpdateEventKind.Removed);Sa(S.UpdateEventKind.Inserted);const Xi=Object.keys;function _r(t){return Boolean(I.has(t,"__isRef"))}function al(t){return{k:ve.genUID(),v:t,__isRef:!0}}class nl{constructor(){this.listeners=new Set}get length(){return this.listeners.size}dispatch(e){this.listeners.forEach(i=>i(e))}addListener(e){this.listeners.add(e)}removeListener(e){this.listeners.delete(e)}}const Te="_WM-STORAGE_";class Ar{constructor(e,i,s){if(this._sideEffect=new ve.SideEffectManager,this._destroyed=!1,this._refMap=new WeakMap,this._lastValue=new Map,this.onStateChanged=new nl,s&&!I.isObject(s))throw new Error(`Default state for Storage ${i} is not an object.`);this._context=e,this.id=i||null,this._state={};const r=this._getRawState(this._state);this._context.isWritable&&(this.id===null?e.isAddApp&&s&&this.setState(s):(r===this._state||!I.isObject(r))&&(I.get(this._context.getAttributes(),[Te])||this._context.updateAttributes([Te],{}),this._context.updateAttributes([Te,this.id],this._state),s&&this.setState(s))),Xi(r).forEach(a=>{if(!(this.id===null&&a===Te))try{const n=I.isObject(r[a])?JSON.parse(JSON.stringify(r[a])):r[a];_r(n)?(this._state[a]=n.v,I.isObject(n.v)&&this._refMap.set(n.v,n)):this._state[a]=n}catch(n){console.error(n)}}),this._sideEffect.addDisposer(Ma(()=>this.id===null?e.getAttributes():I.get(e.getAttributes(),[Te,this.id]),this._updateProperties.bind(this),this.destroy.bind(this)))}get state(){return this._destroyed&&console.warn(`Accessing state on destroyed Storage "${this.id}"`),this._state}addStateChangedListener(e){return this.onStateChanged.addListener(e),()=>this.onStateChanged.removeListener(e)}ensureState(e){return this.setState(Xi(e).reduce((i,s)=>(I.has(this._state,s)||(i[s]=e[s]),i),{}))}setState(e){if(this._destroyed){console.error(new Error(`Cannot call setState on destroyed Storage "${this.id}".`));return}if(!this._context.isWritable){console.error(new Error(`Cannot setState on Storage "${this.id}" without writable access`),e);return}const i=Xi(e);i.length>0&&i.forEach(s=>{const r=e[s];if(r!==this._state[s])if(r===void 0)this._lastValue.set(s,this._state[s]),delete this._state[s],this._setRawState(s,r);else{this._lastValue.set(s,this._state[s]),this._state[s]=r;let a=r;if(I.isObject(r)){let n=this._refMap.get(r);n||(n=al(r),this._refMap.set(r,n)),a=n}this._setRawState(s,a)}})}emptyStorage(){if(!(I.size(this._state)<=0)){if(this._destroyed){console.error(new Error(`Cannot empty destroyed Storage "${this.id}".`));return}if(!this._context.isWritable){console.error(new Error(`Cannot empty Storage "${this.id}" without writable access.`));return}this.setState(I.mapValues(this._state,I.noop))}}deleteStorage(){if(this.id===null)throw new Error("Cannot delete main Storage");if(!this._context.isWritable){console.error(new Error(`Cannot delete Storage "${this.id}" without writable access.`));return}this.destroy(),this._context.updateAttributes([Te,this.id],void 0)}get destroyed(){return this._destroyed}destroy(){this._destroyed=!0,this._sideEffect.flushAll()}_getRawState(e){var i;return this.id===null?(i=this._context.getAttributes())!=null?i:e:I.get(this._context.getAttributes(),[Te,this.id],e)}_setRawState(e,i){if(this.id===null){if(e===Te)throw new Error(`Cannot set attribute internal filed "${Te}"`);return this._context.updateAttributes([e],i)}else return this._context.updateAttributes([Te,this.id,e],i)}_updateProperties(e){var i;if(this._destroyed){console.error(new Error(`Cannot call _updateProperties on destroyed Storage "${this.id}".`));return}if(e.length>0){const s={};for(let r=0;r<e.length;r++)try{const a=e[r],n=a.key;if(this.id===null&&n===Te)continue;const o=I.isObject(a.value)?JSON.parse(JSON.stringify(a.value)):a.value;let c;switch(this._lastValue.has(n)&&(c=this._lastValue.get(n),this._lastValue.delete(n)),a.kind){case 2:{I.has(this._state,n)&&(c=this._state[n],delete this._state[n]),s[n]={oldValue:c};break}default:{let l=o;if(_r(o)){const{k:d,v:u}=o,p=this._state[n];I.isObject(p)&&((i=this._refMap.get(p))==null?void 0:i.k)===d?l=p:(l=u,I.isObject(u)&&this._refMap.set(u,o))}l!==this._state[n]&&(c=this._state[n],this._state[n]=l),s[n]={newValue:l,oldValue:c};break}}}catch(a){console.error(a)}this.onStateChanged.dispatch(s)}}}class ol{constructor(e,i,s,r){this.view=e,this.appContext=i,this.appProxy=s,this.ensureSize=r,this.nextPage=async()=>{const l=this.pageState.index+1;return this.jumpPage(l)},this.prevPage=async()=>{const l=this.pageState.index-1;return this.jumpPage(l)},this.jumpPage=async l=>l<0||l>=this.pageState.length?(console.warn(`[WindowManager]: index ${l} out of range`),!1):(this.appProxy.setSceneIndex(l),!0),this.addPage=async l=>{const d=l==null?void 0:l.after,u=l==null?void 0:l.scene,p=this.appProxy.scenePath;if(!!p)if(d){const m=this.pageState.index+1;vt(this.appContext.room,p,[u||{}],m)}else vt(this.appContext.room,p,[u||{}])},this.removePage=async l=>{const d=l===void 0?this.pageState.index:l;return this.pageState.length===1?(console.warn("[WindowManager]: can not remove the last page"),!1):d<0||d>=this.pageState.length?(console.warn(`[WindowManager]: page index ${l} out of range`),!1):this.appProxy.removeSceneByIndex(d)};const a=new w.Val(s.pageState),n=new w.Val(s.size$.value),o=l=>I.pick(l,["centerX","centerY","scale"]),c=new w.Val(o(this.view.camera));this.baseRect$=n,this.pageState$=a,this.baseCamera$=c,this.appProxy.sideEffectManager.add(()=>[s.appEmitter.on("pageStateChange",l=>a.setValue(l)),s.camera$.subscribe(l=>{l&&c.setValue(o(l))}),s.size$.subscribe(l=>{l&&n.setValue(I.pick(l,["width","height"]))})]),e.disableCameraTransform=!0}get pageState(){return this.pageState$.value}moveCamera(e){this.appProxy.moveCamera(e)}setBaseRect(e){this.appProxy.updateSize(e.width,e.height)}}const Je=(...t)=>{le.debug&&console.log("[WindowManager]:",...t)},ll=(t,e)=>{const i=document.createElement("div");i.className="netless-window-manager-playground";const s=document.createElement("div");return s.className="netless-window-manager-main-view",e.appendChild(s),t.appendChild(i),{playground:i,mainViewElement:s}},cl=()=>{if(Ir(S.WhiteVersion)<Ir(vr))throw new fa(vr)},Ca=(t,e)=>{const i=t==null?void 0:t.state.roomMembers;return i==null?void 0:i.find(s=>{var r;return((r=s.payload)==null?void 0:r.uid)===e})},kr=t=>t.map(e=>{var i;return R({uid:((i=e.payload)==null?void 0:i.uid)||""},S.toJS(e))}),Tr=async t=>{try{return await t.createInvisiblePlugin(le,{})}catch(e){if(e.message==='invisible plugin "WindowManager" exits')return await Si(200),t.getInvisiblePlugin(le.kind);Je("createInvisiblePlugin failed",e)}};class hl{constructor(e,i,s,r){this.manager=e,this.appId=i,this.appProxy=s,this.appOptions=r,this.mobxUtils={autorun:S.autorun,reaction:S.reaction,toJS:S.toJS},this.objectUtils={listenUpdated:S.listenUpdated,unlistenUpdated:S.unlistenUpdated,listenDisposed:S.listenDisposed,unlistenDisposed:S.unlistenDisposed},this.store=this.manager.store,this.isReplay=this.manager.isReplay,this.getAttributes=()=>this.appProxy.attributes,this.getScenes=()=>{const a=this.store.getAppAttributes(this.appId);return a!=null&&a.isDynamicPPT?this.appProxy.scenes:a==null?void 0:a.options.scenes},this.createWhiteBoardView=a=>{if(this.whiteBoardView)return this.whiteBoardView;let n=this.view;n||(n=this.appProxy.createAppDir()),a&&I.isBoolean(a.syncCamera)&&this.appProxy.syncCamera$.setValue(a.syncCamera);const o=document.createElement("div");return this._viewWrapper=o,o.className="window-manager-view-wrapper",this.box.$main.appendChild(o),n.divElement=o,this.appProxy.fireMemberStateChange(),this.isAddApp&&this.ensurePageSize(a==null?void 0:a.size),this.whiteBoardView=new ol(n,this,this.appProxy,this.ensurePageSize),this.appProxy.sideEffectManager.add(()=>[this.box._stageRect$.subscribe(c=>{o.style.left=`${c.x}px`,o.style.top=`${c.y}px`,o.style.width=`${c.width}px`,o.style.height=`${c.height}px`}),()=>()=>{this.whiteBoardView=void 0}]),this.appProxy.whiteBoardViewCreated$.setValue(!0),this.whiteBoardView},this.ensurePageSize=a=>{var c;if(!I.isNumber(a)||!this.appProxy.scenePath||this.appProxy.pageState.length>=a)return;if(a<=0||a>=xr)throw Error(`[WindowManager]: size ${a} muse be in range [1, ${xr}]`);const n=a-this.appProxy.pageState.length,o=new Array(n).fill({});(c=this.room)==null||c.putScenes(this.appProxy.scenePath,o)},this.getInitScenePath=()=>this.appProxy.scenePath,this.setAttributes=a=>{this.manager.safeSetAttributes({[this.appId]:a})},this.updateAttributes=(a,n)=>{this.manager.attributes[this.appId]&&this.manager.safeUpdateAttributes([this.appId,...a],n)},this.setScenePath=async a=>{var n;!this.appProxy.box||(this.appProxy.setFullPath(a),(n=this.room)==null||n.setScenePath(a))},this.getAppOptions=()=>typeof this.appOptions=="function"?this.appOptions():this.appOptions,this.createStorage=(a,n)=>{const o=new Ar(this,a,n);return this.emitter.on("destroy",()=>{o.destroy()}),o},this.dispatchMagixEvent=(...a)=>{var o;const n=`${this.appId}:${a[0]}`;return(o=this.manager.room)==null?void 0:o.dispatchMagixEvent(n,a[1])},this.addMagixEventListener=(a,n,o)=>{const c=`${this.appId}:${a}`;return this.manager.displayer.addMagixEventListener(c,n,o),()=>this.manager.displayer.removeMagixEventListener(c,n)},this.removeMagixEventListener=this.manager.displayer.removeMagixEventListener.bind(this.manager.displayer),this.emitter=s.appEmitter,this.isAddApp=s.isAddApp}get displayer(){return this.manager.displayer}get destroyed(){return this.appProxy.status==="destroyed"}get view(){return this.appProxy.view}get now(){if(this.isReplay){const e=this.displayer;return e.beginTimestamp+e.progressTime}else return this.displayer.calibrationTimestamp}get isWritable(){return this.manager.canOperate&&!this.destroyed}get box(){const e=this.appProxy.box$.value;if(e)return e;throw new ya}get room(){return this.manager.room}get members(){return this.manager.members$.value}get currentMember(){const e=Ca(this.room,this.manager.uid);if(!e)throw new Error(`Member ${this.manager.uid} not found.`);return R({uid:this.manager.uid},e)}get storage(){return this._storage||(this._storage=new Ar(this)),this._storage}}class dl{constructor(e){this.params=e,this.sceneNode=null,this.createSceneNode=r=>(this.scenePath=r,this.sceneNode&&this.sceneNode.dispose(),this.sceneNode=this.params.displayer.createScenesCallback(r,{onAddScene:this.onSceneChange,onRemoveScene:this.onSceneChange}),this.sceneNode),this.onSceneChange=()=>{this.params.notifyPageStateChange()};const{displayer:i,scenePath:s}=this.params;this.view=this.params.view,s&&(this.scenePath=s,this.sceneNode=i.createScenesCallback(s,{onAddScene:this.onSceneChange,onRemoveScene:this.onSceneChange}))}setView(e){this.view=e}getFullPath(e){var s;const i=(s=this.sceneNode)==null?void 0:s.scenes;if(this.scenePath&&i){const r=i[e];if(r)return`${this.scenePath}/${r}`}}toObject(){var e,i;return{index:((e=this.view)==null?void 0:e.focusSceneIndex)||0,length:((i=this.sceneNode)==null?void 0:i.scenes.length)||0}}destroy(){var e;(e=this.sceneNode)==null||e.dispose()}}class Ia{constructor(e){this.context=e,this.sem=new ve.SideEffectManager,this.bindView=s=>{!s||(this.synchronizer.setView(s),this.sem.flush("view"),this.sem.add(()=>(s.callbacks.on("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice),()=>s.callbacks.off("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice)),"view"))},this.onCameraUpdatedByDevice=s=>{if(!!s&&this.context.size$.value&&this.context.stageRect$.value){const r=Ei(this.context.size$.value,this.context.stageRect$.value),a=s.scale/r;this.synchronizer.onLocalCameraUpdate(he(R({},s),{scale:a,id:this.context.uid}))}},this.synchronizer=new tl(s=>{this.context.camera$.setValue(s,!0),!(this.context.viewMode$&&this.context.viewMode$.value===S.ViewMode.Freedom)&&this.context.storeCamera(s)}),this.bindView(this.context.view$.value),this.sem.add(()=>[this.context.view$.subscribe(s=>{const r=this.context.camera$.value;r&&this.context.size$.value&&(s==null||s.moveCamera({scale:1,animationMode:S.AnimationMode.Immediately}),this.synchronizer.onRemoteUpdate(r,this.context.size$.value)),this.bindView(s)}),this.context.camera$.subscribe((s,r)=>{const a=this.context.size$.value;s&&a&&!r&&this.synchronizer.onRemoteUpdate(s,a)}),this.context.size$.subscribe(s=>{s&&this.synchronizer.onRemoteSizeUpdate(s)}),this.context.stageRect$.subscribe(s=>{s&&this.synchronizer.setRect(s)})]);const i=w.combine([this.context.camera$,this.context.size$]);i.reaction(([s,r])=>{s&&r&&(this.synchronizer.onRemoteUpdate(s,r),i.destroy())})}destroy(){this.sem.flushAll()}}const Ue=new rt.default,Vs=(t,e)=>{let i=0;const s=e.length-1;return t===e.index?t===s?i=t-1:i=e.index+1:i=e.index,i};var ee=(t=>(t.Apps="apps",t.Focus="focus",t.State="state",t.BoxState="boxState",t.MainViewCamera="mainViewCamera",t.MainViewSize="mainViewSize",t.Broadcaster="broadcaster",t.Cursors="cursors",t.Position="position",t.CursorState="cursorState",t.FullPath="fullPath",t.Registered="registered",t.Camera="camera",t.Size="size",t))(ee||{});class ul{constructor(e){this.context=e,this.setAppFocus=(i,s)=>{s?this.context.safeSetAttributes({focus:i}):this.context.safeSetAttributes({focus:void 0})}}setContext(e){this.context=e}get attributes(){return this.context.getAttributes()}apps(){return I.get(this.attributes,["apps"])}get focus(){return I.get(this.attributes,["focus"])}getAppAttributes(e){return I.get(this.apps(),[e])}getAppState(e){return I.get(this.apps(),[e,"state"])}getMaximized(){return I.get(this.attributes,["maximized"])}getMinimized(){return I.get(this.attributes,["minimized"])}setupAppAttributes(e,i,s){this.attributes.apps||this.context.safeSetAttributes({apps:{}});const a=["scenePath","title"];s||a.push("scenes");const n=I.pick(e.options,a),o={kind:e.kind,options:n,isDynamicPPT:s,setup:!1};typeof e.src=="string"&&(o.src=e.src),o.createdAt=Date.now(),this.context.safeUpdateAttributes(["apps",i],o),this.context.safeUpdateAttributes(["apps",i,"state"],{[Ee.Size]:{},[Ee.Position]:{},[Ee.SceneIndex]:0})}updateAppState(e,i,s){I.get(this.attributes,["apps",e,"state"])&&this.context.safeUpdateAttributes(["apps",e,"state",i],s)}updateAppAttributes(e,i,s){this.context.safeUpdateAttributes(["apps",e,i],s)}cleanAppAttributes(e){this.context.safeUpdateAttributes(["apps",e],void 0),this.context.safeSetAttributes({[e]:void 0}),this.attributes.focus===e&&this.cleanFocus()}cleanFocus(){this.context.safeSetAttributes({focus:void 0})}getAppSceneIndex(e){var i;return(i=this.getAppState(e))==null?void 0:i[Ee.SceneIndex]}getAppScenePath(e){var i,s;return(s=(i=this.getAppAttributes(e))==null?void 0:i.options)==null?void 0:s.scenePath}getMainViewScenePath(){return this.attributes._mainScenePath}getMainViewSceneIndex(){return this.attributes._mainSceneIndex}getBoxState(){return this.attributes.boxState}setMainViewScenePath(e){this.context.safeSetAttributes({_mainScenePath:e})}setMainViewSceneIndex(e){this.context.safeSetAttributes({_mainSceneIndex:e})}getMainViewCamera(){return I.get(this.attributes,["mainViewCamera"])}getMainViewSize(){return I.get(this.attributes,["mainViewSize"])}setMainViewCamera(e){this.context.safeSetAttributes({mainViewCamera:R({},e)})}setMainViewSize(e){this.context.safeSetAttributes({mainViewSize:R({},e)})}setMainViewCameraAndSize(e,i){this.context.safeSetAttributes({mainViewCamera:R({},e),mainViewSize:R({},i)})}updateCursor(e,i){I.get(this.attributes,["cursors"])||this.context.safeUpdateAttributes(["cursors"],{}),I.get(this.attributes,["cursors",e])||this.context.safeUpdateAttributes(["cursors",e],{}),this.context.safeUpdateAttributes(["cursors",e,"position"],i)}updateCursorState(e,i){I.get(this.attributes,["cursors",e])||this.context.safeUpdateAttributes(["cursors",e],{}),this.context.safeUpdateAttributes(["cursors",e,"cursorState"],i)}getCursorState(e){return I.get(this.attributes,["cursors",e,"cursorState"])}cleanCursor(e){this.context.safeUpdateAttributes(["cursors",e],void 0)}setMainViewFocusPath(e){const i=this.getMainViewScenePath();i&&dt(e,i)}}const pl=new ul({getAttributes:()=>{throw new Error("getAttributes not implemented")},safeSetAttributes:()=>{throw new Error("safeSetAttributes not implemented")},safeUpdateAttributes:()=>{throw new Error("safeUpdateAttributes not implemented")}});class $s{constructor(e,i,s,r){var a;this.params=e,this.manager=i,this.boxManager=this.manager.boxManager,this.appProxies=this.manager.appProxies,this.viewManager=this.manager.viewManager,this.store=this.manager.store,this.uid=this.manager.uid,this.status="normal",this.sideEffectManager=new ve.SideEffectManager,this.valManager=new w.ValManager,this.fullPath$=this.valManager.attach(new w.Val(void 0)),this.camera$=this.valManager.attach(new w.Val(void 0)),this.size$=this.valManager.attach(new w.Val(void 0)),this.box$=this.valManager.attach(new w.Val(void 0)),this.view$=this.valManager.attach(new w.Val(void 0)),this.syncCamera$=this.valManager.attach(new w.Val(!0)),this.whiteBoardViewCreated$=this.valManager.attach(new w.Val(!1)),this.fireMemberStateChange=()=>{this.manager.room&&this.onMemberStateChange(this.manager.room.state.memberState)},this.onMemberStateChange=n=>{var c,l;n.currentApplianceName==="clicker"?(c=this.appContext)!=null&&c._viewWrapper&&(this.appContext._viewWrapper.style.pointerEvents="none"):(l=this.appContext)!=null&&l._viewWrapper&&(this.appContext._viewWrapper.style.pointerEvents="auto")},this.computedInitialRect=n=>{var c;const o=(c=this.manager.boxManager)==null?void 0:c.stageRect;if(o){const{width:l,height:d}=o,u=n.height/n.width;return d<480?{width:480/u,height:480}:{width:l*.65,height:d*.65}}},this.getAppInitState=n=>{var m,g;const o=this.store.getAppState(n);if(!o)return;const c=this.store.focus,l=(m=this.attributes)==null?void 0:m.maximized,d=(g=this.attributes)==null?void 0:g.minimized;let u={maximized:l,minimized:d,id:n};const p=I.omitBy(o,I.isUndefined);return c===n&&(u=he(R({},u),{focus:!0})),Object.assign(u,p)},this.appAttributesUpdateListener=n=>{this.sideEffectManager.add(()=>[this.manager.refresher.add(n,()=>S.autorun(()=>{const o=this.manager.attributes[n];o&&this.appEmitter.emit("attributesUpdate",o)})),this.manager.refresher.add(this.stateKey,()=>S.autorun(()=>{var c,l,d;const o=(c=this.appAttributes)==null?void 0:c.state;(o==null?void 0:o.zIndex)>0&&o.zIndex!==((l=this.box)==null?void 0:l.zIndex)&&((d=this.boxManager)==null||d.setZIndex(n,o.zIndex))})),this.manager.refresher.add(`${n}-fullPath`,()=>S.autorun(()=>{var c;const o=(c=this.appAttributes)==null?void 0:c.fullPath;this.setFocusScenePathHandler(o),this.fullPath$.value!==o&&(this.notifyPageStateChange(),this.fullPath$.setValue(o))}))])},this.setFocusScenePathHandler=I.debounce(n=>{var o;this.view&&n&&n!==((o=this.view)==null?void 0:o.focusScenePath)&&dt(this.view,n)},50),this.notifyPageStateChange=I.debounce(()=>{this.pageState&&this.appEmitter.emit("pageStateChange",this.pageState)},50),this.storeCamera=n=>{this.store.updateAppAttributes(this.id,ee.Camera,n)},this.storeSize=n=>{this.store.updateAppAttributes(this.id,ee.Size,n)},this.updateSize=(n,o)=>{const c={id:this.manager.uid,width:n,height:o};this.store.updateAppAttributes(this.id,ee.Size,c),this.size$.setValue(c)},this.moveCamera=n=>{if(!this.camera$.value)return;const o=he(R(R({},this.camera$.value),n),{id:this.uid});this.storeCamera(o),this.camera$.setValue(o)},this.addCameraReaction=()=>{this.sideEffectManager.add(()=>this.manager.refresher.add(`${this.id}-camera`,()=>S.reaction(()=>{var n;return(n=this.appAttributes)==null?void 0:n.camera},n=>{if(n){const o=S.toJS(n);I.isEqual(o,this.camera$.value)||this.camera$.setValue(o)}})),"camera")},this.addSizeReaction=()=>{this.sideEffectManager.add(()=>this.manager.refresher.add(`${this.id}-size`,()=>S.reaction(()=>{var n;return(n=this.appAttributes)==null?void 0:n.size},n=>{if(n){const o=S.toJS(n);I.isEqual(o,this.size$.value)||this.size$.setValue(o)}})),"size")},this.onFocus=()=>{this.setScenePath()},this.setupDone=()=>{this.store.updateAppAttributes(this.id,"setup",!0),this.manager.dispatchInternalEvent(Y.InvokeAttributesUpdateCallback)},this.kind=e.kind,this.id=s,this.appScenePath=`/${this.id}-app-dir`,this.stateKey=`${this.id}_state`,this.appProxies.set(this.id,this),this.appEmitter=new rt.default,this.appListener=this.makeAppEventListener(this.id),this.isAddApp=r,this.initScenes(),(a=this.params.options)!=null&&a.scenePath&&this.createView(),this.scenePath||(this.scenePath=this.appScenePath),this._pageState=new dl({displayer:this.manager.displayer,scenePath:this.scenePath,view:this.view,notifyPageStateChange:this.notifyPageStateChange}),this.sideEffectManager.add(()=>()=>this._pageState.destroy()),this.camera$.setValue(S.toJS(this.appAttributes.camera)),this.size$.setValue(S.toJS(this.appAttributes.size)),this.addCameraReaction(),this.addSizeReaction(),this.sideEffectManager.add(()=>P.on("memberStateChange",this.onMemberStateChange)),this.sideEffectManager.add(()=>[this.syncCamera$.reaction(n=>{n||this.viewSync&&(this.viewSync.destroy(),this.viewSync=void 0,this.sideEffectManager.flush("camera"),this.sideEffectManager.flush("size"))}),this.whiteBoardViewCreated$.reaction(n=>{if(n&&this.box){if(!this.syncCamera$.value)return;w.combine([this.box$,this.view$]).subscribe(([o,c])=>{if(o&&c){if(this.camera$.value||(this.storeCamera({centerX:null,centerY:null,scale:1,id:this.uid}),this.camera$.setValue(S.toJS(this.appAttributes.camera))),!this.size$.value&&o.stageRect){const l=this.computedInitialRect(o.stageRect),d=(l==null?void 0:l.width)||o.stageRect.width,u=(l==null?void 0:l.height)||o.stageRect.height;this.storeSize({id:this.uid,width:d,height:u}),this.size$.setValue(S.toJS(this.appAttributes.size))}this.viewSync=new Ia({uid:this.uid,view$:this.view$,camera$:this.camera$,size$:this.size$,stageRect$:o._stageRect$,storeCamera:this.storeCamera,storeSize:this.storeSize}),this.sideEffectManager.add(()=>()=>{var l;return(l=this.viewSync)==null?void 0:l.destroy()}),this.whiteBoardViewCreated$.destroy()}})}}),this.manager.members$.reaction(n=>{this.appEmitter.emit("roomMembersChange",n)})])}createAppDir(){const e=this.scenePath||this.appScenePath;this._pageState.createSceneNode(e)||(vt(this.manager.room,e,[{name:"1"}]),this._pageState.createSceneNode(e),this.setSceneIndex(0)),this.scenes=ut(this.manager.displayer)[e];const s=this.createView();return this._pageState.setView(s),s}initScenes(){var i;const e=this.params.options;e&&(this.scenePath=e.scenePath,((i=this.appAttributes)==null?void 0:i.isDynamicPPT)&&this.scenePath?this.scenes=ut(this.manager.displayer)[this.scenePath]:this.scenes=e.scenes)}get view(){return this.view$.value}get viewIndex(){var e;return(e=this.view)==null?void 0:e.focusSceneIndex}get isWritable(){var e;return this.manager.canOperate&&!((e=this.box)!=null&&e.readonly)}get attributes(){return this.manager.attributes[this.id]}get appAttributes(){return this.store.getAppAttributes(this.id)}getFullScenePath(){if(this.scenePath)return I.get(this.appAttributes,[ee.FullPath])||this.getFullScenePathFromScenes()}getFullScenePathFromScenes(){const e=I.get(this.appAttributes,["state","SceneIndex"],0),i=Go(this.manager.room,this.scenePath,e);return i&&this.setFullPath(i),i}setFullPath(e){this.store.updateAppAttributes(this.id,ee.FullPath,e)}async baseInsertApp(e=!1){var a;const i=this.params;if(!i.kind)throw new Error("[WindowManager]: kind require");const s=await((a=pe.appClasses.get(i.kind))==null?void 0:a()),r=pe.registered.get(i.kind);if(s)await this.setupApp(this.id,e,s,i.options,r==null?void 0:r.appOptions);else throw new Error(`[WindowManager]: app load failed ${i.kind} ${i.src}`);return P.emit("updateManagerRect"),{appId:this.id,app:s}}get box(){return this.box$.value}async setupApp(e,i,s,r,a){var o;if(Je("setupApp",e,s,r),!this.boxManager)throw new va;const n=new hl(this.manager,e,this,a);this.appContext=n;try{P.once(`${e}${Y.WindowCreated}`).then(async()=>{var u;let d;i||(d=this.getAppInitState(e),(u=this.boxManager)==null||u.updateBoxState(d)),this.appEmitter.onAny(this.appListener),this.appAttributesUpdateListener(e),this.setViewFocusScenePath(),setTimeout(async()=>{const p=await s.setup(n);this.appResult=p,pe.notifyApp(this.kind,"created",{appId:e,result:p}),this.fixMobileSize(),this.isAddApp&&this.setupDone()},ga)});const c=(o=this.boxManager)==null?void 0:o.createBox({appId:e,app:s,options:r,canOperate:this.manager.canOperate,smartPosition:this.isAddApp}),l=pe.registered.get(this.kind);l!=null&&l.contentStyles&&(c==null||c.mountUserStyles(l.contentStyles)),this.box$.setValue(c),this.isAddApp&&this.box&&(this.store.updateAppState(e,Ee.ZIndex,this.box.zIndex),this.store.updateAppState(e,Ee.Size,{width:this.box.intrinsicWidth,height:this.box.intrinsicHeight}),this.boxManager.focusBox({appId:e},!1))}catch(c){throw console.error(c),new Error(`[WindowManager]: app setup error: ${c.message}`)}}fixMobileSize(){var i,s;const e=(i=this.boxManager)==null?void 0:i.getBox(this.id);e&&(e.minimized||(s=this.boxManager)==null||s.resizeBox({appId:this.id,width:e.intrinsicWidth+.001,height:e.intrinsicHeight+.001,skipUpdate:!0}))}async onSeek(e){var s;this.appEmitter.emit("seek",e).catch(r=>{console.log(`[WindowManager]: emit seek error: ${r.message}`)});const i=this.getAppInitState(this.id);(s=this.boxManager)==null||s.updateBoxState(i)}async onReconnected(){var a;if(!Boolean(this.manager.attributes.apps[this.id])){await this.destroy(!0,!1,!0);return}this.appEmitter.emit("reconnected",void 0);const i=this.getAppInitState(this.id);await this.destroy(!0,!1,!0);const s=this.params;await new $s(s,this.manager,this.id,this.isAddApp).baseInsertApp(!0),(a=this.boxManager)==null||a.updateBoxState(i)}async onRemoveScene(e){if(this.scenePath&&e.startsWith(this.scenePath+"/")){let i=this.pageState.index,s=this._pageState.getFullPath(i);s||(i=0,s=this._pageState.getFullPath(i)),s&&this.setFullPath(s),this.setViewFocusScenePath(),this.view&&(this.view.focusSceneIndex=i)}}emitAppSceneStateChange(e){this.appEmitter.emit("sceneStateChange",e)}emitAppIsWritableChange(){this.appEmitter.emit("writableChange",this.isWritable)}makeAppEventListener(e){return(i,s)=>{var r,a,n,o;if(!!this.manager.canOperate)switch(i){case"setBoxSize":{(r=this.boxManager)==null||r.resizeBox({appId:e,width:s.width,height:s.height,skipUpdate:!1});break}case"setBoxMinSize":{(a=this.boxManager)==null||a.setBoxMinSize({appId:e,minWidth:s.minwidth,minHeight:s.minheight});break}case"setBoxTitle":{(n=this.boxManager)==null||n.setBoxTitle({appId:e,title:s.title});break}case da.destroy:{if(this.status==="destroyed")return;this.destroy(!0,!1,!0,s==null?void 0:s.error),s!=null&&s.error&&console.error(s==null?void 0:s.error);break}case"focus":{(o=this.boxManager)==null||o.focusBox({appId:this.id}),Ue.emit("focus",{appId:this.id});break}}}}setScenePath(){if(!this.manager.canOperate)return;const e=this.getFullScenePath();this.manager.room&&e&&this.view&&Yt(this.manager.room,e)}setViewFocusScenePath(){if(this.status==="destroyed")return;const e=this.getFullScenePath();return e&&this.view&&dt(this.view,e),e}createView(){const e=this.viewManager.createView(this.id);return this.view$.setValue(e),this.setViewFocusScenePath(),e}get pageState(){return this._pageState.toObject()}async removeSceneByIndex(e){const i=this._pageState.getFullPath(e);if(i&&this.pageState){const s=Vs(e,this.pageState);return this.setSceneIndexWithoutSync(s),this.manager.dispatchInternalEvent(Y.SetAppFocusIndex,{type:"app",appID:this.id,index:s}),setTimeout(()=>{gs(this.manager.room,i,e)},100),!0}else return!1}setSceneIndexWithoutSync(e){this.view&&(this.view.focusSceneIndex=e)}setSceneIndex(e){if(this.view){this.view.focusSceneIndex=e;const i=this._pageState.getFullPath(e);i&&(this.setFullPath(i),Yt(this.manager.room,i))}}async destroy(e,i,s,r){var a;if(this.status!=="destroyed"){this.status="destroyed";try{await pe.notifyApp(this.kind,"destroy",{appId:this.id}),Q.emit("appClose",{appId:this.id,kind:this.kind,error:r}),await this.appEmitter.emit("destroy",{error:r})}catch(n){console.error("[WindowManager]: notifyApp error",n.message,n.stack)}this.appEmitter.clearListeners(),this.sideEffectManager.flushAll(),P.emit(`destroy-${this.id}`,{error:r}),e&&((a=this.boxManager)==null||a.closeBox(this.id,s)),i&&(this.store.cleanAppAttributes(this.id),this.scenePath&&gs(this.manager.room,this.scenePath)),this.appProxies.delete(this.id),this.viewManager.destroyView(this.id),this.manager.appStatus.delete(this.id),this.valManager.destroy()}}close(){return this.destroy(!0,!0,!1)}}class gl{constructor(e){this.displayer=e,this.views=new Map}createView(e){const i=_a(this.displayer);return this.views.set(e,i),i}getView(e){return this.views.get(e)}destroyView(e){const i=this.views.get(e);if(i){try{i.release()}catch{}this.views.delete(e)}}setViewScenePath(e,i){const s=this.views.get(e);s&&(s.focusScenePath=i)}destroy(){this.views.forEach(e=>{try{e.release()}catch{}}),this.views.clear()}}const _a=t=>{const e=t.views.createView();return ml(e),e},ml=t=>{t.setCameraBound({maxContentMode:()=>10,minContentMode:()=>.1})};class fl{constructor(e){this.manager=e,this.started=!1,this.mainViewIsAddListener=!1,this.store=this.manager.store,this.sideEffectManager=new ve.SideEffectManager,this.camera$=new w.Val(void 0),this.size$=new w.Val(void 0),this.view$=new w.Val(void 0),this.createViewSync=()=>{var i;this.manager.boxManager&&!this.viewSync&&(this.viewSync=new Ia({uid:this.manager.uid,view$:this.view$,camera$:this.camera$,size$:this.size$,stageRect$:(i=this.manager.boxManager)==null?void 0:i.stageRect$,viewMode$:this.manager.windowManger.viewMode$,storeCamera:this.storeCamera,storeSize:this.storeSize}))},this.startListenWritableChange=()=>{this.sideEffectManager.add(()=>P.on("writableChange",i=>{i&&this.ensureCameraAndSize()}))},this.addCameraReaction=()=>{this.manager.refresher.add(ee.MainViewCamera,this.cameraReaction),this.manager.refresher.add(ee.MainViewSize,this.sizeReaction)},this.storeCurrentCamera=()=>{const i=this.view.camera;this.storeCamera(R({id:this.manager.uid},i))},this.storeCurrentSize=()=>{var s;const i=(s=this.manager.boxManager)==null?void 0:s.stageRect;i&&this.storeSize({id:this.manager.uid,width:i.width,height:i.height})},this.storeCamera=i=>{this.store.setMainViewCamera(i)},this.storeSize=i=>{this.store.setMainViewSize(i)},this.cameraReaction=()=>S.reaction(()=>this.mainViewCamera,i=>{if(i){const s=S.toJS(i);I.isEqual(s,this.camera$.value)||this.camera$.setValue(s)}},{fireImmediately:!0}),this.sizeReaction=()=>S.reaction(()=>this.mainViewSize,i=>{if(i){const s=S.toJS(i);I.isEqual(s,this.size$.value)||this.size$.setValue(s)}},{fireImmediately:!0}),this.mainViewClickListener=()=>{this.mainViewClickHandler()},this.setMainViewSize=I.debounce(i=>{this.store.setMainViewSize(he(R({},i),{id:this.manager.uid}))},50),this.onCameraOrSizeUpdated=()=>{Q.emit("cameraStateChange",this.cameraState)},this.mainView=this.createMainView(),P.once("mainViewMounted").then(()=>{this.addMainViewListener(),this.start(),this.ensureCameraAndSize(),this.startListenWritableChange()}),this.sideEffectManager.add(()=>[P.on("startReconnect",()=>{Cr(this.mainView)})]),this.createViewSync(),this.sideEffectManager.add(()=>P.on("focusedChange",({focused:i})=>{if(i===void 0){const s=this.store.getMainViewScenePath();s&&Yt(this.manager.room,s)}})),this.camera$.reaction(i=>{i&&Q.emit("baseCameraChange",i)}),this.size$.reaction(i=>{i&&Q.emit("baseSizeChange",i)})}ensureCameraAndSize(){var e;if(!this.mainViewCamera||!this.mainViewSize){this.manager.dispatchInternalEvent(Y.InitMainViewCamera),this.storeCamera(R({id:this.manager.uid},this.view.camera));const i=(e=this.manager.boxManager)==null?void 0:e.stageRect;i&&!this.mainViewSize&&this.storeSize({id:this.manager.uid,width:i.width,height:i.height})}}get mainViewCamera(){return this.store.getMainViewCamera()}get mainViewSize(){return this.store.getMainViewSize()}get didRelease(){return I.get(this.view,["didRelease"])}start(){this.started||(this.addCameraListener(),this.addCameraReaction(),this.started=!0)}get view(){return this.mainView}get cameraState(){return R(R({},this.view.camera),this.view.size)}createMainView(){const e=_a(this.manager.displayer),i=this.store.getMainViewScenePath();return i&&dt(e,i),this.view$.setValue(e),e}onReconnect(){if(this.didRelease)this.rebind();else{const e=this.store.getMainViewScenePath();this.setFocusScenePath(e)}}setFocusScenePath(e){if(e)return dt(this.view,e)}rebind(){const e=this.mainView.divElement,i=this.mainView.disableCameraTransform,s=R({},this.mainView.camera);this.stop(),Cr(this.mainView),this.removeMainViewListener(),this.mainView=this.createMainView(),this.mainView.disableCameraTransform=i,this.mainView.divElement=e,this.mainView.moveCamera(he(R({},s),{animationMode:S.AnimationMode.Immediately})),this.addMainViewListener(),this.start()}addMainViewListener(){this.mainViewIsAddListener||this.view.divElement&&(this.view.divElement.addEventListener("click",this.mainViewClickListener),this.view.divElement.addEventListener("touchend",this.mainViewClickListener),this.mainViewIsAddListener=!0)}removeMainViewListener(){this.view.divElement&&(this.view.divElement.removeEventListener("click",this.mainViewClickListener),this.view.divElement.removeEventListener("touchend",this.mainViewClickListener)),this.mainViewIsAddListener=!1}async mainViewClickHandler(){var e;!this.manager.canOperate||(this.store.cleanFocus(),(e=this.manager.boxManager)==null||e.blurAllBox())}addCameraListener(){this.view.callbacks.on("onCameraUpdated",this.onCameraOrSizeUpdated),this.view.callbacks.on("onSizeUpdated",this.onCameraOrSizeUpdated)}removeCameraListener(){this.view.callbacks.off("onCameraUpdated",this.onCameraOrSizeUpdated),this.view.callbacks.off("onSizeUpdated",this.onCameraOrSizeUpdated)}stop(){this.removeCameraListener(),this.manager.refresher.remove(ee.MainViewCamera),this.manager.refresher.remove(ee.MainViewSize),this.started=!1}destroy(){this.camera$.destroy(),this.size$.destroy(),this.view$.destroy(),this.removeMainViewListener(),this.stop(),this.sideEffectManager.flushAll()}}class bl{constructor(e){this.context=e,this.addRedoUndoListeners=i=>{if(i===void 0)this.addViewCallbacks(this.context.mainView(),this.onCanRedoStepsUpdate,this.onCanUndoStepsUpdate);else{const s=this.context.getAppProxy(i);s&&s.view&&this.addViewCallbacks(s.view,this.onCanRedoStepsUpdate,this.onCanUndoStepsUpdate)}},this.addViewCallbacks=(i,s,r)=>{s(i.canRedoSteps),r(i.canUndoSteps),i.callbacks.on("onCanRedoStepsUpdate",s),i.callbacks.on("onCanUndoStepsUpdate",r)},this.disposeViewCallbacks=i=>{i.callbacks.off("onCanRedoStepsUpdate",this.onCanRedoStepsUpdate),i.callbacks.off("onCanUndoStepsUpdate",this.onCanUndoStepsUpdate)},this.onCanRedoStepsUpdate=i=>{Q.emit("canRedoStepsChange",i)},this.onCanUndoStepsUpdate=i=>{Q.emit("canUndoStepsChange",i)},this.disposePrevFocusViewRedoUndoListeners=i=>{let s;if(i===void 0)s=this.context.mainView();else{const r=this.context.getAppProxy(i);r&&r.view&&(s=r.view)}s&&this.disposeViewCallbacks(s)},P.on("focusedChange",i=>{this.disposePrevFocusViewRedoUndoListeners(i.prev),setTimeout(()=>{this.addRedoUndoListeners(i.focused)},0)}),P.on("rootDirRemoved",()=>{this.disposePrevFocusViewRedoUndoListeners(e.focus()),this.addRedoUndoListeners(e.focus())}),this.addRedoUndoListeners(e.focus())}destroy(){this.disposePrevFocusViewRedoUndoListeners(this.context.focus())}}class yl{constructor(e){this.windowManger=e,this.appProxies=new Map,this.appStatus=new Map,this.store=pl,this.isReplay=this.windowManger.isReplay,this.mainViewScenesLength=0,this.callbacksNode=null,this.appCreateQueue=new Do,this.sceneIndex$=new w.Val(void 0),this.focused$=new w.Val(void 0),this.members$=new w.Val([]),this.sideEffectManager=new ve.SideEffectManager,this.sceneState=null,this.rootDirRemoving=!1,this.onRemoveScenes=async i=>{var r,a;const{scenePath:s}=i;if(s===we){await this.onRootDirRemoved(),this.dispatchInternalEvent(Y.RootDirRemoved);return}if(el(s)){let n=this.mainView.focusSceneIndex||0,o=(r=this.callbacksNode)==null?void 0:r.scenes[n];o||(n=0,o=(a=this.callbacksNode)==null?void 0:a.scenes[n]),o&&await this.setMainViewScenePath(`${we}${o}`),await this.setMainViewSceneIndex(n)}else this.appProxies.forEach(n=>{n.onRemoveScene(s)})},this.onReadonlyChanged=()=>{this.appProxies.forEach(i=>{i.emitAppIsWritableChange()})},this.onPlayerSeekStart=async()=>{await this.closeAll()},this.onPlayerSeekDone=async i=>{await this.attributesUpdateCallback(this.attributes.apps),this.appProxies.forEach(s=>{s.onSeek(i)})},this.createRootDirScenesCallback=()=>{let i=!1;this.callbacksNode&&(this.callbacksNode.dispose(),i=!0),this.callbacksNode=this.displayer.createScenesCallback(we,{onAddScene:this.onSceneChange,onRemoveScene:async(s,r)=>{await this.onSceneChange(s),P.emit("rootDirSceneRemoved",r)}}),this.callbacksNode&&(this.updateSceneState(this.callbacksNode),this.mainViewScenesLength=this.callbacksNode.scenes.length,i&&this.emitMainViewScenesChange(this.callbacksNode.scenes.length))},this.removeSceneByIndex=async i=>{var a;const s=Vs(i,this.windowManger.pageState);this.setSceneIndexWithoutSync(s),this.dispatchInternalEvent(Y.SetAppFocusIndex,{type:"main",index:s});const r=(a=this.callbacksNode)==null?void 0:a.scenes[i];return setTimeout(()=>{r&&gs(this.room,`${we}${r}`,i)},100),new Promise((n,o)=>{P.once("rootDirSceneRemoved").then(c=>{c===r&&n(!0)}).catch(c=>{console.log(`[WindowManager]: removePage error: ${c}`),o(!1)})})},this.setSceneIndexWithoutSync=i=>{var r;const s=(r=this.callbacksNode)==null?void 0:r.scenes[i];s&&this.mainViewProxy.setFocusScenePath(`${we}${s}`)},this.onSceneChange=i=>(this.mainViewScenesLength=i.scenes.length,this.updateSceneState(i),this.emitMainViewScenesChange(this.mainViewScenesLength)),this.emitMainViewScenesChange=i=>Promise.all([Q.emit("mainViewScenesLengthChange",i),P.emit("changePageState")]),this.updateSceneState=i=>{const s=this.store.getMainViewSceneIndex()||0;let r=i.scenes[s];r||(r=i.scenes[this.mainView.focusSceneIndex||0]),this.sceneState={scenePath:`${we}${r}`,contextPath:i.path,index:s,scenes:i.scenes.map(a=>({name:a})),sceneName:r},Q.emit("sceneStateChange",this.sceneState)},this.onBoxMove=i=>{this.dispatchInternalEvent(Y.AppMove,i),this.store.updateAppState(i.appId,Ee.Position,{x:i.x,y:i.y})},this.onBoxResize=i=>{i.width&&i.height&&(this.dispatchInternalEvent(Y.AppResize,i),this.store.updateAppState(i.appId,Ee.Size,{width:i.width,height:i.height}))},this.onBoxFocus=i=>{this.windowManger.safeSetAttributes({focus:i.appId})},this.onBoxClose=i=>{const s=this.appProxies.get(i.appId);s&&s.destroy(!1,!0,!0,i.error)},this.onBoxStateChange=i=>{this.dispatchInternalEvent(Y.AppBoxStateChange,i)},this.addAppsChangeListener=()=>{this.refresher.add("apps",()=>Ma(()=>this.attributes.apps,()=>{this.attributesUpdateCallback(this.attributes.apps)}))},this.addAppCloseListener=()=>{var i;(i=this.refresher)==null||i.add("appsClose",()=>rl(this.attributes.apps,()=>{this.onAppDelete(this.attributes.apps)}))},this.onMainViewIndexChange=i=>{i!==void 0&&this.sceneIndex$.value!==i&&(Q.emit("mainViewSceneIndexChange",i),P.emit("changePageState"),this.callbacksNode&&this.updateSceneState(this.callbacksNode),this.sceneIndex$.setValue(i))},this.onFocusChange=i=>{var s;this.focused$.value!==i&&(Q.emit("focusedChange",i),P.emit("focusedChange",{focused:i,prev:this.focused$.value}),this.focused$.setValue(i),i!==void 0&&((s=this.boxManager)==null||s.focusBox({appId:i}),setTimeout(()=>{const r=this.appProxies.get(i);r&&(r.onFocus(),pe.notifyApp(r.kind,"focus",{appId:i}))},0)))},this.attributesUpdateCallback=I.debounce(i=>this._attributesUpdateCallback(i),100),this.onRegisteredChange=i=>{!i||Object.entries(i).forEach(([s,r])=>{pe.appClasses.has(s)||pe.register({kind:s,src:r.src,name:r.name})})},this.onMinimized=i=>{var s,r;((s=this.boxManager)==null?void 0:s.minimized)!==i&&(i===!0&&((r=this.boxManager)==null||r.blurAllBox()),setTimeout(()=>{var a;(a=this.boxManager)==null||a.setMinimized(Boolean(i))},0))},this.onAppDelete=async i=>{const s=Object.keys(i);for(const[r,a]of this.appProxies.entries())s.includes(r)||await a.destroy(!0,!1,!0)},this.closeAll=async()=>{for(const[i,s]of this.appProxies.entries())await s.destroy(!0,!1,!0)},this.displayerStateListener=i=>{const s=i.sceneState;if(s){const r=s.scenePath;this.appProxies.forEach(a=>{a.scenePath&&r.startsWith(a.scenePath)&&(a.emitAppSceneStateChange(s),a.setFullPath(r))})}this.appProxies.forEach(r=>{r.appEmitter.emit("roomStateChange",i)}),i.roomMembers&&this.members$.setValue(kr(i.roomMembers)),P.emit("observerIdChange",this.displayer.observerId),i.memberState&&P.emit("memberStateChange",S.toJS(i.memberState))},this.displayerWritableListener=i=>{var a,n;const s=!i,r=this.windowManger.readonly===void 0||!this.windowManger.readonly;this.windowManger.readonly===void 0?(a=this.boxManager)==null||a.setReadonly(i):(n=this.boxManager)==null||n.setReadonly(!(s&&r)),this.appProxies.forEach(o=>{o.emitAppIsWritableChange()}),s&&this.room&&this.room.disableSerialization===!0&&(this.room.disableSerialization=!1),P.emit("writableChange",s)},this.updateSceneIndex=()=>{const i=this.store.getMainViewScenePath(),s=Ji(i),r=ut(this.displayer)[s];if(r.length){const a=i.replace(s,"").replace("/",""),n=r.findIndex(o=>o.name===a);I.isInteger(n)&&n>=0&&this.safeSetAttributes({_mainSceneIndex:n})}},this.updateRootDirRemoving=i=>{this.rootDirRemoving=i},this.displayer=e.displayer,this.store.setContext({getAttributes:()=>this.attributes,safeSetAttributes:i=>this.safeSetAttributes(i),safeUpdateAttributes:(i,s)=>this.safeUpdateAttributes(i,s)}),this.mainViewProxy=new fl(this),this.viewManager=new gl(this.displayer),this.appListeners=new il(this),this.displayer.callbacks.on(this.eventName,this.displayerStateListener),this.appListeners.addListeners(),this.refresher=uo,this.refresher.setRoom(this.room),this.refresher.setContext({emitter:P}),this.sideEffectManager.add(()=>()=>{var i,s,r;this.appCreateQueue.destroy(),this.mainViewProxy.destroy(),(i=this.refresher)==null||i.destroy(),this.viewManager.destroy(),(s=this.boxManager)==null||s.destroy(),(r=this.callbacksNode)==null||r.dispose()}),P.once("onCreated").then(()=>this.onCreated()),P.on("onReconnected",()=>this.onReconnected()),S.isPlayer(this.displayer)&&(P.on("seekStart",this.onPlayerSeekStart),P.on("seek",this.onPlayerSeekDone)),P.on("removeScenes",this.onRemoveScenes),P.on("setReadonly",this.onReadonlyChanged),this.createRootDirScenesCallback(),pe.setSyncRegisterApp(i=>{this.safeUpdateAttributes([ee.Registered,i.kind],i)}),this.members$.setValue(kr(this.displayer.state.roomMembers))}async onRootDirRemoved(e=!0){await this.setMainViewScenePath(pa),this.createRootDirScenesCallback();for(const[i,s]of this.appProxies.entries())s.view&&await this.closeApp(i,e);this.mainViewProxy.rebind(),await P.emit("rootDirRemoved"),this.updateRootDirRemoving(!1)}get eventName(){return S.isRoom(this.displayer)?"onRoomStateChanged":"onPlayerStateChanged"}get attributes(){return this.windowManger.attributes}get canOperate(){return this.windowManger.canOperate}get room(){return S.isRoom(this.displayer)?this.displayer:void 0}get mainView(){return this.mainViewProxy.view}get focusApp(){if(this.store.focus)return this.appProxies.get(this.store.focus)}get uid(){var e;return((e=this.room)==null?void 0:e.uid)||""}getMainViewSceneDir(){const e=this.store.getMainViewScenePath();if(e)return Ji(e);throw new Error("[WindowManager]: mainViewSceneDir not found")}async onCreated(){var e;if(await this.attributesUpdateCallback(this.attributes.apps),P.emit("updateManagerRect"),Ue.on("move",this.onBoxMove),Ue.on("resize",this.onBoxResize),Ue.on("focus",this.onBoxFocus),Ue.on("close",this.onBoxClose),Ue.on("boxStateChange",this.onBoxStateChange),this.addAppsChangeListener(),this.addAppCloseListener(),this.refresher.add("maximized",()=>S.autorun(()=>{var s;const i=this.attributes.maximized;(s=this.boxManager)==null||s.setMaximized(Boolean(i))})),this.refresher.add("minimized",()=>S.autorun(()=>{const i=this.attributes.minimized;this.onMinimized(i)})),this.refresher.add("mainViewIndex",()=>S.autorun(()=>{const i=I.get(this.attributes,"_mainSceneIndex");this.onMainViewIndexChange(i)})),this.refresher.add("focusedChange",()=>S.autorun(()=>{const i=I.get(this.attributes,"focus");this.onFocusChange(i)})),this.refresher.add("registeredChange",()=>S.autorun(()=>{const i=I.get(this.attributes,ee.Registered);this.onRegisteredChange(i)})),!this.attributes.apps||Object.keys(this.attributes.apps).length===0){const i=this.store.getMainViewScenePath();if(!i)return;this.resetScenePath(i)}this.displayerWritableListener(!((e=this.room)!=null&&e.isWritable)),this.displayer.callbacks.on("onEnableWriteNowChanged",this.displayerWritableListener),this.focused$.setValue(this.attributes.focus),this.sideEffectManager.add(()=>{const i=new bl({mainView:()=>this.mainViewProxy.view,focus:()=>this.attributes.focus,getAppProxy:s=>this.appProxies.get(s)});return()=>i.destroy()})}async _attributesUpdateCallback(e){if(e&&le.container){const i=Object.keys(e);i.length===0&&this.appCreateQueue.emitReady();let s=i.map(r=>e[r].setup?{id:r,createdAt:e[r].createdAt}:{});this.isReplay&&(s=i.map(r=>({id:r,createdAt:e[r].createdAt})));for(const{id:r}of I.orderBy(s,"createdAt","asc"))if(r&&!this.appProxies.has(r)&&!this.appStatus.has(r)){const a=e[r];try{if(!this.attributes[r])throw new Error("appAttributes is undefined");this.appCreateQueue.push(()=>(this.appStatus.set(r,ps.StartCreate),this.baseInsertApp({kind:a.kind,options:a.options,isDynamicPPT:a.isDynamicPPT},r,!1))),this.focusByAttributes(e)}catch(n){console.warn("[WindowManager]: Insert App Error",n)}}}}refresh(){this.attributesUpdateCallback(this.attributes.apps)}setBoxManager(e){this.boxManager=e,this.mainViewProxy.createViewSync()}resetMaximized(){var e;(e=this.boxManager)==null||e.setMaximized(Boolean(this.store.getMaximized()))}resetMinimized(){var e;(e=this.boxManager)==null||e.setMinimized(Boolean(this.store.getMinimized()))}bindMainView(e,i){const s=this.mainViewProxy.view;s.disableCameraTransform=i,Si(30).then(()=>{s.divElement=e,P.emit("mainViewMounted")}),s.focusScenePath||this.setMainViewFocusPath()}setMainViewFocusPath(e){var s;const i=e||this.store.getMainViewScenePath();if(i)return dt(this.mainView,i),((s=this.mainView)==null?void 0:s.focusScenePath)===i}resetScenePath(e){this.displayer.state.sceneState.scenePath!==e&&Yt(this.room,e)}async addApp(e,i){Je("addApp",e);const{appId:s,needFocus:r}=await this.beforeAddApp(e,i),a=await this.baseInsertApp(e,s,!0,r);return this.afterAddApp(a),a==null?void 0:a.id}async beforeAddApp(e,i){var n,o;const s=await Qo(e.kind);this.appStatus.set(s,ps.StartCreate);const r=(n=e.attributes)!=null?n:{};this.safeUpdateAttributes([s],r),this.store.setupAppAttributes(e,s,i);const a=!((o=this.boxManager)!=null&&o.minimized);return a&&this.store.setAppFocus(s,!0),{appId:s,needFocus:a}}afterAddApp(e){var i,s;if(e&&e.box){const r=e.box;Ue.emit("move",{appId:e.id,x:r==null?void 0:r.intrinsicX,y:r==null?void 0:r.intrinsicY}),this.store.updateAppState(e.id,Ee.ZIndex,r.zIndex)}(i=this.boxManager)!=null&&i.minimized&&((s=this.boxManager)==null||s.setMinimized(!1,!1))}async closeApp(e,i=!0){const s=this.appProxies.get(e);s&&s.destroy(!0,i,!1)}async baseInsertApp(e,i,s,r){if(this.appProxies.has(i)){console.warn("[WindowManager]: app duplicate exists and cannot be created again");return}const a=new $s(e,this,i,s);if(a)return await a.baseInsertApp(r),this.appStatus.delete(i),a;throw this.appStatus.delete(i),new Error("[WindowManger]: initialize AppProxy failed")}safeSetAttributes(e){this.windowManger.safeSetAttributes(e)}safeUpdateAttributes(e,i){this.windowManger.safeUpdateAttributes(e,i)}async setMainViewScenePath(e){if(this.room){const i=this.displayer.scenePathType(e);if(Ji(e)!==we)throw new Error('[WindowManager]: main view scenePath must in root dir "/"');if(i===S.ScenePathType.None)throw new Error(`[WindowManager]: ${e} not valid scene`);if(i===S.ScenePathType.Page)await this._setMainViewScenePath(e);else if(i===S.ScenePathType.Dir){const r=Jo(this.displayer,e);r&&await this._setMainViewScenePath(r)}}}async _setMainViewScenePath(e){this.setMainViewFocusPath(e)&&(this.safeSetAttributes({_mainScenePath:e}),this.store.setMainViewFocusPath(this.mainView),this.updateSceneIndex(),this.dispatchSetMainViewScenePath(e))}async setMainViewSceneIndex(e){var i;if(this.room){if(this.store.getMainViewSceneIndex()===e)return;const s=(i=this.callbacksNode)==null?void 0:i.scenes[e],r=`${we}${s}`;if(s)this.setMainViewFocusPath(r)&&(this.store.setMainViewScenePath(r),this.safeSetAttributes({_mainSceneIndex:e}),this.dispatchSetMainViewScenePath(r));else throw new Error(`[WindowManager]: ${e} not valid index`)}}dispatchSetMainViewScenePath(e){this.dispatchInternalEvent(Y.SetMainViewScenePath,{nextScenePath:e}),Yt(this.room,e)}getAppInitPath(e){var s;const i=this.store.getAppAttributes(e);if(i)return(s=i==null?void 0:i.options)==null?void 0:s.scenePath}safeDispatchMagixEvent(e,i){this.canOperate&&this.displayer.dispatchMagixEvent(e,i)}focusByAttributes(e){var i;if(e&&Object.keys(e).length===((i=this.boxManager)==null?void 0:i.boxSize)){const s=this.store.focus;s&&this.boxManager.focusBox({appId:s})}}async onReconnected(){this.attributesUpdateCallback(this.attributes.apps);const i=Array.from(this.appProxies.values()).map(s=>s.onReconnected());this.mainViewProxy.onReconnect(),await Promise.all(i)}notifyContainerRectUpdate(e){this.appProxies.forEach(i=>{i.appEmitter.emit("containerRectUpdate",e)})}dispatchInternalEvent(e,i){this.safeDispatchMagixEvent(us,{eventName:e,payload:i})}destroy(){this.displayer.callbacks.off(this.eventName,this.displayerStateListener),this.displayer.callbacks.off("onEnableWriteNowChanged",this.displayerWritableListener),this.appListeners.removeListeners(),Ue.clearListeners(),P.clearListeners(),this.appProxies.size&&this.appProxies.forEach(e=>{e.destroy(!0,!1,!0)}),Q.clearListeners(),this.sideEffectManager.flushAll(),this.sceneIndex$.destroy(),this.focused$.destroy(),this.members$.destroy()}}/*! *****************************************************************************
|
1
|
+
"use strict";var Co=Object.defineProperty,Io=Object.defineProperties;var _o=Object.getOwnPropertyDescriptors;var oi=Object.getOwnPropertySymbols;var yr=Object.prototype.hasOwnProperty,wr=Object.prototype.propertyIsEnumerable;var br=(t,e,i)=>e in t?Co(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,j=(t,e)=>{for(var i in e||(e={}))yr.call(e,i)&&br(t,i,e[i]);if(oi)for(var i of oi(e))wr.call(e,i)&&br(t,i,e[i]);return t},oe=(t,e)=>Io(t,_o(e));var vr=(t,e)=>{var i={};for(var s in t)yr.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(t!=null&&oi)for(var s of oi(t))e.indexOf(s)<0&&wr.call(t,s)&&(i[s]=t[s]);return i};Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var Ao=require("p-retry"),ko=require("emittery"),C=require("lodash"),M=require("white-web-sdk"),To=require("uuid"),ve=require("side-effect-manager"),w=require("value-enhancer"),ha=require("@juggle/resize-observer");function da(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var No=da(Ao),rt=da(ko),Y=(t=>(t.AppMove="AppMove",t.AppFocus="AppFocus",t.AppResize="AppResize",t.AppBoxStateChange="AppBoxStateChange",t.GetAttributes="GetAttributes",t.UpdateWindowManagerWrapper="UpdateWindowManagerWrapper",t.WindowCreated="WindowCreated",t.SetMainViewScenePath="SetMainViewScenePath",t.SetMainViewSceneIndex="SetMainViewSceneIndex",t.SetAppFocusIndex="SetAppFocusIndex",t.SwitchViewsToFreedom="SwitchViewsToFreedom",t.CursorMove="CursorMove",t.RootDirRemoved="RootDirRemoved",t.Refresh="Refresh",t.InitMainViewCamera="InitMainViewCamera",t.InvokeAttributesUpdateCallback="InvokeAttributesUpdateCallback",t.MoveCamera="MoveCamera",t.MoveCameraToContain="moveCameraToContain",t))(Y||{});const us="__WindowManger",qi="__WindowMangerEnsureReconnected__";var Ee=(t=>(t.Size="size",t.Position="position",t.SceneIndex="SceneIndex",t.ZIndex="zIndex",t.Visible="visible",t.Ratio="ratio",t.StageRatio="stageRatio",t.Draggable="draggable",t.Resizable="resizable",t))(Ee||{}),ua=(t=>(t.setBoxSize="setBoxSize",t.setBoxMinSize="setBoxMinSize",t.destroy="destroy",t))(ua||{}),ps=(t=>(t.StartCreate="StartCreate",t))(ps||{}),pa=(t=>(t.Leave="leave",t.Normal="normal",t))(pa||{});const xr="2.16.1",Eo=340/720,Po=340/720,zo=9/16,we="/",ga="/init",ma=50,Mr=500,Q=new rt.default;class Do{constructor(){this.list=[],this.isEmit=!1,this.invoked=()=>{this.currentInvoker=void 0,this.list.length===0&&(this.clear(),this.emitReady())},this.clear=()=>{clearInterval(this.timer),this.timer=void 0}}initInterval(){return setInterval(()=>{this.invoke()},50)}push(e){this.list.push(e),this.invoke(),this.timer===void 0&&this.list.length>0&&(this.timer=this.initInterval())}invoke(){if(this.list.length===0||this.currentInvoker!==void 0)return;const e=this.list.shift();e&&(this.currentInvoker=e,e().then(()=>{this.invoked()}).catch(i=>{console.error(`[WindowManager]: create app error: ${i.message}`),this.invoked()}))}emitReady(){this.isEmit||setTimeout(()=>{Q.emit("ready")},ma),this.isEmit=!0}empty(){this.list=[],this.clear()}destroy(){this.timer&&this.clear()}}const P=new rt.default,Lo="__WindowManagerAppCache";let Zt,Sr;const Vo=async()=>{Zt=await Bo()},$o=(t,e)=>{if(!!Zt)return Oo(Zt,{kind:t,sourceCode:e})},jo=async t=>Zt?await Ro(Zt,t):null;function Bo(){return new Promise((t,e)=>{const i=indexedDB.open(Lo,2);i.onerror=s=>{e(s)},i.onupgradeneeded=s=>{const r=s.target.result;r.objectStoreNames.contains("apps")||(Sr=r.createObjectStore("apps",{keyPath:"kind"}),Sr.createIndex("kind","kind",{unique:!0}))},i.onsuccess=()=>{const s=i.result;t(s)}})}function Ro(t,e){return new Promise((i,s)=>{const a=t.transaction(["apps"]).objectStore("apps").index("kind").get(e);a.onerror=n=>s(n),a.onsuccess=()=>{a.result?i(a.result):i(null)}})}function Oo(t,e){return new Promise((i,s)=>{const r=t.transaction(["apps"],"readwrite").objectStore("apps").add(e);r.onsuccess=()=>i(),r.onerror=()=>s()})}const Uo="NetlessApp",Wo=1e4,Ho=async t=>{const e=await jo(t);if(e)return e.sourceCode;{const s=await(await Zo(t,{timeout:Wo})).text();return await $o(t,s),s}},Cr=(t,e)=>{let i=Function(t+`
|
2
|
+
;return ${e}`)();return typeof i=="undefined"&&(i=window[e]),i},Fo=async(t,e,i)=>{const s=i||Uo+e;Q.emit("loadApp",{kind:e,status:"start"});try{const r=await Ho(t);if(!r||r.length===0){Q.emit("loadApp",{kind:e,status:"failed",reason:"script is empty."});return}try{const a=Cr(r,s);return Q.emit("loadApp",{kind:e,status:"success"}),a}catch(a){if(a.message.includes("Can only have one anonymous define call per script file")){const n=window.define;typeof n=="function"&&n.amd&&delete n.amd;const o=Cr(r,s);return Q.emit("loadApp",{kind:e,status:"success"}),o}Q.emit("loadApp",{kind:e,status:"failed",reason:a.message})}}catch(r){Q.emit("loadApp",{kind:e,status:"failed",reason:r.message})}};async function Zo(t,e){const{timeout:i=1e4}=e,s=new AbortController,r=setTimeout(()=>s.abort(),i),a=await fetch(t,oe(j({},e),{signal:s.signal,headers:{"content-type":"text/plain"}}));return clearTimeout(r),a}class Yo{constructor(){this.kindEmitters=new Map,this.registered=new Map,this.appClassesCache=new Map,this.appClasses=new Map,this.syncRegisterApp=null,this.onSyncRegisterAppChange=e=>{this.register({kind:e.kind,src:e.src})}}setSyncRegisterApp(e){this.syncRegisterApp=e}async register(e){this.appClassesCache.delete(e.kind),this.registered.set(e.kind,e);const i=e.src;let s;if(typeof i=="string"?(s=async()=>{let r=await Fo(i,e.kind,e.name);if(r)return r.__esModule&&(r=r.default),r;throw new Error(`[WindowManager]: load remote script failed, ${i}`)},this.syncRegisterApp&&this.syncRegisterApp({kind:e.kind,src:i,name:e.name})):typeof i=="function"?s=i:s=async()=>i,this.appClasses.set(e.kind,async()=>{let r=this.appClassesCache.get(e.kind);return r||(r=s(),this.appClassesCache.set(e.kind,r)),r}),e.addHooks){const r=this.createKindEmitter(e.kind);r&&e.addHooks(r)}}unregister(e){this.appClasses.delete(e),this.appClassesCache.delete(e),this.registered.delete(e);const i=this.kindEmitters.get(e);i&&(i.clearListeners(),this.kindEmitters.delete(e))}async notifyApp(e,i,s){const r=this.kindEmitters.get(e);await(r==null?void 0:r.emit(i,s))}createKindEmitter(e){if(!this.kindEmitters.has(e)){const i=new rt.default;this.kindEmitters.set(e,i)}return this.kindEmitters.get(e)}}const pe=new Yo,Qo=async t=>{var i,s;const e=await((i=pe.appClasses.get(t))==null?void 0:i());return e&&((s=e.config)==null?void 0:s.singleton)?t:`${t}-${To.v4().replace("-","").slice(0,8)}`},dt=(t,e)=>{if(!t.didRelease&&t.focusScenePath!==e)return t.focusScenePath=e,t},Ir=t=>{t.didRelease||t.release()},Yt=(t,e)=>{if(t&&t.isWritable&&t.state.sceneState.scenePath!==e){const i=e==="/"?"":e;t.setScenePath(i)}},Go=(t,e,i)=>{var s;if(t&&e){const a=(s=ut(t)[e])==null?void 0:s[i];if(a)return`${e}/${a.name}`}},gs=(t,e,i)=>{t&&t.scenePathType(e)!==M.ScenePathType.None&&t.removeScenes(e,i)},qo=(t,e)=>{P.once(t).then(e)};C.debounce((t,e)=>{t.emit("mainViewModeChange",e)},200);const Jo=(t,e,i=0)=>{const s=ut(t)[e];if(!s)return;const r=s[i];if(!r)return;const a=r.name;return e===we?`/${a}`:`${e}/${a}`},ut=t=>t.entireScenes(),vt=(t,e,i,s)=>t==null?void 0:t.putScenes(e,i,s),Xo=t=>t.startsWith("/"),Ji=t=>{const e=t.split("/");e.pop();let i=e.join("/");return i===""&&(i="/"),i},Ko=t=>t.endsWith("/")?t.slice(0,-1):t,_r=t=>{const e=t.split(".").map(i=>i.padStart(2,"0")).join("");return parseInt(e)},Mi=t=>new Promise(e=>setTimeout(e,t)),el=t=>t.split("").reduce((i,s)=>(s===we&&(i+=1),i),0)===1;class tl{constructor(e){this.saveCamera=e,this.setRect=i=>{this.rect=i,this.remoteCamera&&this.remoteSize&&this.onRemoteUpdate(this.remoteCamera,this.remoteSize)},this.onRemoteUpdate=C.throttle((i,s)=>{if(this.remoteCamera=i,this.remoteSize=s,this.remoteSize&&this.rect){const a={scale:i.scale*Ei(s,this.rect)};i.centerX!==null&&(a.centerX=i.centerX),i.centerY!==null&&(a.centerY=i.centerY),this.moveCamera(a)}},10)}setView(e){this.view=e}onRemoteSizeUpdate(e){var s;this.remoteSize=e;const i=!C.isEqual(C.pick(this.rect,["width","height"]),C.pick(e,["width","height"]));if(this.rect&&this.remoteCamera&&i){if(!this.view)return;const r=this.view.camera;(s=this.view)==null||s.moveCameraToContain({width:e.width,height:e.height,originX:r.centerX-e.width/2,originY:r.centerY-e.height/2})}}onLocalCameraUpdate(e){this.saveCamera(e),this.remoteCamera=e}moveCamera(e){var i;(i=this.view)==null||i.moveCamera(oe(j({},e),{animationMode:M.AnimationMode.Immediately}))}}const Ei=(t,e)=>{const i=e.width/t.width,s=e.height/t.height;return Math.min(i,s)};class il{constructor(e){this.manager=e,this.displayer=this.manager.displayer,this.mainMagixEventListener=i=>{if(i.authorId!==this.displayer.observerId){const s=i.payload;switch(s.eventName){case Y.AppMove:{this.appMoveHandler(s.payload);break}case Y.AppResize:{this.appResizeHandler(s.payload);break}case Y.AppBoxStateChange:{this.boxStateChangeHandler(s.payload);break}case Y.SetMainViewScenePath:{this.setMainViewScenePathHandler(s.payload);break}case Y.CursorMove:{this.cursorMoveHandler(s.payload);break}case Y.RootDirRemoved:{this.rootDirRemovedHandler();break}case Y.Refresh:{this.refreshHandler();break}case Y.InitMainViewCamera:{this.initMainViewCameraHandler();break}case Y.SetAppFocusIndex:{this.setAppFocusViewIndexHandler(s.payload);break}case Y.InvokeAttributesUpdateCallback:{this.manager.attributesUpdateCallback(this.manager.attributes.apps);break}case Y.MoveCamera:{this.moveCameraHandler(s.payload);break}case Y.MoveCameraToContain:{this.moveCameraToContainHandler(s.payload);break}}}},this.appMoveHandler=i=>{var s;(s=this.boxManager)==null||s.moveBox(i)},this.appResizeHandler=i=>{var s,r;(s=this.boxManager)==null||s.resizeBox(Object.assign(i,{skipUpdate:!0})),(r=this.manager.room)==null||r.refreshViewSize()},this.boxStateChangeHandler=i=>{Q.emit("boxStateChange",i)},this.setMainViewScenePathHandler=({nextScenePath:i})=>{dt(this.manager.mainView,i),Q.emit("mainViewScenePathChange",i)},this.cursorMoveHandler=i=>{P.emit("cursorMove",i)},this.rootDirRemovedHandler=()=>{this.manager.createRootDirScenesCallback(),this.manager.mainViewProxy.rebind(),P.emit("rootDirRemoved")},this.refreshHandler=()=>{this.manager.windowManger._refresh()},this.initMainViewCameraHandler=()=>{this.manager.mainViewProxy.addCameraReaction()},this.setAppFocusViewIndexHandler=i=>{if(i.type==="main")this.manager.setSceneIndexWithoutSync(i.index);else if(i.type==="app"&&i.appID){const s=this.manager.appProxies.get(i.appID);s&&s.setSceneIndexWithoutSync(i.index)}},this.moveCameraHandler=i=>{var r;const s=i;if(i.scale){const a=this.manager.mainViewProxy.size$.value,n=(r=this.manager.boxManager)==null?void 0:r.stageRect;a&&n&&(s.scale=i.scale*Ei(a,n))}this.manager.mainView.moveCamera(s)},this.moveCameraToContainHandler=i=>{this.manager.mainView.moveCameraToContain(i)}}get boxManager(){return this.manager.boxManager}addListeners(){this.displayer.addMagixEventListener(us,this.mainMagixEventListener)}removeListeners(){this.displayer.removeMagixEventListener(us,this.mainMagixEventListener)}}class fa extends Error{constructor(){super(...arguments);this.message="[WindowManager]: app duplicate exists and cannot be created again"}}class sl extends Error{constructor(e){super(`[WindowManager]: app ${e} need register or provide src`)}}class de extends Error{constructor(){super(...arguments);this.message="[WindowManager]: AppManager must be initialized"}}class ba extends Error{constructor(e){super(`[WindowManager]: white-web-sdk version must large than ${e}`)}}class ya extends Error{constructor(){super(...arguments);this.message="[WindowManager]: kind must be a valid string"}}class wa extends Error{constructor(){super(...arguments);this.message="[WindowManager]: box need created"}}class va extends Error{constructor(){super(...arguments);this.message='[WindowManager]: ScenePath should start with "/"'}}class Vs extends Error{constructor(){super(...arguments);this.message="[WindowManager]: boxManager need initialize"}}class xa extends Error{constructor(){super(...arguments);this.message="[WindowManager]: room phase only Connected can be bindContainer"}}const Ma=t=>(e,i)=>{if(e!==void 0)if(M.listenUpdated){const s=r=>{r.map(n=>n.kind).includes(t)&&i()};return M.listenUpdated(e,s),i(),()=>M.unlistenUpdated(e,s)}else return M.reaction(()=>e,()=>{i()},{fireImmediately:!0})},Sa=(t,e,i)=>{let s=null;const r=M.reaction(t,()=>{s&&(s(),s=null);const a=t();C.isObject(a)?(s=()=>M.unlistenUpdated(a,e),M.listenUpdated(a,e)):i==null||i(a)},{fireImmediately:!0});return()=>{s==null||s(),r()}},rl=Ma(M.UpdateEventKind.Removed);Ma(M.UpdateEventKind.Inserted);const Xi=Object.keys;function Ar(t){return Boolean(C.has(t,"__isRef"))}function al(t){return{k:ve.genUID(),v:t,__isRef:!0}}class nl{constructor(){this.listeners=new Set}get length(){return this.listeners.size}dispatch(e){this.listeners.forEach(i=>i(e))}addListener(e){this.listeners.add(e)}removeListener(e){this.listeners.delete(e)}}const Te="_WM-STORAGE_";class kr{constructor(e,i,s){if(this._sideEffect=new ve.SideEffectManager,this._destroyed=!1,this._refMap=new WeakMap,this._lastValue=new Map,this.onStateChanged=new nl,s&&!C.isObject(s))throw new Error(`Default state for Storage ${i} is not an object.`);this._context=e,this.id=i||null,this._state={};const r=this._getRawState(this._state);this._context.isWritable&&(this.id===null?e.isAddApp&&s&&this.setState(s):(r===this._state||!C.isObject(r))&&(C.get(this._context.getAttributes(),[Te])||this._context.updateAttributes([Te],{}),this._context.updateAttributes([Te,this.id],this._state),s&&this.setState(s))),Xi(r).forEach(a=>{if(!(this.id===null&&a===Te))try{const n=C.isObject(r[a])?JSON.parse(JSON.stringify(r[a])):r[a];Ar(n)?(this._state[a]=n.v,C.isObject(n.v)&&this._refMap.set(n.v,n)):this._state[a]=n}catch(n){console.error(n)}}),this._sideEffect.addDisposer(Sa(()=>this.id===null?e.getAttributes():C.get(e.getAttributes(),[Te,this.id]),this._updateProperties.bind(this),this.destroy.bind(this)))}get state(){return this._destroyed&&console.warn(`Accessing state on destroyed Storage "${this.id}"`),this._state}addStateChangedListener(e){return this.onStateChanged.addListener(e),()=>this.onStateChanged.removeListener(e)}ensureState(e){return this.setState(Xi(e).reduce((i,s)=>(C.has(this._state,s)||(i[s]=e[s]),i),{}))}setState(e){if(this._destroyed){console.error(new Error(`Cannot call setState on destroyed Storage "${this.id}".`));return}if(!this._context.isWritable){console.error(new Error(`Cannot setState on Storage "${this.id}" without writable access`),e);return}const i=Xi(e);i.length>0&&i.forEach(s=>{const r=e[s];if(r!==this._state[s])if(r===void 0)this._lastValue.set(s,this._state[s]),delete this._state[s],this._setRawState(s,r);else{this._lastValue.set(s,this._state[s]),this._state[s]=r;let a=r;if(C.isObject(r)){let n=this._refMap.get(r);n||(n=al(r),this._refMap.set(r,n)),a=n}this._setRawState(s,a)}})}emptyStorage(){if(!(C.size(this._state)<=0)){if(this._destroyed){console.error(new Error(`Cannot empty destroyed Storage "${this.id}".`));return}if(!this._context.isWritable){console.error(new Error(`Cannot empty Storage "${this.id}" without writable access.`));return}this.setState(C.mapValues(this._state,C.noop))}}deleteStorage(){if(this.id===null)throw new Error("Cannot delete main Storage");if(!this._context.isWritable){console.error(new Error(`Cannot delete Storage "${this.id}" without writable access.`));return}this.destroy(),this._context.updateAttributes([Te,this.id],void 0)}get destroyed(){return this._destroyed}destroy(){this._destroyed=!0,this._sideEffect.flushAll()}_getRawState(e){var i;return this.id===null?(i=this._context.getAttributes())!=null?i:e:C.get(this._context.getAttributes(),[Te,this.id],e)}_setRawState(e,i){if(this.id===null){if(e===Te)throw new Error(`Cannot set attribute internal filed "${Te}"`);return this._context.updateAttributes([e],i)}else return this._context.updateAttributes([Te,this.id,e],i)}_updateProperties(e){var i;if(this._destroyed){console.error(new Error(`Cannot call _updateProperties on destroyed Storage "${this.id}".`));return}if(e.length>0){const s={};for(let r=0;r<e.length;r++)try{const a=e[r],n=a.key;if(this.id===null&&n===Te)continue;const o=C.isObject(a.value)?JSON.parse(JSON.stringify(a.value)):a.value;let c;switch(this._lastValue.has(n)&&(c=this._lastValue.get(n),this._lastValue.delete(n)),a.kind){case 2:{C.has(this._state,n)&&(c=this._state[n],delete this._state[n]),s[n]={oldValue:c};break}default:{let l=o;if(Ar(o)){const{k:d,v:u}=o,p=this._state[n];C.isObject(p)&&((i=this._refMap.get(p))==null?void 0:i.k)===d?l=p:(l=u,C.isObject(u)&&this._refMap.set(u,o))}l!==this._state[n]&&(c=this._state[n],this._state[n]=l),s[n]={newValue:l,oldValue:c};break}}}catch(a){console.error(a)}this.onStateChanged.dispatch(s)}}}class ol{constructor(e,i,s,r){this.view=e,this.appContext=i,this.appProxy=s,this.ensureSize=r,this.nextPage=async()=>{const l=this.pageState.index+1;return this.jumpPage(l)},this.prevPage=async()=>{const l=this.pageState.index-1;return this.jumpPage(l)},this.jumpPage=async l=>l<0||l>=this.pageState.length?(console.warn(`[WindowManager]: index ${l} out of range`),!1):(this.appProxy.setSceneIndex(l),!0),this.addPage=async l=>{const d=l==null?void 0:l.after,u=l==null?void 0:l.scene,p=this.appProxy.scenePath;if(!!p)if(d){const m=this.pageState.index+1;vt(this.appContext.room,p,[u||{}],m)}else vt(this.appContext.room,p,[u||{}])},this.removePage=async l=>{const d=l===void 0?this.pageState.index:l;return this.pageState.length===1?(console.warn("[WindowManager]: can not remove the last page"),!1):d<0||d>=this.pageState.length?(console.warn(`[WindowManager]: page index ${l} out of range`),!1):this.appProxy.removeSceneByIndex(d)};const a=new w.Val(s.pageState),n=new w.Val(s.size$.value),o=l=>C.pick(l,["centerX","centerY","scale"]),c=new w.Val(o(this.view.camera));this.baseRect$=n,this.pageState$=a,this.baseCamera$=c,this.appProxy.sideEffectManager.add(()=>[s.appEmitter.on("pageStateChange",l=>a.setValue(l)),s.camera$.subscribe(l=>{l&&c.setValue(o(l))}),s.size$.subscribe(l=>{l&&n.setValue(C.pick(l,["width","height"]))})]),e.disableCameraTransform=!0}get pageState(){return this.pageState$.value}moveCamera(e){this.appProxy.moveCamera(e)}setBaseRect(e){this.appProxy.updateSize(e.width,e.height)}}const Je=(...t)=>{ce.debug&&console.log("[WindowManager]:",...t)},ll=(t,e)=>{const i=document.createElement("div");i.className="netless-window-manager-playground";const s=document.createElement("div");return s.className="netless-window-manager-main-view",e.appendChild(s),t.appendChild(i),{playground:i,mainViewElement:s}},cl=()=>{if(_r(M.WhiteVersion)<_r(xr))throw new ba(xr)},Ca=(t,e)=>{const i=t==null?void 0:t.state.roomMembers;return i==null?void 0:i.find(s=>{var r;return((r=s.payload)==null?void 0:r.uid)===e})},Tr=t=>t.map(e=>{var i;return j({uid:((i=e.payload)==null?void 0:i.uid)||""},M.toJS(e))}),Nr=async t=>{try{return await t.createInvisiblePlugin(ce,{})}catch(e){if(e.message==='invisible plugin "WindowManager" exits')return await Mi(200),t.getInvisiblePlugin(ce.kind);Je("createInvisiblePlugin failed",e)}};class hl{constructor(e,i,s,r){this.manager=e,this.appId=i,this.appProxy=s,this.appOptions=r,this.mobxUtils={autorun:M.autorun,reaction:M.reaction,toJS:M.toJS},this.objectUtils={listenUpdated:M.listenUpdated,unlistenUpdated:M.unlistenUpdated,listenDisposed:M.listenDisposed,unlistenDisposed:M.unlistenDisposed},this.store=this.manager.store,this.isReplay=this.manager.isReplay,this.getAttributes=()=>this.appProxy.attributes,this.getScenes=()=>{const a=this.store.getAppAttributes(this.appId);return a!=null&&a.isDynamicPPT?this.appProxy.scenes:a==null?void 0:a.options.scenes},this.createWhiteBoardView=a=>{if(this.whiteBoardView)return this.whiteBoardView;let n=this.view;n||(n=this.appProxy.createAppDir()),a&&C.isBoolean(a.syncCamera)&&this.appProxy.syncCamera$.setValue(a.syncCamera);const o=document.createElement("div");return this._viewWrapper=o,o.className="window-manager-view-wrapper",this.box.$main.appendChild(o),n.divElement=o,this.appProxy.fireMemberStateChange(),this.isAddApp&&this.ensurePageSize(a==null?void 0:a.size),this.whiteBoardView=new ol(n,this,this.appProxy,this.ensurePageSize),this.appProxy.sideEffectManager.add(()=>[this.box._stageRect$.subscribe(c=>{o.style.left=`${c.x}px`,o.style.top=`${c.y}px`,o.style.width=`${c.width}px`,o.style.height=`${c.height}px`}),()=>()=>{this.whiteBoardView=void 0}]),this.appProxy.whiteBoardViewCreated$.setValue(!0),this.whiteBoardView},this.ensurePageSize=a=>{var c;if(!C.isNumber(a)||!this.appProxy.scenePath||this.appProxy.pageState.length>=a)return;if(a<=0||a>=Mr)throw Error(`[WindowManager]: size ${a} muse be in range [1, ${Mr}]`);const n=a-this.appProxy.pageState.length,o=new Array(n).fill({});(c=this.room)==null||c.putScenes(this.appProxy.scenePath,o)},this.getInitScenePath=()=>this.appProxy.scenePath,this.setAttributes=a=>{this.manager.safeSetAttributes({[this.appId]:a})},this.updateAttributes=(a,n)=>{this.manager.attributes[this.appId]&&this.manager.safeUpdateAttributes([this.appId,...a],n)},this.setScenePath=async a=>{var n;!this.appProxy.box||(this.appProxy.setFullPath(a),(n=this.room)==null||n.setScenePath(a))},this.getAppOptions=()=>typeof this.appOptions=="function"?this.appOptions():this.appOptions,this.createStorage=(a,n)=>{const o=new kr(this,a,n);return this.emitter.on("destroy",()=>{o.destroy()}),o},this.dispatchMagixEvent=(...a)=>{var o;const n=`${this.appId}:${a[0]}`;return(o=this.manager.room)==null?void 0:o.dispatchMagixEvent(n,a[1])},this.addMagixEventListener=(a,n,o)=>{const c=`${this.appId}:${a}`;return this.manager.displayer.addMagixEventListener(c,n,o),()=>this.manager.displayer.removeMagixEventListener(c,n)},this.removeMagixEventListener=this.manager.displayer.removeMagixEventListener.bind(this.manager.displayer),this.emitter=s.appEmitter,this.isAddApp=s.isAddApp}get displayer(){return this.manager.displayer}get destroyed(){return this.appProxy.status==="destroyed"}get view(){return this.appProxy.view}get now(){if(this.isReplay){const e=this.displayer;return e.beginTimestamp+e.progressTime}else return this.displayer.calibrationTimestamp}get isWritable(){return this.manager.canOperate&&!this.destroyed}get box(){const e=this.appProxy.box$.value;if(e)return e;throw new wa}get room(){return this.manager.room}get members(){return this.manager.members$.value}get currentMember(){const e=Ca(this.room,this.manager.uid);if(!e)throw new Error(`Member ${this.manager.uid} not found.`);return j({uid:this.manager.uid},e)}get storage(){return this._storage||(this._storage=new kr(this)),this._storage}}class dl{constructor(e){this.params=e,this.sceneNode=null,this.createSceneNode=r=>(this.scenePath=r,this.sceneNode&&this.sceneNode.dispose(),this.sceneNode=this.params.displayer.createScenesCallback(r,{onAddScene:this.onSceneChange,onRemoveScene:this.onSceneChange}),this.sceneNode),this.onSceneChange=()=>{this.params.notifyPageStateChange()};const{displayer:i,scenePath:s}=this.params;this.view=this.params.view,s&&(this.scenePath=s,this.sceneNode=i.createScenesCallback(s,{onAddScene:this.onSceneChange,onRemoveScene:this.onSceneChange}))}setView(e){this.view=e}getFullPath(e){var s;const i=(s=this.sceneNode)==null?void 0:s.scenes;if(this.scenePath&&i){const r=i[e];if(r)return`${this.scenePath}/${r}`}}toObject(){var e,i;return{index:((e=this.view)==null?void 0:e.focusSceneIndex)||0,length:((i=this.sceneNode)==null?void 0:i.scenes.length)||0}}destroy(){var e;(e=this.sceneNode)==null||e.dispose()}}class Ia{constructor(e){this.context=e,this.sem=new ve.SideEffectManager,this.bindView=s=>{!s||(this.synchronizer.setView(s),this.sem.flush("view"),this.sem.add(()=>(s.callbacks.on("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice),()=>s.callbacks.off("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice)),"view"))},this.onCameraUpdatedByDevice=s=>{if(!!s&&this.context.size$.value&&this.context.stageRect$.value){const r=Ei(this.context.size$.value,this.context.stageRect$.value),a=s.scale/r;this.synchronizer.onLocalCameraUpdate(oe(j({},s),{scale:a,id:this.context.uid}))}},this.synchronizer=new tl(s=>{this.context.camera$.setValue(s,!0),!(this.context.viewMode$&&this.context.viewMode$.value===M.ViewMode.Freedom)&&this.context.storeCamera(s)}),this.bindView(this.context.view$.value),this.sem.add(()=>[this.context.view$.subscribe(s=>{const r=this.context.camera$.value;r&&this.context.size$.value&&(s==null||s.moveCamera({scale:1,animationMode:M.AnimationMode.Immediately}),this.synchronizer.onRemoteUpdate(r,this.context.size$.value)),this.bindView(s)}),this.context.camera$.subscribe((s,r)=>{const a=this.context.size$.value;s&&a&&!r&&this.synchronizer.onRemoteUpdate(s,a)}),this.context.size$.subscribe(s=>{s&&this.synchronizer.onRemoteSizeUpdate(s)}),this.context.stageRect$.subscribe(s=>{s&&this.synchronizer.setRect(s)})]);const i=w.combine([this.context.camera$,this.context.size$]);i.reaction(([s,r])=>{s&&r&&(this.synchronizer.onRemoteUpdate(s,r),i.destroy())})}destroy(){this.sem.flushAll()}}const Ue=new rt.default,$s=(t,e)=>{let i=0;const s=e.length-1;return t===e.index?t===s?i=t-1:i=e.index+1:i=e.index,i};var ee=(t=>(t.Apps="apps",t.Focus="focus",t.State="state",t.BoxState="boxState",t.MainViewCamera="mainViewCamera",t.MainViewSize="mainViewSize",t.Broadcaster="broadcaster",t.Cursors="cursors",t.Position="position",t.CursorState="cursorState",t.FullPath="fullPath",t.Registered="registered",t.Camera="camera",t.Size="size",t))(ee||{});class ul{constructor(e){this.context=e,this.setAppFocus=(i,s)=>{s?this.context.safeSetAttributes({focus:i}):this.context.safeSetAttributes({focus:void 0})}}setContext(e){this.context=e}get attributes(){return this.context.getAttributes()}apps(){return C.get(this.attributes,["apps"])}get focus(){return C.get(this.attributes,["focus"])}getAppAttributes(e){return C.get(this.apps(),[e])}getAppState(e){return C.get(this.apps(),[e,"state"])}getMaximized(){return C.get(this.attributes,["maximized"])}getMinimized(){return C.get(this.attributes,["minimized"])}setupAppAttributes(e,i,s){this.attributes.apps||this.context.safeSetAttributes({apps:{}});const a=["scenePath","title"];s||a.push("scenes");const n=C.pick(e.options,a),o={kind:e.kind,options:n,isDynamicPPT:s,setup:!1};typeof e.src=="string"&&(o.src=e.src),o.createdAt=Date.now(),this.context.safeUpdateAttributes(["apps",i],o),this.context.safeUpdateAttributes(["apps",i,"state"],{[Ee.Size]:{},[Ee.Position]:{},[Ee.SceneIndex]:0})}updateAppState(e,i,s){C.get(this.attributes,["apps",e,"state"])&&this.context.safeUpdateAttributes(["apps",e,"state",i],s)}updateAppAttributes(e,i,s){this.context.safeUpdateAttributes(["apps",e,i],s)}cleanAppAttributes(e){this.context.safeUpdateAttributes(["apps",e],void 0),this.context.safeSetAttributes({[e]:void 0}),this.attributes.focus===e&&this.cleanFocus()}cleanFocus(){this.context.safeSetAttributes({focus:void 0})}getAppSceneIndex(e){var i;return(i=this.getAppState(e))==null?void 0:i[Ee.SceneIndex]}getAppScenePath(e){var i,s;return(s=(i=this.getAppAttributes(e))==null?void 0:i.options)==null?void 0:s.scenePath}getMainViewScenePath(){return this.attributes._mainScenePath}getMainViewSceneIndex(){return this.attributes._mainSceneIndex}getBoxState(){return this.attributes.boxState}setMainViewScenePath(e){this.context.safeSetAttributes({_mainScenePath:e})}setMainViewSceneIndex(e){this.context.safeSetAttributes({_mainSceneIndex:e})}getMainViewCamera(){return C.get(this.attributes,["mainViewCamera"])}getMainViewSize(){return C.get(this.attributes,["mainViewSize"])}setMainViewCamera(e){this.context.safeSetAttributes({mainViewCamera:j({},e)})}setMainViewSize(e){this.context.safeSetAttributes({mainViewSize:j({},e)})}setMainViewCameraAndSize(e,i){this.context.safeSetAttributes({mainViewCamera:j({},e),mainViewSize:j({},i)})}updateCursor(e,i){C.get(this.attributes,["cursors"])||this.context.safeUpdateAttributes(["cursors"],{}),C.get(this.attributes,["cursors",e])||this.context.safeUpdateAttributes(["cursors",e],{}),this.context.safeUpdateAttributes(["cursors",e,"position"],i)}updateCursorState(e,i){C.get(this.attributes,["cursors",e])||this.context.safeUpdateAttributes(["cursors",e],{}),this.context.safeUpdateAttributes(["cursors",e,"cursorState"],i)}getCursorState(e){return C.get(this.attributes,["cursors",e,"cursorState"])}cleanCursor(e){this.context.safeUpdateAttributes(["cursors",e],void 0)}setMainViewFocusPath(e){const i=this.getMainViewScenePath();i&&dt(e,i)}}const pl=new ul({getAttributes:()=>{throw new Error("getAttributes not implemented")},safeSetAttributes:()=>{throw new Error("safeSetAttributes not implemented")},safeUpdateAttributes:()=>{throw new Error("safeUpdateAttributes not implemented")}});class js{constructor(e,i,s,r){var a;this.params=e,this.manager=i,this.boxManager=this.manager.boxManager,this.appProxies=this.manager.appProxies,this.viewManager=this.manager.viewManager,this.store=this.manager.store,this.uid=this.manager.uid,this.status="normal",this.sideEffectManager=new ve.SideEffectManager,this.valManager=new w.ValManager,this.fullPath$=this.valManager.attach(new w.Val(void 0)),this.camera$=this.valManager.attach(new w.Val(void 0)),this.size$=this.valManager.attach(new w.Val(void 0)),this.box$=this.valManager.attach(new w.Val(void 0)),this.view$=this.valManager.attach(new w.Val(void 0)),this.syncCamera$=this.valManager.attach(new w.Val(!0)),this.whiteBoardViewCreated$=this.valManager.attach(new w.Val(!1)),this.fireMemberStateChange=()=>{this.manager.room&&this.onMemberStateChange(this.manager.room.state.memberState)},this.onMemberStateChange=n=>{var c,l;n.currentApplianceName==="clicker"?(c=this.appContext)!=null&&c._viewWrapper&&(this.appContext._viewWrapper.style.pointerEvents="none"):(l=this.appContext)!=null&&l._viewWrapper&&(this.appContext._viewWrapper.style.pointerEvents="auto")},this.computedInitialRect=n=>{var c;const o=(c=this.manager.boxManager)==null?void 0:c.stageRect;if(o){const{width:l,height:d}=o,u=n.height/n.width;return d<480?{width:480/u,height:480}:{width:l*.65,height:d*.65}}},this.getAppInitState=n=>{var m,g;const o=this.store.getAppState(n);if(!o)return;const c=this.store.focus,l=(m=this.attributes)==null?void 0:m.maximized,d=(g=this.attributes)==null?void 0:g.minimized;let u={maximized:l,minimized:d,id:n};const p=C.omitBy(o,C.isUndefined);return c===n&&(u=oe(j({},u),{focus:!0})),Object.assign(u,p)},this.appAttributesUpdateListener=n=>{this.sideEffectManager.add(()=>[this.manager.refresher.add(n,()=>M.autorun(()=>{const o=this.manager.attributes[n];o&&this.appEmitter.emit("attributesUpdate",o)})),this.manager.refresher.add(this.stateKey,()=>M.autorun(()=>{var c,l,d;const o=(c=this.appAttributes)==null?void 0:c.state;(o==null?void 0:o.zIndex)>0&&o.zIndex!==((l=this.box)==null?void 0:l.zIndex)&&((d=this.boxManager)==null||d.setZIndex(n,o.zIndex))})),this.manager.refresher.add(`${n}-fullPath`,()=>M.autorun(()=>{var c;const o=(c=this.appAttributes)==null?void 0:c.fullPath;this.setFocusScenePathHandler(o),this.fullPath$.value!==o&&(this.notifyPageStateChange(),this.fullPath$.setValue(o))}))])},this.setFocusScenePathHandler=C.debounce(n=>{var o;this.view&&n&&n!==((o=this.view)==null?void 0:o.focusScenePath)&&dt(this.view,n)},50),this.notifyPageStateChange=C.debounce(()=>{this.pageState&&this.appEmitter.emit("pageStateChange",this.pageState)},50),this.storeCamera=n=>{this.store.updateAppAttributes(this.id,ee.Camera,n)},this.storeSize=n=>{this.store.updateAppAttributes(this.id,ee.Size,n)},this.updateSize=(n,o)=>{const c={id:this.manager.uid,width:n,height:o};this.store.updateAppAttributes(this.id,ee.Size,c),this.size$.setValue(c)},this.moveCamera=n=>{if(!this.camera$.value)return;const o=oe(j(j({},this.camera$.value),n),{id:this.uid});this.storeCamera(o),this.camera$.setValue(o)},this.addCameraReaction=()=>{this.sideEffectManager.add(()=>this.manager.refresher.add(`${this.id}-camera`,()=>M.reaction(()=>{var n;return(n=this.appAttributes)==null?void 0:n.camera},n=>{if(n){const o=M.toJS(n);C.isEqual(o,this.camera$.value)||this.camera$.setValue(o)}})),"camera")},this.addSizeReaction=()=>{this.sideEffectManager.add(()=>this.manager.refresher.add(`${this.id}-size`,()=>M.reaction(()=>{var n;return(n=this.appAttributes)==null?void 0:n.size},n=>{if(n){const o=M.toJS(n);C.isEqual(o,this.size$.value)||this.size$.setValue(o)}})),"size")},this.onFocus=()=>{this.setScenePath()},this.setupDone=()=>{this.store.updateAppAttributes(this.id,"setup",!0),this.manager.dispatchInternalEvent(Y.InvokeAttributesUpdateCallback)},this.kind=e.kind,this.id=s,this.appScenePath=`/${this.id}-app-dir`,this.stateKey=`${this.id}_state`,this.appProxies.set(this.id,this),this.appEmitter=new rt.default,this.appListener=this.makeAppEventListener(this.id),this.isAddApp=r,this.initScenes(),(a=this.params.options)!=null&&a.scenePath&&this.createView(),this.scenePath||(this.scenePath=this.appScenePath),this._pageState=new dl({displayer:this.manager.displayer,scenePath:this.scenePath,view:this.view,notifyPageStateChange:this.notifyPageStateChange}),this.sideEffectManager.add(()=>()=>this._pageState.destroy()),this.camera$.setValue(M.toJS(this.appAttributes.camera)),this.size$.setValue(M.toJS(this.appAttributes.size)),this.addCameraReaction(),this.addSizeReaction(),this.sideEffectManager.add(()=>P.on("memberStateChange",this.onMemberStateChange)),this.sideEffectManager.add(()=>[this.syncCamera$.reaction(n=>{n||this.viewSync&&(this.viewSync.destroy(),this.viewSync=void 0,this.sideEffectManager.flush("camera"),this.sideEffectManager.flush("size"))}),this.whiteBoardViewCreated$.reaction(n=>{if(n&&this.box){if(!this.syncCamera$.value)return;w.combine([this.box$,this.view$]).subscribe(([o,c])=>{if(o&&c){if(this.camera$.value||(this.storeCamera({centerX:null,centerY:null,scale:1,id:this.uid}),this.camera$.setValue(M.toJS(this.appAttributes.camera))),!this.size$.value&&o.stageRect){const l=this.computedInitialRect(o.stageRect),d=(l==null?void 0:l.width)||o.stageRect.width,u=(l==null?void 0:l.height)||o.stageRect.height;this.storeSize({id:this.uid,width:d,height:u}),this.size$.setValue(M.toJS(this.appAttributes.size))}this.viewSync=new Ia({uid:this.uid,view$:this.view$,camera$:this.camera$,size$:this.size$,stageRect$:o._stageRect$,storeCamera:this.storeCamera,storeSize:this.storeSize}),this.sideEffectManager.add(()=>()=>{var l;return(l=this.viewSync)==null?void 0:l.destroy()}),this.whiteBoardViewCreated$.destroy()}})}}),this.manager.members$.reaction(n=>{this.appEmitter.emit("roomMembersChange",n)})])}createAppDir(){const e=this.scenePath||this.appScenePath;this._pageState.createSceneNode(e)||(vt(this.manager.room,e,[{name:"1"}]),this._pageState.createSceneNode(e),this.setSceneIndex(0)),this.scenes=ut(this.manager.displayer)[e];const s=this.createView();return this._pageState.setView(s),s}initScenes(){var i;const e=this.params.options;e&&(this.scenePath=e.scenePath,((i=this.appAttributes)==null?void 0:i.isDynamicPPT)&&this.scenePath?this.scenes=ut(this.manager.displayer)[this.scenePath]:this.scenes=e.scenes)}get view(){return this.view$.value}get viewIndex(){var e;return(e=this.view)==null?void 0:e.focusSceneIndex}get isWritable(){var e;return this.manager.canOperate&&!((e=this.box)!=null&&e.readonly)}get attributes(){return this.manager.attributes[this.id]}get appAttributes(){return this.store.getAppAttributes(this.id)}getFullScenePath(){if(this.scenePath)return C.get(this.appAttributes,[ee.FullPath])||this.getFullScenePathFromScenes()}getFullScenePathFromScenes(){const e=C.get(this.appAttributes,["state","SceneIndex"],0),i=Go(this.manager.room,this.scenePath,e);return i&&this.setFullPath(i),i}setFullPath(e){this.store.updateAppAttributes(this.id,ee.FullPath,e)}async baseInsertApp(e=!1){var a;const i=this.params;if(!i.kind)throw new Error("[WindowManager]: kind require");const s=await((a=pe.appClasses.get(i.kind))==null?void 0:a()),r=pe.registered.get(i.kind);if(s)await this.setupApp(this.id,e,s,i.options,r==null?void 0:r.appOptions);else throw new Error(`[WindowManager]: app load failed ${i.kind} ${i.src}`);return P.emit("updateManagerRect"),{appId:this.id,app:s}}get box(){return this.box$.value}async setupApp(e,i,s,r,a){var o;if(Je("setupApp",e,s,r),!this.boxManager)throw new Vs;const n=new hl(this.manager,e,this,a);this.appContext=n;try{P.once(`${e}${Y.WindowCreated}`).then(async()=>{var u;let d;i||(d=this.getAppInitState(e),(u=this.boxManager)==null||u.updateBoxState(d)),this.appEmitter.onAny(this.appListener),this.appAttributesUpdateListener(e),this.setViewFocusScenePath(),setTimeout(async()=>{const p=await s.setup(n);this.appResult=p,pe.notifyApp(this.kind,"created",{appId:e,result:p}),this.fixMobileSize(),this.isAddApp&&this.setupDone()},ma)});const c=(o=this.boxManager)==null?void 0:o.createBox({appId:e,app:s,options:r,canOperate:this.manager.canOperate,smartPosition:this.isAddApp}),l=pe.registered.get(this.kind);l!=null&&l.contentStyles&&(c==null||c.mountUserStyles(l.contentStyles)),this.box$.setValue(c),this.isAddApp&&this.box&&(this.store.updateAppState(e,Ee.ZIndex,this.box.zIndex),this.store.updateAppState(e,Ee.Size,{width:this.box.intrinsicWidth,height:this.box.intrinsicHeight}),this.boxManager.focusBox({appId:e},!1))}catch(c){throw console.error(c),new Error(`[WindowManager]: app setup error: ${c.message}`)}}fixMobileSize(){var i,s;const e=(i=this.boxManager)==null?void 0:i.getBox(this.id);e&&(e.minimized||(s=this.boxManager)==null||s.resizeBox({appId:this.id,width:e.intrinsicWidth+.001,height:e.intrinsicHeight+.001,skipUpdate:!0}))}async onSeek(e){var s;this.appEmitter.emit("seek",e).catch(r=>{console.log(`[WindowManager]: emit seek error: ${r.message}`)});const i=this.getAppInitState(this.id);(s=this.boxManager)==null||s.updateBoxState(i)}async onReconnected(){var a;if(!Boolean(this.manager.attributes.apps[this.id])){await this.destroy(!0,!1,!0);return}this.appEmitter.emit("reconnected",void 0);const i=this.getAppInitState(this.id);await this.destroy(!0,!1,!0);const s=this.params;await new js(s,this.manager,this.id,this.isAddApp).baseInsertApp(!0),(a=this.boxManager)==null||a.updateBoxState(i)}async onRemoveScene(e){if(this.scenePath&&e.startsWith(this.scenePath+"/")){let i=this.pageState.index,s=this._pageState.getFullPath(i);s||(i=0,s=this._pageState.getFullPath(i)),s&&this.setFullPath(s),this.setViewFocusScenePath(),this.view&&(this.view.focusSceneIndex=i)}}emitAppSceneStateChange(e){this.appEmitter.emit("sceneStateChange",e)}emitAppIsWritableChange(){this.appEmitter.emit("writableChange",this.isWritable)}makeAppEventListener(e){return(i,s)=>{var r,a,n,o;if(!!this.manager.canOperate)switch(i){case"setBoxSize":{(r=this.boxManager)==null||r.resizeBox({appId:e,width:s.width,height:s.height,skipUpdate:!1});break}case"setBoxMinSize":{(a=this.boxManager)==null||a.setBoxMinSize({appId:e,minWidth:s.minwidth,minHeight:s.minheight});break}case"setBoxTitle":{(n=this.boxManager)==null||n.setBoxTitle({appId:e,title:s.title});break}case ua.destroy:{if(this.status==="destroyed")return;this.destroy(!0,!1,!0,s==null?void 0:s.error),s!=null&&s.error&&console.error(s==null?void 0:s.error);break}case"focus":{(o=this.boxManager)==null||o.focusBox({appId:this.id}),Ue.emit("focus",{appId:this.id});break}}}}setScenePath(){if(!this.manager.canOperate)return;const e=this.getFullScenePath();this.manager.room&&e&&this.view&&Yt(this.manager.room,e)}setViewFocusScenePath(){if(this.status==="destroyed")return;const e=this.getFullScenePath();return e&&this.view&&dt(this.view,e),e}createView(){const e=this.viewManager.createView(this.id);return this.view$.setValue(e),this.setViewFocusScenePath(),e}get pageState(){return this._pageState.toObject()}async removeSceneByIndex(e){const i=this._pageState.getFullPath(e);if(i&&this.pageState){const s=$s(e,this.pageState);return this.setSceneIndexWithoutSync(s),this.manager.dispatchInternalEvent(Y.SetAppFocusIndex,{type:"app",appID:this.id,index:s}),setTimeout(()=>{gs(this.manager.room,i,e)},100),!0}else return!1}setSceneIndexWithoutSync(e){this.view&&(this.view.focusSceneIndex=e)}setSceneIndex(e){if(this.view){this.view.focusSceneIndex=e;const i=this._pageState.getFullPath(e);i&&(this.setFullPath(i),Yt(this.manager.room,i))}}async destroy(e,i,s,r){var a;if(this.status!=="destroyed"){this.status="destroyed";try{await pe.notifyApp(this.kind,"destroy",{appId:this.id}),Q.emit("appClose",{appId:this.id,kind:this.kind,error:r}),await this.appEmitter.emit("destroy",{error:r})}catch(n){console.error("[WindowManager]: notifyApp error",n.message,n.stack)}this.appEmitter.clearListeners(),this.sideEffectManager.flushAll(),P.emit(`destroy-${this.id}`,{error:r}),e&&((a=this.boxManager)==null||a.closeBox(this.id,s)),i&&(this.store.cleanAppAttributes(this.id),this.scenePath&&gs(this.manager.room,this.scenePath)),this.appProxies.delete(this.id),this.viewManager.destroyView(this.id),this.manager.appStatus.delete(this.id),this.valManager.destroy()}}close(){return this.destroy(!0,!0,!1)}}class gl{constructor(e){this.displayer=e,this.views=new Map}createView(e){const i=_a(this.displayer);return this.views.set(e,i),i}getView(e){return this.views.get(e)}destroyView(e){const i=this.views.get(e);if(i){try{i.release()}catch{}this.views.delete(e)}}setViewScenePath(e,i){const s=this.views.get(e);s&&(s.focusScenePath=i)}destroy(){this.views.forEach(e=>{try{e.release()}catch{}}),this.views.clear()}}const _a=t=>{const e=t.views.createView();return ml(e),e},ml=t=>{t.setCameraBound({maxContentMode:()=>10,minContentMode:()=>.1})};class fl{constructor(e){this.manager=e,this.started=!1,this.mainViewIsAddListener=!1,this.store=this.manager.store,this.sideEffectManager=new ve.SideEffectManager,this.camera$=new w.Val(void 0),this.size$=new w.Val(void 0),this.view$=new w.Val(void 0),this.createViewSync=()=>{var i;this.manager.boxManager&&!this.viewSync&&(this.viewSync=new Ia({uid:this.manager.uid,view$:this.view$,camera$:this.camera$,size$:this.size$,stageRect$:(i=this.manager.boxManager)==null?void 0:i.stageRect$,viewMode$:this.manager.windowManger.viewMode$,storeCamera:this.storeCamera,storeSize:this.storeSize}))},this.startListenWritableChange=()=>{this.sideEffectManager.add(()=>P.on("writableChange",i=>{i&&this.ensureCameraAndSize()}))},this.addCameraReaction=()=>{this.manager.refresher.add(ee.MainViewCamera,this.cameraReaction),this.manager.refresher.add(ee.MainViewSize,this.sizeReaction)},this.storeCurrentCamera=()=>{const i=this.view.camera;this.storeCamera(j({id:this.manager.uid},i))},this.storeCurrentSize=()=>{var s;const i=(s=this.manager.boxManager)==null?void 0:s.stageRect;i&&this.storeSize({id:this.manager.uid,width:i.width,height:i.height})},this.storeCamera=i=>{this.store.setMainViewCamera(i)},this.storeSize=i=>{this.store.setMainViewSize(i)},this.cameraReaction=()=>M.reaction(()=>this.mainViewCamera,i=>{if(i){const s=M.toJS(i);C.isEqual(s,this.camera$.value)||this.camera$.setValue(s)}},{fireImmediately:!0}),this.sizeReaction=()=>M.reaction(()=>this.mainViewSize,i=>{if(i){const s=M.toJS(i);C.isEqual(s,this.size$.value)||this.size$.setValue(s)}},{fireImmediately:!0}),this.mainViewClickListener=()=>{this.mainViewClickHandler()},this.setMainViewSize=C.debounce(i=>{this.store.setMainViewSize(oe(j({},i),{id:this.manager.uid}))},50),this.onCameraOrSizeUpdated=()=>{Q.emit("cameraStateChange",this.cameraState)},this.mainView=this.createMainView(),P.once("mainViewMounted").then(()=>{this.addMainViewListener(),this.start(),this.ensureCameraAndSize(),this.startListenWritableChange()}),this.sideEffectManager.add(()=>[P.on("startReconnect",()=>{Ir(this.mainView)})]),this.createViewSync(),this.sideEffectManager.add(()=>P.on("focusedChange",({focused:i})=>{if(i===void 0){const s=this.store.getMainViewScenePath();s&&Yt(this.manager.room,s)}})),this.camera$.reaction(i=>{i&&Q.emit("baseCameraChange",i)}),this.size$.reaction(i=>{i&&Q.emit("baseSizeChange",i)})}ensureCameraAndSize(){var e;if(!this.mainViewCamera||!this.mainViewSize){this.manager.dispatchInternalEvent(Y.InitMainViewCamera),this.storeCamera(j({id:this.manager.uid},this.view.camera));const i=(e=this.manager.boxManager)==null?void 0:e.stageRect;i&&!this.mainViewSize&&this.storeSize({id:this.manager.uid,width:i.width,height:i.height})}}get mainViewCamera(){return this.store.getMainViewCamera()}get mainViewSize(){return this.store.getMainViewSize()}get didRelease(){return C.get(this.view,["didRelease"])}start(){this.started||(this.addCameraListener(),this.addCameraReaction(),this.started=!0)}get view(){return this.mainView}get cameraState(){return j(j({},this.view.camera),this.view.size)}createMainView(){const e=_a(this.manager.displayer),i=this.store.getMainViewScenePath();return i&&dt(e,i),this.view$.setValue(e),e}onReconnect(){if(this.didRelease)this.rebind();else{const e=this.store.getMainViewScenePath();this.setFocusScenePath(e)}}setFocusScenePath(e){if(e)return dt(this.view,e)}rebind(){const e=this.mainView.divElement,i=this.mainView.disableCameraTransform,s=j({},this.mainView.camera);this.stop(),Ir(this.mainView),this.removeMainViewListener(),this.mainView=this.createMainView(),this.mainView.disableCameraTransform=i,this.mainView.divElement=e,this.mainView.moveCamera(oe(j({},s),{animationMode:M.AnimationMode.Immediately})),this.addMainViewListener(),this.start()}addMainViewListener(){this.mainViewIsAddListener||this.view.divElement&&(this.view.divElement.addEventListener("click",this.mainViewClickListener),this.view.divElement.addEventListener("touchend",this.mainViewClickListener),this.mainViewIsAddListener=!0)}removeMainViewListener(){this.view.divElement&&(this.view.divElement.removeEventListener("click",this.mainViewClickListener),this.view.divElement.removeEventListener("touchend",this.mainViewClickListener)),this.mainViewIsAddListener=!1}async mainViewClickHandler(){var e;!this.manager.canOperate||(this.store.cleanFocus(),(e=this.manager.boxManager)==null||e.blurAllBox())}addCameraListener(){this.view.callbacks.on("onCameraUpdated",this.onCameraOrSizeUpdated),this.view.callbacks.on("onSizeUpdated",this.onCameraOrSizeUpdated)}removeCameraListener(){this.view.callbacks.off("onCameraUpdated",this.onCameraOrSizeUpdated),this.view.callbacks.off("onSizeUpdated",this.onCameraOrSizeUpdated)}stop(){this.removeCameraListener(),this.manager.refresher.remove(ee.MainViewCamera),this.manager.refresher.remove(ee.MainViewSize),this.started=!1}destroy(){this.camera$.destroy(),this.size$.destroy(),this.view$.destroy(),this.removeMainViewListener(),this.stop(),this.sideEffectManager.flushAll()}}class bl{constructor(e){this.context=e,this.addRedoUndoListeners=i=>{if(i===void 0)this.addViewCallbacks(this.context.mainView(),this.onCanRedoStepsUpdate,this.onCanUndoStepsUpdate);else{const s=this.context.getAppProxy(i);s&&s.view&&this.addViewCallbacks(s.view,this.onCanRedoStepsUpdate,this.onCanUndoStepsUpdate)}},this.addViewCallbacks=(i,s,r)=>{s(i.canRedoSteps),r(i.canUndoSteps),i.callbacks.on("onCanRedoStepsUpdate",s),i.callbacks.on("onCanUndoStepsUpdate",r)},this.disposeViewCallbacks=i=>{i.callbacks.off("onCanRedoStepsUpdate",this.onCanRedoStepsUpdate),i.callbacks.off("onCanUndoStepsUpdate",this.onCanUndoStepsUpdate)},this.onCanRedoStepsUpdate=i=>{Q.emit("canRedoStepsChange",i)},this.onCanUndoStepsUpdate=i=>{Q.emit("canUndoStepsChange",i)},this.disposePrevFocusViewRedoUndoListeners=i=>{let s;if(i===void 0)s=this.context.mainView();else{const r=this.context.getAppProxy(i);r&&r.view&&(s=r.view)}s&&this.disposeViewCallbacks(s)},P.on("focusedChange",i=>{this.disposePrevFocusViewRedoUndoListeners(i.prev),setTimeout(()=>{this.addRedoUndoListeners(i.focused)},0)}),P.on("rootDirRemoved",()=>{this.disposePrevFocusViewRedoUndoListeners(e.focus()),this.addRedoUndoListeners(e.focus())}),this.addRedoUndoListeners(e.focus())}destroy(){this.disposePrevFocusViewRedoUndoListeners(this.context.focus())}}class yl{constructor(e){this.windowManger=e,this.appProxies=new Map,this.appStatus=new Map,this.store=pl,this.isReplay=this.windowManger.isReplay,this.mainViewScenesLength=0,this.callbacksNode=null,this.appCreateQueue=new Do,this.sceneIndex$=new w.Val(void 0),this.focused$=new w.Val(void 0),this.members$=new w.Val([]),this.sideEffectManager=new ve.SideEffectManager,this.sceneState=null,this.rootDirRemoving=!1,this.onRemoveScenes=async i=>{var r,a;const{scenePath:s}=i;if(s===we){await this.onRootDirRemoved(),this.dispatchInternalEvent(Y.RootDirRemoved);return}if(el(s)){let n=this.mainView.focusSceneIndex||0,o=(r=this.callbacksNode)==null?void 0:r.scenes[n];o||(n=0,o=(a=this.callbacksNode)==null?void 0:a.scenes[n]),o&&await this.setMainViewScenePath(`${we}${o}`),await this.setMainViewSceneIndex(n)}else this.appProxies.forEach(n=>{n.onRemoveScene(s)})},this.onReadonlyChanged=()=>{this.appProxies.forEach(i=>{i.emitAppIsWritableChange()})},this.onPlayerSeekStart=async()=>{await this.closeAll()},this.onPlayerSeekDone=async i=>{await this.attributesUpdateCallback(this.attributes.apps),this.appProxies.forEach(s=>{s.onSeek(i)})},this.createRootDirScenesCallback=()=>{let i=!1;this.callbacksNode&&(this.callbacksNode.dispose(),i=!0),this.callbacksNode=this.displayer.createScenesCallback(we,{onAddScene:this.onSceneChange,onRemoveScene:async(s,r)=>{await this.onSceneChange(s),P.emit("rootDirSceneRemoved",r)}}),this.callbacksNode&&(this.updateSceneState(this.callbacksNode),this.mainViewScenesLength=this.callbacksNode.scenes.length,i&&this.emitMainViewScenesChange(this.callbacksNode.scenes.length))},this.removeSceneByIndex=async i=>{var a;const s=$s(i,this.windowManger.pageState);this.setSceneIndexWithoutSync(s),this.dispatchInternalEvent(Y.SetAppFocusIndex,{type:"main",index:s});const r=(a=this.callbacksNode)==null?void 0:a.scenes[i];return setTimeout(()=>{r&&gs(this.room,`${we}${r}`,i)},100),new Promise((n,o)=>{P.once("rootDirSceneRemoved").then(c=>{c===r&&n(!0)}).catch(c=>{console.log(`[WindowManager]: removePage error: ${c}`),o(!1)})})},this.setSceneIndexWithoutSync=i=>{var r;const s=(r=this.callbacksNode)==null?void 0:r.scenes[i];s&&this.mainViewProxy.setFocusScenePath(`${we}${s}`)},this.onSceneChange=i=>(this.mainViewScenesLength=i.scenes.length,this.updateSceneState(i),this.emitMainViewScenesChange(this.mainViewScenesLength)),this.emitMainViewScenesChange=i=>Promise.all([Q.emit("mainViewScenesLengthChange",i),P.emit("changePageState")]),this.updateSceneState=i=>{const s=this.store.getMainViewSceneIndex()||0;let r=i.scenes[s];r||(r=i.scenes[this.mainView.focusSceneIndex||0]),this.sceneState={scenePath:`${we}${r}`,contextPath:i.path,index:s,scenes:i.scenes.map(a=>({name:a})),sceneName:r},Q.emit("sceneStateChange",this.sceneState)},this.onBoxMove=i=>{this.dispatchInternalEvent(Y.AppMove,i),this.store.updateAppState(i.appId,Ee.Position,{x:i.x,y:i.y})},this.onBoxResize=i=>{i.width&&i.height&&(this.dispatchInternalEvent(Y.AppResize,i),this.store.updateAppState(i.appId,Ee.Size,{width:i.width,height:i.height}))},this.onBoxFocus=i=>{this.windowManger.safeSetAttributes({focus:i.appId})},this.onBoxClose=i=>{const s=this.appProxies.get(i.appId);s&&s.destroy(!1,!0,!0,i.error)},this.onBoxStateChange=i=>{this.dispatchInternalEvent(Y.AppBoxStateChange,i)},this.addAppsChangeListener=()=>{this.refresher.add("apps",()=>Sa(()=>this.attributes.apps,()=>{this.attributesUpdateCallback(this.attributes.apps)}))},this.addAppCloseListener=()=>{var i;(i=this.refresher)==null||i.add("appsClose",()=>rl(this.attributes.apps,()=>{this.onAppDelete(this.attributes.apps)}))},this.onMainViewIndexChange=i=>{i!==void 0&&this.sceneIndex$.value!==i&&(Q.emit("mainViewSceneIndexChange",i),P.emit("changePageState"),this.callbacksNode&&this.updateSceneState(this.callbacksNode),this.sceneIndex$.setValue(i))},this.onFocusChange=i=>{var s;this.focused$.value!==i&&(Q.emit("focusedChange",i),P.emit("focusedChange",{focused:i,prev:this.focused$.value}),this.focused$.setValue(i),i!==void 0&&((s=this.boxManager)==null||s.focusBox({appId:i}),setTimeout(()=>{const r=this.appProxies.get(i);r&&(r.onFocus(),pe.notifyApp(r.kind,"focus",{appId:i}))},0)))},this.attributesUpdateCallback=C.debounce(i=>this._attributesUpdateCallback(i),100),this.onRegisteredChange=i=>{!i||Object.entries(i).forEach(([s,r])=>{pe.appClasses.has(s)||pe.register({kind:s,src:r.src,name:r.name})})},this.onMinimized=i=>{var s,r;((s=this.boxManager)==null?void 0:s.minimized)!==i&&(i===!0&&((r=this.boxManager)==null||r.blurAllBox()),setTimeout(()=>{var a;(a=this.boxManager)==null||a.setMinimized(Boolean(i))},0))},this.onAppDelete=async i=>{const s=Object.keys(i);for(const[r,a]of this.appProxies.entries())s.includes(r)||await a.destroy(!0,!1,!0)},this.closeAll=async()=>{for(const[i,s]of this.appProxies.entries())await s.destroy(!0,!1,!0)},this.displayerStateListener=i=>{const s=i.sceneState;if(s){const r=s.scenePath;this.appProxies.forEach(a=>{a.scenePath&&r.startsWith(a.scenePath)&&(a.emitAppSceneStateChange(s),a.setFullPath(r))})}this.appProxies.forEach(r=>{r.appEmitter.emit("roomStateChange",i)}),i.roomMembers&&this.members$.setValue(Tr(i.roomMembers)),P.emit("observerIdChange",this.displayer.observerId),i.memberState&&P.emit("memberStateChange",M.toJS(i.memberState))},this.displayerWritableListener=i=>{var a,n;const s=!i,r=this.windowManger.readonly===void 0||!this.windowManger.readonly;this.windowManger.readonly===void 0?(a=this.boxManager)==null||a.setReadonly(i):(n=this.boxManager)==null||n.setReadonly(!(s&&r)),this.appProxies.forEach(o=>{o.emitAppIsWritableChange()}),s&&this.room&&this.room.disableSerialization===!0&&(this.room.disableSerialization=!1),P.emit("writableChange",s)},this.updateSceneIndex=()=>{const i=this.store.getMainViewScenePath(),s=Ji(i),r=ut(this.displayer)[s];if(r.length){const a=i.replace(s,"").replace("/",""),n=r.findIndex(o=>o.name===a);C.isInteger(n)&&n>=0&&this.safeSetAttributes({_mainSceneIndex:n})}},this.updateRootDirRemoving=i=>{this.rootDirRemoving=i},this.displayer=e.displayer,this.store.setContext({getAttributes:()=>this.attributes,safeSetAttributes:i=>this.safeSetAttributes(i),safeUpdateAttributes:(i,s)=>this.safeUpdateAttributes(i,s)}),this.mainViewProxy=new fl(this),this.viewManager=new gl(this.displayer),this.appListeners=new il(this),this.displayer.callbacks.on(this.eventName,this.displayerStateListener),this.appListeners.addListeners(),this.refresher=uo,this.refresher.setRoom(this.room),this.refresher.setContext({emitter:P}),this.sideEffectManager.add(()=>()=>{var i,s,r;this.appCreateQueue.destroy(),this.mainViewProxy.destroy(),(i=this.refresher)==null||i.destroy(),this.viewManager.destroy(),(s=this.boxManager)==null||s.destroy(),(r=this.callbacksNode)==null||r.dispose()}),P.once("onCreated").then(()=>this.onCreated()),P.on("onReconnected",()=>this.onReconnected()),M.isPlayer(this.displayer)&&(P.on("seekStart",this.onPlayerSeekStart),P.on("seek",this.onPlayerSeekDone)),P.on("removeScenes",this.onRemoveScenes),P.on("setReadonly",this.onReadonlyChanged),this.createRootDirScenesCallback(),pe.setSyncRegisterApp(i=>{this.safeUpdateAttributes([ee.Registered,i.kind],i)}),this.members$.setValue(Tr(this.displayer.state.roomMembers))}async onRootDirRemoved(e=!0){await this.setMainViewScenePath(ga),this.createRootDirScenesCallback();for(const[i,s]of this.appProxies.entries())s.view&&await this.closeApp(i,e);this.mainViewProxy.rebind(),await P.emit("rootDirRemoved"),this.updateRootDirRemoving(!1)}get eventName(){return M.isRoom(this.displayer)?"onRoomStateChanged":"onPlayerStateChanged"}get attributes(){return this.windowManger.attributes}get canOperate(){return this.windowManger.canOperate}get room(){return M.isRoom(this.displayer)?this.displayer:void 0}get mainView(){return this.mainViewProxy.view}get focusApp(){if(this.store.focus)return this.appProxies.get(this.store.focus)}get uid(){var e;return((e=this.room)==null?void 0:e.uid)||""}getMainViewSceneDir(){const e=this.store.getMainViewScenePath();if(e)return Ji(e);throw new Error("[WindowManager]: mainViewSceneDir not found")}async onCreated(){var e;if(await this.attributesUpdateCallback(this.attributes.apps),P.emit("updateManagerRect"),Ue.on("move",this.onBoxMove),Ue.on("resize",this.onBoxResize),Ue.on("focus",this.onBoxFocus),Ue.on("close",this.onBoxClose),Ue.on("boxStateChange",this.onBoxStateChange),this.addAppsChangeListener(),this.addAppCloseListener(),this.refresher.add("maximized",()=>M.autorun(()=>{var s;const i=this.attributes.maximized;(s=this.boxManager)==null||s.setMaximized(Boolean(i))})),this.refresher.add("minimized",()=>M.autorun(()=>{const i=this.attributes.minimized;this.onMinimized(i)})),this.refresher.add("mainViewIndex",()=>M.autorun(()=>{const i=C.get(this.attributes,"_mainSceneIndex");this.onMainViewIndexChange(i)})),this.refresher.add("focusedChange",()=>M.autorun(()=>{const i=C.get(this.attributes,"focus");this.onFocusChange(i)})),this.refresher.add("registeredChange",()=>M.autorun(()=>{const i=C.get(this.attributes,ee.Registered);this.onRegisteredChange(i)})),!this.attributes.apps||Object.keys(this.attributes.apps).length===0){const i=this.store.getMainViewScenePath();if(!i)return;this.resetScenePath(i)}this.displayerWritableListener(!((e=this.room)!=null&&e.isWritable)),this.displayer.callbacks.on("onEnableWriteNowChanged",this.displayerWritableListener),this.focused$.setValue(this.attributes.focus),this.sideEffectManager.add(()=>{const i=new bl({mainView:()=>this.mainViewProxy.view,focus:()=>this.attributes.focus,getAppProxy:s=>this.appProxies.get(s)});return()=>i.destroy()})}async _attributesUpdateCallback(e){if(e&&ce.container){const i=Object.keys(e);i.length===0&&this.appCreateQueue.emitReady();let s=i.map(r=>e[r].setup?{id:r,createdAt:e[r].createdAt}:{});this.isReplay&&(s=i.map(r=>({id:r,createdAt:e[r].createdAt})));for(const{id:r}of C.orderBy(s,"createdAt","asc"))if(r&&!this.appProxies.has(r)&&!this.appStatus.has(r)){const a=e[r];try{if(!this.attributes[r])throw new Error("appAttributes is undefined");this.appCreateQueue.push(()=>(this.appStatus.set(r,ps.StartCreate),this.baseInsertApp({kind:a.kind,options:a.options,isDynamicPPT:a.isDynamicPPT},r,!1))),this.focusByAttributes(e)}catch(n){console.warn("[WindowManager]: Insert App Error",n)}}}}refresh(){this.attributesUpdateCallback(this.attributes.apps)}setBoxManager(e){this.boxManager=e,this.mainViewProxy.createViewSync()}resetMaximized(){var e;(e=this.boxManager)==null||e.setMaximized(Boolean(this.store.getMaximized()))}resetMinimized(){var e;(e=this.boxManager)==null||e.setMinimized(Boolean(this.store.getMinimized()))}bindMainView(e,i){const s=this.mainViewProxy.view;s.disableCameraTransform=i,Mi(30).then(()=>{s.divElement=e,P.emit("mainViewMounted")}),s.focusScenePath||this.setMainViewFocusPath()}setMainViewFocusPath(e){var s;const i=e||this.store.getMainViewScenePath();if(i)return dt(this.mainView,i),((s=this.mainView)==null?void 0:s.focusScenePath)===i}resetScenePath(e){this.displayer.state.sceneState.scenePath!==e&&Yt(this.room,e)}async addApp(e,i){Je("addApp",e);const{appId:s,needFocus:r}=await this.beforeAddApp(e,i),a=await this.baseInsertApp(e,s,!0,r);return this.afterAddApp(a),a==null?void 0:a.id}async beforeAddApp(e,i){var n,o;const s=await Qo(e.kind);this.appStatus.set(s,ps.StartCreate);const r=(n=e.attributes)!=null?n:{};this.safeUpdateAttributes([s],r),this.store.setupAppAttributes(e,s,i);const a=!((o=this.boxManager)!=null&&o.minimized);return a&&this.store.setAppFocus(s,!0),{appId:s,needFocus:a}}afterAddApp(e){var i,s;if(e&&e.box){const r=e.box;Ue.emit("move",{appId:e.id,x:r==null?void 0:r.intrinsicX,y:r==null?void 0:r.intrinsicY}),this.store.updateAppState(e.id,Ee.ZIndex,r.zIndex)}(i=this.boxManager)!=null&&i.minimized&&((s=this.boxManager)==null||s.setMinimized(!1,!1))}async closeApp(e,i=!0){const s=this.appProxies.get(e);s&&s.destroy(!0,i,!1)}async baseInsertApp(e,i,s,r){if(this.appProxies.has(i)){console.warn("[WindowManager]: app duplicate exists and cannot be created again");return}const a=new js(e,this,i,s);if(a)return await a.baseInsertApp(r),this.appStatus.delete(i),a;throw this.appStatus.delete(i),new Error("[WindowManger]: initialize AppProxy failed")}safeSetAttributes(e){this.windowManger.safeSetAttributes(e)}safeUpdateAttributes(e,i){this.windowManger.safeUpdateAttributes(e,i)}async setMainViewScenePath(e){if(this.room){const i=this.displayer.scenePathType(e);if(Ji(e)!==we)throw new Error('[WindowManager]: main view scenePath must in root dir "/"');if(i===M.ScenePathType.None)throw new Error(`[WindowManager]: ${e} not valid scene`);if(i===M.ScenePathType.Page)await this._setMainViewScenePath(e);else if(i===M.ScenePathType.Dir){const r=Jo(this.displayer,e);r&&await this._setMainViewScenePath(r)}}}async _setMainViewScenePath(e){this.setMainViewFocusPath(e)&&(this.safeSetAttributes({_mainScenePath:e}),this.store.setMainViewFocusPath(this.mainView),this.updateSceneIndex(),this.dispatchSetMainViewScenePath(e))}async setMainViewSceneIndex(e){var i;if(this.room){if(this.store.getMainViewSceneIndex()===e)return;const s=(i=this.callbacksNode)==null?void 0:i.scenes[e],r=`${we}${s}`;if(s)this.setMainViewFocusPath(r)&&(this.store.setMainViewScenePath(r),this.safeSetAttributes({_mainSceneIndex:e}),this.dispatchSetMainViewScenePath(r));else throw new Error(`[WindowManager]: ${e} not valid index`)}}dispatchSetMainViewScenePath(e){this.dispatchInternalEvent(Y.SetMainViewScenePath,{nextScenePath:e}),Yt(this.room,e)}getAppInitPath(e){var s;const i=this.store.getAppAttributes(e);if(i)return(s=i==null?void 0:i.options)==null?void 0:s.scenePath}safeDispatchMagixEvent(e,i){this.canOperate&&this.displayer.dispatchMagixEvent(e,i)}focusByAttributes(e){var i;if(e&&Object.keys(e).length===((i=this.boxManager)==null?void 0:i.boxSize)){const s=this.store.focus;s&&this.boxManager.focusBox({appId:s})}}async onReconnected(){this.attributesUpdateCallback(this.attributes.apps);const i=Array.from(this.appProxies.values()).map(s=>s.onReconnected());this.mainViewProxy.onReconnect(),await Promise.all(i)}notifyContainerRectUpdate(e){this.appProxies.forEach(i=>{i.appEmitter.emit("containerRectUpdate",e)})}dispatchInternalEvent(e,i){this.safeDispatchMagixEvent(us,{eventName:e,payload:i})}destroy(){this.displayer.callbacks.off(this.eventName,this.displayerStateListener),this.displayer.callbacks.off("onEnableWriteNowChanged",this.displayerWritableListener),this.appListeners.removeListeners(),Ue.clearListeners(),P.clearListeners(),this.appProxies.size&&this.appProxies.forEach(e=>{e.destroy(!0,!1,!0)}),Q.clearListeners(),this.sideEffectManager.flushAll(),this.sceneIndex$.destroy(),this.focused$.destroy(),this.members$.destroy()}}/*! *****************************************************************************
|
3
3
|
Copyright (c) Microsoft Corporation.
|
4
4
|
|
5
5
|
Permission to use, copy, modify, and/or distribute this software for any
|
@@ -12,7 +12,7 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
12
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
15
|
-
***************************************************************************** */var ce=function(){return ce=Object.assign||function(e){for(var i,s=1,r=arguments.length;s<r;s++){i=arguments[s];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(e[a]=i[a])}return e},ce.apply(this,arguments)};function js(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(i[s[r]]=t[s[r]]);return i}var Ki=0,Aa=typeof window!="undefined"&&window.requestAnimationFrame!==void 0?function(t){return window.requestAnimationFrame(t)}:function(t){var e=Date.now(),i=Math.max(0,16.7-(e-Ki));Ki=e+i,setTimeout(function(){return t(Ki)},i)},wl=function(t){var e=[],i=[],s=0,r=!1,a=0,n=new WeakSet,o=new WeakSet,c={cancel:function(l){var d=i.indexOf(l);n.add(l),d!==-1&&i.splice(d,1)},process:function(l){var d;if(r=!0,d=[i,e],e=d[0],i=d[1],i.length=0,s=e.length,s){var u;for(a=0;a<s;a++)u=e[a],u(l),o.has(u)===!0&&!n.has(u)&&(c.schedule(u),t(!0))}r=!1},schedule:function(l,d,u){d===void 0&&(d=!1),u===void 0&&(u=!1);var p=u&&r,m=p?e:i;n.delete(l),d&&o.add(l),m.indexOf(l)===-1&&(m.push(l),p&&(s=e.length))}};return c},vl=40,Nr=1/60*1e3,pi=!0,Qt=!1,ms=!1,zt={delta:0,timestamp:0},Bs=["read","update","preRender","render","postRender"],xl=function(t){return Qt=t},ka=Bs.reduce(function(t,e){return t[e]=wl(xl),t},{}),Sl=Bs.reduce(function(t,e){var i=ka[e];return t[e]=function(s,r,a){return r===void 0&&(r=!1),a===void 0&&(a=!1),Qt||Cl(),i.schedule(s,r,a),s},t},{}),Ml=function(t){return ka[t].process(zt)},Ta=function(t){Qt=!1,zt.delta=pi?Nr:Math.max(Math.min(t-zt.timestamp,vl),1),pi||(Nr=zt.delta),zt.timestamp=t,ms=!0,Bs.forEach(Ml),ms=!1,Qt&&(pi=!1,Aa(Ta))},Cl=function(){Qt=!0,pi=!0,ms||Aa(Ta)},Na=function(t,e){return function(i){return Math.max(Math.min(i,e),t)}},gi=function(t){return t%1?Number(t.toFixed(5)):t},Ea=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i,Pi={test:function(t){return typeof t=="number"},parse:parseFloat,transform:function(t){return t}},Vt=ce(ce({},Pi),{transform:Na(0,1)}),li=ce(ce({},Pi),{default:1}),Rs=function(t){return{test:function(e){return typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1},parse:parseFloat,transform:function(e){return""+e+t}}},lt=Rs("deg"),$t=Rs("%"),L=Rs("px"),Er=ce(ce({},$t),{parse:function(t){return $t.parse(t)/100},transform:function(t){return $t.transform(t*100)}}),Il=function(t){return t.substring(t.indexOf("(")+1,t.lastIndexOf(")"))},_l=Na(0,255),fs=function(t){return t.red!==void 0},bs=function(t){return t.hue!==void 0};function Al(t){return Il(t).replace(/(,|\/)/g," ").split(/ \s*/)}var Pa=function(t){return function(e){if(typeof e!="string")return e;for(var i={},s=Al(e),r=0;r<4;r++)i[t[r]]=s[r]!==void 0?parseFloat(s[r]):1;return i}},kl=function(t){var e=t.red,i=t.green,s=t.blue,r=t.alpha,a=r===void 0?1:r;return"rgba("+e+", "+i+", "+s+", "+a+")"},Tl=function(t){var e=t.hue,i=t.saturation,s=t.lightness,r=t.alpha,a=r===void 0?1:r;return"hsla("+e+", "+i+", "+s+", "+a+")"},es=ce(ce({},Pi),{transform:function(t){return Math.round(_l(t))}});function Os(t,e){return t.startsWith(e)&&Ea.test(t)}var mi={test:function(t){return typeof t=="string"?Os(t,"rgb"):fs(t)},parse:Pa(["red","green","blue","alpha"]),transform:function(t){var e=t.red,i=t.green,s=t.blue,r=t.alpha,a=r===void 0?1:r;return kl({red:es.transform(e),green:es.transform(i),blue:es.transform(s),alpha:gi(Vt.transform(a))})}},ts={test:function(t){return typeof t=="string"?Os(t,"hsl"):bs(t)},parse:Pa(["hue","saturation","lightness","alpha"]),transform:function(t){var e=t.hue,i=t.saturation,s=t.lightness,r=t.alpha,a=r===void 0?1:r;return Tl({hue:Math.round(e),saturation:$t.transform(gi(i)),lightness:$t.transform(gi(s)),alpha:gi(Vt.transform(a))})}},Pr=ce(ce({},mi),{test:function(t){return typeof t=="string"&&Os(t,"#")},parse:function(t){var e="",i="",s="";return t.length>4?(e=t.substr(1,2),i=t.substr(3,2),s=t.substr(5,2)):(e=t.substr(1,1),i=t.substr(2,1),s=t.substr(3,1),e+=e,i+=i,s+=s),{red:parseInt(e,16),green:parseInt(i,16),blue:parseInt(s,16),alpha:1}}}),ze={test:function(t){return typeof t=="string"&&Ea.test(t)||fs(t)||bs(t)},parse:function(t){return mi.test(t)?mi.parse(t):ts.test(t)?ts.parse(t):Pr.test(t)?Pr.parse(t):t},transform:function(t){return fs(t)?mi.transform(t):bs(t)?ts.transform(t):t}},Us=function(t){var e=t.onRead,i=t.onRender,s=t.uncachedValues,r=s===void 0?new Set:s,a=t.useCache,n=a===void 0?!0:a;return function(o){o===void 0&&(o={});var c=js(o,[]),l={},d=[],u=!1;function p(g,f){g.startsWith("--")&&(c.hasCSSVariable=!0);var b=l[g];l[g]=f,l[g]!==b&&(d.indexOf(g)===-1&&d.push(g),u||(u=!0,Sl.render(m.render)))}var m={get:function(g,f){f===void 0&&(f=!1);var b=!f&&n&&!r.has(g)&&l[g]!==void 0;return b?l[g]:e(g,c)},set:function(g,f){if(typeof g=="string")p(g,f);else for(var b in g)p(b,g[b]);return this},render:function(g){return g===void 0&&(g=!1),(u||g===!0)&&(i(l,c,d),u=!1,d.length=0),this}};return m}},Nl=/([a-z])([A-Z])/g,El="$1-$2",zi=function(t){return t.replace(Nl,El).toLowerCase()},za=new Map,Ws=new Map,Da=["Webkit","Moz","O","ms",""],Pl=Da.length,zl=typeof document!="undefined",is,La=function(t,e){return Ws.set(t,zi(e))},Dl=function(t){is=is||document.createElement("div");for(var e=0;e<Pl;e++){var i=Da[e],s=i==="",r=s?t:i+t.charAt(0).toUpperCase()+t.slice(1);if(r in is.style||s){if(s&&t==="clipPath"&&Ws.has(t))return;za.set(t,r),La(t,(s?"":"-")+zi(r))}}},Ll=function(t){return La(t,t)},Va=function(t,e){e===void 0&&(e=!1);var i=e?Ws:za;return i.has(t)||(zl?Dl(t):Ll(t)),i.get(t)||t},Vl=["","X","Y","Z"],$l=["translate","scale","rotate","skew","transformPerspective"],ys=$l.reduce(function(t,e){return Vl.reduce(function(i,s){return i.push(e+s),i},t)},["x","y","z"]),jl=ys.reduce(function(t,e){return t[e]=!0,t},{});function Hs(t){return jl[t]===!0}function Bl(t,e){return ys.indexOf(t)-ys.indexOf(e)}var Rl=new Set(["originX","originY","originZ"]);function Ol(t){return Rl.has(t)}var zr=ce(ce({},Pi),{transform:Math.round}),Ul={color:ze,backgroundColor:ze,outlineColor:ze,fill:ze,stroke:ze,borderColor:ze,borderTopColor:ze,borderRightColor:ze,borderBottomColor:ze,borderLeftColor:ze,borderWidth:L,borderTopWidth:L,borderRightWidth:L,borderBottomWidth:L,borderLeftWidth:L,borderRadius:L,radius:L,borderTopLeftRadius:L,borderTopRightRadius:L,borderBottomRightRadius:L,borderBottomLeftRadius:L,width:L,maxWidth:L,height:L,maxHeight:L,size:L,top:L,right:L,bottom:L,left:L,padding:L,paddingTop:L,paddingRight:L,paddingBottom:L,paddingLeft:L,margin:L,marginTop:L,marginRight:L,marginBottom:L,marginLeft:L,rotate:lt,rotateX:lt,rotateY:lt,rotateZ:lt,scale:li,scaleX:li,scaleY:li,scaleZ:li,skew:lt,skewX:lt,skewY:lt,distance:L,translateX:L,translateY:L,translateZ:L,x:L,y:L,z:L,perspective:L,opacity:Vt,originX:Er,originY:Er,originZ:L,zIndex:zr,fillOpacity:Vt,strokeOpacity:Vt,numOctaves:zr},Fs=function(t){return Ul[t]},Wl=function(t,e){return e&&typeof t=="number"?e.transform(t):t},jt="scrollLeft",Bt="scrollTop",$a=new Set([jt,Bt]),Hl=new Set([jt,Bt,"transform"]),Fl={x:"translateX",y:"translateY",z:"translateZ"};function ja(t){return typeof t=="function"}function Zl(t,e,i,s,r,a){a===void 0&&(a=!0);var n="",o=!1;i.sort(Bl);for(var c=i.length,l=0;l<c;l++){var d=i[l];n+=(Fl[d]||d)+"("+e[d]+") ",o=d==="z"?!0:o}return!o&&r?n+="translateZ(0)":n=n.trim(),ja(t.transform)?n=t.transform(e,s?"":n):a&&s&&(n="none"),n}function Yl(t,e,i,s,r,a,n,o){e===void 0&&(e=!0),i===void 0&&(i={}),s===void 0&&(s={}),r===void 0&&(r={}),a===void 0&&(a=[]),n===void 0&&(n=!1),o===void 0&&(o=!0);var c=!0,l=!1,d=!1;for(var u in t){var p=t[u],m=Fs(u),g=Wl(p,m);Hs(u)?(l=!0,s[u]=g,a.push(u),c&&(m.default&&p!==m.default||!m.default&&p!==0)&&(c=!1)):Ol(u)?(r[u]=g,d=!0):(!Hl.has(u)||!ja(g))&&(i[Va(u,n)]=g)}return(l||typeof t.transform=="function")&&(i.transform=Zl(t,s,a,c,e,o)),d&&(i.transformOrigin=(r.originX||"50%")+" "+(r.originY||"50%")+" "+(r.originZ||0)),i}function Zs(t){var e=t===void 0?{}:t,i=e.enableHardwareAcceleration,s=i===void 0?!0:i,r=e.isDashCase,a=r===void 0?!0:r,n=e.allowTransformNone,o=n===void 0?!0:n,c={},l={},d={},u=[];return function(p){return u.length=0,Yl(p,s,c,l,d,u,a,o),c}}function Ql(t,e){var i=e.element,s=e.preparseOutput,r=Fs(t);if(Hs(t))return r&&r.default||0;if($a.has(t))return i[t];var a=window.getComputedStyle(i,null).getPropertyValue(Va(t,!0))||0;return s&&r&&r.test(a)&&r.parse?r.parse(a):a}function Gl(t,e,i){var s=e.element,r=e.buildStyles,a=e.hasCSSVariable;if(Object.assign(s.style,r(t)),a)for(var n=i.length,o=0;o<n;o++){var c=i[o];c.startsWith("--")&&s.style.setProperty(c,t[c])}i.indexOf(jt)!==-1&&(s[jt]=t[jt]),i.indexOf(Bt)!==-1&&(s[Bt]=t[Bt])}var ql=Us({onRead:Ql,onRender:Gl,uncachedValues:$a});function Jl(t,e){e===void 0&&(e={});var i=e.enableHardwareAcceleration,s=e.allowTransformNone,r=js(e,["enableHardwareAcceleration","allowTransformNone"]);return ql(ce({element:t,buildStyles:Zs({enableHardwareAcceleration:i,allowTransformNone:s}),preparseOutput:!0},r))}var Ba=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues"]),Dr=.5,Ra=function(){return{style:{}}},ss=function(t,e){return L.transform(t*e)},Xl={x:0,y:0,width:0,height:0};function Lr(t,e,i){return typeof t=="string"?t:L.transform(e+i*t)}function Kl(t,e,i){return Lr(e,t.x,t.width)+" "+Lr(i,t.y,t.height)}var Oa={enableHardwareAcceleration:!1,isDashCase:!1};function ec(t,e,i,s,r,a){e===void 0&&(e=Xl),s===void 0&&(s=Zs(Oa)),r===void 0&&(r=Ra()),a===void 0&&(a=!0);var n=t.attrX,o=t.attrY,c=t.originX,l=t.originY,d=t.pathLength,u=t.pathSpacing,p=u===void 0?1:u,m=t.pathOffset,g=m===void 0?0:m,f=js(t,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]),b=s(f);for(var v in b)if(v==="transform")r.style.transform=b[v];else{var x=a&&!Ba.has(v)?zi(v):v;r[x]=b[v]}return(c!==void 0||l!==void 0||b.transform)&&(r.style.transformOrigin=Kl(e,c!==void 0?c:Dr,l!==void 0?l:Dr)),n!==void 0&&(r.x=n),o!==void 0&&(r.y=o),i!==void 0&&d!==void 0&&(r[a?"stroke-dashoffset":"strokeDashoffset"]=ss(-g,i),r[a?"stroke-dasharray":"strokeDasharray"]=ss(d,i)+" "+ss(p,i)),r}function tc(t,e,i){i===void 0&&(i=!0);var s=Ra(),r=Zs(Oa);return function(a){return ec(a,t,e,r,s,i)}}var ic=function(t){return typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()},sc=function(t){try{return ic(t)}catch{return{x:0,y:0,width:0,height:0}}},rc=function(t){return t.tagName==="path"},ac=Us({onRead:function(t,e){var i=e.element;if(t=Ba.has(t)?t:zi(t),Hs(t)){var s=Fs(t);return s&&s.default||0}else return i.getAttribute(t)},onRender:function(t,e){var i=e.element,s=e.buildAttrs,r=s(t);for(var a in r)a==="style"?Object.assign(i.style,r.style):i.setAttribute(a,r[a])}}),nc=function(t){var e=sc(t),i=rc(t)&&t.getTotalLength?t.getTotalLength():void 0;return ac({element:t,buildAttrs:tc(e,i)})},oc=Us({useCache:!1,onRead:function(t){return t==="scrollTop"?window.pageYOffset:window.pageXOffset},onRender:function(t){var e=t.scrollTop,i=e===void 0?0:e,s=t.scrollLeft,r=s===void 0?0:s;return window.scrollTo(r,i)}}),ws=new WeakMap,lc=function(t){return t instanceof HTMLElement||typeof t.click=="function"},cc=function(t){return t instanceof SVGElement||"ownerSVGElement"in t},hc=function(t,e){var i;return t===window?i=oc(t):lc(t)?i=Jl(t,e):cc(t)&&(i=nc(t)),ws.set(t,i),i},dc=function(t,e){return ws.has(t)?ws.get(t):hc(t,e)};function uc(t,e){var i=typeof t=="string"?document.querySelector(t):t;return dc(i,e)}var Ne=function(e,i,s,r){var a=s?s.call(r,e,i):void 0;if(a!==void 0)return!!a;if(e===i)return!0;if(typeof e!="object"||!e||typeof i!="object"||!i)return!1;var n=Object.keys(e),o=Object.keys(i);if(n.length!==o.length)return!1;for(var c=Object.prototype.hasOwnProperty.bind(i),l=0;l<n.length;l++){var d=n[l];if(!c(d))return!1;var u=e[d],p=i[d];if(a=s?s.call(r,u,p,d):void 0,a===!1||a===void 0&&u!==p)return!1}return!0},pc=(()=>`.tele-fancy-scrollbar {
|
15
|
+
***************************************************************************** */var he=function(){return he=Object.assign||function(e){for(var i,s=1,r=arguments.length;s<r;s++){i=arguments[s];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(e[a]=i[a])}return e},he.apply(this,arguments)};function Bs(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(i[s[r]]=t[s[r]]);return i}var Ki=0,Aa=typeof window!="undefined"&&window.requestAnimationFrame!==void 0?function(t){return window.requestAnimationFrame(t)}:function(t){var e=Date.now(),i=Math.max(0,16.7-(e-Ki));Ki=e+i,setTimeout(function(){return t(Ki)},i)},wl=function(t){var e=[],i=[],s=0,r=!1,a=0,n=new WeakSet,o=new WeakSet,c={cancel:function(l){var d=i.indexOf(l);n.add(l),d!==-1&&i.splice(d,1)},process:function(l){var d;if(r=!0,d=[i,e],e=d[0],i=d[1],i.length=0,s=e.length,s){var u;for(a=0;a<s;a++)u=e[a],u(l),o.has(u)===!0&&!n.has(u)&&(c.schedule(u),t(!0))}r=!1},schedule:function(l,d,u){d===void 0&&(d=!1),u===void 0&&(u=!1);var p=u&&r,m=p?e:i;n.delete(l),d&&o.add(l),m.indexOf(l)===-1&&(m.push(l),p&&(s=e.length))}};return c},vl=40,Er=1/60*1e3,pi=!0,Qt=!1,ms=!1,zt={delta:0,timestamp:0},Rs=["read","update","preRender","render","postRender"],xl=function(t){return Qt=t},ka=Rs.reduce(function(t,e){return t[e]=wl(xl),t},{}),Ml=Rs.reduce(function(t,e){var i=ka[e];return t[e]=function(s,r,a){return r===void 0&&(r=!1),a===void 0&&(a=!1),Qt||Cl(),i.schedule(s,r,a),s},t},{}),Sl=function(t){return ka[t].process(zt)},Ta=function(t){Qt=!1,zt.delta=pi?Er:Math.max(Math.min(t-zt.timestamp,vl),1),pi||(Er=zt.delta),zt.timestamp=t,ms=!0,Rs.forEach(Sl),ms=!1,Qt&&(pi=!1,Aa(Ta))},Cl=function(){Qt=!0,pi=!0,ms||Aa(Ta)},Na=function(t,e){return function(i){return Math.max(Math.min(i,e),t)}},gi=function(t){return t%1?Number(t.toFixed(5)):t},Ea=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i,Pi={test:function(t){return typeof t=="number"},parse:parseFloat,transform:function(t){return t}},Vt=he(he({},Pi),{transform:Na(0,1)}),li=he(he({},Pi),{default:1}),Os=function(t){return{test:function(e){return typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1},parse:parseFloat,transform:function(e){return""+e+t}}},lt=Os("deg"),$t=Os("%"),L=Os("px"),Pr=he(he({},$t),{parse:function(t){return $t.parse(t)/100},transform:function(t){return $t.transform(t*100)}}),Il=function(t){return t.substring(t.indexOf("(")+1,t.lastIndexOf(")"))},_l=Na(0,255),fs=function(t){return t.red!==void 0},bs=function(t){return t.hue!==void 0};function Al(t){return Il(t).replace(/(,|\/)/g," ").split(/ \s*/)}var Pa=function(t){return function(e){if(typeof e!="string")return e;for(var i={},s=Al(e),r=0;r<4;r++)i[t[r]]=s[r]!==void 0?parseFloat(s[r]):1;return i}},kl=function(t){var e=t.red,i=t.green,s=t.blue,r=t.alpha,a=r===void 0?1:r;return"rgba("+e+", "+i+", "+s+", "+a+")"},Tl=function(t){var e=t.hue,i=t.saturation,s=t.lightness,r=t.alpha,a=r===void 0?1:r;return"hsla("+e+", "+i+", "+s+", "+a+")"},es=he(he({},Pi),{transform:function(t){return Math.round(_l(t))}});function Us(t,e){return t.startsWith(e)&&Ea.test(t)}var mi={test:function(t){return typeof t=="string"?Us(t,"rgb"):fs(t)},parse:Pa(["red","green","blue","alpha"]),transform:function(t){var e=t.red,i=t.green,s=t.blue,r=t.alpha,a=r===void 0?1:r;return kl({red:es.transform(e),green:es.transform(i),blue:es.transform(s),alpha:gi(Vt.transform(a))})}},ts={test:function(t){return typeof t=="string"?Us(t,"hsl"):bs(t)},parse:Pa(["hue","saturation","lightness","alpha"]),transform:function(t){var e=t.hue,i=t.saturation,s=t.lightness,r=t.alpha,a=r===void 0?1:r;return Tl({hue:Math.round(e),saturation:$t.transform(gi(i)),lightness:$t.transform(gi(s)),alpha:gi(Vt.transform(a))})}},zr=he(he({},mi),{test:function(t){return typeof t=="string"&&Us(t,"#")},parse:function(t){var e="",i="",s="";return t.length>4?(e=t.substr(1,2),i=t.substr(3,2),s=t.substr(5,2)):(e=t.substr(1,1),i=t.substr(2,1),s=t.substr(3,1),e+=e,i+=i,s+=s),{red:parseInt(e,16),green:parseInt(i,16),blue:parseInt(s,16),alpha:1}}}),ze={test:function(t){return typeof t=="string"&&Ea.test(t)||fs(t)||bs(t)},parse:function(t){return mi.test(t)?mi.parse(t):ts.test(t)?ts.parse(t):zr.test(t)?zr.parse(t):t},transform:function(t){return fs(t)?mi.transform(t):bs(t)?ts.transform(t):t}},Ws=function(t){var e=t.onRead,i=t.onRender,s=t.uncachedValues,r=s===void 0?new Set:s,a=t.useCache,n=a===void 0?!0:a;return function(o){o===void 0&&(o={});var c=Bs(o,[]),l={},d=[],u=!1;function p(g,f){g.startsWith("--")&&(c.hasCSSVariable=!0);var b=l[g];l[g]=f,l[g]!==b&&(d.indexOf(g)===-1&&d.push(g),u||(u=!0,Ml.render(m.render)))}var m={get:function(g,f){f===void 0&&(f=!1);var b=!f&&n&&!r.has(g)&&l[g]!==void 0;return b?l[g]:e(g,c)},set:function(g,f){if(typeof g=="string")p(g,f);else for(var b in g)p(b,g[b]);return this},render:function(g){return g===void 0&&(g=!1),(u||g===!0)&&(i(l,c,d),u=!1,d.length=0),this}};return m}},Nl=/([a-z])([A-Z])/g,El="$1-$2",zi=function(t){return t.replace(Nl,El).toLowerCase()},za=new Map,Hs=new Map,Da=["Webkit","Moz","O","ms",""],Pl=Da.length,zl=typeof document!="undefined",is,La=function(t,e){return Hs.set(t,zi(e))},Dl=function(t){is=is||document.createElement("div");for(var e=0;e<Pl;e++){var i=Da[e],s=i==="",r=s?t:i+t.charAt(0).toUpperCase()+t.slice(1);if(r in is.style||s){if(s&&t==="clipPath"&&Hs.has(t))return;za.set(t,r),La(t,(s?"":"-")+zi(r))}}},Ll=function(t){return La(t,t)},Va=function(t,e){e===void 0&&(e=!1);var i=e?Hs:za;return i.has(t)||(zl?Dl(t):Ll(t)),i.get(t)||t},Vl=["","X","Y","Z"],$l=["translate","scale","rotate","skew","transformPerspective"],ys=$l.reduce(function(t,e){return Vl.reduce(function(i,s){return i.push(e+s),i},t)},["x","y","z"]),jl=ys.reduce(function(t,e){return t[e]=!0,t},{});function Fs(t){return jl[t]===!0}function Bl(t,e){return ys.indexOf(t)-ys.indexOf(e)}var Rl=new Set(["originX","originY","originZ"]);function Ol(t){return Rl.has(t)}var Dr=he(he({},Pi),{transform:Math.round}),Ul={color:ze,backgroundColor:ze,outlineColor:ze,fill:ze,stroke:ze,borderColor:ze,borderTopColor:ze,borderRightColor:ze,borderBottomColor:ze,borderLeftColor:ze,borderWidth:L,borderTopWidth:L,borderRightWidth:L,borderBottomWidth:L,borderLeftWidth:L,borderRadius:L,radius:L,borderTopLeftRadius:L,borderTopRightRadius:L,borderBottomRightRadius:L,borderBottomLeftRadius:L,width:L,maxWidth:L,height:L,maxHeight:L,size:L,top:L,right:L,bottom:L,left:L,padding:L,paddingTop:L,paddingRight:L,paddingBottom:L,paddingLeft:L,margin:L,marginTop:L,marginRight:L,marginBottom:L,marginLeft:L,rotate:lt,rotateX:lt,rotateY:lt,rotateZ:lt,scale:li,scaleX:li,scaleY:li,scaleZ:li,skew:lt,skewX:lt,skewY:lt,distance:L,translateX:L,translateY:L,translateZ:L,x:L,y:L,z:L,perspective:L,opacity:Vt,originX:Pr,originY:Pr,originZ:L,zIndex:Dr,fillOpacity:Vt,strokeOpacity:Vt,numOctaves:Dr},Zs=function(t){return Ul[t]},Wl=function(t,e){return e&&typeof t=="number"?e.transform(t):t},jt="scrollLeft",Bt="scrollTop",$a=new Set([jt,Bt]),Hl=new Set([jt,Bt,"transform"]),Fl={x:"translateX",y:"translateY",z:"translateZ"};function ja(t){return typeof t=="function"}function Zl(t,e,i,s,r,a){a===void 0&&(a=!0);var n="",o=!1;i.sort(Bl);for(var c=i.length,l=0;l<c;l++){var d=i[l];n+=(Fl[d]||d)+"("+e[d]+") ",o=d==="z"?!0:o}return!o&&r?n+="translateZ(0)":n=n.trim(),ja(t.transform)?n=t.transform(e,s?"":n):a&&s&&(n="none"),n}function Yl(t,e,i,s,r,a,n,o){e===void 0&&(e=!0),i===void 0&&(i={}),s===void 0&&(s={}),r===void 0&&(r={}),a===void 0&&(a=[]),n===void 0&&(n=!1),o===void 0&&(o=!0);var c=!0,l=!1,d=!1;for(var u in t){var p=t[u],m=Zs(u),g=Wl(p,m);Fs(u)?(l=!0,s[u]=g,a.push(u),c&&(m.default&&p!==m.default||!m.default&&p!==0)&&(c=!1)):Ol(u)?(r[u]=g,d=!0):(!Hl.has(u)||!ja(g))&&(i[Va(u,n)]=g)}return(l||typeof t.transform=="function")&&(i.transform=Zl(t,s,a,c,e,o)),d&&(i.transformOrigin=(r.originX||"50%")+" "+(r.originY||"50%")+" "+(r.originZ||0)),i}function Ys(t){var e=t===void 0?{}:t,i=e.enableHardwareAcceleration,s=i===void 0?!0:i,r=e.isDashCase,a=r===void 0?!0:r,n=e.allowTransformNone,o=n===void 0?!0:n,c={},l={},d={},u=[];return function(p){return u.length=0,Yl(p,s,c,l,d,u,a,o),c}}function Ql(t,e){var i=e.element,s=e.preparseOutput,r=Zs(t);if(Fs(t))return r&&r.default||0;if($a.has(t))return i[t];var a=window.getComputedStyle(i,null).getPropertyValue(Va(t,!0))||0;return s&&r&&r.test(a)&&r.parse?r.parse(a):a}function Gl(t,e,i){var s=e.element,r=e.buildStyles,a=e.hasCSSVariable;if(Object.assign(s.style,r(t)),a)for(var n=i.length,o=0;o<n;o++){var c=i[o];c.startsWith("--")&&s.style.setProperty(c,t[c])}i.indexOf(jt)!==-1&&(s[jt]=t[jt]),i.indexOf(Bt)!==-1&&(s[Bt]=t[Bt])}var ql=Ws({onRead:Ql,onRender:Gl,uncachedValues:$a});function Jl(t,e){e===void 0&&(e={});var i=e.enableHardwareAcceleration,s=e.allowTransformNone,r=Bs(e,["enableHardwareAcceleration","allowTransformNone"]);return ql(he({element:t,buildStyles:Ys({enableHardwareAcceleration:i,allowTransformNone:s}),preparseOutput:!0},r))}var Ba=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues"]),Lr=.5,Ra=function(){return{style:{}}},ss=function(t,e){return L.transform(t*e)},Xl={x:0,y:0,width:0,height:0};function Vr(t,e,i){return typeof t=="string"?t:L.transform(e+i*t)}function Kl(t,e,i){return Vr(e,t.x,t.width)+" "+Vr(i,t.y,t.height)}var Oa={enableHardwareAcceleration:!1,isDashCase:!1};function ec(t,e,i,s,r,a){e===void 0&&(e=Xl),s===void 0&&(s=Ys(Oa)),r===void 0&&(r=Ra()),a===void 0&&(a=!0);var n=t.attrX,o=t.attrY,c=t.originX,l=t.originY,d=t.pathLength,u=t.pathSpacing,p=u===void 0?1:u,m=t.pathOffset,g=m===void 0?0:m,f=Bs(t,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]),b=s(f);for(var v in b)if(v==="transform")r.style.transform=b[v];else{var x=a&&!Ba.has(v)?zi(v):v;r[x]=b[v]}return(c!==void 0||l!==void 0||b.transform)&&(r.style.transformOrigin=Kl(e,c!==void 0?c:Lr,l!==void 0?l:Lr)),n!==void 0&&(r.x=n),o!==void 0&&(r.y=o),i!==void 0&&d!==void 0&&(r[a?"stroke-dashoffset":"strokeDashoffset"]=ss(-g,i),r[a?"stroke-dasharray":"strokeDasharray"]=ss(d,i)+" "+ss(p,i)),r}function tc(t,e,i){i===void 0&&(i=!0);var s=Ra(),r=Ys(Oa);return function(a){return ec(a,t,e,r,s,i)}}var ic=function(t){return typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()},sc=function(t){try{return ic(t)}catch{return{x:0,y:0,width:0,height:0}}},rc=function(t){return t.tagName==="path"},ac=Ws({onRead:function(t,e){var i=e.element;if(t=Ba.has(t)?t:zi(t),Fs(t)){var s=Zs(t);return s&&s.default||0}else return i.getAttribute(t)},onRender:function(t,e){var i=e.element,s=e.buildAttrs,r=s(t);for(var a in r)a==="style"?Object.assign(i.style,r.style):i.setAttribute(a,r[a])}}),nc=function(t){var e=sc(t),i=rc(t)&&t.getTotalLength?t.getTotalLength():void 0;return ac({element:t,buildAttrs:tc(e,i)})},oc=Ws({useCache:!1,onRead:function(t){return t==="scrollTop"?window.pageYOffset:window.pageXOffset},onRender:function(t){var e=t.scrollTop,i=e===void 0?0:e,s=t.scrollLeft,r=s===void 0?0:s;return window.scrollTo(r,i)}}),ws=new WeakMap,lc=function(t){return t instanceof HTMLElement||typeof t.click=="function"},cc=function(t){return t instanceof SVGElement||"ownerSVGElement"in t},hc=function(t,e){var i;return t===window?i=oc(t):lc(t)?i=Jl(t,e):cc(t)&&(i=nc(t)),ws.set(t,i),i},dc=function(t,e){return ws.has(t)?ws.get(t):hc(t,e)};function uc(t,e){var i=typeof t=="string"?document.querySelector(t):t;return dc(i,e)}var Ne=function(e,i,s,r){var a=s?s.call(r,e,i):void 0;if(a!==void 0)return!!a;if(e===i)return!0;if(typeof e!="object"||!e||typeof i!="object"||!i)return!1;var n=Object.keys(e),o=Object.keys(i);if(n.length!==o.length)return!1;for(var c=Object.prototype.hasOwnProperty.bind(i),l=0;l<n.length;l++){var d=n[l];if(!c(d))return!1;var u=e[d],p=i[d];if(a=s?s.call(r,u,p,d):void 0,a===!1||a===void 0&&u!==p)return!1}return!0},pc=(()=>`.tele-fancy-scrollbar {
|
16
16
|
overscroll-behavior: contain;
|
17
17
|
overflow: auto;
|
18
18
|
overflow-y: scroll;
|
@@ -120,8 +120,8 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
120
120
|
color: var(--tele-boxFooterColor, #e9e9e9);
|
121
121
|
background-color: #383b42;
|
122
122
|
background-color: var(--tele-boxFooterBackground, #383b42);
|
123
|
-
}`)(),Ua=(t=>(t.Light="light",t.Dark="dark",t.Auto="auto",t))(Ua||{}),se=(t=>(t.Normal="normal",t.Minimized="minimized",t.Maximized="maximized",t))(se||{}),ue=(t=>(t.DarkMode="dark_mode",t.PrefersColorScheme="prefers_color_scheme",t.Close="close",t.Focus="focus",t.Blur="blur",t.IntrinsicMove="intrinsic_move",t.IntrinsicResize="intrinsic_resize",t.ZIndex="z_index",t.State="state",t.Minimized="minimized",t.Maximized="maximized",t.Readonly="readonly",t.Destroyed="destroyed",t))(ue||{}),je=(t=>(t.Close="close",t.Maximize="maximize",t.Minimize="minimize",t))(je||{}),De=(t=>(t.North="n",t.South="s",t.West="w",t.East="e",t.NorthWest="nw",t.NorthEast="ne",t.SouthEast="se",t.SouthWest="sw",t))(De||{});const rs="dh";function wt(t,e,i){return Math.min(Math.max(t,e),i)}function Rt(t){t.stopPropagation(),t.cancelable&&t.preventDefault()}let gc=1;function mc(){return`New Box ${gc++}`}class Wa{constructor({readonly$:e,state$:i,title$:s,buttons:r,onEvent:a,onDragStart:n,namespace:o="telebox"}){this.sideEffect=new ve.SideEffectManager,this.lastTitleBarClick={timestamp:0,clientX:-100,clientY:-100},this.handleTitleBarClick=c=>{var l;if(!c.isPrimary||this.readonly$.value||c.button!==0||(l=c.target.dataset)!=null&&l.teleTitleBarNoDblClick)return;Rt(c);const d=Date.now();d-this.lastTitleBarClick.timestamp<=500?Math.abs(c.clientX-this.lastTitleBarClick.clientX)<=5&&Math.abs(c.clientY-this.lastTitleBarClick.clientY)<=5&&this.onEvent&&this.onEvent({type:je.Maximize}):this.onDragStart&&this.onDragStart(c),this.lastTitleBarClick.timestamp=d,this.lastTitleBarClick.clientX=c.clientX,this.lastTitleBarClick.clientY=c.clientY},this.readonly$=e,this.state$=i,this.title$=s,this.onEvent=a,this.onDragStart=n,this.namespace=o,this.buttons=r||[{type:je.Minimize,iconClassName:this.wrapClassName("titlebar-icon-minimize")},{type:je.Maximize,iconClassName:this.wrapClassName("titlebar-icon-maximize"),isActive:c=>c===se.Maximized},{type:je.Close,iconClassName:this.wrapClassName("titlebar-icon-close")}],this.$dragArea=this.renderDragArea()}render(){if(!this.$titleBar){this.$titleBar=document.createElement("div"),this.$titleBar.className=this.wrapClassName("titlebar");const e=document.createElement("div");e.className=this.wrapClassName("title-area"),e.dataset.teleBoxHandle=rs;const i=document.createElement("h1");i.className=this.wrapClassName("title"),i.dataset.teleBoxHandle=rs,e.appendChild(i),e.appendChild(this.$dragArea);const s=document.createElement("div");s.className=this.wrapClassName("titlebar-btns"),this.buttons.forEach(({iconClassName:r},a)=>{const n=String(a),o=document.createElement("button");o.className=`${this.wrapClassName("titlebar-btn")} ${r}`,o.dataset.teleTitleBarBtnIndex=n,o.dataset.teleTitleBarNoDblClick="true",s.appendChild(o)}),this.sideEffect.addDisposer(this.title$.subscribe(r=>{i.textContent=r,i.title=r}),"render-title"),this.sideEffect.addDisposer(this.state$.subscribe(r=>{this.buttons.forEach((a,n)=>{var o;a.isActive&&((o=s.children[n])==null||o.classList.toggle("is-active",a.isActive(r)))})}),"render-state-btns"),this.sideEffect.addEventListener(s,"click",r=>{var a;if(this.readonly$.value)return;const n=r.target,o=Number((a=n.dataset)==null?void 0:a.teleTitleBarBtnIndex);if(!Number.isNaN(o)&&o<this.buttons.length){Rt(r);const c=this.buttons[o];this.onEvent&&this.onEvent({type:c.type,value:c.value})}},{},"render-btns-container-click"),this.$titleBar.appendChild(e),this.$titleBar.appendChild(s)}return this.$titleBar}renderDragArea(){const e=document.createElement("div");return e.className=this.wrapClassName("drag-area"),e.dataset.teleBoxHandle=rs,this.sideEffect.addEventListener(e,"pointerdown",this.handleTitleBarClick),e}dragHandle(){return this.$titleBar}wrapClassName(e){return`${this.namespace}-${e}`}destroy(){this.sideEffect.flushAll(),this.$titleBar&&(this.$titleBar=void 0,this.onDragStart=void 0,this.onEvent=void 0)}}function Ha([t,e]){if(e<=0||t.width<=0||t.height<=0)return t;const i=t.width*e;if(i===t.height)return t;if(i<t.height)return{x:0,y:(t.height-i)/2,width:t.width,height:i};const s=t.height/e;return{x:(t.width-s)/2,y:0,width:s,height:t.height}}const fc=window.ResizeObserver||ca.ResizeObserver;class bc{constructor({id:e=ve.genUID(),title:i=mc(),namespace:s="telebox",visible:r=!0,width:a=.5,height:n=.5,minWidth:o=0,minHeight:c=0,x:l=.1,y:d=.1,resizable:u=!0,draggable:p=!0,boxRatio:m=-1,focus:g=!1,zIndex:f=100,stageRatio:b=null,enableShadowDOM:v=!0,titleBar:x,content:y,stage:k,footer:z,styles:T,userStyles:O,bodyStyle:te=null,stageStyle:G=null,darkMode$:xe,fence$:Re,root:me,rootRect$:Ie,managerMinimized$:fe,managerMaximized$:_e,managerReadonly$:be,managerStageRect$:ye,managerStageRatio$:Se,defaultBoxBodyStyle$:Ae,defaultBoxStageStyle$:Me,collectorRect$:ot}){this.events=new rt.default,this._delegateEvents=new rt.default,this.handleTrackStart=D=>{var U;return(U=this._handleTrackStart)==null?void 0:U.call(this,D)},this._sideEffect=new ve.SideEffectManager,this.id=e,this.namespace=s,this.enableShadowDOM=v;const Oe=new w.ValManager;this._sideEffect.addDisposer(()=>Oe.destroy());const Qe=new w.Val(i),bt=new w.Val(r),A=new w.Val(u),B=new w.Val(p),ke=new w.Val(m),Ce=new w.Val(f),Tt=new w.Val(g),yt=new w.Val(null),ur=new w.Val(null),pr=new w.Val(null),Hi=w.combine([yt,_e],([D,U])=>D!=null?D:U),ai=w.combine([ur,fe],([D,U])=>D!=null?D:U),Fi=w.combine([pr,be],([D,U])=>D!=null?D:U),Zi=w.combine([ai,Hi],([D,U])=>D?se.Minimized:U?se.Maximized:se.Normal),Yi=new w.Val({width:wt(o,0,1),height:wt(c,0,1)},{compare:Ne}),po=w.combine([Yi,ye],([D,U])=>({width:D.width*U.width,height:D.height*U.height}),{compare:Ne}),ni=new w.Val({width:a,height:n},{compare:Ne});this._sideEffect.addDisposer(Yi.reaction((D,U)=>{ni.setValue({width:Math.max(a,D.width),height:Math.max(n,D.height)},U)}));const Qi=new w.Val({x:l,y:d},{compare:Ne}),Gi=w.combine([ni,ye],([D,U])=>({width:U.width*D.width,height:U.height*D.height}),{compare:Ne}),Nt=w.combine([Qi,ye],([D,U])=>({x:D.x*U.width,y:D.y*U.height}),{compare:Ne}),go=new w.Val(te),mo=new w.Val(G),fo=new w.Val(null),gr=new w.Val(ye.value,{compare:Ne}),mr=new w.Val(b),bo=w.combine([mr,Se],([D,U])=>D!=null?D:U),yo=w.combine([gr,bo],Ha,{compare:Ne}),wo={darkMode:xe,fence:Re,rootRect:Ie,managerMinimized:fe,managerMaximized:_e,managerReadonly:be,managerStageRect:ye,managerStageRatio:Se,defaultBoxBodyStyle:Ae,defaultBoxStageStyle:Me,collectorRect:ot};w.withReadonlyValueEnhancer(this,wo);const vo={zIndex:Ce,focus:Tt,state:Zi,minSize:Yi,pxMinSize:po,intrinsicSize:ni,intrinsicCoord:Qi,pxIntrinsicSize:Gi,pxIntrinsicCoord:Nt,bodyRect:gr,stageRect:yo,minimized:ai,maximized:Hi,readonly:Fi};w.withReadonlyValueEnhancer(this,vo,Oe);const xo={title:Qe,visible:bt,resizable:A,draggable:B,boxRatio:ke,boxMinimized:ur,boxMaximized:yt,boxReadonly:pr,stageRatio:mr,bodyStyle:go,stageStyle:mo};w.withValueEnhancer(this,xo,Oe),this.titleBar=x||new Wa({readonly$:Fi,state$:Zi,title$:Qe,namespace:this.namespace,onDragStart:D=>{var U;return(U=this._handleTrackStart)==null?void 0:U.call(this,D)},onEvent:D=>this._delegateEvents.emit(D.type)}),this._sideEffect.addDisposer(w.combine([ke,ai]).subscribe(([D,U])=>{!U&&D>0&&this.transform(Nt.value.x,Nt.value.y,Gi.value.width,Gi.value.height)})),this._sideEffect.addDisposer(Re.subscribe(D=>{D&&this.move(Nt.value.x,Nt.value.y)})),this.$box=this._render(),fo.setValue(this.$content.parentElement),y&&this.mountContent(y),k&&this.mountStage(k),z&&this.mountFooter(z),T&&this.mountStyles(T),O&&this.mountUserStyles(O),me.appendChild(this.$box);const Ge=(D,U)=>{this._sideEffect.addDisposer(D.reaction((So,Mo)=>{Mo||this.events.emit(U,So)}))};Ge(xe,ue.DarkMode),Ge(Fi,ue.Readonly),Ge(Ce,ue.ZIndex),Ge(ai,ue.Minimized),Ge(Hi,ue.Maximized),Ge(Zi,ue.State),Ge(ni,ue.IntrinsicResize),Ge(Qi,ue.IntrinsicMove),this._sideEffect.addDisposer([bt.reaction((D,U)=>{!U&&!D&&this.events.emit(ue.Close)}),Tt.reaction((D,U)=>{U||this.events.emit(D?ue.Focus:ue.Blur)})])}get minWidth(){return this._minSize$.value.width}get minHeight(){return this._minSize$.value.height}setMinWidth(e,i=!1){this._minSize$.setValue({width:e,height:this.minHeight},i)}setMinHeight(e,i=!1){this._minSize$.setValue({width:this.minWidth,height:e},i)}resize(e,i,s=!1){this._intrinsicSize$.setValue({width:Math.max(e,this.minWidth),height:Math.max(i,this.minHeight)},s)}get intrinsicX(){return this._intrinsicCoord$.value.x}get intrinsicY(){return this._intrinsicCoord$.value.y}get intrinsicWidth(){return this._intrinsicSize$.value.width}get intrinsicHeight(){return this._intrinsicSize$.value.height}move(e,i,s=!1){let r,a;const n=this.managerStageRect,o=this.pxIntrinsicSize;this.fence?(r=wt(e,0,n.width-o.width),a=wt(i,0,n.height-o.height)):(r=wt(e,-(o.width-120),0+n.width-20),a=wt(i,0,0+n.height-20)),this._intrinsicCoord$.setValue({x:r/n.width,y:a/n.height},s)}transform(e,i,s,r,a=!1){const n=this.managerStageRect;if(s=Math.max(s,this.pxMinSize.width),r=Math.max(r,this.pxMinSize.height),this.boxRatio>0){const o=this.boxRatio*s;i!==this.pxIntrinsicCoord.y&&(i-=o-r),r=o}i<0&&(i=0,r=this.pxIntrinsicSize.height),this.move(e,i,a),this._intrinsicSize$.setValue({width:s/n.width,height:r/n.height},a)}mountContent(e){var i;(i=this.$authorContent)==null||i.remove(),this.$authorContent=e,this.$content.appendChild(e)}unmountContent(){this.$authorContent&&(this.$authorContent.remove(),this.$authorContent=void 0)}mountStage(e){var i;(i=this.$authorStage)==null||i.remove(),this.$authorStage=e,this.$stage||(this.$stage=this._renderStage()),this.$stage.appendChild(e),this.$stage.parentElement||this.$body.appendChild(this.$stage)}unmountStage(){var e;this.$authorStage&&(this.$authorStage.remove(),this.$authorStage=void 0),(e=this.$stage)==null||e.remove()}mountFooter(e){var i;(i=this.$authorFooter)==null||i.remove(),this.$authorFooter=e,this.$footer.appendChild(e)}unmountFooter(){this.$authorFooter&&(this.$authorFooter.remove(),this.$authorFooter=void 0)}mountStyles(e){this.$styles.textContent=e}unmountStyles(){this.$styles.textContent=""}mountUserStyles(e){this.$userStyles.textContent=e}unmountUserStyles(){this.$userStyles.textContent=""}_render(){if(this.$box)return this.$box;const e=(b,v)=>this._sideEffect.addDisposer([this._readonly$.subscribe(x=>b.classList.toggle(this.wrapClassName("readonly"),x)),this._draggable$.subscribe(x=>b.classList.toggle(this.wrapClassName("no-drag"),!x)),this._resizable$.subscribe(x=>b.classList.toggle(this.wrapClassName("no-resize"),!x)),this._focus$.subscribe(x=>b.classList.toggle(this.wrapClassName("blur"),!x)),this._darkMode$.subscribe(x=>{b.classList.toggle(this.wrapClassName("color-scheme-dark"),x),b.classList.toggle(this.wrapClassName("color-scheme-light"),!x)})],v);this.$box=document.createElement("div"),this.$box.classList.add(this.wrapClassName("box")),e(this.$box,"bind-box-state"),this._sideEffect.add(()=>{const b=this.wrapClassName("minimized"),v=this.wrapClassName("maximized"),x="box-maximized-timer";return this._state$.subscribe(y=>{this.$box.classList.toggle(b,y===se.Minimized),y===se.Maximized?(this._sideEffect.flush(x),this.$box.classList.toggle(v,!0)):this._sideEffect.setTimeout(()=>{this.$box.classList.toggle(v,!1)},0,x)})}),this._sideEffect.addDisposer(this._visible$.subscribe(b=>{this.$box.style.display=b?"block":"none"})),this._sideEffect.addDisposer(this._zIndex$.subscribe(b=>{this.$box.style.zIndex=String(b)})),this.$box.dataset.teleBoxID=this.id;const i=uc(this.$box),s=w.combine([this._maximized$,this._minimized$,this._pxIntrinsicSize$,this._pxIntrinsicCoord$,this._collectorRect$,this._rootRect$,this._managerStageRect$],([b,v,x,y,k,z,T])=>{const O=b?{x:-T.x,y:-T.y,width:z.width,height:z.height,scaleX:1,scaleY:1}:{x:y.x,y:y.y,width:x.width,height:x.height,scaleX:1,scaleY:1};if(v&&k){const{width:te,height:G}=b?this.rootRect:x;O.x=k.x-te/2+k.width/2-T.x,O.y=k.y-G/2+k.height/2-T.y,O.scaleX=k.width/te,O.scaleY=k.height/G}return O},{compare:Ne}),r=s.value;this.$box.style.width=r.width+"px",this.$box.style.height=r.height+"px",this.$box.style.transform=`translate(${r.x-10}px,${r.y-10}px)`,this._sideEffect.addDisposer(s.subscribe(b=>{i.set(b)}));const a=document.createElement("div");a.className=this.wrapClassName("box-main"),this.$box.appendChild(a);const n=document.createElement("div");n.className=this.wrapClassName("titlebar-wrap"),n.appendChild(this.titleBar.render()),this.$titleBar=n;const o=document.createElement("div");o.className=this.wrapClassName("body-wrap"),this.$body=o;const c=document.createElement("style");this.$styles=c,o.appendChild(c);const l=document.createElement("style");this.$userStyles=l,o.appendChild(l);const d=document.createElement("div");d.className=this.wrapClassName("content")+" tele-fancy-scrollbar",this.$content=d,this._sideEffect.addDisposer(w.combine([this._bodyStyle$,this._defaultBoxBodyStyle$],([b,v])=>b!=null?b:v).subscribe(b=>d.style.cssText=b||"")),o.appendChild(d);const u=document.createElement("div");u.className=this.wrapClassName("footer-wrap"),this.$footer=u,a.appendChild(n);const p=document.createElement("div");p.className=this.wrapClassName("main"),this.$main=p,a.appendChild(p);const m=document.createElement("div");m.className=this.wrapClassName("quarantine-outer"),p.appendChild(m);const g=document.createElement("div");if(g.className=this.wrapClassName("quarantine"),g.appendChild(o),g.appendChild(u),this.enableShadowDOM){e(g,"bind-quarantine-state");const b=document.createElement("style");b.textContent=pc,g.insertBefore(b,g.firstChild),m.attachShadow({mode:"open"}).appendChild(g)}else m.appendChild(g);this._renderResizeHandlers();const f=()=>{const b=o.getBoundingClientRect();this._bodyRect$.setValue({x:0,y:0,width:b.width,height:b.height})};return this._sideEffect.add(()=>{const b=new fc(()=>{this.minimized||f()});return b.observe(o),()=>b.disconnect()}),this._sideEffect.addDisposer(this._minimized$.reaction(b=>{b||this._sideEffect.setTimeout(f,400,"minimized-content-rect-fix")})),this.$box}_renderStage(){const e=document.createElement("div");e.className=this.wrapClassName("box-stage");const i=s=>{e.style.top=s.y+"px",e.style.left=s.x+"px",e.style.width=s.width+"px",e.style.height=s.height+"px"};return this._sideEffect.addDisposer([w.combine([this._stageStyle$,this._defaultBoxStageStyle$],([s,r])=>s!=null?s:r).subscribe(s=>{e.style.cssText=s||"",i(this._stageRect$.value)}),this._stageRect$.subscribe(i)],"box-stage-styles"),e}_renderResizeHandlers(){const e=document.createElement("div");e.className=this.wrapClassName("resize-handles"),Object.values(De).forEach(f=>{const b=document.createElement("div");b.className=this.wrapClassName(f)+" "+this.wrapClassName("resize-handle"),b.dataset.teleBoxHandle=f,e.appendChild(b)}),this.$box.appendChild(e);const i="handle-tracking-listener",s=this.wrapClassName("transforming");let r,a=0,n=0,o=0,c=0,l=0,d=0,u;const p=f=>{if(!f.isPrimary||this.state!==se.Normal)return;Rt(f);let{pageX:b,pageY:v}=f;v<0&&(v=0);const x=b-l,y=v-d;let{x:k,y:z}=this.pxIntrinsicCoord,{width:T,height:O}=this.pxIntrinsicSize;switch(u){case De.North:{z=n+y,O=c-y;break}case De.South:{O=c+y;break}case De.West:{k=a+x,T=o-x;break}case De.East:{T=o+x;break}case De.NorthWest:{k=a+x,z=n+y,T=o-x,O=c-y;break}case De.NorthEast:{z=n+y,T=o+x,O=c-y;break}case De.SouthEast:{T=o+x,O=c+y;break}case De.SouthWest:{k=a+x,T=o-x,O=c+y;break}default:{this.move(a+x,n+y);return}}this.transform(k,z,T,O)},m=f=>{!f.isPrimary||(u=void 0,r&&(Rt(f),this.$box.classList.toggle(s,!1),this._sideEffect.flush(i),r.remove()))},g=f=>{var b;if(!f.isPrimary||this.readonly||f.button!=null&&f.button!==0||!this.draggable||u||this.state!==se.Normal)return;const v=f.target;if((b=v.dataset)!=null&&b.teleBoxHandle){Rt(f),{x:a,y:n}=this.pxIntrinsicCoord,{width:o,height:c}=this.pxIntrinsicSize,{pageX:l,pageY:d}=f,u=v.dataset.teleBoxHandle,r||(r=document.createElement("div"));const x=u?this.wrapClassName(`cursor-${u}`):"";r.className=this.wrapClassName(`track-mask${x?` ${x}`:""}`),this.$box.appendChild(r),this.$box.classList.add(s),this._sideEffect.add(()=>(window.addEventListener("pointermove",p,{passive:!1}),window.addEventListener("pointerup",m,{passive:!1}),window.addEventListener("pointercancel",m,{passive:!1}),()=>{window.removeEventListener("pointermove",p),window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",m)}),i)}};this._handleTrackStart=g,this._sideEffect.addEventListener(e,"pointerdown",g,{},"box-resizeHandles-pointerdown")}async destroy(){this.$box.remove(),this._sideEffect.flushAll(),this._sideEffect.flushAll(),await this.events.emit(ue.Destroyed),this.events.clearListeners(),this._delegateEvents.clearListeners()}wrapClassName(e){return`${this.namespace}-${e}`}}var yc="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K";class wc{constructor({minimized$:e,readonly$:i,darkMode$:s,namespace:r="telebox",styles:a={},root:n,onClick:o}){this._sideEffect=new ve.SideEffectManager,this.namespace=r;const c=new w.ValManager;this._sideEffect.addDisposer(()=>c.destroy());const l=new w.Val(void 0),d=w.derive(e),u=new w.Val(a),p=new w.Val(document.createElement("button")),m={styles:u,$collector:p};w.withValueEnhancer(this,m,c);const g={rect:l,visible:d};w.withReadonlyValueEnhancer(this,g,c),p.value.className=this.wrapClassName("collector"),p.value.style.backgroundImage=`url('${yc}')`,this._sideEffect.addDisposer(p.subscribe(f=>{this._sideEffect.add(()=>(n.appendChild(f),()=>f.remove()),"telebox-collector-mount"),this._sideEffect.addEventListener(f,"click",()=>{i.value||o==null||o()},{},"telebox-collector-click"),this._sideEffect.addDisposer([d.subscribe(b=>{f.classList.toggle(this.wrapClassName("collector-visible"),b)}),i.subscribe(b=>{f.classList.toggle(this.wrapClassName("collector-readonly"),b)}),s.subscribe(b=>{f.classList.toggle(this.wrapClassName("color-scheme-dark"),b),f.classList.toggle(this.wrapClassName("color-scheme-light"),!b)}),u.subscribe(b=>{Object.keys(b).forEach(v=>{const x=b[v];x!=null&&(f.style[v]=x)})}),e.subscribe(b=>{if(b){const{x:v,y:x,width:y,height:k}=f.getBoundingClientRect(),z=n.getBoundingClientRect();l.setValue({x:v-z.x,y:x-z.y,width:y,height:k})}})],"telebox-collector-el")}))}destroy(){this._sideEffect.flushAll()}wrapClassName(e){return`${this.namespace}-${e}`}}var oe=(t=>(t.Focused="focused",t.Blurred="blurred",t.Created="created",t.Removed="removed",t.State="state",t.Maximized="maximized",t.Minimized="minimized",t.IntrinsicMove="intrinsic_move",t.IntrinsicResize="intrinsic_resize",t.ZIndex="z_index",t.PrefersColorScheme="prefers_color_scheme",t.DarkMode="dark_mode",t))(oe||{});class vc extends Wa{constructor(e){super(e);this.boxes$=e.boxes$,this.rootRect$=e.rootRect$,this.darkMode$=e.darkMode$,e.root.appendChild(this.render())}focusBox(e){var i;if(!(this.focusedBox&&this.focusedBox===e)){if(this.$titles&&this.state$.value===se.Maximized){const{children:s}=this.$titles.firstElementChild;for(let r=s.length-1;r>=0;r-=1){const a=s[r],n=(i=a.dataset)==null?void 0:i.teleBoxID;n&&(e&&n===e.id?a.classList.toggle(this.wrapClassName("titles-tab-focus"),!0):this.focusedBox&&n===this.focusedBox.id&&a.classList.toggle(this.wrapClassName("titles-tab-focus"),!1))}}this.focusedBox=e}}render(){if(this.$titleBar)return this.$titleBar;const e=super.render();e.classList.add(this.wrapClassName("max-titlebar")),this.sideEffect.addDisposer([this.state$.subscribe(s=>{e.classList.toggle(this.wrapClassName("max-titlebar-maximized"),s===se.Maximized)}),this.readonly$.subscribe(s=>{e.classList.toggle(this.wrapClassName("readonly"),s)}),w.combine([this.state$,this.boxes$]).subscribe(([s,r])=>{s===se.Maximized&&(e.classList.toggle(this.wrapClassName("max-titlebar-single-title"),r.length===1),r.length!==1&&e.replaceChild(this.renderTitles(),e.firstElementChild))})],"max-render");const i=document.createElement("div");return i.classList.add(this.wrapClassName("titles-area")),e.insertBefore(i,e.firstElementChild),e}destroy(){super.destroy(),this.$titles=void 0,this.focusedBox=void 0}renderTitles(){this.$titles=document.createElement("div"),this.$titles.className=this.wrapClassName("titles"),this.sideEffect.addEventListener(this.$titles,"wheel",s=>{s.currentTarget.scrollBy({left:s.deltaY>0?250:-250,behavior:"smooth"})},{passive:!1},"max-render-wheel-titles");const e=document.createElement("div");e.className=this.wrapClassName("titles-content"),this.$titles.appendChild(e);const i=this.boxes$.value.map(s=>{const r=document.createElement("button");return r.className=this.wrapClassName("titles-tab"),r.textContent=s.title,r.dataset.teleBoxID=s.id,r.dataset.teleTitleBarNoDblClick="true",this.focusedBox&&s.id===this.focusedBox.id&&r.classList.add(this.wrapClassName("titles-tab-focus")),e.appendChild(r),s._title$.reaction(a=>r.textContent=a)});return this.sideEffect.addDisposer(()=>i.forEach(s=>s()),"max-render-tab-titles"),this.$titles}}const xc=window.ResizeObserver||ca.ResizeObserver;class Sc{constructor({root:e=null,fullscreen:i=!1,prefersColorScheme:s=Ua.Light,minimized:r=!1,maximized:a=!1,fence:n=!0,collector:o,namespace:c="telebox",readonly:l=!1,stageRatio:d=-1,containerStyle:u="",stageStyle:p="",defaultBoxBodyStyle:m=null,defaultBoxStageStyle:g=null,theme:f={}}={}){this.events=new rt.default,this._sideEffect=new ve.SideEffectManager,this.namespace=c;const b=new w.ValManager;this._sideEffect.addDisposer(()=>b.destroy());const v=new w.Val(e),x=new w.Val(l),y=new w.Val(n),k=new w.Val(u),z=new w.Val(p),T=new w.Val(d),O=new w.Val(m),te=new w.Val(g),G=new w.Val(i),xe=new w.Val(r),Re=new w.Val(a),me=w.combine([Re,G],([A,B])=>B?!0:A),Ie=w.combine([xe,G],([A,B])=>B?!1:A);this.setMaximized=(A,B)=>Re.setValue(A,B),this.setMinimized=(A,B)=>xe.setValue(A,B);const fe=new w.Val({x:0,y:0,width:window.innerWidth,height:window.innerHeight},{compare:Ne});this._sideEffect.addDisposer(v.subscribe(A=>{this._sideEffect.add(()=>{if(!A)return()=>{};const B=new xc(()=>{const ke=A.getBoundingClientRect();fe.setValue({x:0,y:0,width:ke.width,height:ke.height})});return B.observe(A),()=>B.disconnect()},"calc-root-rect")}));const _e=w.combine([fe,T],Ha,{compare:Ne});this.boxes$=new w.Val([]),this.topBox$=new w.Val(void 0),this._sideEffect.addDisposer(this.boxes$.subscribe(A=>{if(A.length>0){const B=A.reduce((ke,Ce)=>ke.zIndex>Ce.zIndex?ke:Ce);this.topBox$.setValue(B)}else this.topBox$.setValue(void 0)}));const be=window.matchMedia("(prefers-color-scheme: dark)"),ye=new w.Val(!1);be&&(ye.setValue(be.matches),this._sideEffect.add(()=>{const A=B=>{ye.setValue(B.matches)};return be.addEventListener("change",A),()=>be.removeEventListener("change",A)}));const Se=new w.Val(s);this._sideEffect.addDisposer(Se.reaction((A,B)=>{B||this.events.emit(oe.PrefersColorScheme,A)}));const Ae=w.combine([ye,Se],([A,B])=>B==="auto"?A:B==="dark"),Me=w.combine([Ie,me],([A,B])=>A?se.Minimized:B?se.Maximized:se.Normal),ot={darkMode:Ae,state:Me,root:v,rootRect:fe,stageRect:_e,minimized:Ie,maximized:me};w.withReadonlyValueEnhancer(this,ot,b);const Oe={fullscreen:G,prefersColorScheme:Se,readonly:x,fence:y,stageRatio:T,containerStyle:k,stageStyle:z,defaultBoxBodyStyle:O,defaultBoxStageStyle:te};w.withValueEnhancer(this,Oe,b);const Qe=this.wrapClassName("titlebar-icon-close"),bt=A=>{var B;if(!A.isPrimary||x.value)return;const ke=A.target;if(!!ke.tagName)for(let Ce=ke;Ce;Ce=Ce.parentElement){if(Ce.classList&&Ce.classList.contains(Qe))return;const Tt=(B=Ce.dataset)==null?void 0:B.teleBoxID;if(Tt){const yt=this.getBox(Tt);if(yt){this.focusBox(yt),this.makeBoxTop(yt);return}}}};this._sideEffect.addEventListener(window,"pointerdown",bt,!0),this.$container=document.createElement("div"),this.$container.className=this.wrapClassName("manager-container"),this.setTheme(f),this.$stage=document.createElement("div"),this.$stage.className=this.wrapClassName("manager-stage"),this.$container.appendChild(this.$stage),this._sideEffect.addDisposer([Ae.subscribe(A=>{this.$container.classList.toggle(this.wrapClassName("color-scheme-dark"),A),this.$container.classList.toggle(this.wrapClassName("color-scheme-light"),!A)}),G.subscribe(A=>{this.$container.classList.toggle(this.wrapClassName("is-fullscreen"),Boolean(A))}),w.combine([this.boxes$,G],([A,B])=>B==="no-titlebar"||B===!0&&A.length<=1).subscribe(A=>{this.$container.classList.toggle(this.wrapClassName("hide-fullscreen-titlebar"),A)}),me.subscribe(A=>{this.$container.classList.toggle(this.wrapClassName("is-maximized"),A)}),Ie.subscribe(A=>{this.$container.classList.toggle(this.wrapClassName("is-minimized"),A)}),k.subscribe(A=>{this.$container.style.cssText=A}),z.subscribe(A=>{this.$stage.style.cssText=A,this.$stage.style.width=_e.value.width+"px",this.$stage.style.height=_e.value.height+"px"}),_e.subscribe(A=>{this.$stage.style.width=A.width+"px",this.$stage.style.height=A.height+"px"}),v.subscribe(A=>{A?A.appendChild(this.$container):this.$container.parentElement&&this.$container.remove()})]),this.collector=o!=null?o:new wc({minimized$:Ie,readonly$:x,darkMode$:Ae,namespace:c,root:this.$container,onClick:()=>xe.setValue(!1)}),this.titleBar=new vc({namespace:this.namespace,title$:w.derive(this.topBox$,A=>(A==null?void 0:A.title)||""),boxes$:this.boxes$,darkMode$:Ae,readonly$:x,state$:Me,rootRect$:fe,root:this.$container,onEvent:A=>{switch(A.type){case je.Maximize:{this.setMaximized(!me.value);break}case je.Minimize:{this.setMinimized(!0);break}case ue.Close:{this.removeTopBox(),this.focusTopBox();break}}}}),this._sideEffect.addDisposer([Me.reaction((A,B)=>{B||this.events.emit(oe.State,A)}),me.reaction((A,B)=>{B||this.events.emit(oe.Maximized,A)}),Ie.reaction((A,B)=>{B||this.events.emit(oe.Minimized,A)}),Ae.reaction((A,B)=>{B||this.events.emit(oe.DarkMode,A)})])}get boxes(){return this.boxes$.value}get topBox(){return this.topBox$.value}setState(e,i=!1){switch(e){case se.Maximized:{this.setMinimized(!1,i),this.setMaximized(!0,i);break}case se.Minimized:{this.setMinimized(!0,i),this.setMaximized(!1,i);break}default:{this.setMinimized(!1,i),this.setMaximized(!1,i);break}}return this}create(e={},i=!0){const s=new bc(he(R(R({zIndex:this.topBox?this.topBox.zIndex+1:100},e),i?this.smartPosition(e):{}),{namespace:this.namespace,root:this.$stage,darkMode$:this._darkMode$,fence$:this._fence$,rootRect$:this._rootRect$,managerStageRect$:this._stageRect$,managerStageRatio$:this._stageRatio$,managerMaximized$:this._maximized$,managerMinimized$:this._minimized$,managerReadonly$:this._readonly$,collectorRect$:this.collector._rect$,defaultBoxBodyStyle$:this._defaultBoxBodyStyle$,defaultBoxStageStyle$:this._defaultBoxStageStyle$}));return s.focus&&(this.focusBox(s),i&&this.makeBoxTop(s)),this.boxes$.setValue([...this.boxes,s]),this._sideEffect.addDisposer([s._delegateEvents.on(je.Maximize,()=>{this.setMaximized(!this.maximized)}),s._delegateEvents.on(je.Minimize,()=>{this.setMinimized(!0)}),s._delegateEvents.on(je.Close,()=>{this.remove(s),this.focusTopBox()}),s._intrinsicCoord$.reaction((r,a)=>{a||this.events.emit(oe.IntrinsicMove,s)}),s._intrinsicSize$.reaction((r,a)=>{a||this.events.emit(oe.IntrinsicResize,s)}),s._zIndex$.reaction((r,a)=>{if(this.boxes.length>0){const n=this.boxes.reduce((o,c)=>o.zIndex>c.zIndex?o:c);this.topBox$.setValue(n)}a||this.events.emit(oe.ZIndex,s)})]),this.events.emit(oe.Created,s),s}query(e){return e?this.boxes.filter(this.teleBoxMatcher(e)):[...this.boxes]}queryOne(e){return e?this.boxes.find(this.teleBoxMatcher(e)):this.boxes[0]}update(e,i,s=!1){const r=this.boxes.find(a=>a.id===e);if(r)return this.updateBox(r,i,s)}updateAll(e,i=!1){this.boxes.forEach(s=>{this.updateBox(s,e,i)})}remove(e,i=!1){const s=this.getBoxIndex(e);if(s>=0){const r=this.boxes.slice(),a=r.splice(s,1);return this.boxes$.setValue(r),a.forEach(n=>n.destroy()),i||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(oe.Removed,a)),a[0]}}removeTopBox(){if(this.topBox)return this.remove(this.topBox)}removeAll(e=!1){const i=this.boxes$.value;return this.boxes$.setValue([]),i.forEach(s=>s.destroy()),e||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(oe.Removed,i)),i}setTheme(e){Object.keys(e).forEach(i=>{var s;this.$container.style.setProperty(`--tele-${i}`,(s=e[i])!=null?s:null)})}mount(e){this._root$.setValue(e)}unmount(){this._root$.setValue(null)}destroy(e=!1){this.events.clearListeners(),this._sideEffect.flushAll(),this.removeAll(e),this.collector.destroy(),this.titleBar.destroy()}wrapClassName(e){return`${this.namespace}-${e}`}focusBox(e,i=!1){const s=this.getBox(e);s&&(this.boxes.forEach(r=>{if(s===r){let a=!1;s.focus||(a=!0,s._focus$.setValue(!0,i)),a&&!i&&this.events.emit(oe.Focused,s)}else r.focus&&this.blurBox(r,i)}),this.titleBar.focusBox(s))}focusTopBox(){if(this.topBox&&!this.topBox.focus)return this.focusBox(this.topBox)}blurBox(e,i=!1){const s=this.getBox(e);s&&(s.focus&&(s._focus$.setValue(!1,i),i||this.events.emit(oe.Blurred,s)),this.titleBar.focusedBox===s&&this.titleBar.focusBox())}blurAll(e=!1){this.boxes.forEach(i=>{i.focus&&(i._focus$.setValue(!1,e),e||this.events.emit(oe.Blurred,i))}),this.titleBar.focusedBox&&this.titleBar.focusBox()}teleBoxMatcher(e){const i=Object.keys(e);return s=>i.every(r=>e[r]===s[r])}updateBox(e,i,s=!1){var r,a,n,o,c,l;(i.x!=null||i.y!=null)&&e._intrinsicCoord$.setValue({x:(r=i.x)!=null?r:e.intrinsicX,y:(a=i.y)!=null?a:e.intrinsicY},s),(i.width!=null||i.height!=null)&&e._intrinsicSize$.setValue({width:(n=i.width)!=null?n:e.intrinsicWidth,height:(o=i.height)!=null?o:e.intrinsicHeight},s),i.title!=null&&e._title$.setValue(i.title),i.visible!=null&&e._visible$.setValue(i.visible,s),i.resizable!=null&&e._resizable$.setValue(i.resizable,s),i.draggable!=null&&e._draggable$.setValue(i.draggable,s),i.boxRatio!=null&&e._boxRatio$.setValue(i.boxRatio,s),i.zIndex!=null&&e._zIndex$.setValue(i.zIndex,s),i.stageRatio!==void 0&&e.setStageRatio(i.stageRatio,s),i.content!=null&&e.mountContent(i.content),i.footer!=null&&e.mountFooter(i.footer),(i.minHeight!=null||i.minWidth!=null)&&e._minSize$.setValue({width:(c=i.minWidth)!=null?c:e.minWidth,height:(l=i.minHeight)!=null?l:e.minHeight},s)}smartPosition(e){let{x:i,y:s}=e;const{width:r=.5,height:a=.5}=e,n=this.stageRect,o=this.topBox;if(i==null){let c=20;if(o){const l=o.pxIntrinsicCoord.x+20,d=r*n.width;l+d<=n.width&&(c=l)}i=c/n.width}if(s==null){let c=20;if(o){const l=o.pxIntrinsicCoord.y+20,d=a*n.height;l+d<=n.height&&(c=l)}s=c/n.height}return{x:i,y:s,width:r,height:a}}makeBoxTop(e,i=!1){this.topBox&&e!==this.topBox&&e._zIndex$.setValue(this.topBox.zIndex+1,i)}getBoxIndex(e){return typeof e=="string"?this.boxes.findIndex(i=>i.id===e):this.boxes.findIndex(i=>i===e)}getBox(e){return typeof e=="string"?this.boxes.find(i=>i.id===e):e}}const Mc=(t,e,i,s,r)=>new Cc({safeSetAttributes:a=>t.safeSetAttributes(a),updateAppState:(...a)=>{var n;return(n=t.appManager)==null?void 0:n.store.updateAppState(...a)},canOperate:()=>t.canOperate,notifyContainerRectUpdate:a=>{var n;return(n=t.appManager)==null?void 0:n.notifyContainerRectUpdate(a)},cleanFocus:()=>{var a;return(a=t.appManager)==null?void 0:a.store.cleanFocus()},setAppFocus:a=>{var n;return(n=t.appManager)==null?void 0:n.store.setAppFocus(a,!0)},callbacks:e,emitter:i,boxEmitter:s},r);class Cc{constructor(e,i){this.context=e,this.sideEffectManager=new ve.SideEffectManager;const{emitter:s,callbacks:r,boxEmitter:a}=e;this.teleBoxManager=this.setupBoxManager(i),this.sideEffectManager.add(()=>[this.teleBoxManager.onValChanged("state",n=>{r.emit("boxStateChange",n),s.emit("boxStateChange",n)}),this.teleBoxManager.onValChanged("darkMode",n=>{r.emit("darkModeChange",n)}),this.teleBoxManager.onValChanged("prefersColorScheme",n=>{r.emit("prefersColorSchemeChange",n)}),this.teleBoxManager.onValChanged("minimized",(n,o)=>{if(!o)if(this.context.safeSetAttributes({minimized:n}),n)this.context.cleanFocus(),this.blurAllBox();else{const c=this.getTopBox();c&&(this.context.setAppFocus(c.id),this.focusBox({appId:c.id},!1))}}),this.teleBoxManager.onValChanged("maximized",(n,o)=>{o||this.context.safeSetAttributes({maximized:n})}),this.teleBoxManager.events.on("removed",n=>{n.forEach(o=>{a.emit("close",{appId:o.id})})}),this.teleBoxManager.events.on("intrinsic_move",I.debounce(n=>{a.emit("move",{appId:n.id,x:n.intrinsicX,y:n.intrinsicY})},50)),this.teleBoxManager.events.on("intrinsic_resize",I.debounce(n=>{a.emit("resize",{appId:n.id,width:n.intrinsicWidth,height:n.intrinsicHeight})},200)),this.teleBoxManager.events.on("focused",n=>{n&&(this.canOperate?a.emit("focus",{appId:n.id}):this.teleBoxManager.blurBox(n.id))}),this.teleBoxManager.events.on("z_index",n=>{this.context.updateAppState(n.id,Ee.ZIndex,n.zIndex)}),s.on("containerSizeRatioUpdate",n=>{this.teleBoxManager._stageRatio$.setValue(n)})])}get canOperate(){return this.context.canOperate()}get boxState(){return this.teleBoxManager.state}get maximized(){return this.teleBoxManager.maximized}get minimized(){return this.teleBoxManager.minimized}get darkMode(){return this.teleBoxManager.darkMode}get prefersColorScheme(){return this.teleBoxManager.prefersColorScheme}get boxSize(){return this.teleBoxManager.boxes.length}get stageRect(){return this.teleBoxManager.stageRect}get stageRect$(){return this.teleBoxManager._stageRect$}createBox(e){var u,p,m;if(!this.teleBoxManager)return;let{minwidth:i=Eo,minheight:s=Po,enableShadowDOM:r=!0}=(u=e.app.config)!=null?u:{};const{width:a,height:n}=(p=e.app.config)!=null?p:{},o=((m=e.options)==null?void 0:m.title)||e.appId,c=this.teleBoxManager.rootRect;i>1&&(i=i/c.width),s>1&&(s=s/c.height);const l={title:o,minWidth:i,minHeight:s,width:a,height:n,id:e.appId,enableShadowDOM:r},d=this.teleBoxManager.create(l,e.smartPosition);return this.context.emitter.emit(`${e.appId}${Y.WindowCreated}`),d}setupBoxManager(e){const i=le.playground,s={stageRatio:e==null?void 0:e.stageRatio,root:i,fence:!1,prefersColorScheme:e==null?void 0:e.prefersColorScheme};e!=null&&e.containerStyle&&(s.containerStyle=e.containerStyle),e!=null&&e.stageStyle&&(s.stageStyle=e.stageStyle),e!=null&&e.fullscreen&&(s.fullscreen=e.fullscreen),(e==null?void 0:e.defaultBoxBodyStyle)!==void 0&&(s.defaultBoxBodyStyle=e.defaultBoxBodyStyle),(e==null?void 0:e.defaultBoxStageStyle)!==void 0&&(s.defaultBoxStageStyle=e.defaultBoxStageStyle),e!=null&&e.theme&&(s.theme=e.theme);const r=new Sc(s);this.teleBoxManager&&this.teleBoxManager.destroy(),this.teleBoxManager=r;const a=e==null?void 0:e.collectorContainer;return a&&this.teleBoxManager.collector.set$collector(a),e!=null&&e.collectorStyles&&this.teleBoxManager.collector.setStyles(e.collectorStyles),r}getBox(e){return this.teleBoxManager.queryOne({id:e})}closeBox(e,i=!1){return this.teleBoxManager.remove(e,i)}boxIsFocus(e){const i=this.getBox(e);return i==null?void 0:i.focus}getFocusBox(){return this.teleBoxManager.query({focus:!0})[0]}getTopBox(){return this.teleBoxManager.topBox}updateBoxState(e){if(!e)return;const i=this.getBox(e.id);i&&(e.size&&i._intrinsicSize$.setValue(e.size,!0),e.position&&i._intrinsicCoord$.setValue(e.position,!0),e.zIndex&&i._zIndex$.setValue(e.zIndex,!0),setTimeout(()=>{e.focus&&this.teleBoxManager.focusBox(i.id,!0),e.maximized!=null&&this.teleBoxManager.setMaximized(Boolean(e.maximized),!0),e.minimized!=null&&this.teleBoxManager.setMinimized(Boolean(e.minimized),!0)},50),this.context.callbacks.emit("boxStateChange",this.teleBoxManager.state))}moveBox({appId:e,x:i,y:s}){const r=this.getBox(e);r&&r._intrinsicCoord$.setValue({x:i,y:s},!0)}focusBox({appId:e},i=!0){this.teleBoxManager.focusBox(e,i)}resizeBox({appId:e,width:i,height:s,skipUpdate:r}){const a=this.getBox(e);a&&a._intrinsicSize$.setValue({width:i,height:s},r)}setBoxMinSize(e){this.teleBoxManager.update(e.appId,{minWidth:e.minWidth,minHeight:e.minHeight},!0)}setBoxTitle(e){this.teleBoxManager.update(e.appId,{title:e.title},!0)}blurAllBox(){this.teleBoxManager.blurAll()}updateAll(e){this.teleBoxManager.updateAll(e)}setMaximized(e,i=!0){e!==this.maximized&&this.teleBoxManager.setMaximized(e,i)}setMinimized(e,i=!0){this.teleBoxManager.setMinimized(e,i)}focusTopBox(){if(this.teleBoxManager.query().length>=1){const i=this.getTopBox();i&&this.focusBox({appId:i.id},!1)}}updateBox(e,i,s=!0){this.teleBoxManager.update(e,i,s)}setReadonly(e){this.teleBoxManager.setReadonly(e)}setPrefersColorScheme(e){this.teleBoxManager.setPrefersColorScheme(e)}setZIndex(e,i,s=!0){this.teleBoxManager.update(e,{zIndex:i},s)}setRoot(e){this.teleBoxManager._root$.setValue(e)}setCollector(e){this.teleBoxManager.collector.set$collector(e)}destroy(){this.sideEffectManager.flushAll(),this.teleBoxManager.destroy()}}function Mi(){}function Fa(t){return t()}function Vr(){return Object.create(null)}function Di(t){t.forEach(Fa)}function Ic(t){return typeof t=="function"}function _c(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let ci;function Ci(t,e){return ci||(ci=document.createElement("a")),ci.href=e,t===ci.href}function Ac(t){return Object.keys(t).length===0}function We(t,e){t.appendChild(e)}function Li(t,e,i){t.insertBefore(e,i||null)}function Kt(t){t.parentNode.removeChild(t)}function et(t){return document.createElement(t)}function Ys(t){return document.createTextNode(t)}function vs(){return Ys(" ")}function ie(t,e,i){i==null?t.removeAttribute(e):t.getAttribute(e)!==i&&t.setAttribute(e,i)}function kc(t){return Array.from(t.childNodes)}function Za(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function ne(t,e,i,s){i===null?t.style.removeProperty(e):t.style.setProperty(e,i,s?"important":"")}let Qs;function Ot(t){Qs=t}const Dt=[],$r=[],fi=[],jr=[],Tc=Promise.resolve();let xs=!1;function Nc(){xs||(xs=!0,Tc.then(Ya))}function Ss(t){fi.push(t)}const as=new Set;let hi=0;function Ya(){const t=Qs;do{for(;hi<Dt.length;){const e=Dt[hi];hi++,Ot(e),Ec(e.$$)}for(Ot(null),Dt.length=0,hi=0;$r.length;)$r.pop()();for(let e=0;e<fi.length;e+=1){const i=fi[e];as.has(i)||(as.add(i),i())}fi.length=0}while(Dt.length);for(;jr.length;)jr.pop()();xs=!1,as.clear(),Ot(t)}function Ec(t){if(t.fragment!==null){t.update(),Di(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(Ss)}}const Pc=new Set;function zc(t,e){t&&t.i&&(Pc.delete(t),t.i(e))}function Dc(t,e,i,s){const{fragment:r,on_mount:a,on_destroy:n,after_update:o}=t.$$;r&&r.m(e,i),s||Ss(()=>{const c=a.map(Fa).filter(Ic);n?n.push(...c):Di(c),t.$$.on_mount=[]}),o.forEach(Ss)}function Lc(t,e){const i=t.$$;i.fragment!==null&&(Di(i.on_destroy),i.fragment&&i.fragment.d(e),i.on_destroy=i.fragment=null,i.ctx=[])}function Vc(t,e){t.$$.dirty[0]===-1&&(Dt.push(t),Nc(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function $c(t,e,i,s,r,a,n,o=[-1]){const c=Qs;Ot(t);const l=t.$$={fragment:null,ctx:null,props:a,update:Mi,not_equal:r,bound:Vr(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:Vr(),dirty:o,skip_bound:!1,root:e.target||c.$$.root};n&&n(l.root);let d=!1;if(l.ctx=i?i(t,e.props||{},(u,p,...m)=>{const g=m.length?m[0]:p;return l.ctx&&r(l.ctx[u],l.ctx[u]=g)&&(!l.skip_bound&&l.bound[u]&&l.bound[u](g),d&&Vc(t,u)),p}):[],l.update(),d=!0,Di(l.before_update),l.fragment=s?s(l.ctx):!1,e.target){if(e.hydrate){const u=kc(e.target);l.fragment&&l.fragment.l(u),u.forEach(Kt)}else l.fragment&&l.fragment.c();e.intro&&zc(t.$$.fragment),Dc(t,e.target,e.anchor,e.customElement),Ya()}Ot(c)}class jc{$destroy(){Lc(this,1),this.$destroy=Mi}$on(e,i){const s=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return s.push(i),()=>{const r=s.indexOf(i);r!==-1&&s.splice(r,1)}}$set(e){this.$$set&&!Ac(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function Br(t){let e,i,s,r,a,n,o=t[14]&&Rr(t),c=t[15]&&Or(t);return{c(){e=et("div"),i=et("div"),o&&o.c(),s=vs(),r=et("span"),a=Ys(t[0]),n=vs(),c&&c.c(),ne(r,"overflow","hidden"),ne(r,"white-space","nowrap"),ne(r,"text-overflow","ellipsis"),ne(r,"max-width","80px"),ie(i,"class",t[8]),ne(i,"background-color",t[2]),ne(i,"color",t[9]),ne(i,"opacity",t[11]),ie(e,"class","netless-window-manager-cursor-name")},m(l,d){Li(l,e,d),We(e,i),o&&o.m(i,null),We(i,s),We(i,r),We(r,a),We(i,n),c&&c.m(i,null)},p(l,d){l[14]?o?o.p(l,d):(o=Rr(l),o.c(),o.m(i,s)):o&&(o.d(1),o=null),d&1&&Za(a,l[0]),l[15]?c?c.p(l,d):(c=Or(l),c.c(),c.m(i,null)):c&&(c.d(1),c=null),d&256&&ie(i,"class",l[8]),d&4&&ne(i,"background-color",l[2]),d&512&&ne(i,"color",l[9]),d&2048&&ne(i,"opacity",l[11])},d(l){l&&Kt(e),o&&o.d(),c&&c.d()}}}function Rr(t){let e,i;return{c(){e=et("img"),ie(e,"class","netless-window-manager-cursor-selector-avatar"),ie(e,"style",t[16]()),Ci(e.src,i=t[7])||ie(e,"src",i),ie(e,"alt","avatar")},m(s,r){Li(s,e,r)},p(s,r){r&128&&!Ci(e.src,i=s[7])&&ie(e,"src",i)},d(s){s&&Kt(e)}}}function Or(t){let e,i;return{c(){e=et("span"),i=Ys(t[1]),ie(e,"class","netless-window-manager-cursor-tag-name"),ne(e,"background-color",t[10])},m(s,r){Li(s,e,r),We(e,i)},p(s,r){r&2&&Za(i,s[1]),r&1024&&ne(e,"background-color",s[10])},d(s){s&&Kt(e)}}}function Bc(t){let e,i,s,r,a,n,o=!t[12]&&Br(t);return{c(){e=et("div"),o&&o.c(),i=vs(),s=et("div"),r=et("img"),ie(r,"class",a="netless-window-manager-cursor-"+t[3]+"-image"),Ci(r.src,n=t[6])||ie(r,"src",n),ie(r,"alt",t[3]),ie(s,"class","cursor-image-wrapper"),ie(e,"class","netless-window-manager-cursor-mid"),ne(e,"transform","translateX("+t[4]+"px) translateY("+t[5]+"px)"),ne(e,"display",t[13])},m(c,l){Li(c,e,l),o&&o.m(e,null),We(e,i),We(e,s),We(s,r)},p(c,[l]){c[12]?o&&(o.d(1),o=null):o?o.p(c,l):(o=Br(c),o.c(),o.m(e,i)),l&8&&a!==(a="netless-window-manager-cursor-"+c[3]+"-image")&&ie(r,"class",a),l&64&&!Ci(r.src,n=c[6])&&ie(r,"src",n),l&8&&ie(r,"alt",c[3]),l&48&&ne(e,"transform","translateX("+c[4]+"px) translateY("+c[5]+"px)"),l&8192&&ne(e,"display",c[13])},i:Mi,o:Mi,d(c){c&&Kt(e),o&&o.d()}}}function Rc(t,e,i){let s,r,a,n,o,{cursorName:c}=e,{tagName:l}=e,{backgroundColor:d}=e,{appliance:u}=e,{x:p}=e,{y:m}=e,{src:g}=e,{visible:f}=e,{avatar:b}=e,{theme:v}=e,{color:x}=e,{cursorTagBackgroundColor:y}=e,{opacity:k}=e;const z=()=>Object.entries({width:(s?19:28)+"px",height:(s?19:28)+"px",position:s?"initial":"absolute","border-color":s?"white":d,"margin-right":(s?4:0)+"px"}).map(([T,O])=>`${T}: ${O}`).join(";");return t.$$set=T=>{"cursorName"in T&&i(0,c=T.cursorName),"tagName"in T&&i(1,l=T.tagName),"backgroundColor"in T&&i(2,d=T.backgroundColor),"appliance"in T&&i(3,u=T.appliance),"x"in T&&i(4,p=T.x),"y"in T&&i(5,m=T.y),"src"in T&&i(6,g=T.src),"visible"in T&&i(17,f=T.visible),"avatar"in T&&i(7,b=T.avatar),"theme"in T&&i(8,v=T.theme),"color"in T&&i(9,x=T.color),"cursorTagBackgroundColor"in T&&i(10,y=T.cursorTagBackgroundColor),"opacity"in T&&i(11,k=T.opacity)},t.$$.update=()=>{t.$$.dirty&1&&(s=!I.isEmpty(c)),t.$$.dirty&2&&i(15,r=!I.isEmpty(l)),t.$$.dirty&128&&i(14,a=!I.isEmpty(b)),t.$$.dirty&131072&&i(13,n=f?"initial":"none"),t.$$.dirty&8&&i(12,o=u===S.ApplianceNames.laserPointer)},[c,l,d,u,p,m,g,b,v,x,y,k,o,n,a,r,z,f]}class Oc extends jc{constructor(e){super();$c(this,e,Rc,Bc,_c,{cursorName:0,tagName:1,backgroundColor:2,appliance:3,x:4,y:5,src:6,visible:17,avatar:7,theme:8,color:9,cursorTagBackgroundColor:10,opacity:11})}}class Uc{constructor(e,i,s,r){this.manager=e,this.memberId=i,this.cursorManager=s,this.wrapper=r,this.move=a=>{var n,o;if(a.type==="main"){const c=(n=this.manager.boxManager)==null?void 0:n.stageRect;this.component&&c&&(this.autoHidden(),this.moveCursor(a,c,this.manager.mainView))}else{const c=this.cursorManager.focusView,l=(o=c==null?void 0:c.divElement)==null?void 0:o.getBoundingClientRect(),d=c==null?void 0:c.camera;c&&l&&d&&this.component&&(this.autoHidden(),this.moveCursor(a,l,c))}},this.leave=()=>{this.hide()},this.updateMember(),this.createCursor(),this.autoHidden()}moveCursor(e,i,s){var c,l;const{x:r,y:a,type:n}=e,o=s==null?void 0:s.screen.convertPointToScreen(r,a);if(o){let d=o.x-2,u=o.y-18;if(n==="app"){const p=this.cursorManager.playgroundRect;p&&(d=d+i.x-p.x,u=u+i.y-p.y)}else d=d+i.x,u=u+i.y;o.x<0||o.x>i.width||o.y<0||o.y>i.height?(c=this.component)==null||c.$set({visible:!1,x:d,y:u}):(l=this.component)==null||l.$set({visible:!0,x:d,y:u})}}get memberApplianceName(){var e,i;return(i=(e=this.member)==null?void 0:e.memberState)==null?void 0:i.currentApplianceName}get memberColor(){var i,s;return`rgb(${(s=(i=this.member)==null?void 0:i.memberState)==null?void 0:s.strokeColor.join(",")})`}get payload(){var e;return(e=this.member)==null?void 0:e.payload}get memberCursorName(){var e,i;return((e=this.payload)==null?void 0:e.nickName)||((i=this.payload)==null?void 0:i.cursorName)||this.memberId}get memberTheme(){var e;return(e=this.payload)!=null&&e.theme?"netless-window-manager-cursor-inner-mellow":"netless-window-manager-cursor-inner"}get memberCursorTextColor(){var e;return((e=this.payload)==null?void 0:e.cursorTextColor)||"#FFFFFF"}get memberCursorTagBackgroundColor(){var e;return((e=this.payload)==null?void 0:e.cursorTagBackgroundColor)||this.memberColor}get memberAvatar(){var e;return(e=this.payload)==null?void 0:e.avatar}get memberOpacity(){return!this.memberCursorName&&!this.memberAvatar?0:1}get memberTagName(){var e;return(e=this.payload)==null?void 0:e.cursorTagName}autoHidden(){this.timer&&clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.hide()},1e3*10)}async createCursor(){this.member&&this.wrapper&&(this.component=new Oc({target:this.wrapper,props:this.initProps()}))}initProps(){return{x:0,y:0,appliance:this.memberApplianceName,avatar:this.memberAvatar,src:this.getIcon(),visible:!1,backgroundColor:this.memberColor,cursorName:this.memberCursorName,theme:this.memberTheme,color:this.memberCursorTextColor,cursorTagBackgroundColor:this.memberCursorTagBackgroundColor,opacity:this.memberOpacity,tagName:this.memberTagName}}getIcon(){if(this.member){const e=this.cursorManager.applianceIcons;return e[this.memberApplianceName||S.ApplianceNames.shape]||e[S.ApplianceNames.shape]}}updateMember(){return this.member=Ca(this.manager.room,this.memberId),this.updateComponent(),this.member}updateComponent(){var e;(e=this.component)==null||e.$set(I.omit(this.initProps(),["x","y"]))}destroy(){this.component&&this.component.$destroy(),this.cursorManager.cursorInstances.delete(this.memberId),this.timer&&clearTimeout(this.timer)}hide(){this.component&&(this.component.$set({visible:!1}),this.destroy())}}var Wc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAYAAADFeBvrAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAYISURBVHgB7ZpNSCtXFIBPEuvz+dMGpYUKD/sWFX+Qti6kK7Hqpm6e9q0rIoIUFUShPLV10VZx4+JZqa9v20LBhdq9fyBUCtKNPH8qYl2IOw3G38Rkek4y15y5uTOZJDOWggcOSSYzN/ebc+45554JwIM8iBCPyTEP+86T4vyMfsRN4b+nQTKIJp0vzuGvlpID7os8EQNEIBD4oKio6Bm9DwaDv/v9/n/076JgbtWUYPchwrW8qD7UnOvr6wFNkpubm+/wu7f0c7y6mrnlvQufxB0Iau7V1dX3BDA/P6/V1dVpzc3N2uLiIofK1c8VYHys/wRKBUN3/hGHqaysNOjc3FwMis6hc0FtLTHuvYLxCCZgci8uLn4wg5Gh6Fy8Jk+/NkcCAlAAuUkoW4g0B+d5tLS05O/r67O8eGxsDNra2uDy8nKsoKCAwCIQDxQa0yTxgrvCYXyTk5Ml+Orf2dlJeeHIyAigFSE/P38ELfUNqNdSkjgF5FF89jL1TU1NlQwODl5gZPujp6cHWltbUw7Koc7Pz8mkZpHPFeFrJuZeqLnoMoPoZqe0JjDP/IZgnyLUG/o8NDRkuo5Ua2pjY6MC4oFCFf1cA0oKzRSOp6enRfTaGh0d/QxBt+1CUVgnOTs7+xrHfQzGyOcKkK3QTJMnQffZ6e/v/xwttmsHqqmpKXbdycnJCxy7ABLh3FEgVZ6hZJhnFZoFFMF0d3c/w7v+dyookXBnZ2c/xvHfhriVcvXfdBRItsxjnOhYqjwjoAimq6vrCysoGofk+Ph4Esd/F/UdiFtJAGUd2DygTpp5dmBUUJ2dnc9VUALm8PDwJY7/BPU9VD8k3M4RC6kskxZMKigKIMLN9vf3p3H8DyWgfEhEOwOQD9IXOTz7EObbwsLC4YWFBRgeHrY9ECXYo6MjaGlpKWlsbPxkYGDgRW1tbSEWquVlZWXBzc3Nl1VVVa8hXiXc6ioqBqGaPDk7AACJTRZ3NS9lcUp86cJwoSQ7Pj4Op6enfxUXF3/V0NCQv7q6GsCvwrqGUG/01xAD4+VQTOxaSF43d5bBOisrGBJRCtXX17+/trb268rKSgASFgmz97KFkmo6OztWuVyPweiWGc4WRkhFRQVEIpHg8vJyQAIQVlLBROVxvBYQHsXnO8tk62ZcyN0wecLBwcEvYHSzEPscBqOLCRhLC4n9uqaA8UAWAcAKhtbQ3t7eTHl5+Y9gtAp3twhT056CDMQ7MRzIFTeTYKb1yYYVQFH9VdzsqNmYKpfTJBDX3Ixgdnd3XyHMT2AMALJlBBSPaMpNngrIsTyTCgaj288YDGakictrxizvKFNOjgSSBLS+vv6UYHDb7DgMVgsChjTEgCIKGG4ZU+EWkgNBzN1qamq+pAMTExPgFMzW1tZrhHkFyWE5KxgSszx0527RaDRmOSpRshEOU11dPQPG8CwHARHJlMnTSrwSRFIlfXt7m3V5ngJGuJtqzaQtZkFBVNJezN5ZAdmwjKo2k9tVtrcI3OXk4tPgcg7ChCDZ1URgMOu72Xa5VFHOkymQhWVU60YVmjN6wiC7k6p+S1syCACOwJBYFaexV+yhBekNPsMBO6KAEeE4BMaCU67RsoYhSbXgaT//ht709vZCaWmp6YkEbLFmVJWzas04+iBL7EKpm0J7duqu0B7+CTUpNJuyvb1NCfMj1CqI9wLKUOlOUMeG+gGFkHii4HizUF4z/KFUrPsJ8WbEIyx7nnZ0dDynME6BAuce09iFHo+GrnmGltltb2//E4wVAN82y7vOjKOZXSBhJdHNiT3TYWD8OY2PTUJkdd7MkJMnT5wZVQF2RFX6yBMUdzPMvvfqxz3sXHF+GNT9ANXit/10O1sgHkZvdQAOKvs9B5L7ARELGAAXLSTvM8QExTE+YbHe+HURhZp1aRyF4CJXClbbWwGketgkW9VsY+YaiBCVhfgE+XvxRwgZSM4jUVCDZFQ9pytmXR8hUTB2gnidx4XffVWydN0yQjwmx/jkAZJBrIBI5J7ZvQGZWUgVSuU/EqmOAzicKNMVu816DdRWUV1/7xAP8n+SfwF3Du3NF2sYhwAAAABJRU5ErkJggg==",Hc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADEAAAAxCAYAAABznEEcAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAZoSURBVHgB7VlLSCRXFL3ljNEhEXTGhMQJmOjCz8ZNVLKICz9xIYhCNi7UgINkGEk2En8hW5cBUQNxo05GAoKikuCAmvGzGMdPcCUGjDPxD/4Vv/3JvWW97luvq7ur+hMZ8MKlqrteNfe8e965970GuLVbC5kpJr53+hjHx9yY3TUxJgLMAQG4ITARfp5T4Mri4uL9q6urnxwOxz/oY5eXl1/Pzs7e195X2FX4jZsIhAK7gx5ps9m6nGj9/f3OtbU1pzAE0318fPwVjYHrrN7R3AjU/wpOBwA9Cmf/9ejoqDMtLU31iooKGdA+ATo4OMiXAEWAHhBAGEApXj4rPAik0vPt7e0vCgoKPH4gMzMTSktLIS8vD2JiYgABvcHMTZyennbHxsaOg3udOJmLzwqEYB0ZgRCZENm4u7e39yQuLq65srISZmZmvP5Ybm4u5OfnQ0lJyXWUCAgzNLS+vt6SnJz8WgvYwV5xSlcRgyVg3ha2Dkxzc3MvfZmVlQW+bGxsDBobGyE7O1u94uJPjIqKqklKSvrbbrfPnp+ff7e8vJwMnlSTKWfJjDKhywJo6wLp0YcZ+dyIUr7s4cOHLsrRlQwBTSBFuzc2NiZYhjjVAIyzZBqEwgCQv0OOM/gNzuiP/ijlDxBRjgClpqa6AF1cXDydmpoaLCws3JcAGYHyC4JMzoKaibKysvienp6FtrY2IA/WCFB5ebkqCHSvARo8Ozt7igIxwIJ2gJ+seFMnDoIyEUV+dHT0G3qWVUr5M043DdAB0m2IKZwAYpgZX+qkywR6NFbuR0iDxmAoZRUQKRxSLTMnJ8eIaqqSeVMnIYUOdu+sq6vrp4f+VCoYo8khZaNs01VRlERUu2/BrWAA7sl2Anink1Ao18JGjyY/PDx8hq1GZqgp5c2mp6chMjLy2b179x7hRzvoqeUUwXIzqq4O5nZsNUaEbIbLqPLTou/s7FTvT05OpsA9sXJG1AVsZDwjutqBIN6gUlWjxod8XRBNKXgsrqpqYZfwEqX9h8TExD7wbFm8LmzxHQ0QHSlXKZVSqFC/hkqlaKapTaGgCQTK7PHW1lb/wsLC86KiokkccoV+qV1tcE0pO7AWxmhTxBszDzqRr66ujqanp2cRpQLNBgUsCh8BwQ54bn5+/s+mpqa+4eHhfS1gb52vwuP0trPjhSZCBtLQ0NA3MDDQQIFYAUHBYhuvzjpVbJr1lZWVP3p7e19UVVXNgHumXYrI4uBx6Yqevz02b0FcRQ8CoBQF3dXVpQLZ3d39C7n+ora29vfJyclDYFnWgFyxK3cxhss/+KoT/N6DVkQpKypFGUCp3Ozo6HgSHx//GLW/BwHsg57zl5pzADajwLn52mPL1ZHPloMoRYPMFL6EhAR18e7s7MxVV1fPsAAp4Avteq7dC/c1+wKI4g+EfGzDM+EYHBw8RDrNiA2QL6upqVGvKJ2/gHu2L1nA5wwEB2YDfSYMO1x/px0cgEc2zBY+eo67u6H29vZ/wU2VC8l58JxKNjDOgojNEp08aFVfX++3l6JMEdDx8fEB0FNIBsDXBc8ArwuW1EkeI1RKdLWmCx+1DhkZGRvR0dFfSsHKxYtnW0iqvJAN9xNm6MR/QO5sfapUSkqKmqW5ubmfwVgyZdpw/vPZl2kUEAinBMSUStG+gwra0NDQSynQKyloIxnlewafjDFLJzLRBJqiFMnqyMgIbG5uDuD996Dnv8iAPOMAPmbcm5lVJwA/vZRMKZGZlpaWVtAvUL4GZMqE1fjRJrUd76LHoX+InlhcXPwZnWW2tra6jjrpiBM3UK/weQr6J+gfodMh9HtwncG7YLA3CMSsLmxx5WuDCt8B7vZeicInTjCWlpb6wc15mfey7oc9E8LElpVmMgb9AXoC+qcTExOPKRu4NlTHs6Q10GfhgfYOvRsJQZ76BWMKuDtaolQs+gfoH6Mn436gDg+e+5BKXUQx/C5Je/a+NpbeiQJPKgUdlNXx/BCBKxVdxW5Q0I3XBqFKRhU4KLtjYawi3csuTKdc4FnIXNvKUJkVEGRG20QZAAUpA5DbaYAQLmQzfzxyk/ffdnCD4NWVnGdE7kQBQvQHC5lVEDxgMaM29lkxGCNLKrDnIbFAMkFmBIaDkHstU41coGZ1TZD5UjReCGUAYbNgdNqoXZB/T67yYbFAMiGML3BhYeH8rb0t9h/zgcTBcTNGiQAAAABJRU5ErkJggg==",Fc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAYAAADFeBvrAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAgrSURBVHgB7ZprTBRXFIDP7gIt8lQppTwE5V0KaAn6o1pqNGkDDTEmTUhsgKRp+gNJw68CFkLbVC2QkDS+gD8KJdWmARvbFBNNWpuIRGPFWBXQRMPDqIki+KLATs+ZnTvcvXtnX8w2beJJToaduTP3fHPOPffcOwC8kP+2WCDwIvahGFxTuN8KmNSZmULPNjLeqF9F8rdPkIEGEn+r+vjx46LQ0NA8/Dsader58+e/h4WFDWntFO7ot6fMFAt3JLWi2lCDpqamCux2+2+KROj82NhYGrXT2lu5Z/DP/deFByElA4Pv3LlTiHY/nJ6eVnbv3q1s2bJFyc7OVrZu3arU1dUp4+PjxPUQoT+g9tp9PkMFgpo9kxljHRoaWp2Xl3duYmIiurKyEvDoclNCQgIcPnxYPc7MzHwcGRnZhaft4Ag7O9fUbRhaITCie4lgcnNzT7qDIaHz27dvh+vXr0NEREQneqoCHKFnAR+8ZCaQGGq2CxcurCGYycnJZHcwTNAzUFFRoUJFRUV1IFQ5OKBsXB9uxSwgl0TQ3d29Yt26dccwoyVXV1d7hGEiQmGi2AzOUHx/hob4K2yuYS9G987s7OwPISEh7xPM6dOnwVfBsIMjR45AZmbmo5s3b76Xnp7+J55egMVxBSAZT0v1ED+76yn66dOnLQSzd+9ev2BIyFP0MjBco1JTU/sxfFeDazp3cYgZHmKqdoaGNISHh9fv378fSJcqlPV6e3sBJ+I/goOD34VFL0k95Y+HxPHCYGxmw5DQ2NuzZw8EBQVtunXr1jvgwUP+hhz/QDXMMCNVE8zx48dNg2FCz6QQjI2N/RA8VBFmANnu3btXihnpG8pM9fX1EAi5du0aeWkVOAMBCF7yN+R0z4yOjq6NiYlpp9CgdBtIwXpPH6vgDKWLt0CygtM6MDCwBuUYZSKaOCksAiVY9wFOBePgDOOytPAGSKzNVCCC2bBhw69YdK7ypgpYimzbtk2dl7CM+hFcveOUHDylbTFO1YdhFbByx44dA1QFUP0VSJj4+Hjo6+sDq9U6iEmHKvFZTedQ50GYbN15SITVlwNlZWUnLRZL8s6dOwMOQ9UCTtKTra2ttdppt9V2kMF5cbmsjxuM43bMNrmUzc6fP6+GQiDGDoOJi4ubwb4qm5ubafyIE6nLxGqTPEsGo1cBOGNX0TyDYafC0CyOaxcVziyh53Z2dkJycvLMvn37PmpoaBgFR4jxYSbWdVIgI89Iq4CjR48CZjlYv369+tssqI6ODsjPz4f+/v668vLycxrEHHfkYdwC8SB6mGEV8Cl64cuuri5oa2tTG+EyGjZu3AiXLl1qefDgwV8lJSUFZkDV1tZCcXExXLx4sbWoqKgPFj0zx8GI9ZwO5W4M6ekZYeqpaqbqmaSqqkpNpcPDw4dwzfM9nrLduHEjEs+X0XV/Sx96LnqE1kLtBQUF3eDwCO8dGQyzV5rl+JyuegfXI29jRotiRlKnpFghHMzKyjqotVXS0tLacKPjF3bdHxjSq1evduAkepAD+ZsDYlC8V5w8ZBVg+PPq2MGMlkInqE4joTf45MmT4YyMjAPcA+ltLSQlJX2BafxnX6HI29QeK44TOTk57mCYZ0QoJ8OBM4yB6dkNkwGlSygsLFQvYtYB3BTMxFL+M+0eFgZqp4mJiU2+QKGX1fGIk/QIrn0aYXGsyDxjmAyMhO2jhaCGoUbX1NSkLSwsPMJqV8Fspu6lIZS6OYhjiOLwdU7fQM1HfRPD7wS1obZ0j0xpb4726Z49ezaJf2/S7s9ATUGNR41BjdJseRnke3WGwhrRTS9pD1mOGoeG15BxOOfoxuCkp0Ih6NeaEaSZGlieJyiCoc1FgsGldokGk8nBvAKOrWIGQ5uPsm0tt0BWDiicAaGuGhkZ+YqMw9StGzU4OKhCnT179hNsswY1FTXdE5QEJhc1S3tGogazXLOBwQSBl3tzIhQPtAL1VQJCTcNx8y1vHIUghSKFZE9PT7H2dlM1b+Wgrr1y5Uq77J75+fnplpaWMg2ch4nlYEI5z7hdensDpI4hrYNErcMMXJ32koG4ztf3pultz83NjWG99Ra2WQ0OL2VjZjwgeufUqVOqV8+cOdPIwdBLSNJeHg8TAh5WqJ6EfSmgt7IMNRJ1JThiOlnrOAMHshprmMKdoGSCpb9s3B3SYLIFGIqICJB7xisYi+RvfiypXw40DWGdlJaWRmMd141hk8V2OWm7ieYTXhBc3+BgaZyqAISjOYxSMVvXsBTNlzdiNQDgRao2AtK3pjggpmrqbGpqSsLPIN/dv38/gaBwUjTshMHcvn27JyUlpRmc5xpPMD599LIYnLNyUKKndKjGxsakXbt2deMCLIE8IVvs0YRM1fjdu3d/wrXN5+BcnzEgvor2uN3rjzAYMp5lPEoQlE5fA0fWo8GfhlCbKVFQ1pKNIfzcOHH58mWqaimVUwJI0+6n59D4pIlzmdZPMPiZzXjDjX47Le5g0Uu8x2zgPqWyKpjVe7x3+AUbq9NYjQbgp2dsBud5o8TP7d5kHAWcQchQfoEmLgn8HjOiBIF7o5hI1x6CEbLNP3bdqYAF44JzyWLzcN1i8DcT/o3awbm8Fz3DAy2A62INwPV/E3wWdx5inmBHuwChCBD6R2JwHge80TIQRQLjt7e8DTkGZgfX8cUMZTDAteFDkveaIlzjX9ySQs8X18r2t2VHUURPKoICmDR+eCO9aSdmOIub3/w9RgpgUpiJhvraXpa6jZKHGEqyusw0GLFzX+5RhN/8kYnMSNMMfyH/V/kHST6OYVElTPAAAAAASUVORK5CYII=",Zc="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDBweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDAgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT5zaGFwZS1jdXJzb3I8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz4KICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0icGF0aC0xIj48L3BhdGg+CiAgICAgICAgPGZpbHRlciB4PSItNjQuNiUiIHk9Ii01OS41JSIgd2lkdGg9IjIyOS4zJSIgaGVpZ2h0PSIyNDYuMSUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0yIj4KICAgICAgICAgICAgPGZlTW9ycGhvbG9neSByYWRpdXM9IjEiIG9wZXJhdG9yPSJkaWxhdGUiIGluPSJTb3VyY2VBbHBoYSIgcmVzdWx0PSJzaGFkb3dTcHJlYWRPdXRlcjEiPjwvZmVNb3JwaG9sb2d5PgogICAgICAgICAgICA8ZmVPZmZzZXQgZHg9IjAiIGR5PSIyIiBpbj0ic2hhZG93U3ByZWFkT3V0ZXIxIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSI+PC9mZU9mZnNldD4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMyIgaW49InNoYWRvd09mZnNldE91dGVyMSIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlR2F1c3NpYW5CbHVyPgogICAgICAgICAgICA8ZmVDb21wb3NpdGUgaW49InNoYWRvd0JsdXJPdXRlcjEiIGluMj0iU291cmNlQWxwaGEiIG9wZXJhdG9yPSJvdXQiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbXBvc2l0ZT4KICAgICAgICAgICAgPGZlQ29sb3JNYXRyaXggdmFsdWVzPSIwIDAgMCAwIDAgICAwIDAgMCAwIDAgICAwIDAgMCAwIDAgIDAgMCAwIDAuMTYgMCIgdHlwZT0ibWF0cml4IiBpbj0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbG9yTWF0cml4PgogICAgICAgIDwvZmlsdGVyPgogICAgPC9kZWZzPgogICAgPGcgaWQ9Iumhtemdoi00IiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0iV2hpdGVib2FyZC1HdWlkZWxpbmVzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMzQ0LjAwMDAwMCwgLTc1MS4wMDAwMDApIj4KICAgICAgICAgICAgPGcgaWQ9InNoYXBlLWN1cnNvciIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMzQ0LjAwMDAwMCwgNzUxLjAwMDAwMCkiPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9ouWkh+S7vS00NCIgZmlsbD0iI0ZGRkZGRiIgb3BhY2l0eT0iMC4wMSIgeD0iMCIgeT0iMCIgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIiByeD0iMiI+PC9yZWN0PgogICAgICAgICAgICAgICAgPGcgaWQ9IuW9oueKtue7k+WQiCIgZmlsbC1ydWxlPSJub256ZXJvIj4KICAgICAgICAgICAgICAgICAgICA8dXNlIGZpbGw9ImJsYWNrIiBmaWxsLW9wYWNpdHk9IjEiIGZpbHRlcj0idXJsKCNmaWx0ZXItMikiIHhsaW5rOmhyZWY9IiNwYXRoLTEiPjwvdXNlPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIxIiBkPSJNMjAsMjEgQzIwLjQ4NTQxMDMsMjEgMjAuODk4MDg1LDIxLjM0Nzk5OTMgMjAuOTg5OTQ3OSwyMS44NjU0ODc3IEwyMSwyMiBMMjEsMjcgQzIxLDI3LjU1MjI4NDcgMjAuNTUyMjg0NywyOCAyMCwyOCBDMTkuNTE0NTg5NywyOCAxOS4xMDE5MTUsMjcuNjUyMDAwNyAxOS4wMTAwNTIxLDI3LjEzNDUxMjMgTDE5LDI3IEwxOSwyMiBDMTksMjEuNDQ3NzE1MyAxOS40NDc3MTUzLDIxIDIwLDIxIFogTTI3LDE5IEMyNy41NTIyODQ3LDE5IDI4LDE5LjQ0NzcxNTMgMjgsMjAgQzI4LDIwLjQ4NTQxMDMgMjcuNjUyMDAwNywyMC44OTgwODUgMjcuMTM0NTEyMywyMC45ODk5NDc5IEwyNywyMSBMMjIsMjEgQzIxLjQ0NzcxNTMsMjEgMjEsMjAuNTUyMjg0NyAyMSwyMCBDMjEsMTkuNTE0NTg5NyAyMS4zNDc5OTkzLDE5LjEwMTkxNSAyMS44NjU0ODc3LDE5LjAxMDA1MjEgTDIyLDE5IEwyNywxOSBaIE0xOCwxOSBDMTguNTUyMjg0NywxOSAxOSwxOS40NDc3MTUzIDE5LDIwIEMxOSwyMC40ODU0MTAzIDE4LjY1MjAwMDcsMjAuODk4MDg1IDE4LjEzNDUxMjMsMjAuOTg5OTQ3OSBMMTgsMjEgTDEzLDIxIEMxMi40NDc3MTUzLDIxIDEyLDIwLjU1MjI4NDcgMTIsMjAgQzEyLDE5LjUxNDU4OTcgMTIuMzQ3OTk5MywxOS4xMDE5MTUgMTIuODY1NDg3NywxOS4wMTAwNTIxIEwxMywxOSBMMTgsMTkgWiBNMjAsMTIgQzIwLjQ4NTQxMDMsMTIgMjAuODk4MDg1LDEyLjM0Nzk5OTMgMjAuOTg5OTQ3OSwxMi44NjU0ODc3IEwyMSwxMyBMMjEsMTggQzIxLDE4LjU1MjI4NDcgMjAuNTUyMjg0NywxOSAyMCwxOSBDMTkuNTE0NTg5NywxOSAxOS4xMDE5MTUsMTguNjUyMDAwNyAxOS4wMTAwNTIxLDE4LjEzNDUxMjMgTDE5LDE4IEwxOSwxMyBDMTksMTIuNDQ3NzE1MyAxOS40NDc3MTUzLDEyIDIwLDEyIFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9oiIgZmlsbD0iI0ZGRkZGRiIgeD0iMTguNSIgeT0iMTciIHdpZHRoPSIzIiBoZWlnaHQ9IjYiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaIiIGZpbGw9IiNGRkZGRkYiIHg9IjE3IiB5PSIxOC41IiB3aWR0aD0iNiIgaGVpZ2h0PSIzIj48L3JlY3Q+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0i5b2i54q257uT5ZCIIiBmaWxsPSIjMjEyMzI0IiBmaWxsLXJ1bGU9Im5vbnplcm8iPjwvcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",Yc="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDdweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDcgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT50ZXh0LWN1cnNvcjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxwYXRoIGQ9Ik0xNiwyNi41IEMxNS43MjM4NTc2LDI2LjUgMTUuNSwyNi4yNzYxNDI0IDE1LjUsMjYgQzE1LjUsMjUuNzU0NTQwMSAxNS42NzY4NzUyLDI1LjU1MDM5MTYgMTUuOTEwMTI0NCwyNS41MDgwNTU3IEwxNiwyNS41IEwxOS41LDI1LjUgTDE5LjUsMTQuNSBMMTYsMTQuNSBDMTUuNzIzODU3NiwxNC41IDE1LjUsMTQuMjc2MTQyNCAxNS41LDE0IEMxNS41LDEzLjc1NDU0MDEgMTUuNjc2ODc1MiwxMy41NTAzOTE2IDE1LjkxMDEyNDQsMTMuNTA4MDU1NyBMMTYsMTMuNSBMMjQsMTMuNSBDMjQuMjc2MTQyNCwxMy41IDI0LjUsMTMuNzIzODU3NiAyNC41LDE0IEMyNC41LDE0LjI0NTQ1OTkgMjQuMzIzMTI0OCwxNC40NDk2MDg0IDI0LjA4OTg3NTYsMTQuNDkxOTQ0MyBMMjQsMTQuNSBMMjAuNSwxNC41IEwyMC41LDI1LjUgTDI0LDI1LjUgQzI0LjI3NjE0MjQsMjUuNSAyNC41LDI1LjcyMzg1NzYgMjQuNSwyNiBDMjQuNSwyNi4yNDU0NTk5IDI0LjMyMzEyNDgsMjYuNDQ5NjA4NCAyNC4wODk4NzU2LDI2LjQ5MTk0NDMgTDI0LDI2LjUgTDE2LDI2LjUgWiIgaWQ9InBhdGgtMSI+PC9wYXRoPgogICAgICAgIDxmaWx0ZXIgeD0iLTI4NC4wJSIgeT0iLTgxLjUlIiB3aWR0aD0iNjY4LjElIiBoZWlnaHQ9IjI5My45JSIgZmlsdGVyVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiBpZD0iZmlsdGVyLTIiPgogICAgICAgICAgICA8ZmVNb3JwaG9sb2d5IHJhZGl1cz0iMSIgb3BlcmF0b3I9ImRpbGF0ZSIgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd1NwcmVhZE91dGVyMSI+PC9mZU1vcnBob2xvZ3k+CiAgICAgICAgICAgIDxmZU9mZnNldCBkeD0iMCIgZHk9IjIiIGluPSJzaGFkb3dTcHJlYWRPdXRlcjEiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIj48L2ZlT2Zmc2V0PgogICAgICAgICAgICA8ZmVHYXVzc2lhbkJsdXIgc3RkRGV2aWF0aW9uPSIzIiBpbj0ic2hhZG93T2Zmc2V0T3V0ZXIxIiByZXN1bHQ9InNoYWRvd0JsdXJPdXRlcjEiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgICAgIDxmZUNvbXBvc2l0ZSBpbj0ic2hhZG93Qmx1ck91dGVyMSIgaW4yPSJTb3VyY2VBbHBoYSIgb3BlcmF0b3I9Im91dCIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29tcG9zaXRlPgogICAgICAgICAgICA8ZmVDb2xvck1hdHJpeCB2YWx1ZXM9IjAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgMCAwIDAgMC4xNiAwIiB0eXBlPSJtYXRyaXgiIGluPSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29sb3JNYXRyaXg+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iLTQiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJXaGl0ZWJvYXJkLUd1aWRlbGluZXMiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zODguMDAwMDAwLCAtNjcyLjAwMDAwMCkiPgogICAgICAgICAgICA8ZyBpZD0idGV4dC1jdXJzb3IiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDM5Mi4wMDAwMDAsIDY3Mi4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaLlpIfku70tNDAiIGZpbGw9IiNGRkZGRkYiIG9wYWNpdHk9IjAuMDEiIHg9IjAiIHk9IjAiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcng9IjIiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgiIGZpbGwtcnVsZT0ibm9uemVybyI+CiAgICAgICAgICAgICAgICAgICAgPHVzZSBmaWxsPSJibGFjayIgZmlsbC1vcGFjaXR5PSIxIiBmaWx0ZXI9InVybCgjZmlsdGVyLTIpIiB4bGluazpocmVmPSIjcGF0aC0xIj48L3VzZT4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMSIgZD0iTTE5LDI1IEwxOSwxNSBMMTYsMTUgQzE1LjQ0NzcxNTMsMTUgMTUsMTQuNTUyMjg0NyAxNSwxNCBDMTUsMTMuNTE0NTg5NyAxNS4zNDc5OTkzLDEzLjEwMTkxNSAxNS44NjU0ODc3LDEzLjAxMDA1MjEgTDE2LDEzIEwyNCwxMyBDMjQuNTUyMjg0NywxMyAyNSwxMy40NDc3MTUzIDI1LDE0IEMyNSwxNC40ODU0MTAzIDI0LjY1MjAwMDcsMTQuODk4MDg1IDI0LjEzNDUxMjMsMTQuOTg5OTQ3OSBMMjQsMTUgTDIxLDE1IEwyMSwyNSBMMjQsMjUgQzI0LjU1MjI4NDcsMjUgMjUsMjUuNDQ3NzE1MyAyNSwyNiBDMjUsMjYuNDg1NDEwMyAyNC42NTIwMDA3LDI2Ljg5ODA4NSAyNC4xMzQ1MTIzLDI2Ljk4OTk0NzkgTDI0LDI3IEwxNiwyNyBDMTUuNDQ3NzE1MywyNyAxNSwyNi41NTIyODQ3IDE1LDI2IEMxNSwyNS41MTQ1ODk3IDE1LjM0Nzk5OTMsMjUuMTAxOTE1IDE1Ljg2NTQ4NzcsMjUuMDEwMDUyMSBMMTYsMjUgTDE5LDI1IFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=",Qc="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjhweCIgaGVpZ2h0PSIyOHB4IiB2aWV3Qm94PSIwIDAgMjggMjgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDU1LjEgKDc4MTM2KSAtIGh0dHBzOi8vc2tldGNoYXBwLmNvbSAtLT4KICAgIDx0aXRsZT7nvJbnu4QgMjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxmaWx0ZXIgeD0iLTEyMC4wJSIgeT0iLTEyMC4wJSIgd2lkdGg9IjM0MC4wJSIgaGVpZ2h0PSIzNDAuMCUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0xIj4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iNCIgaW49IlNvdXJjZUdyYXBoaWMiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9Iue8lue7hC0yIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg5LjAwMDAwMCwgOS4wMDAwMDApIiBmaWxsPSIjRkYwMTAwIj4KICAgICAgICAgICAgPGNpcmNsZSBpZD0i5qSt5ZyG5b2iIiBmaWx0ZXI9InVybCgjZmlsdGVyLTEpIiBjeD0iNSIgY3k9IjUiIHI9IjUiPjwvY2lyY2xlPgogICAgICAgICAgICA8cGF0aCBkPSJNNSw4IEM2LjY1Njg1NDI1LDggOCw2LjY1Njg1NDI1IDgsNSBDOCwzLjM0MzE0NTc1IDYuNjU2ODU0MjUsMiA1LDIgQzMuMzQzMTQ1NzUsMiAyLDMuMzQzMTQ1NzUgMiw1IEMyLDYuNjU2ODU0MjUgMy4zNDMxNDU3NSw4IDUsOCBaIE01LDYuMjg1NzE0MjkgQzQuMjg5OTE5NjEsNi4yODU3MTQyOSAzLjcxNDI4NTcxLDUuNzEwMDgwMzkgMy43MTQyODU3MSw1IEMzLjcxNDI4NTcxLDQuMjg5OTE5NjEgNC4yODk5MTk2MSwzLjcxNDI4NTcxIDUsMy43MTQyODU3MSBDNS43MTAwODAzOSwzLjcxNDI4NTcxIDYuMjg1NzE0MjksNC4yODk5MTk2MSA2LjI4NTcxNDI5LDUgQzYuMjg1NzE0MjksNS43MTAwODAzOSA1LjcxMDA4MDM5LDYuMjg1NzE0MjkgNSw2LjI4NTcxNDI5IFoiIGlkPSLmpK3lnIblvaIiIGZpbGwtcnVsZT0ibm9uemVybyI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+";const Ur={[S.ApplianceNames.pencil]:Wc,[S.ApplianceNames.selector]:Hc,[S.ApplianceNames.eraser]:Fc,[S.ApplianceNames.shape]:Zc,[S.ApplianceNames.text]:Yc,[S.ApplianceNames.laserPointer]:Qc};class Gc{constructor(e,i,s){var a;this.manager=e,this.enableCursor=i,this.cursorInstances=new Map,this.sideEffectManager=new ve.SideEffectManager,this.store=this.manager.store,this.applianceIcons=Ur,this.onCursorMove=n=>{const o=this.initCursorInstance(n.uid);if(n.state===ua.Leave)o.leave();else{const c=o.updateMember();this.canMoveCursor(c)&&o.move(n.position)}},this.initCursorInstance=n=>{let o=this.cursorInstances.get(n);return o||(o=new Uc(this.manager,n,this,le.playground),this.cursorInstances.set(n,o)),o},this.mouseMoveListener=I.throttle(n=>{n.pointerType==="touch"&&!n.isPrimary||this.updateCursor(this.getType(n),n.clientX,n.clientY)},48),this.getPoint=(n,o,c)=>{var d;const l=(d=n==null?void 0:n.divElement)==null?void 0:d.getBoundingClientRect();if(l)return n==null?void 0:n.convertToPointInWorld({x:o-l.x,y:c-l.y})},this.getType=n=>{var l;const o=n.target,c=this.manager.focusApp;switch(o.parentElement){case this.mainViewElement:return{type:"main"};case((l=c==null?void 0:c.view)==null?void 0:l.divElement):return{type:"app"};default:return{type:"main"}}},this.mouseLeaveListener=()=>{this.hideCursor(this.manager.uid)},this.roomMembers=(a=this.manager.room)==null?void 0:a.state.roomMembers;const r=le.playground;r&&this.setupWrapper(r),this.sideEffectManager.add(()=>P.on("cursorMove",this.onCursorMove)),this.sideEffectManager.add(()=>P.on("playgroundSizeChange",()=>this.updateContainerRect())),s&&(this.applianceIcons=R(R({},Ur),s))}canMoveCursor(e){const i=(e==null?void 0:e.memberState.currentApplianceName)===S.ApplianceNames.laserPointer;return this.enableCursor||i}setupWrapper(e){this.sideEffectManager.add(()=>(e.addEventListener("pointerenter",this.mouseMoveListener),e.addEventListener("pointermove",this.mouseMoveListener),e.addEventListener("pointerleave",this.mouseLeaveListener),()=>{e.removeEventListener("pointerenter",this.mouseMoveListener),e.removeEventListener("pointermove",this.mouseMoveListener),e.removeEventListener("pointerleave",this.mouseLeaveListener)})),this.updateContainerRect()}setMainViewDivElement(e){this.mainViewElement=e}get boxState(){return this.store.getBoxState()}get focusView(){var e;return(e=this.manager.focusApp)==null?void 0:e.view}updateCursor(e,i,s){if(this.wrapperRect&&this.manager.canOperate){const r=e.type==="main"?this.manager.mainView:this.focusView,a=this.getPoint(r,i,s);a&&this.manager.dispatchInternalEvent(Y.CursorMove,{uid:this.manager.uid,position:{x:a.x,y:a.y,type:e.type}})}}updateContainerRect(){var e,i;this.wrapperRect=(e=this.manager.boxManager)==null?void 0:e.stageRect,this.playgroundRect=(i=le.playground)==null?void 0:i.getBoundingClientRect()}deleteCursor(e){this.store.cleanCursor(e);const i=this.cursorInstances.get(e);i&&i.destroy()}hideCursor(e){const i=this.cursorInstances.get(e);i&&i.hide()}destroy(){this.sideEffectManager.flushAll(),this.cursorInstances.size&&(this.cursorInstances.forEach(e=>{e.destroy()}),this.cursorInstances.clear())}}class qc{constructor(e){this.manager=e,P.on("changePageState",()=>{Q.emit("pageStateChange",this.toObject())})}get index(){var e;return((e=this.manager)==null?void 0:e.store.getMainViewSceneIndex())||0}get length(){var e;return((e=this.manager)==null?void 0:e.mainViewScenesLength)||0}toObject(){return{index:this.index>=this.length?this.length-1:this.index,length:this.length}}}class Jc{constructor(e){this.ctx=e,this.reactors=new Map,this.disposers=new Map,this.onPhaseChanged=i=>{var s,r;i===S.RoomPhase.Reconnecting&&this.ctx.emitter.emit("startReconnect"),i===S.RoomPhase.Connected&&this.phase===S.RoomPhase.Reconnecting&&((s=this.room)!=null&&s.isWritable?(r=this.room)==null||r.dispatchMagixEvent(qi,{}):this.onReconnected()),this.phase=i},this.onReconnected=I.debounce(()=>{this._onReconnected()},1e3),this._onReconnected=()=>{Je("onReconnected refresh reactors"),this.releaseDisposers(),this.reactors.forEach((i,s)=>{I.isFunction(i)&&this.disposers.set(s,i())}),this.ctx.emitter.emit("onReconnected")}}setRoom(e){this.room=e,this.phase=e==null?void 0:e.phase,e&&(e.callbacks.off("onPhaseChanged",this.onPhaseChanged),e.callbacks.on("onPhaseChanged",this.onPhaseChanged),e.addMagixEventListener(qi,i=>{i.authorId===e.observerId&&this.onReconnected()},{fireSelfEventAfterCommit:!0}))}setContext(e){this.ctx=e}releaseDisposers(){this.disposers.forEach(e=>{I.isFunction(e)&&e()}),this.disposers.clear()}refresh(){this._onReconnected()}add(e,i){const s=this.disposers.get(e);return s&&I.isFunction(s)&&s(),I.isFunction(i)&&(this.reactors.set(e,i),this.disposers.set(e,i())),()=>this.remove(e)}remove(e){this.reactors.has(e)&&this.reactors.delete(e);const i=this.disposers.get(e);i&&(I.isFunction(i)&&i(),this.disposers.delete(e))}hasReactor(e){return this.reactors.has(e)}destroy(){var e,i;(e=this.room)==null||e.callbacks.off("onPhaseChanged",this.onPhaseChanged),(i=this.room)==null||i.removeMagixEventListener(qi,this.onReconnected),this.releaseDisposers()}}const Xc=(t,e)=>{if(S.isPlayer(t))eh(t);else{if(t=t,Object.getOwnPropertyDescriptor(t,"disableCameraTransform"))return;Object.defineProperty(t,"disableCameraTransform",{get(){return e.mainView.disableCameraTransform},set(s){e.mainView.disableCameraTransform=s}}),Object.defineProperty(t,"canUndoSteps",{get(){return e.canUndoSteps}}),Object.defineProperty(t,"canRedoSteps",{get(){return e.canRedoSteps}}),t.moveCamera=s=>e.moveCamera(s),t.moveCameraToContain=(...s)=>e.moveCameraToContain(...s),t.convertToPointInWorld=(...s)=>e.mainView.convertToPointInWorld(...s),t.setCameraBound=(...s)=>e.mainView.setCameraBound(...s),t.scenePreview=(...s)=>e.mainView.scenePreview(...s),t.fillSceneSnapshot=(...s)=>e.mainView.fillSceneSnapshot(...s),t.generateScreenshot=(...s)=>e.mainView.generateScreenshot(...s),t.setMemberState=(...s)=>e.mainView.setMemberState(...s),t.redo=()=>e.redo(),t.undo=()=>e.undo(),t.cleanCurrentScene=()=>e.cleanCurrentScene(),t.delete=()=>e.delete(),t.copy=()=>e.copy(),t.paste=()=>e.paste(),t.duplicate=()=>e.duplicate(),t.insertImage=(...s)=>e.insertImage(...s),t.completeImageUpload=(...s)=>e.completeImageUpload(...s),t.insertText=(...s)=>e.insertText(...s),t.lockImage=(...s)=>e.lockImage(...s),t.lockImages=(...s)=>e.lockImages(...s),Kc(t,e),t.dynamicPpt.slideStateAdapter.pptHandler||(t.dynamicPpt.slideStateAdapter.pptHandler=e.createPPTHandler())}},Kc=(t,e)=>{const i=t.removeScenes;t.removeScenes=(s,r)=>{var n;s===we&&((n=e.appManager)==null||n.updateRootDirRemoving(!0));const a=i.call(t,s);return P.emit("removeScenes",{scenePath:s,index:r}),a}},eh=t=>{const e=t.seekToProgressTime;async function i(s){await P.emit("seekStart");const r=await e.call(t,s);return P.emit("seek",s),r}t.seekToProgressTime=i};var th=(()=>`.netless-app-docs-viewer-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;font-family:PingFang SC,Source Han Sans SC,Microsoft YaHei,Helvetica Neue,Noto Sans CJK SC,WenQuanYi Micro Hei,sans-serif}.netless-app-docs-viewer-footer-btn{box-sizing:border-box;width:26px;height:26px;font-size:0;margin:0;padding:3px;border:none;border-radius:1px;outline:none;color:currentColor;background:transparent;transition:background .4s;cursor:pointer;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-docs-viewer-footer-btn:hover{background:rgba(237,237,240,.9)}@media (hover: none){.netless-app-docs-viewer-footer-btn:hover{background:transparent!important}}.netless-app-docs-viewer-footer-btn>svg{width:100%;height:100%}.netless-app-docs-viewer-footer-btn>svg:nth-of-type(2){display:none}.netless-app-docs-viewer-footer-btn.netless-app-docs-viewer-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-docs-viewer-footer-btn.netless-app-docs-viewer-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-docs-viewer-footer-btn~.netless-app-docs-viewer-footer-btn{margin-left:15px}.netless-app-docs-viewer-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-docs-viewer-page-number{display:flex;align-items:center;height:26px;margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-docs-viewer-page-number-input{border:none;outline:none;width:3em;margin:0;padding:0 .5em 0 2px;text-align:right;font-size:13px;line-height:1;font-weight:400;font-family:inherit;border-radius:2px;color:currentColor;font-family:PingFang SC,Source Han Sans SC,Microsoft YaHei,Helvetica Neue,Noto Sans CJK SC,WenQuanYi Micro Hei,sans-serif;background:transparent;transition:background .4s;user-select:text;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-docs-viewer-page-number-input:hover,.netless-app-docs-viewer-page-number-input:focus,.netless-app-docs-viewer-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-footer-btn{cursor:not-allowed}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-footer-btn:hover{background:transparent}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input{cursor:not-allowed}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:hover,.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:focus,.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:active{background:transparent;box-shadow:none}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:disabled{color:inherit}.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:active,.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:focus,.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:hover{color:currentColor;background:#25282e}.telebox-color-scheme-dark .netless-app-docs-viewer-footer{border-top:none}.telebox-color-scheme-dark .netless-app-docs-viewer-footer-btn:hover{background:#212126}.netless-app-docs-viewer-preview.netless-app-docs-viewer-preview-active{transform:translate(0)}.netless-app-docs-viewer-content{position:relative;height:100%;overflow:hidden}.netless-app-docs-viewer-preview-mask{position:absolute;z-index:10200;top:0;left:0;width:100%;height:100%}.netless-app-docs-viewer-preview{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;position:absolute;z-index:10300;top:0;left:0;width:33%;max-width:200px;height:100%;padding-top:10px;transform:translate(-100%);background:rgba(237,237,240,.9);box-shadow:inset -1px 0 #0000001c;transition:transform .4s}.netless-app-docs-viewer-preview-active .netless-app-docs-viewer-preview-mask{display:block}.netless-app-docs-viewer-preview-active .netless-app-docs-viewer-preview{transform:translate(0)}.netless-app-docs-viewer-preview-page{position:relative;display:block;width:55%;margin-bottom:10px;font-size:0;color:transparent;outline:none;border:7px solid transparent;border-radius:4px;transition:border-color .3s;user-select:none}.netless-app-docs-viewer-preview-page:hover,.netless-app-docs-viewer-preview-page.netless-app-docs-viewer-preview-page-active{border-color:#444e601a}.netless-app-docs-viewer-preview-page>img{width:100%;height:auto;box-sizing:border-box;border:1px solid rgba(0,0,0,.5);border-radius:1px;background-color:#fff;box-shadow:0 2px 8px #0000004d}.netless-app-docs-viewer-preview-page-name{position:absolute;top:1px;left:-10px;transform:translate(-100%);text-align:right;font-size:12px;user-select:none}.telebox-color-scheme-dark .netless-app-docs-viewer-preview{background:rgba(50,50,50,.9)}.netless-app-docs-viewer-static-scrollbar{box-sizing:border-box;position:absolute;top:0;right:0;z-index:2147483647;width:16px;min-height:30px;margin:0;padding:0 0 0 8px;border:none;outline:none;opacity:0;background:transparent;transition:opacity .4s 3s,transform .1s;user-select:none;touch-action:none}.netless-app-docs-viewer-static-scrollbar:after{content:"";display:block;width:8px;height:100%;border-radius:4px;background:rgba(68,78,96,.4);box-shadow:1px 1px 8px #ffffffb3;transition:background .4s}.netless-app-docs-viewer-static-scrollbar.netless-app-docs-viewer-static-scrolling{opacity:1;transition:opacity .4s,transform .1s}.netless-app-docs-viewer-static-scrollbar.netless-app-docs-viewer-static-scrollbar-dragging{opacity:1;transition:opacity .4s 3s!important}.netless-app-docs-viewer-static-scrollbar.netless-app-docs-viewer-static-scrollbar-dragging:after{background:rgba(68,78,96,.6)}.netless-app-docs-viewer-static-scrollbar:hover:after,.netless-app-docs-viewer-static-scrollbar:focus:after{background:rgba(68,78,96,.5)}.netless-app-docs-viewer-static-scrollbar:active:after{background:rgba(68,78,96,.6)}.telebox-body-wrap:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:opacity .4s,transform .1s}.telebox-readonly .netless-app-docs-viewer-static-scrollbar{display:none}.page-renderer-pages-container{position:relative;width:100%;height:100%}.page-renderer-page{position:absolute;top:0;left:0;background-position:center;background-size:cover;background-repeat:no-repeat}.page-renderer-pages-container.is-hwa .page-renderer-page{will-change:transform}.page-renderer-page-img{display:block;width:100%;height:auto;user-select:none}.netless-app-docs-viewer-static-pages{overflow:hidden;position:relative;height:100%;user-select:none}.netless-app-docs-viewer-static-page{display:block;width:100%;height:auto;user-select:none}.netless-app-docs-viewer-dynamic-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden}.netless-app-docs-viewer-dynamic-wb-view .cursor-clicker .ppt-event-source{cursor:pointer}
|
124
|
-
`)();const Qa="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",ih=Qa.length,Wr=Array(20),sh=()=>{for(let t=0;t<20;t++)Wr[t]=Qa.charAt(Math.random()*ih);return Wr.join("")};function Hr(t){try{return t()}catch(e){console.error(e)}}class gt{constructor(){this.disposers=new Map}addDisposer(e,i=this.genUID()){return this.flush(i),this.disposers.set(i,Array.isArray(e)?()=>e.forEach(Hr):e),i}add(e,i=this.genUID()){const s=e();return s?this.addDisposer(s,i):i}addEventListener(e,i,s,r,a=this.genUID()){return e.addEventListener(i,s,r),this.addDisposer(()=>e.removeEventListener(i,s,r),a),a}setTimeout(e,i,s=this.genUID()){const r=window.setTimeout(()=>{this.remove(s),e()},i);return this.addDisposer(()=>window.clearTimeout(r),s)}setInterval(e,i,s=this.genUID()){const r=window.setInterval(e,i);return this.addDisposer(()=>window.clearInterval(r),s)}remove(e){const i=this.disposers.get(e);return this.disposers.delete(e),i}flush(e){const i=this.remove(e);if(i)try{i()}catch(s){console.error(s)}}flushAll(){this.disposers.forEach(Hr),this.disposers.clear()}genUID(){let e;do e=sh();while(this.disposers.has(e));return e}}var rh=Object.defineProperty,ah=Object.defineProperties,nh=Object.getOwnPropertyDescriptors,Fr=Object.getOwnPropertySymbols,oh=Object.prototype.hasOwnProperty,lh=Object.prototype.propertyIsEnumerable,Ms=(t,e,i)=>e in t?rh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Ga=(t,e)=>{for(var i in e||(e={}))oh.call(e,i)&&Ms(t,i,e[i]);if(Fr)for(var i of Fr(e))lh.call(e,i)&&Ms(t,i,e[i]);return t},qa=(t,e)=>ah(t,nh(e)),tt=(t,e,i)=>(Ms(t,typeof e!="symbol"?e+"":e,i),i);class ch{constructor(e){tt(this,"_subscribers"),tt(this,"_bSub"),tt(this,"_bSubDisposer"),this._bSub=e}get size(){return this._subscribers?this._subscribers.size:0}invoke(e,i){this._subscribers&&this._subscribers.forEach(s=>s(e,i))}add(e){this._bSub&&(!this._subscribers||this._subscribers.size<=0)&&(this._bSubDisposer=this._bSub()),this._subscribers||(this._subscribers=new Set),this._subscribers.add(e)}remove(e){if(this._subscribers&&this._subscribers.delete(e),this._subscribers&&this._subscribers.size<=0&&this._bSubDisposer){const i=this._bSubDisposer;this._bSubDisposer=null,i()}}clear(){if(this._subscribers&&this._subscribers.clear(),this._bSubDisposer){const e=this._bSubDisposer;this._bSubDisposer=null,e()}}destroy(){this.clear()}}class Gs{constructor(e,i){tt(this,"_subscribers"),tt(this,"_value"),this._value=e;let s;if(i&&(i.compare&&(this.compare=i.compare),i.beforeSubscribe)){const r=i.beforeSubscribe,a=this._setValue.bind(this);s=()=>r(a)}this._subscribers=new ch(s)}_setValue(e,i){this.compare(e,this._value)||(this._value=e,this._subscribers.invoke(e,i))}get value(){return this._value}reaction(e){return this._subscribers.add(e),()=>{this._subscribers.remove(e)}}subscribe(e,i){const s=this.reaction(e);return e(this._value,i),s}destroy(){this._subscribers.destroy()}unsubscribe(e){this._subscribers.remove(e)}get size(){return this._subscribers.size}compare(e,i){return e===i}}class Fe extends Gs{constructor(){super(...arguments);tt(this,"setValue",this._setValue)}}class hh extends Gs{constructor(e,i,s={}){super(i(e.value),qa(Ga({},s),{beforeSubscribe:r=>{const a=e.subscribe((n,o)=>r(i(n),o));if(s.beforeSubscribe){const n=s.beforeSubscribe(r);if(n)return()=>{a(),n()}}return a}}));tt(this,"_srcValue"),this._srcValue=()=>i(e.value)}get value(){if(this.size<=0){const e=this._srcValue();return this.compare(e,this._value)?this._value:e}return this._value}}function Ut(t,e=s=>s,i={}){return new hh(t,e,i)}class dh extends Gs{constructor(e,i,s={}){super(i(ns(e)),qa(Ga({},s),{beforeSubscribe:r=>{let a=ns(e);r(i(a));const n=e.map((c,l)=>c.reaction((d,u)=>{a=a.slice(),a[l]=d,r(i(a),u)})),o=()=>n.forEach(c=>c());if(s.beforeSubscribe){const c=s.beforeSubscribe(r);if(c)return()=>{o(),c()}}return o}}));tt(this,"_srcValue"),this._srcValue=()=>i(ns(e))}get value(){if(this.size<=0){const e=this._srcValue();return this.compare(e,this._value)?this._value:e}return this._value}}function ns(t){return t.map(uh)}function uh(t){return t.value}function Pe(t,e=s=>s,i={}){return new dh(t,e,i)}function Ja(t){t.onValChanged||(t.onValChanged=ph)}function ph(t,e){const i=this[`_${t}$`]||this[t];if(!(i!=null&&i.reaction))throw new TypeError(`"${t}" is not related to a Val in this instance`);return i.reaction(e)}function gh(t,e,i){Object.keys(e).forEach(s=>{mh(t,s,e[s]),i&&i.attach(e[s])}),Ja(t)}function mh(t,e,i){return Object.defineProperties(t,{[e]:{get(){return i.value}},[`_${e}$`]:{value:i}}),t}function fh(t,e,i){Object.keys(e).forEach(s=>{bh(t,s,e[s]),i&&i.attach(e[s])}),Ja(t)}function bh(t,e,i){return Object.defineProperties(t,{[e]:{get(){return i.value},set(s){i.setValue(s)}},[`_${e}$`]:{value:i},[`set${yh(e)}`]:{value:(s,r)=>i.setValue(s,r)}}),t}function yh(t){return t[0].toUpperCase()+t.slice(1)}const at=typeof window!="undefined",Xa=at&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),Ka=at&&"IntersectionObserver"in window,en=at&&"classList"in document.createElement("p"),tn=at&&window.devicePixelRatio>1,wh={elements_selector:".lazy",container:Xa||at?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_bg_hidpi:"bg-hidpi",data_bg_multi:"bg-multi",data_bg_multi_hidpi:"bg-multi-hidpi",data_bg_set:"bg-set",data_poster:"poster",class_applied:"applied",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_entered:"entered",class_exited:"exited",unobserve_completed:!0,unobserve_entered:!1,cancel_on_exit:!0,callback_enter:null,callback_exit:null,callback_applied:null,callback_loading:null,callback_loaded:null,callback_error:null,callback_finish:null,callback_cancel:null,use_native:!1,restore_on_error:!1},sn=t=>Object.assign({},wh,t),Zr=function(t,e){let i;const s="LazyLoad::Initialized",r=new t(e);try{i=new CustomEvent(s,{detail:{instance:r}})}catch{i=document.createEvent("CustomEvent"),i.initCustomEvent(s,!1,!1,{instance:r})}window.dispatchEvent(i)},vh=(t,e)=>{if(!!e)if(!e.length)Zr(t,e);else for(let i=0,s;s=e[i];i+=1)Zr(t,s)},Ze="src",qs="srcset",Js="sizes",rn="poster",ei="llOriginalAttrs",an="data",Xs="loading",nn="loaded",on="applied",xh="entered",Ks="error",ln="native",cn="data-",hn="ll-status",ge=(t,e)=>t.getAttribute(cn+e),Sh=(t,e,i)=>{var s=cn+e;if(i===null){t.removeAttribute(s);return}t.setAttribute(s,i)},ti=t=>ge(t,hn),mt=(t,e)=>Sh(t,hn,e),Vi=t=>mt(t,null),er=t=>ti(t)===null,Mh=t=>ti(t)===Xs,Ch=t=>ti(t)===Ks,tr=t=>ti(t)===ln,Ih=[Xs,nn,on,Ks],_h=t=>Ih.indexOf(ti(t))>=0,nt=(t,e,i,s)=>{if(!!t){if(s!==void 0){t(e,i,s);return}if(i!==void 0){t(e,i);return}t(e)}},_t=(t,e)=>{if(en){t.classList.add(e);return}t.className+=(t.className?" ":"")+e},$e=(t,e)=>{if(en){t.classList.remove(e);return}t.className=t.className.replace(new RegExp("(^|\\s+)"+e+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},Ah=t=>{t.llTempImage=document.createElement("IMG")},kh=t=>{delete t.llTempImage},dn=t=>t.llTempImage,$i=(t,e)=>{if(!e)return;const i=e._observer;!i||i.unobserve(t)},Th=t=>{t.disconnect()},Nh=(t,e,i)=>{e.unobserve_entered&&$i(t,i)},ir=(t,e)=>{!t||(t.loadingCount+=e)},Eh=t=>{!t||(t.toLoadCount-=1)},un=(t,e)=>{!t||(t.toLoadCount=e)},Ph=t=>t.loadingCount>0,zh=t=>t.toLoadCount>0,pn=t=>{let e=[];for(let i=0,s;s=t.children[i];i+=1)s.tagName==="SOURCE"&&e.push(s);return e},sr=(t,e)=>{const i=t.parentNode;if(!i||i.tagName!=="PICTURE")return;pn(i).forEach(e)},gn=(t,e)=>{pn(t).forEach(e)},ji=[Ze],mn=[Ze,rn],Gt=[Ze,qs,Js],fn=[an],Bi=t=>!!t[ei],bn=t=>t[ei],yn=t=>delete t[ei],Mt=(t,e)=>{if(Bi(t))return;const i={};e.forEach(s=>{i[s]=t.getAttribute(s)}),t[ei]=i},Dh=t=>{Bi(t)||(t[ei]={backgroundImage:t.style.backgroundImage})},Lh=(t,e,i)=>{if(!i){t.removeAttribute(e);return}t.setAttribute(e,i)},pt=(t,e)=>{if(!Bi(t))return;const i=bn(t);e.forEach(s=>{Lh(t,s,i[s])})},Vh=t=>{if(!Bi(t))return;const e=bn(t);t.style.backgroundImage=e.backgroundImage},wn=(t,e,i)=>{_t(t,e.class_applied),mt(t,on),i&&(e.unobserve_completed&&$i(t,e),nt(e.callback_applied,t,i))},vn=(t,e,i)=>{_t(t,e.class_loading),mt(t,Xs),i&&(ir(i,1),nt(e.callback_loading,t,i))},it=(t,e,i)=>{!i||t.setAttribute(e,i)},Yr=(t,e)=>{it(t,Js,ge(t,e.data_sizes)),it(t,qs,ge(t,e.data_srcset)),it(t,Ze,ge(t,e.data_src))},$h=(t,e)=>{sr(t,i=>{Mt(i,Gt),Yr(i,e)}),Mt(t,Gt),Yr(t,e)},jh=(t,e)=>{Mt(t,ji),it(t,Ze,ge(t,e.data_src))},Bh=(t,e)=>{gn(t,i=>{Mt(i,ji),it(i,Ze,ge(i,e.data_src))}),Mt(t,mn),it(t,rn,ge(t,e.data_poster)),it(t,Ze,ge(t,e.data_src)),t.load()},Rh=(t,e)=>{Mt(t,fn),it(t,an,ge(t,e.data_src))},Oh=(t,e,i)=>{const s=ge(t,e.data_bg),r=ge(t,e.data_bg_hidpi),a=tn&&r?r:s;!a||(t.style.backgroundImage=`url("${a}")`,dn(t).setAttribute(Ze,a),vn(t,e,i))},Uh=(t,e,i)=>{const s=ge(t,e.data_bg_multi),r=ge(t,e.data_bg_multi_hidpi),a=tn&&r?r:s;!a||(t.style.backgroundImage=a,wn(t,e,i))},Wh=(t,e,i)=>{const s=ge(t,e.data_bg_set);if(!s)return;const r=s.split("|");let a=r.map(n=>`image-set(${n})`);t.style.backgroundImage=a.join(),t.style.backgroundImage===""&&(a=r.map(n=>`-webkit-image-set(${n})`),t.style.backgroundImage=a.join()),wn(t,e,i)},xn={IMG:$h,IFRAME:jh,VIDEO:Bh,OBJECT:Rh},Hh=(t,e)=>{const i=xn[t.tagName];!i||i(t,e)},Fh=(t,e,i)=>{const s=xn[t.tagName];!s||(s(t,e),vn(t,e,i))},Zh=["IMG","IFRAME","VIDEO","OBJECT"],Yh=t=>Zh.indexOf(t.tagName)>-1,Sn=(t,e)=>{e&&!Ph(e)&&!zh(e)&&nt(t.callback_finish,e)},Qr=(t,e,i)=>{t.addEventListener(e,i),t.llEvLisnrs[e]=i},Qh=(t,e,i)=>{t.removeEventListener(e,i)},rr=t=>!!t.llEvLisnrs,Gh=(t,e,i)=>{rr(t)||(t.llEvLisnrs={});const s=t.tagName==="VIDEO"?"loadeddata":"load";Qr(t,s,e),Qr(t,"error",i)},Cs=t=>{if(!rr(t))return;const e=t.llEvLisnrs;for(let i in e){const s=e[i];Qh(t,i,s)}delete t.llEvLisnrs},Mn=(t,e,i)=>{kh(t),ir(i,-1),Eh(i),$e(t,e.class_loading),e.unobserve_completed&&$i(t,i)},qh=(t,e,i,s)=>{const r=tr(e);Mn(e,i,s),_t(e,i.class_loaded),mt(e,nn),nt(i.callback_loaded,e,s),r||Sn(i,s)},Jh=(t,e,i,s)=>{const r=tr(e);Mn(e,i,s),_t(e,i.class_error),mt(e,Ks),nt(i.callback_error,e,s),i.restore_on_error&&pt(e,Gt),r||Sn(i,s)},ar=(t,e,i)=>{const s=dn(t)||t;if(rr(s))return;Gh(s,n=>{qh(n,t,e,i),Cs(s)},n=>{Jh(n,t,e,i),Cs(s)})},Xh=(t,e,i)=>{Ah(t),ar(t,e,i),Dh(t),Oh(t,e,i),Uh(t,e,i),Wh(t,e,i)},Kh=(t,e,i)=>{ar(t,e,i),Fh(t,e,i)},nr=(t,e,i)=>{Yh(t)?Kh(t,e,i):Xh(t,e,i)},ed=(t,e,i)=>{t.setAttribute("loading","lazy"),ar(t,e,i),Hh(t,e),mt(t,ln)},Gr=t=>{t.removeAttribute(Ze),t.removeAttribute(qs),t.removeAttribute(Js)},td=t=>{sr(t,e=>{Gr(e)}),Gr(t)},Cn=t=>{sr(t,e=>{pt(e,Gt)}),pt(t,Gt)},id=t=>{gn(t,e=>{pt(e,ji)}),pt(t,mn),t.load()},sd=t=>{pt(t,ji)},rd=t=>{pt(t,fn)},ad={IMG:Cn,IFRAME:sd,VIDEO:id,OBJECT:rd},nd=t=>{const e=ad[t.tagName];if(!e){Vh(t);return}e(t)},od=(t,e)=>{er(t)||tr(t)||($e(t,e.class_entered),$e(t,e.class_exited),$e(t,e.class_applied),$e(t,e.class_loading),$e(t,e.class_loaded),$e(t,e.class_error))},ld=(t,e)=>{nd(t),od(t,e),Vi(t),yn(t)},cd=(t,e,i,s)=>{!i.cancel_on_exit||!Mh(t)||t.tagName==="IMG"&&(Cs(t),td(t),Cn(t),$e(t,i.class_loading),ir(s,-1),Vi(t),nt(i.callback_cancel,t,e,s))},hd=(t,e,i,s)=>{const r=_h(t);mt(t,xh),_t(t,i.class_entered),$e(t,i.class_exited),Nh(t,i,s),nt(i.callback_enter,t,e,s),!r&&nr(t,i,s)},dd=(t,e,i,s)=>{er(t)||(_t(t,i.class_exited),cd(t,e,i,s),nt(i.callback_exit,t,e,s))},ud=["IMG","IFRAME","VIDEO"],In=t=>t.use_native&&"loading"in HTMLImageElement.prototype,pd=(t,e,i)=>{t.forEach(s=>{ud.indexOf(s.tagName)!==-1&&ed(s,e,i)}),un(i,0)},gd=t=>t.isIntersecting||t.intersectionRatio>0,md=t=>({root:t.container===document?null:t.container,rootMargin:t.thresholds||t.threshold+"px"}),fd=(t,e,i)=>{t.forEach(s=>gd(s)?hd(s.target,s,e,i):dd(s.target,s,e,i))},bd=(t,e)=>{e.forEach(i=>{t.observe(i)})},yd=(t,e)=>{Th(t),bd(t,e)},wd=(t,e)=>{!Ka||In(t)||(e._observer=new IntersectionObserver(i=>{fd(i,t,e)},md(t)))},_n=t=>Array.prototype.slice.call(t),Ii=t=>t.container.querySelectorAll(t.elements_selector),vd=t=>_n(t).filter(er),xd=t=>Ch(t),Sd=t=>_n(t).filter(xd),qr=(t,e)=>vd(t||Ii(e)),Md=(t,e)=>{Sd(Ii(t)).forEach(s=>{$e(s,t.class_error),Vi(s)}),e.update()},Cd=(t,e)=>{!at||(e._onlineHandler=()=>{Md(t,e)},window.addEventListener("online",e._onlineHandler))},Id=t=>{!at||window.removeEventListener("online",t._onlineHandler)},ii=function(t,e){const i=sn(t);this._settings=i,this.loadingCount=0,wd(i,this),Cd(i,this),this.update(e)};ii.prototype={update:function(t){const e=this._settings,i=qr(t,e);if(un(this,i.length),Xa||!Ka){this.loadAll(i);return}if(In(e)){pd(i,e,this);return}yd(this._observer,i)},destroy:function(){this._observer&&this._observer.disconnect(),Id(this),Ii(this._settings).forEach(t=>{yn(t)}),delete this._observer,delete this._settings,delete this._onlineHandler,delete this.loadingCount,delete this.toLoadCount},loadAll:function(t){const e=this._settings;qr(t,e).forEach(s=>{$i(s,this),nr(s,e,this)})},restoreAll:function(){const t=this._settings;Ii(t).forEach(e=>{ld(e,t)})}};ii.load=(t,e)=>{const i=sn(e);nr(t,i)};ii.resetStatus=t=>{Vi(t)};at&&vh(ii,window.lazyLoadOptions);class _d{constructor({namespace:e,pages$:i,sideEffect:s,readonly$:r,events:a,wrapClassName:n,root:o,pagesIndex$:c}){this.showPreview$=new Fe(!1),this.namespace=e,this.pages$=i,this.sideEffect=s,this.readonly$=r,this.events=a,this.wrapClassName=n,this.sideEffect.addDisposer(this.events.on("togglePreview",()=>{this.showPreview$.setValue(!this.showPreview$.value)})),this.sideEffect.addDisposer(this.showPreview$.subscribe(l=>{this.sideEffect.add(()=>{const d=this.renderPreview(),u=this.renderPreviewMask();if(l){o.appendChild(d),o.appendChild(u),d.scrollTop;const p=d.querySelector("."+this.wrapClassName(`preview-page-${c.value}`));return p&&d.scrollTo({top:p.offsetTop-16}),d.classList.toggle(this.wrapClassName("preview-active"),!0),this.previewLazyLoad=new ii({container:this.$preview,elements_selector:"."+this.wrapClassName("preview-page>img")}),()=>{var m;return(m=this.previewLazyLoad)==null?void 0:m.destroy()}}else return d.classList.toggle(this.wrapClassName("preview-active"),!1),this.sideEffect.setTimeout(()=>{d.remove(),u.remove()},500,"preview-remove"),null},"preview-lazyload")}))}destroy(){var e,i;(e=this.$preview)==null||e.remove(),(i=this.$previewMask)==null||i.remove()}renderPreview(){if(this.$preview)return this.$preview;const e=document.createElement("div");return e.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=e,this.sideEffect.addEventListener(e,"wheel",i=>i.stopPropagation(),{passive:!1}),this.sideEffect.addDisposer(this.pages$.subscribe(i=>{var s;this.sideEffect.add(()=>{const r=i.map((a,n)=>{var o;const c=(o=a.thumbnail)!=null?o:a.src.startsWith("ppt")?void 0:a.src;if(!c)return;const l=String(n),d=document.createElement("a");d.className=this.wrapClassName("preview-page")+" "+this.wrapClassName(`preview-page-${n}`),d.setAttribute("href","#"),d.dataset.pageIndex=l;const u=document.createElement("span");u.className=this.wrapClassName("preview-page-name"),u.textContent=String(n+1),u.dataset.pageIndex=l;const p=document.createElement("img");return p.width=a.width,p.height=a.height,p.dataset.src=c,p.dataset.pageIndex=l,d.appendChild(p),d.appendChild(u),e.appendChild(d),d});return()=>r.forEach(a=>a==null?void 0:a.remove())},"render-preview-pages"),(s=this.previewLazyLoad)==null||s.update()})),this.sideEffect.addEventListener(e,"click",i=>{var s;if(this.readonly$.value)return;const r=(s=i.target.dataset)==null?void 0:s.pageIndex;r&&(i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation(),this.events.emit("jumpPage",Number(r)),this.showPreview$.setValue(!1))}),e}renderPreviewMask(){if(this.$previewMask)return this.$previewMask;const e=document.createElement("div");return e.className=this.wrapClassName("preview-mask"),this.$previewMask=e,this.sideEffect.addEventListener(e,"click",i=>{this.readonly$.value||i.target===e&&this.showPreview$.setValue(!1)}),e}}function Ad(t){const e="http://www.w3.org/2000/svg",i=document.createElementNS(e,"svg");i.setAttribute("class",`${t}-footer-icon-sidebar`),i.setAttribute("viewBox","0 0 64 64");const s=document.createElementNS(e,"path");return s.setAttribute("fill","currentColor"),s.setAttribute("d","M50 8H14c-3.309 0-6 2.691-6 6v36c0 3.309 2.691 6 6 6h36c3.309 0 6-2.691 6-6V14c0-3.309-2.691-6-6-6zM12 50V14c0-1.103.897-2 2-2h8v40h-8c-1.103 0-2-.897-2-2zm40 0c0 1.103-.897 2-2 2H26V12h24c1.103 0 2 .897 2 2z"),i.appendChild(s),i}function kd(t){const e="http://www.w3.org/2000/svg",i=document.createElementNS(e,"svg");i.setAttribute("class",`${t}-footer-icon-arrow-left`),i.setAttribute("viewBox","0 0 500 500");const s=document.createElementNS(e,"path");return s.setAttribute("fill","currentColor"),s.setAttribute("d","M177.81 249.959L337.473 90.295c2.722-2.865 2.651-7.378-.143-10.1-2.793-2.65-7.163-2.65-9.956 0l-164.75 164.75c-2.793 2.793-2.793 7.306 0 10.1l164.75 164.75c2.865 2.722 7.378 2.65 10.099-.143 2.651-2.794 2.651-7.163 0-9.957L177.809 249.959z"),i.appendChild(s),i}function Td(t){const e="http://www.w3.org/2000/svg",i=document.createElementNS(e,"svg");i.setAttribute("class",`${t}-footer-icon-arrow-right`),i.setAttribute("viewBox","0 0 500 500");const s=document.createElementNS(e,"path");return s.setAttribute("fill","currentColor"),s.setAttribute("d","M322.19 250.041L162.527 409.705c-2.722 2.865-2.651 7.378.143 10.1 2.793 2.65 7.163 2.65 9.956 0l164.75-164.75c2.793-2.793 2.793-7.306 0-10.1l-164.75-164.75c-2.865-2.722-7.378-2.65-10.099.143-2.651 2.794-2.651 7.163 0 9.957l159.664 159.736z"),i.appendChild(s),i}function Nd(t){const e="http://www.w3.org/2000/svg",i=document.createElementNS(e,"svg");i.setAttribute("class",`${t}-footer-icon-play`),i.setAttribute("viewBox","0 0 500 500");const s=document.createElementNS(e,"path");return s.setAttribute("fill","currentColor"),s.setAttribute("d","M418.158 257.419L174.663 413.33c-6.017 3.919-15.708 3.772-21.291-.29-2.791-2.018-4.295-4.483-4.295-7.084V94.109c0-5.65 6.883-10.289 15.271-10.289 4.298 0 8.391 1.307 11.181 3.332l242.629 155.484c6.016 3.917 6.451 10.292.649 14.491-.216.154-.432.154-.649.292zM170.621 391.288l223.116-141.301L170.71 107.753l-.089 283.535z"),i.appendChild(s),i}function Ed(t){const e="http://www.w3.org/2000/svg",i=document.createElementNS(e,"svg");i.setAttribute("class",`${t}-footer-icon-pause`),i.setAttribute("viewBox","0 0 500 500");const s=document.createElementNS(e,"path");return s.setAttribute("fill","currentColor"),s.setAttribute("d","M312.491 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261zM165.257 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261z"),i.appendChild(s),i}class Pd{constructor({namespace:e,pages$:i,sideEffect:s,readonly$:r,events:a,playable:n,wrapClassName:o,pagesIndex$:c,root:l}){this.namespace=e,this.pages$=i,this.sideEffect=s,this.readonly$=r,this.events=a,this.wrapClassName=o,this.pagesIndex$=c,this.playable=n,this.$footer=this.render(),l.appendChild(this.$footer)}destroy(){this.$footer.remove()}render(){const e=document.createElement("div");e.className=this.wrapClassName("footer"),this.sideEffect.addDisposer(this.readonly$.subscribe(l=>e.classList.toggle(this.wrapClassName("readonly"),l)));const i=this.renderFooterBtn("btn-sidebar",Ad(this.namespace));this.sideEffect.addEventListener(i,"click",()=>{this.readonly$.value||this.events.emit("togglePreview")}),e.appendChild(i),this.sideEffect.addDisposer(this.pages$.subscribe(l=>{const d=l.some(u=>u.thumbnail||!u.src.startsWith("ppt"));i.style.display=d?"":"none"}));const s=document.createElement("div");s.className=this.wrapClassName("page-jumps");const r=this.renderFooterBtn("btn-page-back",kd(this.namespace));if(this.sideEffect.addEventListener(r,"click",()=>{this.readonly$.value||this.events.emit("back")}),s.appendChild(r),this.playable){const l=this.renderFooterBtn("btn-page-play",Nd(this.namespace),Ed(this.namespace));this.sideEffect.addEventListener(l,"click",()=>{this.readonly$.value||(l.classList.toggle(this.wrapClassName("footer-btn-playing"),!0),this.events.emit("play"),this.sideEffect.setTimeout(()=>l.classList.toggle(this.wrapClassName("footer-btn-playing"),!1),500,"returnPlay"))}),s.appendChild(l)}const a=this.renderFooterBtn("btn-page-next",Td(this.namespace));this.sideEffect.addEventListener(a,"click",()=>{this.readonly$.value||this.events.emit("next")}),s.appendChild(a);const n=document.createElement("div");n.className=this.wrapClassName("page-number");const o=document.createElement("input");o.className=this.wrapClassName("page-number-input"),this.sideEffect.addDisposer(this.readonly$.subscribe(l=>o.disabled=l)),this.sideEffect.addDisposer(this.pagesIndex$.subscribe(l=>o.value=String(l+1))),this.sideEffect.addEventListener(o,"focus",()=>{o.select()}),this.sideEffect.addEventListener(o,"change",()=>{if(this.readonly$.value)return;const l=Number(o.value)-1;l>=0&&this.events.emit("jumpPage",l)});const c=document.createElement("span");return this.sideEffect.addDisposer(this.pages$.subscribe(l=>{c.textContent=" / "+l.length})),n.appendChild(o),n.appendChild(c),e.appendChild(s),e.appendChild(n),e}renderFooterBtn(e,i,s){const r=document.createElement("button");return r.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(e),r.appendChild(i),s&&r.appendChild(s),r}}class zd{constructor(){this.listeners=new Map,this.relayListeners=new Set}emit(e,i){var s;(s=this.listeners.get(e))==null||s.forEach(r=>r(i))}on(e,i){let s=this.listeners.get(e);return s||(s=new Set,this.listeners.set(e,s)),s.add(i),s.size===1&&this.relayListeners.forEach(r=>r.start(e)),()=>{this.off(e,i)}}off(e,i){const s=this.listeners.get(e);if(s){const r=s.delete(i);return s.size<=0&&(this.listeners.delete(e),this.relayListeners.forEach(a=>a.dispose(e))),r}return!1}clear(e){var i;e?(i=this.listeners.get(e))==null||i.clear():this.listeners.clear()}count(e){var i;if(e)return((i=this.listeners.get(e))==null?void 0:i.size)||0;{let s=0;return this.listeners.forEach(r=>{s+=r.size}),s}}remit(e,i){let s;const r={start:a=>{a===e&&(s=i(this))},dispose:a=>{s&&(!a||a===e)&&s()}};return this.relayListeners.add(r),()=>{this.relayListeners.delete(r),s&&s()}}destroy(){this.clear(),this.relayListeners.forEach(e=>e.dispose()),this.relayListeners.clear()}}class An{constructor({readonly$:e,pagesIndex$:i,box:s,pages:r=[],playable:a}){this.wrapClassName=o=>`${this.namespace}-${o}`,this.namespace="netless-app-docs-viewer",this.sideEffect=new gt,this.events=new zd;const n=new Fe(r);fh(this,{pages:n}),this.preview=new _d({pages$:n,readonly$:e,pagesIndex$:i,root:s.$body,sideEffect:this.sideEffect,events:this.events,namespace:this.namespace,wrapClassName:this.wrapClassName}),this.footer=new Pd({pages$:n,readonly$:e,playable:a,pagesIndex$:i,root:s.$footer,namespace:this.namespace,sideEffect:this.sideEffect,events:this.events,wrapClassName:this.wrapClassName})}destroy(){this.preview.destroy(),this.footer.destroy(),this.sideEffect.flushAll(),this.events.destroy()}}function Xe(t,e,i){return Math.min(Math.max(t,e),i)}function Jr(t){return t.touches?t.touches[0]:t}function kn(t){t.stopPropagation(),t.cancelable&&t.preventDefault()}function Tn(t,e){return t.width===e.width&&t.height===e.height}class Dd{constructor(e){var i,s,r;this.velocity=0,this._paused=!0,this._animationFrameID=null,this._loopTimestamp=0,this.looper=a=>{var n;if(this._paused)return;let o=Math.floor((a-this._loopTimestamp)/1e3*60)+1;for(this._loopTimestamp=a;o-- >0;)this.stepper();(n=this.onStep)==null||n.call(this,this.current),this._paused?this._animationFrameID=null:this._animationFrameID=window.requestAnimationFrame(this.looper)},this.current=(i=e.start)!=null?i:0,this.target=this.current,this.stiffness=(s=e.stiffness)!=null?s:170,this.damping=(r=e.damping)!=null?r:26,this.onStep=e.onStep}get paused(){return this._paused}stepTo(e,i){var s;this._paused&&i!=null&&(this.current=i),this._paused=!1,this.target=e,(s=this.onStep)==null||s.call(this,this.current),this._loopTimestamp=Date.now(),this._animationFrameID=window.requestAnimationFrame(this.looper)}pause(){this._paused=!0,this._animationFrameID!=null&&window.cancelAnimationFrame(this._animationFrameID)}destroy(){this.pause(),this.onStep=void 0}stepper(){const e=-this.stiffness*(this.current-this.target),i=-this.damping*this.velocity,s=this.velocity+(e+i)/60,r=this.current+s/60;Math.abs(s-0)<.01&&Math.abs(r-this.target)<.01?(this.current=this.target,this.velocity=0,this._paused=!0):(this.current=r,this.velocity=s)}}class Ld{constructor(e,i,s,r,a,n){this.index=e,this.lastVisit=Date.now(),this.sideEffect=new gt;const o=Ut(i,p=>p[e]||{width:0,height:0}),c=Pe([o,s],([p,m])=>(m.width-p.width)/2),l=Pe([a,n],([p,m])=>(p[e]||0)-m),d=document.createElement("div");d.className="page-renderer-page",d.dataset.index=`${e}`;const u=document.createElement("img");u.className="page-renderer-page-img",d.appendChild(u),this.sideEffect.addDisposer([Pe([o,r]).subscribe(([p,m])=>{d.style.width=`${p.width*m}px`,d.style.height=`${p.height*m}px`}),o.subscribe(p=>{p.thumbnail&&(d.style.backgroundImage=`url("${p.thumbnail}")`),u.width=p.width,u.height=p.height,u.src=p.src}),Pe([c,l,r]).subscribe(([p,m,g])=>{d.style.transform=`translate(${p*g}px, ${m*g}px)`})]),this.$page=d}destroy(){this.sideEffect.flushAll(),this.$page.remove()}}const Vd=window.requestIdleCallback||(t=>window.setTimeout(t,5e3)),$d=window.cancelIdleCallback||window.clearTimeout;class jd{constructor(e,i,s,r,a){this.pages$=e,this.pagesSize$=i,this.scale$=s,this.pagesYs$=r,this.pagesScrollTop$=a,this.els=new Map,this.maxElCount=200,this.gcTimer=null,this.gc=()=>{var n;if(this.gcTimer=null,this.els.size>this.maxElCount){const o=[...this.els.values()].sort((c,l)=>l.lastVisit-c.lastVisit);for(let c=Math.floor(this.maxElCount/4);c<o.length;c++)(n=this.els.get(o[c].index))==null||n.destroy(),this.els.delete(o[c].index)}}}getEl(e){let i=this.els.get(e);return i||(i=new Ld(e,this.pages$,this.pagesSize$,this.scale$,this.pagesYs$,this.pagesScrollTop$),this.els.set(e,i)),i.lastVisit=Date.now(),this.els.size>this.maxElCount&&this.gcTimer===null&&(this.gcTimer=Vd(this.gc)),i}destroy(){this.els.forEach(e=>e.destroy()),this.els.clear(),this.gcTimer!==null&&($d(this.gcTimer),this.gcTimer=null)}}class Bd{constructor({pagesScrollTop$:e,containerRect$:i,pages$:s,pagesSize$:r}){this.sideEffect=new gt,s=Ut(s,m=>m.map(g=>{if(g.thumbnail)return g;try{const f=new URL(g.src);return f.searchParams.set("x-oss-process","image/resize,l_50"),he(R({},g),{thumbnail:f.toString()})}catch(f){return console.error(f),g}}));const a=Ut(s,m=>{const g=Array(m.length);for(let f=0;f<m.length;f++)g[f]=f>0?g[f-1]+m[f-1].height:0;return g}),n=Ut(s,m=>{let g=1/0;for(let f=m.length-1;f>=0;f--)m[f].height<=g&&(g=m[f].height);return g}),o=Pe([e,a,s],([m,g,f])=>{for(let b=0;b<g.length;b++)if(g[b]+f[b].height-m>=.001)return b;return g.length-1}),c=Pe([i,r],([m,g])=>m.width/g.width||1),l=Pe([s,i,n,c],([m,g,f,b])=>Xe(Math.ceil(g.height/b/f/2),1,m.length));gh(this,{pagesScrollTop:e,containerRect:i,pages:s,pagesSize:r,pagesIndex:o,pagesYs:a,pagesMinHeight:n,scale:c}),this.pageElManager=new jd(s,r,c,a,e),this.$pages=this.renderPages();const d=new Fe(!1);this.sideEffect.addDisposer(d.subscribe(m=>this.$pages.classList.toggle("is-hwa",m)));const u=()=>d.setValue(!1),p=()=>{this.sideEffect.setTimeout(u,1e3,"turn-off-hwa"),d.setValue(!0)};this.sideEffect.addDisposer(Pe([o,l,s]).subscribe(([m,g,f])=>{p();const b=Math.max(m-g,0),v=Math.min(m+g,f.length-1);for(let x=0;x<this.$pages.children.length;x++){const y=this.$pages.children[x],k=Number(y.dataset.index);k>=b&&k<=v||(y.remove(),x--)}for(let x=b;x<=v;x++){const y=this.pageElManager.getEl(x);y.$page.parentElement!==this.$pages&&this.$pages.appendChild(y.$page)}}))}renderPages(){const e=document.createElement("div");return e.className="page-renderer-pages-container",this.sideEffect.addDisposer(this._containerRect$.subscribe(i=>{e.style.width=`${i.width}px`,e.style.height=`${i.height}px`}),"render-pages-size"),e}destroy(){this.sideEffect.flushAll(),this.$pages.remove(),this.pageElManager.destroy()}}const Rd=30;class Od{constructor({pagesScrollTop$:e,containerRect$:i,stageRect$:s,pagesSize$:r,readonly$:a,scrollbarMinHeight:n=Rd,wrapClassName:o,onDragScroll:c}){this.sideEffect=new gt,this.scrolling$=new Fe(!1),this.pagesScrollTop$=e,this.containerRect$=i,this.stageRect$=s,this.pagesSize$=r,this.scrollbarMinHeight=n,this.readonly$=a,this.wrapClassName=o,this.onDragScroll=c,this.scrollbarHeight$=Pe([i,s,r],([l,d,u])=>Xe(d.height/(d.width/u.width*u.height)*l.height,n,l.height)),this.scrollTop$=Pe([i,s,r,this.scrollbarHeight$,this.pagesScrollTop$],([l,d,u,p,m])=>Xe(m/(u.height-u.width/d.width*d.height)*(l.height-p),0,l.height-p)),this.$scrollbar=this.renderScrollbar()}mount(e){e.appendChild(this.$scrollbar)}destroy(){this.$scrollbar.remove(),this.onDragScroll=void 0,this.sideEffect.flushAll()}renderScrollbar(){const e=document.createElement("button");e.className=this.wrapClassName("scrollbar"),e.style.minHeight=`${this.scrollbarMinHeight}px`,this.sideEffect.addDisposer([this.scrollbarHeight$.subscribe(s=>{e.style.height=`${s}px`}),this.scrollTop$.subscribe(s=>{this.scrolling$.setValue(!0),this.sideEffect.setTimeout(()=>this.scrolling$.setValue(!1),100,"reset-scrolling");const r=()=>e.style.transform=`translateY(${s}px)`;window.requestAnimationFrame?window.requestAnimationFrame(r):r()}),this.scrolling$.subscribe(s=>{e.classList.toggle(this.wrapClassName("scrolling"),s)})]);const i=s=>{if(!s.isPrimary||this.readonly$.value||s.button!=null&&s.button!==0)return;kn(s);const r=this.wrapClassName("scrollbar-dragging");e.classList.toggle(r,!0);const a=this.pagesScrollTop$.value,{clientY:n}=Jr(s),o=l=>{if(!l.isPrimary||this.readonly$.value)return;const{clientY:d}=Jr(l),u=d-n;Math.abs(u)>0&&this.onDragScroll&&this.onDragScroll(a+u/this.containerRect$.value.height*this.pagesSize$.value.height)},c=l=>{!l.isPrimary||(e.classList.toggle(r,!1),window.removeEventListener("pointermove",o,!0),window.removeEventListener("pointerup",c,!0),window.removeEventListener("pointercancel",c,!0))};window.addEventListener("pointermove",o,!0),window.addEventListener("pointerup",c,!0),window.addEventListener("pointercancel",c,!0)};return this.sideEffect.addEventListener(e,"pointerdown",i),e}}class Ud{constructor({whiteboard:e,readonly$:i,box:s,pages:r,pagesScrollTop:a=0,onUserScroll:n}){this.sideEffect=new gt,this.userScrolling=!1,this.whiteboard=e,this.readonly$=i,this.box=s,this.pages=r,this.onUserScroll=n;const o=()=>{var l;this.userScrolling=!1,(l=this.onUserScroll)==null||l.call(this,this.pagesScrollTop$.value)};this.debounceOnUserScroll=()=>{this.userScrolling=!0,this.sideEffect.setTimeout(o,80,"debounceOnUserScroll")};const c=new Fe(r);this.pagesScrollTop$=new Fe(a),this.pagesSize$=Ut(c,l=>{let d=0,u=0;for(let p=l.length-1;p>=0;p--){const m=l[p];m.width>d&&(d=m.width),u+=m.height}return{width:Math.max(1,d),height:Math.max(1,u)}},{compare:Tn}),this.pageRenderer=new Bd({pagesScrollTop$:this.pagesScrollTop$,containerRect$:s._stageRect$,pages$:c,pagesSize$:this.pagesSize$}),this.viewer=new An({readonly$:i,pagesIndex$:this.pageRenderer._pagesIndex$,box:s,pages:r,playable:!1}),this.sideEffect.addDisposer([this.viewer.events.on("next",()=>{this.userScrollByPercent(.8)}),this.viewer.events.on("back",()=>{this.userScrollByPercent(-.8)})]),this.scrollbar=new Od({pagesScrollTop$:this.pagesScrollTop$,containerRect$:s._bodyRect$,stageRect$:s._stageRect$,pagesSize$:this.pagesSize$,readonly$:i,wrapClassName:this.wrapClassName.bind(this),onDragScroll:l=>{this.pageScrollTo(l),this.debounceOnUserScroll()}}),this.pageScrollStepper=new Dd({start:this.pagesScrollTop$.value,onStep:l=>{this.pageScrollTo(l)}}),this.sideEffect.addDisposer(this.viewer.events.on("jumpPage",l=>this.userScrollToPageIndex(l))),this.render(),this.setupScrollListener(),this.sideEffect.setTimeout(()=>{this.userScrolling||this.pageScrollTo(this.pageRenderer.pagesScrollTop)},100)}get pagesScrollTop(){return this.pagesScrollTop$.value}destroy(){this.sideEffect.flushAll(),this.pageScrollStepper.destroy(),this.onUserScroll=void 0,this.viewer.destroy(),this.pageRenderer.destroy(),this.scrollbar.destroy()}syncPageScrollTop(e){!this.userScrolling&&e>=0&&Math.abs(this.pagesScrollTop$.value-e)>.01&&this.pageScrollStepper.stepTo(e,this.pagesScrollTop$.value)}render(){this.box.$content.style.overflow="hidden",this.box.mountStage(this.pageRenderer.$pages),this.scrollbar.mount(this.box.$body)}pageScrollTo(e){const i=this.whiteboard.view.size.height/2/this.pageRenderer.scale;this.whiteboard.view.moveCamera({centerY:Xe(e+i,i,this.pagesSize$.value.height-i),animationMode:"immediately"})}userScrollToPageIndex(e){var i;if(e=Xe(e,0,this.pages.length-1),!this.readonly$.value&&!Number.isNaN(e)){const s=this.pageRenderer.pagesYs[e];s>=0&&((i=this.onUserScroll)==null||i.call(this,s+5/this.pageRenderer.scale))}}userScrollByPercent(e){var i;this.readonly$.value||(i=this.onUserScroll)==null||i.call(this,Xe(this.pageRenderer.pagesScrollTop+this.pageRenderer.containerRect.height/this.pageRenderer.scale*Xe(e,-1,1),0,this.pageRenderer.pagesSize.height-this.pageRenderer.containerRect.height/this.pageRenderer.scale))}setupScrollListener(){this.sideEffect.addEventListener(this.box.$main,"wheel",e=>{kn(e),!this.readonly$.value&&this.pageScrollStepper.paused&&(this.pageScrollTo(this.pagesScrollTop+e.deltaY),this.debounceOnUserScroll())},{passive:!1}),this.sideEffect.addEventListener(this.box.$main,"touchmove",e=>{!this.readonly$.value&&e.touches.length>1&&this.debounceOnUserScroll()},{passive:!0,capture:!0}),this.sideEffect.add(()=>{const e=i=>{const{width:s,height:r}=this.whiteboard.view.size;if(s<=0||r<=0)return;const a=i.centerY-this.pageRenderer.containerRect.height/this.pageRenderer.scale/2;this.pagesScrollTop$.setValue(a)};return this.whiteboard.view.callbacks.on("onCameraUpdated",e),()=>this.whiteboard.view.callbacks.off("onCameraUpdated",e)}),this.sideEffect.addDisposer(this.box._stageRect$.subscribe(e=>{const{width:i,height:s}=this.pagesSize$.value;this.whiteboard.view.moveCameraToContain({originX:0,originY:this.pageRenderer.pagesScrollTop,width:i,height:e.height/this.pageRenderer.scale,animationMode:"immediately"}),this.whiteboard.view.setCameraBound({damping:1,maxContentMode:()=>this.pageRenderer.scale,minContentMode:()=>this.pageRenderer.scale,centerX:i/2,centerY:s/2,width:i,height:s})}),"whiteboard-size-update"),this.sideEffect.addEventListener(window,"keyup",e=>{if(!(this.readonly$.value||!this.box.focus||this.box.minimized))switch(e.key){case"PageDown":{this.userScrollByPercent(.8);break}case"PageUp":{this.userScrollByPercent(-.8);break}case"ArrowLeft":{this.userScrollByPercent(-.25);break}case"ArrowRight":{this.userScrollByPercent(.25);break}case"ArrowDown":{this.userScrollByPercent(.5);break}case"ArrowUp":{this.userScrollByPercent(-.5);break}}},{capture:!0})}wrapClassName(e){return"netless-app-docs-viewer-static-"+e}}class Wd{constructor({readonly$:e,context:i,whiteboard:s,box:r,pages:a}){this.sideEffect=new gt,this.context=i,this.whiteboard=s,this.box=r,this.pages=a;const n=new Fe(i.displayer.state.sceneState.index||0);this.pagesIndex$=n,this.sideEffect.add(()=>{const o=c=>{this.jumpToPage(c.index)};return this.context.emitter.on("sceneStateChange",o),()=>this.context.emitter.off("sceneStateChange",o)}),this.viewer=new An({readonly$:e,pagesIndex$:n,box:r,pages:a,playable:!0}),this.sideEffect.addDisposer([this.viewer.events.on("jumpPage",o=>this.jumpToPage(o,!0)),this.viewer.events.on("play",()=>{var o;return(o=this.context.room)==null?void 0:o.pptNextStep()}),this.viewer.events.on("back",()=>this.prevPage()),this.viewer.events.on("next",()=>this.nextPage())]),this.render(),this.sideEffect.addDisposer(n.subscribe((o,c)=>{var l,d;if(e.value)return;const u=this.context.getInitScenePath(),p=(d=(l=this.context.getScenes())==null?void 0:l[o])==null?void 0:d.name;if(u&&p&&this.context.setScenePath(`${u}/${p}`),c){const m=this.context.room;if(m){const g=m.state.globalState.__pptState;m.setGlobalState({__pptState:g&&{uuid:g.uuid,pageIndex:o,disableAutoPlay:g.disableAutoPlay}})}}}))}destroy(){this.sideEffect.flushAll(),this.viewer.destroy()}nextPage(){this.jumpToPage(this.pagesIndex$.value+1,!0)}prevPage(){this.jumpToPage(this.pagesIndex$.value-1,!0)}jumpToPage(e,i=!1){this.pagesIndex$.setValue(Xe(e,0,this.pages.length-1),i)}render(){var e;this.box.mountStage(document.createElement("div")),this.sideEffect.addEventListener(window,"keydown",s=>{var r;if(this.box.focus)switch(s.key){case"ArrowUp":case"ArrowLeft":{this.prevPage();break}case"ArrowRight":case"ArrowDown":{(r=this.context.room)==null||r.pptNextStep();break}}});const i=(e=this.whiteboard.view.divElement)==null?void 0:e.parentElement;i&&this.sideEffect.addEventListener(i,"click",s=>{var r;const a=this.context.room;if(a&&a.state.memberState.currentApplianceName==="clicker"){for(let n=s.target;n;n=n.parentElement)if((r=n.classList)!=null&&r.contains("ppt-event-source"))return;a.pptNextStep()}})}wrapClassName(e){return"netless-app-docs-viewer-dynamic-"+e}}const Hd="DocsViewer",_i={kind:Hd,setup(t){const e=t.box,i=t.getScenes();if(!i)throw new Error("[Docs Viewer]: scenes not found.");const s=new gt,r=i.map(({ppt:n})=>n?{width:n.width,height:n.height,src:n.src,thumbnail:n.previewURL}:null).filter(n=>Boolean(n));if(r.length<=0)throw new Error("[Docs Viewer]: empty scenes.");e.mountStyles(th);const a=new Fe(!t.isWritable);s.addDisposer(t.emitter.on("writableChange",n=>{a.setValue(!n)})),r[0].src.startsWith("ppt")?Zd(s,t,e,r,a):Fd(s,t,e,r,a),s.addDisposer(t.emitter.on("destroy",()=>{s.flushAll()}))}};function Fd(t,e,i,s,r){const a=e.createWhiteBoardView({syncCamera:!1});t.addDisposer(r.subscribe(l=>{a.view.disableCameraTransform=l}));const n=e.createStorage("static-docs-viewer",{pagesScrollTop:0}),o=new Ud({whiteboard:a,readonly$:r,box:i,pages:s,pagesScrollTop:n.state.pagesScrollTop,onUserScroll:l=>{e.isWritable&&n.setState({pagesScrollTop:l})}});t.addDisposer(()=>o.destroy()),t.addDisposer(n.addStateChangedListener(l=>{l.pagesScrollTop&&o.syncPageScrollTop(l.pagesScrollTop.newValue||0)}));let c=1;if(s.length>0){const{width:l,height:d}=s[0];d<=l?c=d/l:c=1/2*d/l}t.addDisposer(Pe([i._maximized$,i._managerStageRect$,i._intrinsicSize$],([l,d,u])=>l?c:u.height*(d.height/d.width)/u.width).subscribe(l=>{i.setStageRatio(l)}))}function Zd(t,e,i,s,r){const a=e.createWhiteBoardView();a.view.disableCameraTransform=!0;const n=new Wd({context:e,whiteboard:a,box:i,pages:s,readonly$:r});t.addDisposer(()=>n.destroy());const o=new Fe({width:s[0].width,height:s[0].height},{compare:Tn});if(t.addDisposer(n.pagesIndex$.subscribe(c=>{const l=s[c];l&&o.setValue({width:l.width,height:l.height})})),t.addDisposer(o.subscribe(c=>{r.value||a.setBaseRect(c)})),e.isAddApp){const c=t.add(()=>{const l=({width:d,height:u})=>{if(s.length>0&&i.state!=="maximized"){const{width:p,height:m}=s[0],f=m/p*d-u;f!==0&&e.isWritable&&e.emitter.emit("setBoxSize",{width:i.intrinsicWidth,height:i.intrinsicHeight+f/i.rootRect.height})}t.remove(c)};return a.view.callbacks.once("onSizeUpdated",l),()=>a.view.callbacks.off("onSizeUpdated",l)})}}function st(){}function Nn(t){return t()}function Xr(){return Object.create(null)}function Ri(t){t.forEach(Nn)}function Yd(t){return typeof t=="function"}function En(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let di;function Pn(t,e){return di||(di=document.createElement("a")),di.href=e,t===di.href}function Qd(t){return Object.keys(t).length===0}function V(t,e){t.appendChild(e)}function At(t,e,i){t.insertBefore(e,i||null)}function ft(t){t.parentNode.removeChild(t)}function Ct(t){return document.createElement(t)}function j(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Is(t){return document.createTextNode(t)}function Gd(){return Is(" ")}function C(t,e,i){i==null?t.removeAttribute(e):t.getAttribute(e)!==i&&t.setAttribute(e,i)}function qd(t){return Array.from(t.childNodes)}function Jd(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}let qt;function Wt(t){qt=t}function zn(){if(!qt)throw new Error("Function called outside component initialization");return qt}function Xd(t){zn().$$.on_mount.push(t)}function Kd(t){zn().$$.on_destroy.push(t)}const Lt=[],Ht=[],bi=[],Kr=[],eu=Promise.resolve();let _s=!1;function tu(){_s||(_s=!0,eu.then(Dn))}function As(t){bi.push(t)}const os=new Set;let ui=0;function Dn(){const t=qt;do{for(;ui<Lt.length;){const e=Lt[ui];ui++,Wt(e),iu(e.$$)}for(Wt(null),Lt.length=0,ui=0;Ht.length;)Ht.pop()();for(let e=0;e<bi.length;e+=1){const i=bi[e];os.has(i)||(os.add(i),i())}bi.length=0}while(Lt.length);for(;Kr.length;)Kr.pop()();_s=!1,os.clear(),Wt(t)}function iu(t){if(t.fragment!==null){t.update(),Ri(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(As)}}const yi=new Set;let su;function Ln(t,e){t&&t.i&&(yi.delete(t),t.i(e))}function ru(t,e,i,s){if(t&&t.o){if(yi.has(t))return;yi.add(t),su.c.push(()=>{yi.delete(t),s&&(i&&t.d(1),s())}),t.o(e)}}function au(t){t&&t.c()}function Vn(t,e,i,s){const{fragment:r,on_mount:a,on_destroy:n,after_update:o}=t.$$;r&&r.m(e,i),s||As(()=>{const c=a.map(Nn).filter(Yd);n?n.push(...c):Ri(c),t.$$.on_mount=[]}),o.forEach(As)}function $n(t,e){const i=t.$$;i.fragment!==null&&(Ri(i.on_destroy),i.fragment&&i.fragment.d(e),i.on_destroy=i.fragment=null,i.ctx=[])}function nu(t,e){t.$$.dirty[0]===-1&&(Lt.push(t),tu(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function jn(t,e,i,s,r,a,n,o=[-1]){const c=qt;Wt(t);const l=t.$$={fragment:null,ctx:null,props:a,update:st,not_equal:r,bound:Xr(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:Xr(),dirty:o,skip_bound:!1,root:e.target||c.$$.root};n&&n(l.root);let d=!1;if(l.ctx=i?i(t,e.props||{},(u,p,...m)=>{const g=m.length?m[0]:p;return l.ctx&&r(l.ctx[u],l.ctx[u]=g)&&(!l.skip_bound&&l.bound[u]&&l.bound[u](g),d&&nu(t,u)),p}):[],l.update(),d=!0,Ri(l.before_update),l.fragment=s?s(l.ctx):!1,e.target){if(e.hydrate){const u=qd(e.target);l.fragment&&l.fragment.l(u),u.forEach(ft)}else l.fragment&&l.fragment.c();e.intro&&Ln(t.$$.fragment),Vn(t,e.target,e.anchor,e.customElement),Dn()}Wt(c)}class Bn{$destroy(){$n(this,1),this.$destroy=st}$on(e,i){const s=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return s.push(i),()=>{const r=s.indexOf(i);r!==-1&&s.splice(r,1)}}$set(e){this.$$set&&!Qd(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const ou={"3g2":"video/3gpp2","3gp":"video/3gpp","3gpp":"audio/3gpp",aac:"audio/x-aac",adp:"audio/adpcm",aif:"audio/x-aiff",aifc:"audio/x-aiff",aiff:"audio/x-aiff",amr:"audio/amr",asf:"video/x-ms-asf",asx:"video/x-ms-asf",au:"audio/basic",avi:"video/x-msvideo",caf:"audio/x-caf",dra:"audio/vnd.dra",dts:"audio/vnd.dts",dtshd:"audio/vnd.dts.hd",dvb:"video/vnd.dvb.file",eol:"audio/vnd.digital-winds",f4v:"video/x-f4v",flac:"audio/x-flac",fli:"video/x-fli",flv:"video/x-flv",fvt:"video/vnd.fvt",h261:"video/h261",h263:"video/h263",h264:"video/h264",jpgm:"video/jpm",jpgv:"video/jpeg",kar:"audio/midi",lvp:"audio/vnd.lucent.voice",m1v:"video/mpeg",m2a:"audio/mpeg",m2v:"video/mpeg",m3a:"audio/mpeg",m3u:"audio/x-mpegurl",m4a:"audio/mp4",m4s:"video/iso.segment",m4u:"video/vnd.mpegurl",m4v:"video/x-m4v",mid:"audio/midi",midi:"audio/midi",mj2:"video/mj2",mjp2:"video/mj2",mk3d:"video/x-matroska",mka:"audio/x-matroska",mks:"video/x-matroska",mkv:"video/x-matroska",mng:"video/x-mng",mov:"video/quicktime",movie:"video/x-sgi-movie",mp2:"audio/mpeg",mp2a:"audio/mpeg",mp3:"audio/mp3",mp4:"video/mp4",mp4a:"audio/mp4",mp4v:"video/mp4",mpe:"video/mpeg",mpeg:"video/mpeg",mpg:"video/mpeg",mpg4:"video/mp4",mpga:"audio/mpeg",mxmf:"audio/mobile-xmf",mxu:"video/vnd.mpegurl",oga:"audio/ogg",ogg:"audio/ogg",ogv:"video/ogg",opus:"audio/ogg",pya:"audio/vnd.ms-playready.media.pya",pyv:"video/vnd.ms-playready.media.pyv",qt:"video/quicktime",ra:"audio/x-pn-realaudio",ram:"audio/x-pn-realaudio",rip:"audio/vnd.rip",rmi:"audio/midi",rmp:"audio/x-pn-realaudio-plugin",s3m:"audio/s3m",sil:"audio/silk",smv:"video/x-smv",snd:"audio/basic",spx:"audio/ogg",ts:"video/mp2t",uva:"audio/vnd.dece.audio",uvh:"video/vnd.dece.hd",uvm:"video/vnd.dece.mobile",uvp:"video/vnd.dece.pd",uvs:"video/vnd.dece.sd",uvu:"video/vnd.uvvu.mp4",uvv:"video/vnd.dece.video",uvva:"audio/vnd.dece.audio",uvvh:"video/vnd.dece.hd",uvvm:"video/vnd.dece.mobile",uvvp:"video/vnd.dece.pd",uvvs:"video/vnd.dece.sd",uvvu:"video/vnd.uvvu.mp4",uvvv:"video/vnd.dece.video",viv:"video/vnd.vivo",vob:"video/x-ms-vob",wav:"audio/wav",wax:"audio/x-ms-wax",weba:"audio/webm",webm:"video/webm",wm:"video/x-ms-wm",wma:"audio/x-ms-wma",wmv:"video/x-ms-wmv",wmx:"video/x-ms-wmx",wvx:"video/x-ms-wvx",xm:"audio/xm",m3u8:"application/vnd.apple.mpegurl"},lu=["application/x-mpegurl","application/vnd.apple.mpegurl"];function cu(t){if(!t)return;const e=t.lastIndexOf(".");if(!~e)return;const i=t.slice(e+1);return ou[i]}async function hu(t){try{return await t.play(),!0}catch(e){return t.muted=!0,await t.play(),console.debug(e),!1}}function du(t){const e=document.createElement("script");return new Promise((i,s)=>{e.onload=()=>i(),e.onerror=s,e.src=t,document.head.appendChild(e)})}async function uu(){const t={loadSource(i){},attachMedia(i){}};let e=window.Hls;if(e===null||e===!1)return t;if(e===void 0&&(await du("https://cdn.jsdelivr.net/npm/hls.js"),e=window.Hls),typeof e=="function")try{return new e}catch(i){return console.debug(i),t}else return t}function pu(t){return"canPlayType"in t&&!t.canPlayType("application/vnd.apple.mpegurl")}function gu(t,e,i){return t<e?e:t>i?i:t}function mu(t){return Array.isArray(t)?t[0]:t}function fu(t){let e,i,s,r,a,n,o,c,l,d,u,p,m,g,f,b,v,x,y,k,z,T,O,te,G,xe,Re,me,Ie,fe,_e,be,ye,Se,Ae,Me,ot,Oe;return{c(){e=j("svg"),i=j("symbol"),s=j("path"),r=j("path"),a=j("symbol"),n=j("path"),o=j("symbol"),c=j("path"),l=j("symbol"),d=j("path"),u=j("symbol"),p=j("path"),m=j("symbol"),g=j("path"),f=j("symbol"),b=j("path"),v=j("symbol"),x=j("path"),y=j("symbol"),k=j("path"),z=j("symbol"),T=j("path"),O=j("symbol"),te=j("path"),G=j("symbol"),xe=j("path"),Re=j("path"),me=j("symbol"),Ie=j("path"),fe=j("symbol"),_e=j("path"),be=j("symbol"),ye=j("path"),Se=j("symbol"),Ae=j("path"),Me=j("symbol"),ot=j("path"),Oe=j("path"),C(s,"d","M16 1H2a1 1 0 00-1 1v10a1 1 0 001 1h3v-2H3V3h12v8h-2v2h3a1 1 0 001-1V2a1 1 0 00-1-1z"),C(r,"d","M4 17h10l-5-6z"),C(i,"id","plyr-airplay"),C(i,"viewBox","0 0 18 18"),C(n,"d","M1 1c-.6 0-1 .4-1 1v11c0 .6.4 1 1 1h4.6l2.7 2.7c.2.2.4.3.7.3.3 0 .5-.1.7-.3l2.7-2.7H17c.6 0 1-.4 1-1V2c0-.6-.4-1-1-1H1zm4.52 10.15c1.99 0 3.01-1.32 3.28-2.41l-1.29-.39c-.19.66-.78 1.45-1.99 1.45-1.14 0-2.2-.83-2.2-2.34 0-1.61 1.12-2.37 2.18-2.37 1.23 0 1.78.75 1.95 1.43l1.3-.41C8.47 4.96 7.46 3.76 5.5 3.76c-1.9 0-3.61 1.44-3.61 3.7 0 2.26 1.65 3.69 3.63 3.69zm7.57 0c1.99 0 3.01-1.32 3.28-2.41l-1.29-.39c-.19.66-.78 1.45-1.99 1.45-1.14 0-2.2-.83-2.2-2.34 0-1.61 1.12-2.37 2.18-2.37 1.23 0 1.78.75 1.95 1.43l1.3-.41c-.28-1.15-1.29-2.35-3.25-2.35-1.9 0-3.61 1.44-3.61 3.7 0 2.26 1.65 3.69 3.63 3.69z"),C(n,"fill-rule","evenodd"),C(n,"fill-opacity",".5"),C(a,"id","plyr-captions-off"),C(a,"viewBox","0 0 18 18"),C(c,"d","M1 1c-.6 0-1 .4-1 1v11c0 .6.4 1 1 1h4.6l2.7 2.7c.2.2.4.3.7.3.3 0 .5-.1.7-.3l2.7-2.7H17c.6 0 1-.4 1-1V2c0-.6-.4-1-1-1H1zm4.52 10.15c1.99 0 3.01-1.32 3.28-2.41l-1.29-.39c-.19.66-.78 1.45-1.99 1.45-1.14 0-2.2-.83-2.2-2.34 0-1.61 1.12-2.37 2.18-2.37 1.23 0 1.78.75 1.95 1.43l1.3-.41C8.47 4.96 7.46 3.76 5.5 3.76c-1.9 0-3.61 1.44-3.61 3.7 0 2.26 1.65 3.69 3.63 3.69zm7.57 0c1.99 0 3.01-1.32 3.28-2.41l-1.29-.39c-.19.66-.78 1.45-1.99 1.45-1.14 0-2.2-.83-2.2-2.34 0-1.61 1.12-2.37 2.18-2.37 1.23 0 1.78.75 1.95 1.43l1.3-.41c-.28-1.15-1.29-2.35-3.25-2.35-1.9 0-3.61 1.44-3.61 3.7 0 2.26 1.65 3.69 3.63 3.69z"),C(c,"fill-rule","evenodd"),C(o,"id","plyr-captions-on"),C(o,"viewBox","0 0 18 18"),C(d,"d","M9 13c.3 0 .5-.1.7-.3L15.4 7 14 5.6l-4 4V1H8v8.6l-4-4L2.6 7l5.7 5.7c.2.2.4.3.7.3zm-7 2h14v2H2z"),C(l,"id","plyr-download"),C(l,"viewBox","0 0 18 18"),C(p,"d","M10 3h3.6l-4 4L11 8.4l4-4V8h2V1h-7zM7 9.6l-4 4V10H1v7h7v-2H4.4l4-4z"),C(u,"id","plyr-enter-fullscreen"),C(u,"viewBox","0 0 18 18"),C(g,"d","M1 12h3.6l-4 4L2 17.4l4-4V17h2v-7H1zM16 .6l-4 4V1h-2v7h7V6h-3.6l4-4z"),C(m,"id","plyr-exit-fullscreen"),C(m,"viewBox","0 0 18 18"),C(b,"d","M7.875 7.171L0 1v16l7.875-6.171V17L18 9 7.875 1z"),C(f,"id","plyr-fast-forward"),C(f,"viewBox","0 0 18 18"),C(x,"d","M17 5.3c-.1 1.6-1.2 3.7-3.3 6.4-2.2 2.8-4 4.2-5.5 4.2-.9 0-1.7-.9-2.4-2.6C5 10.9 4.4 6 3 6c-.1 0-.5.3-1.2.8l-.8-1c.8-.7 3.5-3.4 4.7-3.5 1.2-.1 2 .7 2.3 2.5.3 2 .8 6.1 1.8 6.1.9 0 2.5-3.4 2.6-4 .1-.9-.3-1.9-2.3-1.1.8-2.6 2.3-3.8 4.5-3.8 1.7.1 2.5 1.2 2.4 3.3z"),C(v,"id","plyr-logo-vimeo"),C(v,"viewBox","0 0 18 18"),C(k,"d","M16.8 5.8c-.2-1.3-.8-2.2-2.2-2.4C12.4 3 9 3 9 3s-3.4 0-5.6.4C2 3.6 1.3 4.5 1.2 5.8 1 7.1 1 9 1 9s0 1.9.2 3.2c.2 1.3.8 2.2 2.2 2.4C5.6 15 9 15 9 15s3.4 0 5.6-.4c1.4-.3 2-1.1 2.2-2.4.2-1.3.2-3.2.2-3.2s0-1.9-.2-3.2zM7 12V6l5 3-5 3z"),C(y,"id","plyr-logo-youtube"),C(y,"viewBox","0 0 18 18"),C(T,"d","M12.4 12.5l2.1-2.1 2.1 2.1 1.4-1.4L15.9 9 18 6.9l-1.4-1.4-2.1 2.1-2.1-2.1L11 6.9 13.1 9 11 11.1zM3.786 6.008H.714C.286 6.008 0 6.31 0 6.76v4.512c0 .452.286.752.714.752h3.072l4.071 3.858c.5.3 1.143 0 1.143-.602V2.752c0-.601-.643-.977-1.143-.601L3.786 6.008z"),C(z,"id","plyr-muted"),C(z,"viewBox","0 0 18 18"),C(te,"d","M6 1H3c-.6 0-1 .4-1 1v14c0 .6.4 1 1 1h3c.6 0 1-.4 1-1V2c0-.6-.4-1-1-1zm6 0c-.6 0-1 .4-1 1v14c0 .6.4 1 1 1h3c.6 0 1-.4 1-1V2c0-.6-.4-1-1-1h-3z"),C(O,"id","plyr-pause"),C(O,"viewBox","0 0 18 18"),C(xe,"d","M13.293 3.293L7.022 9.564l1.414 1.414 6.271-6.271L17 7V1h-6z"),C(Re,"d","M13 15H3V5h5V3H2a1 1 0 00-1 1v12a1 1 0 001 1h12a1 1 0 001-1v-6h-2v5z"),C(G,"id","plyr-pip"),C(G,"viewBox","0 0 18 18"),C(Ie,"d","M15.562 8.1L3.87.225c-.818-.562-1.87 0-1.87.9v15.75c0 .9 1.052 1.462 1.87.9L15.563 9.9c.584-.45.584-1.35 0-1.8z"),C(me,"id","plyr-play"),C(me,"viewBox","0 0 18 18"),C(_e,"d","M9.7 1.2l.7 6.4 2.1-2.1c1.9 1.9 1.9 5.1 0 7-.9 1-2.2 1.5-3.5 1.5-1.3 0-2.6-.5-3.5-1.5-1.9-1.9-1.9-5.1 0-7 .6-.6 1.4-1.1 2.3-1.3l-.6-1.9C6 2.6 4.9 3.2 4 4.1 1.3 6.8 1.3 11.2 4 14c1.3 1.3 3.1 2 4.9 2 1.9 0 3.6-.7 4.9-2 2.7-2.7 2.7-7.1 0-9.9L16 1.9l-6.3-.7z"),C(fe,"id","plyr-restart"),C(fe,"viewBox","0 0 18 18"),C(ye,"d","M10.125 1L0 9l10.125 8v-6.171L18 17V1l-7.875 6.171z"),C(be,"id","plyr-rewind"),C(be,"viewBox","0 0 18 18"),C(Ae,"d","M16.135 7.784a2 2 0 01-1.23-2.969c.322-.536.225-.998-.094-1.316l-.31-.31c-.318-.318-.78-.415-1.316-.094a2 2 0 01-2.969-1.23C10.065 1.258 9.669 1 9.219 1h-.438c-.45 0-.845.258-.997.865a2 2 0 01-2.969 1.23c-.536-.322-.999-.225-1.317.093l-.31.31c-.318.318-.415.781-.093 1.317a2 2 0 01-1.23 2.969C1.26 7.935 1 8.33 1 8.781v.438c0 .45.258.845.865.997a2 2 0 011.23 2.969c-.322.536-.225.998.094 1.316l.31.31c.319.319.782.415 1.316.094a2 2 0 012.969 1.23c.151.607.547.865.997.865h.438c.45 0 .845-.258.997-.865a2 2 0 012.969-1.23c.535.321.997.225 1.316-.094l.31-.31c.318-.318.415-.781.094-1.316a2 2 0 011.23-2.969c.607-.151.865-.547.865-.997v-.438c0-.451-.26-.846-.865-.997zM9 12a3 3 0 110-6 3 3 0 010 6z"),C(Se,"id","plyr-settings"),C(Se,"viewBox","0 0 18 18"),C(ot,"d","M15.6 3.3c-.4-.4-1-.4-1.4 0-.4.4-.4 1 0 1.4C15.4 5.9 16 7.4 16 9c0 1.6-.6 3.1-1.8 4.3-.4.4-.4 1 0 1.4.2.2.5.3.7.3.3 0 .5-.1.7-.3C17.1 13.2 18 11.2 18 9s-.9-4.2-2.4-5.7z"),C(Oe,"d","M11.282 5.282a.909.909 0 000 1.316c.735.735.995 1.458.995 2.402 0 .936-.425 1.917-.995 2.487a.909.909 0 000 1.316c.145.145.636.262 1.018.156a.725.725 0 00.298-.156C13.773 11.733 14.13 10.16 14.13 9c0-.17-.002-.34-.011-.51-.053-.992-.319-2.005-1.522-3.208a.909.909 0 00-1.316 0zm-7.496.726H.714C.286 6.008 0 6.31 0 6.76v4.512c0 .452.286.752.714.752h3.072l4.071 3.858c.5.3 1.143 0 1.143-.602V2.752c0-.601-.643-.977-1.143-.601L3.786 6.008z"),C(Me,"id","plyr-volume"),C(Me,"viewBox","0 0 18 18"),C(e,"xmlns","http://www.w3.org/2000/svg"),C(e,"xmlns:xlink","http://www.w3.org/1999/xlink")},m(Qe,bt){At(Qe,e,bt),V(e,i),V(i,s),V(i,r),V(e,a),V(a,n),V(e,o),V(o,c),V(e,l),V(l,d),V(e,u),V(u,p),V(e,m),V(m,g),V(e,f),V(f,b),V(e,v),V(v,x),V(e,y),V(y,k),V(e,z),V(z,T),V(e,O),V(O,te),V(e,G),V(G,xe),V(G,Re),V(e,me),V(me,Ie),V(e,fe),V(fe,_e),V(e,be),V(be,ye),V(e,Se),V(Se,Ae),V(e,Me),V(Me,ot),V(Me,Oe)},p:st,i:st,o:st,d(Qe){Qe&&ft(e)}}}class bu extends Bn{constructor(e){super();jn(this,e,null,fu,En,{})}}function _(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function yu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ea(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}function wu(t,e,i){return e&&ea(t.prototype,e),i&&ea(t,i),t}function vu(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function ta(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,s)}return i}function ia(t){for(var e=1;e<arguments.length;e++){var i=arguments[e]!=null?arguments[e]:{};e%2?ta(Object(i),!0).forEach(function(s){vu(t,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ta(Object(i)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(i,s))})}return t}var sa={addCSS:!0,thumbWidth:15,watch:!0};function xu(t,e){return function(){return Array.from(document.querySelectorAll(e)).includes(this)}.call(t,e)}function Su(t,e){if(t&&e){var i=new Event(e,{bubbles:!0});t.dispatchEvent(i)}}var si=function(t){return t!=null?t.constructor:null},or=function(t,e){return!!(t&&e&&t instanceof e)},Rn=function(t){return t==null},On=function(t){return si(t)===Object},Mu=function(t){return si(t)===Number&&!Number.isNaN(t)},Un=function(t){return si(t)===String},Cu=function(t){return si(t)===Boolean},Iu=function(t){return si(t)===Function},Wn=function(t){return Array.isArray(t)},Hn=function(t){return or(t,NodeList)},_u=function(t){return or(t,Element)},Au=function(t){return or(t,Event)},ku=function(t){return Rn(t)||(Un(t)||Wn(t)||Hn(t))&&!t.length||On(t)&&!Object.keys(t).length},ae={nullOrUndefined:Rn,object:On,number:Mu,string:Un,boolean:Cu,function:Iu,array:Wn,nodeList:Hn,element:_u,event:Au,empty:ku};function Tu(t){var e="".concat(t).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return e?Math.max(0,(e[1]?e[1].length:0)-(e[2]?+e[2]:0)):0}function Nu(t,e){if(1>e){var i=Tu(e);return parseFloat(t.toFixed(i))}return Math.round(t/e)*e}var Eu=function(){function t(e,i){yu(this,t),ae.element(e)?this.element=e:ae.string(e)&&(this.element=document.querySelector(e)),ae.element(this.element)&&ae.empty(this.element.rangeTouch)&&(this.config=ia({},sa,{},i),this.init())}return wu(t,[{key:"init",value:function(){t.enabled&&(this.config.addCSS&&(this.element.style.userSelect="none",this.element.style.webKitUserSelect="none",this.element.style.touchAction="manipulation"),this.listeners(!0),this.element.rangeTouch=this)}},{key:"destroy",value:function(){t.enabled&&(this.config.addCSS&&(this.element.style.userSelect="",this.element.style.webKitUserSelect="",this.element.style.touchAction=""),this.listeners(!1),this.element.rangeTouch=null)}},{key:"listeners",value:function(e){var i=this,s=e?"addEventListener":"removeEventListener";["touchstart","touchmove","touchend"].forEach(function(r){i.element[s](r,function(a){return i.set(a)},!1)})}},{key:"get",value:function(e){if(!t.enabled||!ae.event(e))return null;var i,s=e.target,r=e.changedTouches[0],a=parseFloat(s.getAttribute("min"))||0,n=parseFloat(s.getAttribute("max"))||100,o=parseFloat(s.getAttribute("step"))||1,c=s.getBoundingClientRect(),l=100/c.width*(this.config.thumbWidth/2)/100;return 0>(i=100/c.width*(r.clientX-c.left))?i=0:100<i&&(i=100),50>i?i-=(100-2*i)*l:50<i&&(i+=2*(i-50)*l),a+Nu(i/100*(n-a),o)}},{key:"set",value:function(e){t.enabled&&ae.event(e)&&!e.target.disabled&&(e.preventDefault(),e.target.value=this.get(e),Su(e.target,e.type==="touchend"?"change":"input"))}}],[{key:"setup",value:function(e){var i=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},s=null;if(ae.empty(e)||ae.string(e)?s=Array.from(document.querySelectorAll(ae.string(e)?e:'input[type="range"]')):ae.element(e)?s=[e]:ae.nodeList(e)?s=Array.from(e):ae.array(e)&&(s=e.filter(ae.element)),ae.empty(s))return null;var r=ia({},sa,{},i);if(ae.string(e)&&r.watch){var a=new MutationObserver(function(n){Array.from(n).forEach(function(o){Array.from(o.addedNodes).forEach(function(c){ae.element(c)&&xu(c,e)&&new t(c,r)})})});a.observe(document.body,{childList:!0,subtree:!0})}return s.map(function(n){return new t(n,i)})}},{key:"enabled",get:function(){return"ontouchstart"in document.documentElement}}]),t}();const kt=t=>t!=null?t.constructor:null,Ye=(t,e)=>Boolean(t&&e&&t instanceof e),lr=t=>t==null,Fn=t=>kt(t)===Object,Pu=t=>kt(t)===Number&&!Number.isNaN(t),Oi=t=>kt(t)===String,zu=t=>kt(t)===Boolean,Zn=t=>kt(t)===Function,Yn=t=>Array.isArray(t),Du=t=>Ye(t,WeakMap),Qn=t=>Ye(t,NodeList),Lu=t=>kt(t)===Text,Vu=t=>Ye(t,Event),$u=t=>Ye(t,KeyboardEvent),ju=t=>Ye(t,window.TextTrackCue)||Ye(t,window.VTTCue),Bu=t=>Ye(t,TextTrack)||!lr(t)&&Oi(t.kind),Ru=t=>Ye(t,Promise)&&Zn(t.then),Ou=t=>t!==null&&typeof t=="object"&&t.nodeType===1&&typeof t.style=="object"&&typeof t.ownerDocument=="object",Gn=t=>lr(t)||(Oi(t)||Yn(t)||Qn(t))&&!t.length||Fn(t)&&!Object.keys(t).length,Uu=t=>{if(Ye(t,window.URL))return!0;if(!Oi(t))return!1;let e=t;t.startsWith("http://")&&t.startsWith("https://")||(e=`http://${t}`);try{return!Gn(new URL(e).hostname)}catch{return!1}};var h={nullOrUndefined:lr,object:Fn,number:Pu,string:Oi,boolean:zu,function:Zn,array:Yn,weakMap:Du,nodeList:Qn,element:Ou,textNode:Lu,event:Vu,keyboardEvent:$u,cue:ju,track:Bu,promise:Ru,url:Uu,empty:Gn};const ks=(()=>{const t=document.createElement("span"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},i=Object.keys(e).find(s=>t.style[s]!==void 0);return!!h.string(i)&&e[i]})();function qn(t,e){setTimeout(()=>{try{t.hidden=!0,t.offsetHeight,t.hidden=!1}catch{}},e)}const re={isIE:Boolean(window.document.documentMode),isEdge:window.navigator.userAgent.includes("Edge"),isWebkit:"WebkitAppearance"in document.documentElement.style&&!/Edge/.test(navigator.userAgent),isIPhone:/(iPhone|iPod)/gi.test(navigator.platform),isIos:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1||/(iPad|iPhone|iPod)/gi.test(navigator.platform)};function Wu(t){return JSON.parse(JSON.stringify(t))}function Jn(t,e){return e.split(".").reduce((i,s)=>i&&i[s],t)}function J(t={},...e){if(!e.length)return t;const i=e.shift();return h.object(i)?(Object.keys(i).forEach(s=>{h.object(i[s])?(Object.keys(t).includes(s)||Object.assign(t,{[s]:{}}),J(t[s],i[s])):Object.assign(t,{[s]:i[s]})}),J(t,...e)):t}function Xn(t,e){const i=t.length?t:[t];Array.from(i).reverse().forEach((s,r)=>{const a=r>0?e.cloneNode(!0):e,n=s.parentNode,o=s.nextSibling;a.appendChild(s),o?n.insertBefore(a,o):n.appendChild(a)})}function Ts(t,e){h.element(t)&&!h.empty(e)&&Object.entries(e).filter(([,i])=>!h.nullOrUndefined(i)).forEach(([i,s])=>t.setAttribute(i,s))}function N(t,e,i){const s=document.createElement(t);return h.object(e)&&Ts(s,e),h.string(i)&&(s.innerText=i),s}function Hu(t,e){h.element(t)&&h.element(e)&&e.parentNode.insertBefore(t,e.nextSibling)}function ra(t,e,i,s){h.element(e)&&e.appendChild(N(t,i,s))}function He(t){h.nodeList(t)||h.array(t)?Array.from(t).forEach(He):h.element(t)&&h.element(t.parentNode)&&t.parentNode.removeChild(t)}function wi(t){if(!h.element(t))return;let{length:e}=t.childNodes;for(;e>0;)t.removeChild(t.lastChild),e-=1}function Ai(t,e){return h.element(e)&&h.element(e.parentNode)&&h.element(t)?(e.parentNode.replaceChild(t,e),t):null}function Le(t,e){if(!h.string(t)||h.empty(t))return{};const i={},s=J({},e);return t.split(",").forEach(r=>{const a=r.trim(),n=a.replace(".",""),o=a.replace(/[[\]]/g,"").split("="),[c]=o,l=o.length>1?o[1].replace(/["']/g,""):"";switch(a.charAt(0)){case".":h.string(s.class)?i.class=`${s.class} ${n}`:i.class=n;break;case"#":i.id=a.replace("#","");break;case"[":i[c]=l}}),J(s,i)}function ct(t,e){if(!h.element(t))return;let i=e;h.boolean(i)||(i=!t.hidden),t.hidden=i}function W(t,e,i){if(h.nodeList(t))return Array.from(t).map(s=>W(s,e,i));if(h.element(t)){let s="toggle";return i!==void 0&&(s=i?"add":"remove"),t.classList[s](e),t.classList.contains(e)}return!1}function ki(t,e){return h.element(t)&&t.classList.contains(e)}function ht(t,e){const{prototype:i}=Element;return(i.matches||i.webkitMatchesSelector||i.mozMatchesSelector||i.msMatchesSelector||function(){return Array.from(document.querySelectorAll(e)).includes(this)}).call(t,e)}function Fu(t,e){const{prototype:i}=Element;return(i.closest||function(){let s=this;do{if(ht.matches(s,e))return s;s=s.parentElement||s.parentNode}while(s!==null&&s.nodeType===1);return null}).call(t,e)}function xt(t){return this.elements.container.querySelectorAll(t)}function X(t){return this.elements.container.querySelector(t)}function ls(t=null,e=!1){h.element(t)&&(t.focus({preventScroll:!0}),e&&W(t,this.config.classNames.tabFocus))}const aa={"audio/ogg":"vorbis","audio/wav":"1","video/webm":"vp8, vorbis","video/mp4":"avc1.42E01E, mp4a.40.2","video/ogg":"theora"},q={audio:"canPlayType"in document.createElement("audio"),video:"canPlayType"in document.createElement("video"),check(t,e,i){const s=re.isIPhone&&i&&q.playsinline,r=q[t]||e!=="html5";return{api:r,ui:r&&q.rangeInput&&(t!=="video"||!re.isIPhone||s)}},pip:!(re.isIPhone||!h.function(N("video").webkitSetPresentationMode)&&(!document.pictureInPictureEnabled||N("video").disablePictureInPicture)),airplay:h.function(window.WebKitPlaybackTargetAvailabilityEvent),playsinline:"playsInline"in document.createElement("video"),mime(t){if(h.empty(t))return!1;const[e]=t.split("/");let i=t;if(!this.isHTML5||e!==this.type)return!1;Object.keys(aa).includes(i)&&(i+=`; codecs="${aa[t]}"`);try{return Boolean(i&&this.media.canPlayType(i).replace(/no/,""))}catch{return!1}},textTracks:"textTracks"in document.createElement("video"),rangeInput:(()=>{const t=document.createElement("input");return t.type="range",t.type==="range"})(),touch:"ontouchstart"in document.documentElement,transitions:ks!==!1,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches},Zu=(()=>{let t=!1;try{const e=Object.defineProperty({},"passive",{get:()=>(t=!0,null)});window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch{}return t})();function St(t,e,i,s=!1,r=!0,a=!1){if(!t||!("addEventListener"in t)||h.empty(e)||!h.function(i))return;const n=e.split(" ");let o=a;Zu&&(o={passive:r,capture:a}),n.forEach(c=>{this&&this.eventListeners&&s&&this.eventListeners.push({element:t,type:c,callback:i,options:o}),t[s?"addEventListener":"removeEventListener"](c,i,o)})}function H(t,e="",i,s=!0,r=!1){St.call(this,t,e,i,!0,s,r)}function Ui(t,e="",i,s=!0,r=!1){St.call(this,t,e,i,!1,s,r)}function cr(t,e="",i,s=!0,r=!1){const a=(...n)=>{Ui(t,e,a,s,r),i.apply(this,n)};St.call(this,t,e,a,!0,s,r)}function E(t,e="",i=!1,s={}){if(!h.element(t)||h.empty(e))return;const r=new CustomEvent(e,{bubbles:i,detail:he(R({},s),{plyr:this})});t.dispatchEvent(r)}function Yu(){this&&this.eventListeners&&(this.eventListeners.forEach(t=>{const{element:e,type:i,callback:s,options:r}=t;e.removeEventListener(i,s,r)}),this.eventListeners=[])}function Qu(){return new Promise(t=>this.ready?setTimeout(t,0):H.call(this,this.elements.container,"ready",t)).then(()=>{})}function Be(t){h.promise(t)&&t.then(null,()=>{})}function Ns(t){return h.array(t)?t.filter((e,i)=>t.indexOf(e)===i):t}function Kn(t,e){return h.array(t)&&t.length?t.reduce((i,s)=>Math.abs(s-e)<Math.abs(i-e)?s:i):null}function eo(t){return!(!window||!window.CSS)&&window.CSS.supports(t)}const na=[[1,1],[4,3],[3,4],[5,4],[4,5],[3,2],[2,3],[16,10],[10,16],[16,9],[9,16],[21,9],[9,21],[32,9],[9,32]].reduce((t,[e,i])=>he(R({},t),{[e/i]:[e,i]}),{});function to(t){return h.array(t)||h.string(t)&&t.includes(":")?(h.array(t)?t:t.split(":")).map(Number).every(h.number):!1}function Ti(t){if(!h.array(t)||!t.every(h.number))return null;const[e,i]=t,s=(a,n)=>n===0?a:s(n,a%n),r=s(e,i);return[e/r,i/r]}function hr(t){const e=s=>to(s)?s.split(":").map(Number):null;let i=e(t);if(i===null&&(i=e(this.config.ratio)),i===null&&!h.empty(this.embed)&&h.array(this.embed.ratio)&&({ratio:i}=this.embed),i===null&&this.isHTML5){const{videoWidth:s,videoHeight:r}=this.media;i=[s,r]}return Ti(i)}function It(t){if(!this.isVideo)return{};const{wrapper:e}=this.elements,i=hr.call(this,t);if(!h.array(i))return{};const[s,r]=Ti(i),a=100/s*r;if(eo(`aspect-ratio: ${s}/${r}`)?e.style.aspectRatio=`${s}/${r}`:e.style.paddingBottom=`${a}%`,this.isVimeo&&!this.config.vimeo.premium&&this.supported.ui){const n=100/this.media.offsetWidth*parseInt(window.getComputedStyle(this.media).paddingBottom,10),o=(n-a)/(n/50);this.fullscreen.active?e.style.paddingBottom=null:this.media.style.transform=`translateY(-${o}%)`}else this.isHTML5&&e.classList.add(this.config.classNames.videoFixedRatio);return{padding:a,ratio:i}}function io(t,e,i=.05){const s=t/e,r=Kn(Object.keys(na),s);return Math.abs(r-s)<=i?na[r]:[t,e]}function Gu(){return[Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)]}const Ke={getSources(){return this.isHTML5?Array.from(this.media.querySelectorAll("source")).filter(t=>{const e=t.getAttribute("type");return!!h.empty(e)||q.mime.call(this,e)}):[]},getQualityOptions(){return this.config.quality.forced?this.config.quality.options:Ke.getSources.call(this).map(t=>Number(t.getAttribute("size"))).filter(Boolean)},setup(){if(!this.isHTML5)return;const t=this;t.options.speed=t.config.speed.options,h.empty(this.config.ratio)||It.call(t),Object.defineProperty(t.media,"quality",{get(){const e=Ke.getSources.call(t).find(i=>i.getAttribute("src")===t.source);return e&&Number(e.getAttribute("size"))},set(e){if(t.quality!==e){if(t.config.quality.forced&&h.function(t.config.quality.onChange))t.config.quality.onChange(e);else{const i=Ke.getSources.call(t).find(c=>Number(c.getAttribute("size"))===e);if(!i)return;const{currentTime:s,paused:r,preload:a,readyState:n,playbackRate:o}=t.media;t.media.src=i.getAttribute("src"),(a!=="none"||n)&&(t.once("loadedmetadata",()=>{t.speed=o,t.currentTime=s,r||Be(t.play())}),t.media.load())}E.call(t,t.media,"qualitychange",!1,{quality:e})}}})},cancelRequests(){this.isHTML5&&(He(Ke.getSources.call(this)),this.media.setAttribute("src",this.config.blankVideo),this.media.load(),this.debug.log("Cancelled network requests"))}};function qu(t){return`${t}-${Math.floor(1e4*Math.random())}`}function Es(t,...e){return h.empty(t)?t:t.toString().replace(/{(\d+)}/g,(i,s)=>e[s].toString())}function Ju(t,e){return t===0||e===0||Number.isNaN(t)||Number.isNaN(e)?0:(t/e*100).toFixed(2)}const Ft=(t="",e="",i="")=>t.replace(new RegExp(e.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),"g"),i.toString()),so=(t="")=>t.toString().replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase());function Xu(t=""){let e=t.toString();return e=Ft(e,"-"," "),e=Ft(e,"_"," "),e=so(e),Ft(e," ","")}function Ku(t=""){let e=t.toString();return e=Xu(e),e.charAt(0).toLowerCase()+e.slice(1)}function ep(t){const e=document.createDocumentFragment(),i=document.createElement("div");return e.appendChild(i),i.innerHTML=t,e.firstChild.innerText}function tp(t){const e=document.createElement("div");return e.appendChild(t),e.innerHTML}const oa={pip:"PIP",airplay:"AirPlay",html5:"HTML5",vimeo:"Vimeo",youtube:"YouTube"},K={get(t="",e={}){if(h.empty(t)||h.empty(e))return"";let i=Jn(e.i18n,t);if(h.empty(i))return Object.keys(oa).includes(t)?oa[t]:"";const s={"{seektime}":e.seekTime,"{title}":e.title};return Object.entries(s).forEach(([r,a])=>{i=Ft(i,r,a)}),i}};class Jt{constructor(e){_(this,"get",i=>{if(!Jt.supported||!this.enabled)return null;const s=window.localStorage.getItem(this.key);if(h.empty(s))return null;const r=JSON.parse(s);return h.string(i)&&i.length?r[i]:r}),_(this,"set",i=>{if(!Jt.supported||!this.enabled||!h.object(i))return;let s=this.get();h.empty(s)&&(s={}),J(s,i);try{window.localStorage.setItem(this.key,JSON.stringify(s))}catch{}}),this.enabled=e.config.storage.enabled,this.key=e.config.storage.key}static get supported(){try{if(!("localStorage"in window))return!1;const e="___test";return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch{return!1}}}function ri(t,e="text"){return new Promise((i,s)=>{try{const r=new XMLHttpRequest;if(!("withCredentials"in r))return;r.addEventListener("load",()=>{if(e==="text")try{i(JSON.parse(r.responseText))}catch{i(r.responseText)}else i(r.response)}),r.addEventListener("error",()=>{throw new Error(r.status)}),r.open("GET",t,!0),r.responseType=e,r.send()}catch(r){s(r)}})}function ro(t,e){if(!h.string(t))return;const i=h.string(e);let s=!1;const r=()=>document.getElementById(e)!==null,a=(n,o)=>{n.innerHTML=o,i&&r()||document.body.insertAdjacentElement("afterbegin",n)};if(!i||!r()){const n=Jt.supported,o=document.createElement("div");if(o.setAttribute("hidden",""),i&&o.setAttribute("id",e),n){const c=window.localStorage.getItem(`cache-${e}`);if(s=c!==null,s){const l=JSON.parse(c);a(o,l.content)}}ri(t).then(c=>{if(!h.empty(c)){if(n)try{window.localStorage.setItem(`cache-${e}`,JSON.stringify({content:c}))}catch{}a(o,c)}}).catch(()=>{})}}const ao=t=>Math.trunc(t/60/60%60,10),ip=t=>Math.trunc(t%60,10);function Wi(t=0,e=!1,i=!1){if(!h.number(t))return Wi(void 0,e,i);const s=c=>`0${c}`.slice(-2);let r=ao(t);const a=(n=t,Math.trunc(n/60%60,10));var n;const o=ip(t);return r=e||r>0?`${r}:`:"",`${i&&t>0?"-":""}${r}${s(a)}:${s(o)}`}const M={getIconUrl(){const t=new URL(this.config.iconUrl,window.location),e=window.location.host?window.location.host:window.top.location.host,i=t.host!==e||re.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:i}},findElements(){try{return this.elements.controls=X.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:xt.call(this,this.config.selectors.buttons.play),pause:X.call(this,this.config.selectors.buttons.pause),restart:X.call(this,this.config.selectors.buttons.restart),rewind:X.call(this,this.config.selectors.buttons.rewind),fastForward:X.call(this,this.config.selectors.buttons.fastForward),mute:X.call(this,this.config.selectors.buttons.mute),pip:X.call(this,this.config.selectors.buttons.pip),airplay:X.call(this,this.config.selectors.buttons.airplay),settings:X.call(this,this.config.selectors.buttons.settings),captions:X.call(this,this.config.selectors.buttons.captions),fullscreen:X.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=X.call(this,this.config.selectors.progress),this.elements.inputs={seek:X.call(this,this.config.selectors.inputs.seek),volume:X.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:X.call(this,this.config.selectors.display.buffer),currentTime:X.call(this,this.config.selectors.display.currentTime),duration:X.call(this,this.config.selectors.display.duration)},h.element(this.elements.progress)&&(this.elements.display.seekTooltip=this.elements.progress.querySelector(`.${this.config.classNames.tooltip}`)),!0}catch(t){return this.debug.warn("It looks like there is a problem with your custom controls HTML",t),this.toggleNativeControls(!0),!1}},createIcon(t,e){const i="http://www.w3.org/2000/svg",s=M.getIconUrl.call(this),r=`${s.cors?"":s.url}#${this.config.iconPrefix}`,a=document.createElementNS(i,"svg");Ts(a,J(e,{"aria-hidden":"true",focusable:"false"}));const n=document.createElementNS(i,"use"),o=`${r}-${t}`;return"href"in n&&n.setAttributeNS("http://www.w3.org/1999/xlink","href",o),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o),a.appendChild(n),a},createLabel(t,e={}){const i=K.get(t,this.config);return N("span",he(R({},e),{class:[e.class,this.config.classNames.hidden].filter(Boolean).join(" ")}),i)},createBadge(t){if(h.empty(t))return null;const e=N("span",{class:this.config.classNames.menu.value});return e.appendChild(N("span",{class:this.config.classNames.menu.badge},t)),e},createButton(t,e){const i=J({},e);let s=Ku(t);const r={element:"button",toggle:!1,label:null,icon:null,labelPressed:null,iconPressed:null};switch(["element","icon","label"].forEach(n=>{Object.keys(i).includes(n)&&(r[n]=i[n],delete i[n])}),r.element!=="button"||Object.keys(i).includes("type")||(i.type="button"),Object.keys(i).includes("class")?i.class.split(" ").some(n=>n===this.config.classNames.control)||J(i,{class:`${i.class} ${this.config.classNames.control}`}):i.class=this.config.classNames.control,t){case"play":r.toggle=!0,r.label="play",r.labelPressed="pause",r.icon="play",r.iconPressed="pause";break;case"mute":r.toggle=!0,r.label="mute",r.labelPressed="unmute",r.icon="volume",r.iconPressed="muted";break;case"captions":r.toggle=!0,r.label="enableCaptions",r.labelPressed="disableCaptions",r.icon="captions-off",r.iconPressed="captions-on";break;case"fullscreen":r.toggle=!0,r.label="enterFullscreen",r.labelPressed="exitFullscreen",r.icon="enter-fullscreen",r.iconPressed="exit-fullscreen";break;case"play-large":i.class+=` ${this.config.classNames.control}--overlaid`,s="play",r.label="play",r.icon="play";break;default:h.empty(r.label)&&(r.label=s),h.empty(r.icon)&&(r.icon=t)}const a=N(r.element);return r.toggle?(a.appendChild(M.createIcon.call(this,r.iconPressed,{class:"icon--pressed"})),a.appendChild(M.createIcon.call(this,r.icon,{class:"icon--not-pressed"})),a.appendChild(M.createLabel.call(this,r.labelPressed,{class:"label--pressed"})),a.appendChild(M.createLabel.call(this,r.label,{class:"label--not-pressed"}))):(a.appendChild(M.createIcon.call(this,r.icon)),a.appendChild(M.createLabel.call(this,r.label))),J(i,Le(this.config.selectors.buttons[s],i)),Ts(a,i),s==="play"?(h.array(this.elements.buttons[s])||(this.elements.buttons[s]=[]),this.elements.buttons[s].push(a)):this.elements.buttons[s]=a,a},createRange(t,e){const i=N("input",J(Le(this.config.selectors.inputs[t]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":K.get(t,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},e));return this.elements.inputs[t]=i,M.updateRangeFill.call(this,i),Eu.setup(i),i},createProgress(t,e){const i=N("progress",J(Le(this.config.selectors.display[t]),{min:0,max:100,value:0,role:"progressbar","aria-hidden":!0},e));if(t!=="volume"){i.appendChild(N("span",null,"0"));const s={played:"played",buffer:"buffered"}[t],r=s?K.get(s,this.config):"";i.innerText=`% ${r.toLowerCase()}`}return this.elements.display[t]=i,i},createTime(t,e){const i=Le(this.config.selectors.display[t],e),s=N("div",J(i,{class:`${i.class?i.class:""} ${this.config.classNames.display.time} `.trim(),"aria-label":K.get(t,this.config)}),"00:00");return this.elements.display[t]=s,s},bindMenuItemShortcuts(t,e){H.call(this,t,"keydown keyup",i=>{if(!["Space","ArrowUp","ArrowDown","ArrowRight"].includes(i.key)||(i.preventDefault(),i.stopPropagation(),i.type==="keydown"))return;const s=ht(t,'[role="menuitemradio"]');if(!s&&["Space","ArrowRight"].includes(i.key))M.showMenuPanel.call(this,e,!0);else{let r;i.key!=="Space"&&(i.key==="ArrowDown"||s&&i.key==="ArrowRight"?(r=t.nextElementSibling,h.element(r)||(r=t.parentNode.firstElementChild)):(r=t.previousElementSibling,h.element(r)||(r=t.parentNode.lastElementChild)),ls.call(this,r,!0))}},!1),H.call(this,t,"keyup",i=>{i.key==="Return"&&M.focusFirstMenuItem.call(this,null,!0)})},createMenuItem({value:t,list:e,type:i,title:s,badge:r=null,checked:a=!1}){const n=Le(this.config.selectors.inputs[i]),o=N("button",J(n,{type:"button",role:"menuitemradio",class:`${this.config.classNames.control} ${n.class?n.class:""}`.trim(),"aria-checked":a,value:t})),c=N("span");c.innerHTML=s,h.element(r)&&c.appendChild(r),o.appendChild(c),Object.defineProperty(o,"checked",{enumerable:!0,get:()=>o.getAttribute("aria-checked")==="true",set(l){l&&Array.from(o.parentNode.children).filter(d=>ht(d,'[role="menuitemradio"]')).forEach(d=>d.setAttribute("aria-checked","false")),o.setAttribute("aria-checked",l?"true":"false")}}),this.listeners.bind(o,"click keyup",l=>{if(!h.keyboardEvent(l)||l.key==="Space"){switch(l.preventDefault(),l.stopPropagation(),o.checked=!0,i){case"language":this.currentTrack=Number(t);break;case"quality":this.quality=t;break;case"speed":this.speed=parseFloat(t)}M.showMenuPanel.call(this,"home",h.keyboardEvent(l))}},i,!1),M.bindMenuItemShortcuts.call(this,o,i),e.appendChild(o)},formatTime(t=0,e=!1){return h.number(t)?Wi(t,ao(this.duration)>0,e):t},updateTimeDisplay(t=null,e=0,i=!1){h.element(t)&&h.number(e)&&(t.innerText=M.formatTime(e,i))},updateVolume(){this.supported.ui&&(h.element(this.elements.inputs.volume)&&M.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),h.element(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||this.volume===0))},setRange(t,e=0){h.element(t)&&(t.value=e,M.updateRangeFill.call(this,t))},updateProgress(t){if(!this.supported.ui||!h.event(t))return;let e=0;const i=(s,r)=>{const a=h.number(r)?r:0,n=h.element(s)?s:this.elements.display.buffer;if(h.element(n)){n.value=a;const o=n.getElementsByTagName("span")[0];h.element(o)&&(o.childNodes[0].nodeValue=a)}};if(t)switch(t.type){case"timeupdate":case"seeking":case"seeked":e=Ju(this.currentTime,this.duration),t.type==="timeupdate"&&M.setRange.call(this,this.elements.inputs.seek,e);break;case"playing":case"progress":i(this.elements.display.buffer,100*this.buffered)}},updateRangeFill(t){const e=h.event(t)?t.target:t;if(h.element(e)&&e.getAttribute("type")==="range"){if(ht(e,this.config.selectors.inputs.seek)){e.setAttribute("aria-valuenow",this.currentTime);const i=M.formatTime(this.currentTime),s=M.formatTime(this.duration),r=K.get("seekLabel",this.config);e.setAttribute("aria-valuetext",r.replace("{currentTime}",i).replace("{duration}",s))}else if(ht(e,this.config.selectors.inputs.volume)){const i=100*e.value;e.setAttribute("aria-valuenow",i),e.setAttribute("aria-valuetext",`${i.toFixed(1)}%`)}else e.setAttribute("aria-valuenow",e.value);re.isWebkit&&e.style.setProperty("--value",e.value/e.max*100+"%")}},updateSeekTooltip(t){var e,i;if(!this.config.tooltips.seek||!h.element(this.elements.inputs.seek)||!h.element(this.elements.display.seekTooltip)||this.duration===0)return;const s=this.elements.display.seekTooltip,r=`${this.config.classNames.tooltip}--visible`,a=d=>W(s,r,d);if(this.touch)return void a(!1);let n=0;const o=this.elements.progress.getBoundingClientRect();if(h.event(t))n=100/o.width*(t.pageX-o.left);else{if(!ki(s,r))return;n=parseFloat(s.style.left,10)}n<0?n=0:n>100&&(n=100);const c=this.duration/100*n;s.innerText=M.formatTime(c);const l=(e=this.config.markers)===null||e===void 0||(i=e.points)===null||i===void 0?void 0:i.find(({time:d})=>d===Math.round(c));l&&s.insertAdjacentHTML("afterbegin",`${l.label}<br>`),s.style.left=`${n}%`,h.event(t)&&["mouseenter","mouseleave"].includes(t.type)&&a(t.type==="mouseenter")},timeUpdate(t){const e=!h.element(this.elements.display.duration)&&this.config.invertTime;M.updateTimeDisplay.call(this,this.elements.display.currentTime,e?this.duration-this.currentTime:this.currentTime,e),t&&t.type==="timeupdate"&&this.media.seeking||M.updateProgress.call(this,t)},durationUpdate(){if(!this.supported.ui||!this.config.invertTime&&this.currentTime)return;if(this.duration>=2**32)return ct(this.elements.display.currentTime,!0),void ct(this.elements.progress,!0);h.element(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute("aria-valuemax",this.duration);const t=h.element(this.elements.display.duration);!t&&this.config.displayDuration&&this.paused&&M.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),t&&M.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),this.config.markers.enabled&&M.setMarkers.call(this),M.updateSeekTooltip.call(this)},toggleMenuButton(t,e){ct(this.elements.settings.buttons[t],!e)},updateSetting(t,e,i){const s=this.elements.settings.panels[t];let r=null,a=e;if(t==="captions")r=this.currentTrack;else{if(r=h.empty(i)?this[t]:i,h.empty(r)&&(r=this.config[t].default),!h.empty(this.options[t])&&!this.options[t].includes(r))return void this.debug.warn(`Unsupported value of '${r}' for ${t}`);if(!this.config[t].options.includes(r))return void this.debug.warn(`Disabled value of '${r}' for ${t}`)}if(h.element(a)||(a=s&&s.querySelector('[role="menu"]')),!h.element(a))return;this.elements.settings.buttons[t].querySelector(`.${this.config.classNames.menu.value}`).innerHTML=M.getLabel.call(this,t,r);const n=a&&a.querySelector(`[value="${r}"]`);h.element(n)&&(n.checked=!0)},getLabel(t,e){switch(t){case"speed":return e===1?K.get("normal",this.config):`${e}×`;case"quality":if(h.number(e)){const i=K.get(`qualityLabel.${e}`,this.config);return i.length?i:`${e}p`}return so(e);case"captions":return F.getLabel.call(this);default:return null}},setQualityMenu(t){if(!h.element(this.elements.settings.panels.quality))return;const e="quality",i=this.elements.settings.panels.quality.querySelector('[role="menu"]');h.array(t)&&(this.options.quality=Ns(t).filter(a=>this.config.quality.options.includes(a)));const s=!h.empty(this.options.quality)&&this.options.quality.length>1;if(M.toggleMenuButton.call(this,e,s),wi(i),M.checkMenu.call(this),!s)return;const r=a=>{const n=K.get(`qualityBadge.${a}`,this.config);return n.length?M.createBadge.call(this,n):null};this.options.quality.sort((a,n)=>{const o=this.config.quality.options;return o.indexOf(a)>o.indexOf(n)?1:-1}).forEach(a=>{M.createMenuItem.call(this,{value:a,list:i,type:e,title:M.getLabel.call(this,"quality",a),badge:r(a)})}),M.updateSetting.call(this,e,i)},setCaptionsMenu(){if(!h.element(this.elements.settings.panels.captions))return;const t="captions",e=this.elements.settings.panels.captions.querySelector('[role="menu"]'),i=F.getTracks.call(this),s=Boolean(i.length);if(M.toggleMenuButton.call(this,t,s),wi(e),M.checkMenu.call(this),!s)return;const r=i.map((a,n)=>({value:n,checked:this.captions.toggled&&this.currentTrack===n,title:F.getLabel.call(this,a),badge:a.language&&M.createBadge.call(this,a.language.toUpperCase()),list:e,type:"language"}));r.unshift({value:-1,checked:!this.captions.toggled,title:K.get("disabled",this.config),list:e,type:"language"}),r.forEach(M.createMenuItem.bind(this)),M.updateSetting.call(this,t,e)},setSpeedMenu(){if(!h.element(this.elements.settings.panels.speed))return;const t="speed",e=this.elements.settings.panels.speed.querySelector('[role="menu"]');this.options.speed=this.options.speed.filter(s=>s>=this.minimumSpeed&&s<=this.maximumSpeed);const i=!h.empty(this.options.speed)&&this.options.speed.length>1;M.toggleMenuButton.call(this,t,i),wi(e),M.checkMenu.call(this),i&&(this.options.speed.forEach(s=>{M.createMenuItem.call(this,{value:s,list:e,type:t,title:M.getLabel.call(this,"speed",s)})}),M.updateSetting.call(this,t,e))},checkMenu(){const{buttons:t}=this.elements.settings,e=!h.empty(t)&&Object.values(t).some(i=>!i.hidden);ct(this.elements.settings.menu,!e)},focusFirstMenuItem(t,e=!1){if(this.elements.settings.popup.hidden)return;let i=t;h.element(i)||(i=Object.values(this.elements.settings.panels).find(r=>!r.hidden));const s=i.querySelector('[role^="menuitem"]');ls.call(this,s,e)},toggleMenu(t){const{popup:e}=this.elements.settings,i=this.elements.buttons.settings;if(!h.element(e)||!h.element(i))return;const{hidden:s}=e;let r=s;if(h.boolean(t))r=t;else if(h.keyboardEvent(t)&&t.key==="Escape")r=!1;else if(h.event(t)){const a=h.function(t.composedPath)?t.composedPath()[0]:t.target,n=e.contains(a);if(n||!n&&t.target!==i&&r)return}i.setAttribute("aria-expanded",r),ct(e,!r),W(this.elements.container,this.config.classNames.menu.open,r),r&&h.keyboardEvent(t)?M.focusFirstMenuItem.call(this,null,!0):r||s||ls.call(this,i,h.keyboardEvent(t))},getMenuSize(t){const e=t.cloneNode(!0);e.style.position="absolute",e.style.opacity=0,e.removeAttribute("hidden"),t.parentNode.appendChild(e);const i=e.scrollWidth,s=e.scrollHeight;return He(e),{width:i,height:s}},showMenuPanel(t="",e=!1){const i=this.elements.container.querySelector(`#plyr-settings-${this.id}-${t}`);if(!h.element(i))return;const s=i.parentNode,r=Array.from(s.children).find(a=>!a.hidden);if(q.transitions&&!q.reducedMotion){s.style.width=`${r.scrollWidth}px`,s.style.height=`${r.scrollHeight}px`;const a=M.getMenuSize.call(this,i),n=o=>{o.target===s&&["width","height"].includes(o.propertyName)&&(s.style.width="",s.style.height="",Ui.call(this,s,ks,n))};H.call(this,s,ks,n),s.style.width=`${a.width}px`,s.style.height=`${a.height}px`}ct(r,!0),ct(i,!1),M.focusFirstMenuItem.call(this,i,e)},setDownloadUrl(){const t=this.elements.buttons.download;h.element(t)&&t.setAttribute("href",this.download)},create(t){const{bindMenuItemShortcuts:e,createButton:i,createProgress:s,createRange:r,createTime:a,setQualityMenu:n,setSpeedMenu:o,showMenuPanel:c}=M;this.elements.controls=null,h.array(this.config.controls)&&this.config.controls.includes("play-large")&&this.elements.container.appendChild(i.call(this,"play-large"));const l=N("div",Le(this.config.selectors.controls.wrapper));this.elements.controls=l;const d={class:"plyr__controls__item"};return Ns(h.array(this.config.controls)?this.config.controls:[]).forEach(u=>{if(u==="restart"&&l.appendChild(i.call(this,"restart",d)),u==="rewind"&&l.appendChild(i.call(this,"rewind",d)),u==="play"&&l.appendChild(i.call(this,"play",d)),u==="fast-forward"&&l.appendChild(i.call(this,"fast-forward",d)),u==="progress"){const p=N("div",{class:`${d.class} plyr__progress__container`}),m=N("div",Le(this.config.selectors.progress));if(m.appendChild(r.call(this,"seek",{id:`plyr-seek-${t.id}`})),m.appendChild(s.call(this,"buffer")),this.config.tooltips.seek){const g=N("span",{class:this.config.classNames.tooltip},"00:00");m.appendChild(g),this.elements.display.seekTooltip=g}this.elements.progress=m,p.appendChild(this.elements.progress),l.appendChild(p)}if(u==="current-time"&&l.appendChild(a.call(this,"currentTime",d)),u==="duration"&&l.appendChild(a.call(this,"duration",d)),u==="mute"||u==="volume"){let{volume:p}=this.elements;if(h.element(p)&&l.contains(p)||(p=N("div",J({},d,{class:`${d.class} plyr__volume`.trim()})),this.elements.volume=p,l.appendChild(p)),u==="mute"&&p.appendChild(i.call(this,"mute")),u==="volume"&&!re.isIos){const m={max:1,step:.05,value:this.config.volume};p.appendChild(r.call(this,"volume",J(m,{id:`plyr-volume-${t.id}`})))}}if(u==="captions"&&l.appendChild(i.call(this,"captions",d)),u==="settings"&&!h.empty(this.config.settings)){const p=N("div",J({},d,{class:`${d.class} plyr__menu`.trim(),hidden:""}));p.appendChild(i.call(this,"settings",{"aria-haspopup":!0,"aria-controls":`plyr-settings-${t.id}`,"aria-expanded":!1}));const m=N("div",{class:"plyr__menu__container",id:`plyr-settings-${t.id}`,hidden:""}),g=N("div"),f=N("div",{id:`plyr-settings-${t.id}-home`}),b=N("div",{role:"menu"});f.appendChild(b),g.appendChild(f),this.elements.settings.panels.home=f,this.config.settings.forEach(v=>{const x=N("button",J(Le(this.config.selectors.buttons.settings),{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--forward`,role:"menuitem","aria-haspopup":!0,hidden:""}));e.call(this,x,v),H.call(this,x,"click",()=>{c.call(this,v,!1)});const y=N("span",null,K.get(v,this.config)),k=N("span",{class:this.config.classNames.menu.value});k.innerHTML=t[v],y.appendChild(k),x.appendChild(y),b.appendChild(x);const z=N("div",{id:`plyr-settings-${t.id}-${v}`,hidden:""}),T=N("button",{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--back`});T.appendChild(N("span",{"aria-hidden":!0},K.get(v,this.config))),T.appendChild(N("span",{class:this.config.classNames.hidden},K.get("menuBack",this.config))),H.call(this,z,"keydown",O=>{O.key==="ArrowLeft"&&(O.preventDefault(),O.stopPropagation(),c.call(this,"home",!0))},!1),H.call(this,T,"click",()=>{c.call(this,"home",!1)}),z.appendChild(T),z.appendChild(N("div",{role:"menu"})),g.appendChild(z),this.elements.settings.buttons[v]=x,this.elements.settings.panels[v]=z}),m.appendChild(g),p.appendChild(m),l.appendChild(p),this.elements.settings.popup=m,this.elements.settings.menu=p}if(u==="pip"&&q.pip&&l.appendChild(i.call(this,"pip",d)),u==="airplay"&&q.airplay&&l.appendChild(i.call(this,"airplay",d)),u==="download"){const p=J({},d,{element:"a",href:this.download,target:"_blank"});this.isHTML5&&(p.download="");const{download:m}=this.config.urls;!h.url(m)&&this.isEmbed&&J(p,{icon:`logo-${this.provider}`,label:this.provider}),l.appendChild(i.call(this,"download",p))}u==="fullscreen"&&l.appendChild(i.call(this,"fullscreen",d))}),this.isHTML5&&n.call(this,Ke.getQualityOptions.call(this)),o.call(this),l},inject(){if(this.config.loadSprite){const r=M.getIconUrl.call(this);r.cors&&ro(r.url,"sprite-plyr")}this.id=Math.floor(1e4*Math.random());let t=null;this.elements.controls=null;const e={id:this.id,seektime:this.config.seekTime,title:this.config.title};let i=!0;h.function(this.config.controls)&&(this.config.controls=this.config.controls.call(this,e)),this.config.controls||(this.config.controls=[]),h.element(this.config.controls)||h.string(this.config.controls)?t=this.config.controls:(t=M.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:F.getLabel.call(this)}),i=!1);let s;if(i&&h.string(this.config.controls)&&(t=(r=>{let a=r;return Object.entries(e).forEach(([n,o])=>{a=Ft(a,`{${n}}`,o)}),a})(t)),h.string(this.config.selectors.controls.container)&&(s=document.querySelector(this.config.selectors.controls.container)),h.element(s)||(s=this.elements.container),s[h.element(t)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",t),h.element(this.elements.controls)||M.findElements.call(this),!h.empty(this.elements.buttons)){const r=a=>{const n=this.config.classNames.controlPressed;Object.defineProperty(a,"pressed",{enumerable:!0,get:()=>ki(a,n),set(o=!1){W(a,n,o)}})};Object.values(this.elements.buttons).filter(Boolean).forEach(a=>{h.array(a)||h.nodeList(a)?Array.from(a).filter(Boolean).forEach(r):r(a)})}if(re.isEdge&&qn(s),this.config.tooltips.controls){const{classNames:r,selectors:a}=this.config,n=`${a.controls.wrapper} ${a.labels} .${r.hidden}`,o=xt.call(this,n);Array.from(o).forEach(c=>{W(c,this.config.classNames.hidden,!1),W(c,this.config.classNames.tooltip,!0)})}},setMediaMetadata(){try{"mediaSession"in navigator&&(navigator.mediaSession.metadata=new window.MediaMetadata({title:this.config.mediaMetadata.title,artist:this.config.mediaMetadata.artist,album:this.config.mediaMetadata.album,artwork:this.config.mediaMetadata.artwork}))}catch{}},setMarkers(){var t,e;if(!this.duration||this.elements.markers)return;const i=(t=this.config.markers)===null||t===void 0||(e=t.points)===null||e===void 0?void 0:e.filter(({time:c})=>c>0&&c<this.duration);if(i==null||!i.length)return;const s=document.createDocumentFragment(),r=document.createDocumentFragment();let a=null;const n=`${this.config.classNames.tooltip}--visible`,o=c=>W(a,n,c);i.forEach(c=>{const l=N("span",{class:this.config.classNames.marker},""),d=c.time/this.duration*100+"%";a&&(l.addEventListener("mouseenter",()=>{c.label||(a.style.left=d,a.innerHTML=c.label,o(!0))}),l.addEventListener("mouseleave",()=>{o(!1)})),l.addEventListener("click",()=>{this.currentTime=c.time}),l.style.left=d,r.appendChild(l)}),s.appendChild(r),this.config.tooltips.seek||(a=N("span",{class:this.config.classNames.tooltip},""),s.appendChild(a)),this.elements.markers={points:r,tip:a},this.elements.progress.appendChild(s)}};function no(t,e=!0){let i=t;if(e){const s=document.createElement("a");s.href=i,i=s.href}try{return new URL(i)}catch{return null}}function oo(t){const e=new URLSearchParams;return h.object(t)&&Object.entries(t).forEach(([i,s])=>{e.set(i,s)}),e}const F={setup(){if(!this.supported.ui)return;if(!this.isVideo||this.isYouTube||this.isHTML5&&!q.textTracks)return void(h.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&M.setCaptionsMenu.call(this));if(h.element(this.elements.captions)||(this.elements.captions=N("div",Le(this.config.selectors.captions)),Hu(this.elements.captions,this.elements.wrapper)),re.isIE&&window.URL){const s=this.media.querySelectorAll("track");Array.from(s).forEach(r=>{const a=r.getAttribute("src"),n=no(a);n!==null&&n.hostname!==window.location.href.hostname&&["http:","https:"].includes(n.protocol)&&ri(a,"blob").then(o=>{r.setAttribute("src",window.URL.createObjectURL(o))}).catch(()=>{He(r)})})}const t=Ns((navigator.languages||[navigator.language||navigator.userLanguage||"en"]).map(s=>s.split("-")[0]));let e=(this.storage.get("language")||this.config.captions.language||"auto").toLowerCase();e==="auto"&&([e]=t);let i=this.storage.get("captions");if(h.boolean(i)||({active:i}=this.config.captions),Object.assign(this.captions,{toggled:!1,active:i,language:e,languages:t}),this.isHTML5){const s=this.config.captions.update?"addtrack removetrack":"removetrack";H.call(this,this.media.textTracks,s,F.update.bind(this))}setTimeout(F.update.bind(this),0)},update(){const t=F.getTracks.call(this,!0),{active:e,language:i,meta:s,currentTrackNode:r}=this.captions,a=Boolean(t.find(n=>n.language===i));this.isHTML5&&this.isVideo&&t.filter(n=>!s.get(n)).forEach(n=>{this.debug.log("Track added",n),s.set(n,{default:n.mode==="showing"}),n.mode==="showing"&&(n.mode="hidden"),H.call(this,n,"cuechange",()=>F.updateCues.call(this))}),(a&&this.language!==i||!t.includes(r))&&(F.setLanguage.call(this,i),F.toggle.call(this,e&&a)),this.elements&&W(this.elements.container,this.config.classNames.captions.enabled,!h.empty(t)),h.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&M.setCaptionsMenu.call(this)},toggle(t,e=!0){if(!this.supported.ui)return;const{toggled:i}=this.captions,s=this.config.classNames.captions.active,r=h.nullOrUndefined(t)?!i:t;if(r!==i){if(e||(this.captions.active=r,this.storage.set({captions:r})),!this.language&&r&&!e){const a=F.getTracks.call(this),n=F.findTrack.call(this,[this.captions.language,...this.captions.languages],!0);return this.captions.language=n.language,void F.set.call(this,a.indexOf(n))}this.elements.buttons.captions&&(this.elements.buttons.captions.pressed=r),W(this.elements.container,s,r),this.captions.toggled=r,M.updateSetting.call(this,"captions"),E.call(this,this.media,r?"captionsenabled":"captionsdisabled")}setTimeout(()=>{r&&this.captions.toggled&&(this.captions.currentTrackNode.mode="hidden")})},set(t,e=!0){const i=F.getTracks.call(this);if(t!==-1)if(h.number(t))if(t in i){if(this.captions.currentTrack!==t){this.captions.currentTrack=t;const s=i[t],{language:r}=s||{};this.captions.currentTrackNode=s,M.updateSetting.call(this,"captions"),e||(this.captions.language=r,this.storage.set({language:r})),this.isVimeo&&this.embed.enableTextTrack(r),E.call(this,this.media,"languagechange")}F.toggle.call(this,!0,e),this.isHTML5&&this.isVideo&&F.updateCues.call(this)}else this.debug.warn("Track not found",t);else this.debug.warn("Invalid caption argument",t);else F.toggle.call(this,!1,e)},setLanguage(t,e=!0){if(!h.string(t))return void this.debug.warn("Invalid language argument",t);const i=t.toLowerCase();this.captions.language=i;const s=F.getTracks.call(this),r=F.findTrack.call(this,[i]);F.set.call(this,s.indexOf(r),e)},getTracks(t=!1){return Array.from((this.media||{}).textTracks||[]).filter(e=>!this.isHTML5||t||this.captions.meta.has(e)).filter(e=>["captions","subtitles"].includes(e.kind))},findTrack(t,e=!1){const i=F.getTracks.call(this),s=n=>Number((this.captions.meta.get(n)||{}).default),r=Array.from(i).sort((n,o)=>s(o)-s(n));let a;return t.every(n=>(a=r.find(o=>o.language===n),!a)),a||(e?r[0]:void 0)},getCurrentTrack(){return F.getTracks.call(this)[this.currentTrack]},getLabel(t){let e=t;return!h.track(e)&&q.textTracks&&this.captions.toggled&&(e=F.getCurrentTrack.call(this)),h.track(e)?h.empty(e.label)?h.empty(e.language)?K.get("enabled",this.config):t.language.toUpperCase():e.label:K.get("disabled",this.config)},updateCues(t){if(!this.supported.ui)return;if(!h.element(this.elements.captions))return void this.debug.warn("No captions element to render to");if(!h.nullOrUndefined(t)&&!Array.isArray(t))return void this.debug.warn("updateCues: Invalid input",t);let e=t;if(!e){const s=F.getCurrentTrack.call(this);e=Array.from((s||{}).activeCues||[]).map(r=>r.getCueAsHTML()).map(tp)}const i=e.map(s=>s.trim()).join(`
|
125
|
-
`);if(i!==this.elements.captions.innerHTML){wi(this.elements.captions);const s=N("span",Le(this.config.selectors.caption));s.innerHTML=i,this.elements.captions.appendChild(s),E.call(this,this.media,"cuechange")}}},lo={enabled:!0,title:"",debug:!1,autoplay:!1,autopause:!0,playsinline:!0,seekTime:10,volume:1,muted:!1,duration:null,displayDuration:!0,invertTime:!0,toggleInvert:!0,ratio:null,clickToPlay:!0,hideControls:!0,resetOnEnd:!1,disableContextMenu:!0,loadSprite:!0,iconPrefix:"plyr",iconUrl:"https://cdn.plyr.io/3.7.2/plyr.svg",blankVideo:"https://cdn.plyr.io/static/blank.mp4",quality:{default:576,options:[4320,2880,2160,1440,1080,720,576,480,360,240],forced:!1,onChange:null},loop:{active:!1},speed:{selected:1,options:[.5,.75,1,1.25,1.5,1.75,2,4]},keyboard:{focused:!0,global:!1},tooltips:{controls:!1,seek:!0},captions:{active:!1,language:"auto",update:!1},fullscreen:{enabled:!0,fallback:!0,iosNative:!1},storage:{enabled:!0,key:"plyr"},controls:["play-large","play","progress","current-time","mute","volume","captions","settings","pip","airplay","fullscreen"],settings:["captions","quality","speed"],i18n:{restart:"Restart",rewind:"Rewind {seektime}s",play:"Play",pause:"Pause",fastForward:"Forward {seektime}s",seek:"Seek",seekLabel:"{currentTime} of {duration}",played:"Played",buffered:"Buffered",currentTime:"Current time",duration:"Duration",volume:"Volume",mute:"Mute",unmute:"Unmute",enableCaptions:"Enable captions",disableCaptions:"Disable captions",download:"Download",enterFullscreen:"Enter fullscreen",exitFullscreen:"Exit fullscreen",frameTitle:"Player for {title}",captions:"Captions",settings:"Settings",pip:"PIP",menuBack:"Go back to previous menu",speed:"Speed",normal:"Normal",quality:"Quality",loop:"Loop",start:"Start",end:"End",all:"All",reset:"Reset",disabled:"Disabled",enabled:"Enabled",advertisement:"Ad",qualityBadge:{2160:"4K",1440:"HD",1080:"HD",720:"HD",576:"SD",480:"SD"}},urls:{download:null,vimeo:{sdk:"https://player.vimeo.com/api/player.js",iframe:"https://player.vimeo.com/video/{0}?{1}",api:"https://vimeo.com/api/oembed.json?url={0}"},youtube:{sdk:"https://www.youtube.com/iframe_api",api:"https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}"},googleIMA:{sdk:"https://imasdk.googleapis.com/js/sdkloader/ima3.js"}},listeners:{seek:null,play:null,pause:null,restart:null,rewind:null,fastForward:null,mute:null,volume:null,captions:null,download:null,fullscreen:null,pip:null,airplay:null,speed:null,quality:null,loop:null,language:null},events:["ended","progress","stalled","playing","waiting","canplay","canplaythrough","loadstart","loadeddata","loadedmetadata","timeupdate","volumechange","play","pause","error","seeking","seeked","emptied","ratechange","cuechange","download","enterfullscreen","exitfullscreen","captionsenabled","captionsdisabled","languagechange","controlshidden","controlsshown","ready","statechange","qualitychange","adsloaded","adscontentpause","adscontentresume","adstarted","adsmidpoint","adscomplete","adsallcomplete","adsimpression","adsclick"],selectors:{editable:"input, textarea, select, [contenteditable]",container:".plyr",controls:{container:null,wrapper:".plyr__controls"},labels:"[data-plyr]",buttons:{play:'[data-plyr="play"]',pause:'[data-plyr="pause"]',restart:'[data-plyr="restart"]',rewind:'[data-plyr="rewind"]',fastForward:'[data-plyr="fast-forward"]',mute:'[data-plyr="mute"]',captions:'[data-plyr="captions"]',download:'[data-plyr="download"]',fullscreen:'[data-plyr="fullscreen"]',pip:'[data-plyr="pip"]',airplay:'[data-plyr="airplay"]',settings:'[data-plyr="settings"]',loop:'[data-plyr="loop"]'},inputs:{seek:'[data-plyr="seek"]',volume:'[data-plyr="volume"]',speed:'[data-plyr="speed"]',language:'[data-plyr="language"]',quality:'[data-plyr="quality"]'},display:{currentTime:".plyr__time--current",duration:".plyr__time--duration",buffer:".plyr__progress__buffer",loop:".plyr__progress__loop",volume:".plyr__volume--display"},progress:".plyr__progress",captions:".plyr__captions",caption:".plyr__caption"},classNames:{type:"plyr--{0}",provider:"plyr--{0}",video:"plyr__video-wrapper",embed:"plyr__video-embed",videoFixedRatio:"plyr__video-wrapper--fixed-ratio",embedContainer:"plyr__video-embed__container",poster:"plyr__poster",posterEnabled:"plyr__poster-enabled",ads:"plyr__ads",control:"plyr__control",controlPressed:"plyr__control--pressed",playing:"plyr--playing",paused:"plyr--paused",stopped:"plyr--stopped",loading:"plyr--loading",hover:"plyr--hover",tooltip:"plyr__tooltip",cues:"plyr__cues",marker:"plyr__progress__marker",hidden:"plyr__sr-only",hideControls:"plyr--hide-controls",isIos:"plyr--is-ios",isTouch:"plyr--is-touch",uiSupported:"plyr--full-ui",noTransition:"plyr--no-transition",display:{time:"plyr__time"},menu:{value:"plyr__menu__value",badge:"plyr__badge",open:"plyr--menu-open"},captions:{enabled:"plyr--captions-enabled",active:"plyr--captions-active"},fullscreen:{enabled:"plyr--fullscreen-enabled",fallback:"plyr--fullscreen-fallback"},pip:{supported:"plyr--pip-supported",active:"plyr--pip-active"},airplay:{supported:"plyr--airplay-supported",active:"plyr--airplay-active"},tabFocus:"plyr__tab-focus",previewThumbnails:{thumbContainer:"plyr__preview-thumb",thumbContainerShown:"plyr__preview-thumb--is-shown",imageContainer:"plyr__preview-thumb__image-container",timeContainer:"plyr__preview-thumb__time-container",scrubbingContainer:"plyr__preview-scrubbing",scrubbingContainerShown:"plyr__preview-scrubbing--is-shown"}},attributes:{embed:{provider:"data-plyr-provider",id:"data-plyr-embed-id",hash:"data-plyr-embed-hash"}},ads:{enabled:!1,publisherId:"",tagUrl:""},previewThumbnails:{enabled:!1,src:""},vimeo:{byline:!1,portrait:!1,title:!1,speed:!0,transparent:!1,customControls:!0,referrerPolicy:null,premium:!1},youtube:{rel:0,showinfo:0,iv_load_policy:3,modestbranding:1,customControls:!0,noCookie:!1},mediaMetadata:{title:"",artist:"",album:"",artwork:[]},markers:{enabled:!1,points:[]}},cs={active:"picture-in-picture",inactive:"inline"},qe={html5:"html5",youtube:"youtube",vimeo:"vimeo"},hs={audio:"audio",video:"video"};function sp(t){return/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(t)?qe.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(t)?qe.vimeo:null}const ds=()=>{};class rp{constructor(e=!1){this.enabled=window.console&&e,this.enabled&&this.log("Debugging enabled")}get log(){return this.enabled?Function.prototype.bind.call(console.log,console):ds}get warn(){return this.enabled?Function.prototype.bind.call(console.warn,console):ds}get error(){return this.enabled?Function.prototype.bind.call(console.error,console):ds}}class Ve{constructor(e){_(this,"onChange",()=>{if(!this.enabled)return;const i=this.player.elements.buttons.fullscreen;h.element(i)&&(i.pressed=this.active);const s=this.target===this.player.media?this.target:this.player.elements.container;E.call(this.player,s,this.active?"enterfullscreen":"exitfullscreen",!0)}),_(this,"toggleFallback",(i=!1)=>{if(i?this.scrollPosition={x:window.scrollX||0,y:window.scrollY||0}:window.scrollTo(this.scrollPosition.x,this.scrollPosition.y),document.body.style.overflow=i?"hidden":"",W(this.target,this.player.config.classNames.fullscreen.fallback,i),re.isIos){let s=document.head.querySelector('meta[name="viewport"]');const r="viewport-fit=cover";s||(s=document.createElement("meta"),s.setAttribute("name","viewport"));const a=h.string(s.content)&&s.content.includes(r);i?(this.cleanupViewport=!a,a||(s.content+=`,${r}`)):this.cleanupViewport&&(s.content=s.content.split(",").filter(n=>n.trim()!==r).join(","))}this.onChange()}),_(this,"trapFocus",i=>{if(re.isIos||!this.active||i.key!=="Tab")return;const s=document.activeElement,r=xt.call(this.player,"a[href], button:not(:disabled), input:not(:disabled), [tabindex]"),[a]=r,n=r[r.length-1];s!==n||i.shiftKey?s===a&&i.shiftKey&&(n.focus(),i.preventDefault()):(a.focus(),i.preventDefault())}),_(this,"update",()=>{if(this.enabled){let i;i=this.forceFallback?"Fallback (forced)":Ve.native?"Native":"Fallback",this.player.debug.log(`${i} fullscreen enabled`)}else this.player.debug.log("Fullscreen not supported and fallback disabled");W(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.enabled)}),_(this,"enter",()=>{this.enabled&&(re.isIos&&this.player.config.fullscreen.iosNative?this.player.isVimeo?this.player.embed.requestFullscreen():this.target.webkitEnterFullscreen():!Ve.native||this.forceFallback?this.toggleFallback(!0):this.prefix?h.empty(this.prefix)||this.target[`${this.prefix}Request${this.property}`]():this.target.requestFullscreen({navigationUI:"hide"}))}),_(this,"exit",()=>{if(this.enabled)if(re.isIos&&this.player.config.fullscreen.iosNative)this.target.webkitExitFullscreen(),Be(this.player.play());else if(!Ve.native||this.forceFallback)this.toggleFallback(!1);else if(this.prefix){if(!h.empty(this.prefix)){const i=this.prefix==="moz"?"Cancel":"Exit";document[`${this.prefix}${i}${this.property}`]()}}else(document.cancelFullScreen||document.exitFullscreen).call(document)}),_(this,"toggle",()=>{this.active?this.exit():this.enter()}),this.player=e,this.prefix=Ve.prefix,this.property=Ve.property,this.scrollPosition={x:0,y:0},this.forceFallback=e.config.fullscreen.fallback==="force",this.player.elements.fullscreen=e.config.fullscreen.container&&Fu(this.player.elements.container,e.config.fullscreen.container),H.call(this.player,document,this.prefix==="ms"?"MSFullscreenChange":`${this.prefix}fullscreenchange`,()=>{this.onChange()}),H.call(this.player,this.player.elements.container,"dblclick",i=>{h.element(this.player.elements.controls)&&this.player.elements.controls.contains(i.target)||this.player.listeners.proxy(i,this.toggle,"fullscreen")}),H.call(this,this.player.elements.container,"keydown",i=>this.trapFocus(i)),this.update()}static get native(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}get usingNative(){return Ve.native&&!this.forceFallback}static get prefix(){if(h.function(document.exitFullscreen))return"";let e="";return["webkit","moz","ms"].some(i=>!(!h.function(document[`${i}ExitFullscreen`])&&!h.function(document[`${i}CancelFullScreen`]))&&(e=i,!0)),e}static get property(){return this.prefix==="moz"?"FullScreen":"Fullscreen"}get enabled(){return(Ve.native||this.player.config.fullscreen.fallback)&&this.player.config.fullscreen.enabled&&this.player.supported.ui&&this.player.isVideo}get active(){if(!this.enabled)return!1;if(!Ve.native||this.forceFallback)return ki(this.target,this.player.config.classNames.fullscreen.fallback);const e=this.prefix?this.target.getRootNode()[`${this.prefix}${this.property}Element`]:this.target.getRootNode().fullscreenElement;return e&&e.shadowRoot?e===this.target.getRootNode().host:e===this.target}get target(){return re.isIos&&this.player.config.fullscreen.iosNative?this.player.media:this.player.elements.fullscreen||this.player.elements.container}}function vi(t,e=1){return new Promise((i,s)=>{const r=new Image,a=()=>{delete r.onload,delete r.onerror,(r.naturalWidth>=e?i:s)(r)};Object.assign(r,{onload:a,onerror:a,src:t})})}const Z={addStyleHook(){W(this.elements.container,this.config.selectors.container.replace(".",""),!0),W(this.elements.container,this.config.classNames.uiSupported,this.supported.ui)},toggleNativeControls(t=!1){t&&this.isHTML5?this.media.setAttribute("controls",""):this.media.removeAttribute("controls")},build(){if(this.listeners.media(),!this.supported.ui)return this.debug.warn(`Basic support only for ${this.provider} ${this.type}`),void Z.toggleNativeControls.call(this,!0);h.element(this.elements.controls)||(M.inject.call(this),this.listeners.controls()),Z.toggleNativeControls.call(this),this.isHTML5&&F.setup.call(this),this.volume=null,this.muted=null,this.loop=null,this.quality=null,this.speed=null,M.updateVolume.call(this),M.timeUpdate.call(this),M.durationUpdate.call(this),Z.checkPlaying.call(this),W(this.elements.container,this.config.classNames.pip.supported,q.pip&&this.isHTML5&&this.isVideo),W(this.elements.container,this.config.classNames.airplay.supported,q.airplay&&this.isHTML5),W(this.elements.container,this.config.classNames.isIos,re.isIos),W(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout(()=>{E.call(this,this.media,"ready")},0),Z.setTitle.call(this),this.poster&&Z.setPoster.call(this,this.poster,!1).catch(()=>{}),this.config.duration&&M.durationUpdate.call(this),this.config.mediaMetadata&&M.setMediaMetadata.call(this)},setTitle(){let t=K.get("play",this.config);if(h.string(this.config.title)&&!h.empty(this.config.title)&&(t+=`, ${this.config.title}`),Array.from(this.elements.buttons.play||[]).forEach(e=>{e.setAttribute("aria-label",t)}),this.isEmbed){const e=X.call(this,"iframe");if(!h.element(e))return;const i=h.empty(this.config.title)?"video":this.config.title,s=K.get("frameTitle",this.config);e.setAttribute("title",s.replace("{title}",i))}},togglePoster(t){W(this.elements.container,this.config.classNames.posterEnabled,t)},setPoster(t,e=!0){return e&&this.poster?Promise.reject(new Error("Poster already set")):(this.media.setAttribute("data-poster",t),this.elements.poster.removeAttribute("hidden"),Qu.call(this).then(()=>vi(t)).catch(i=>{throw t===this.poster&&Z.togglePoster.call(this,!1),i}).then(()=>{if(t!==this.poster)throw new Error("setPoster cancelled by later call to setPoster")}).then(()=>(Object.assign(this.elements.poster.style,{backgroundImage:`url('${t}')`,backgroundSize:""}),Z.togglePoster.call(this,!0),t)))},checkPlaying(t){W(this.elements.container,this.config.classNames.playing,this.playing),W(this.elements.container,this.config.classNames.paused,this.paused),W(this.elements.container,this.config.classNames.stopped,this.stopped),Array.from(this.elements.buttons.play||[]).forEach(e=>{Object.assign(e,{pressed:this.playing}),e.setAttribute("aria-label",K.get(this.playing?"pause":"play",this.config))}),h.event(t)&&t.type==="timeupdate"||Z.toggleControls.call(this)},checkLoading(t){this.loading=["stalled","waiting"].includes(t.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout(()=>{W(this.elements.container,this.config.classNames.loading,this.loading),Z.toggleControls.call(this)},this.loading?250:0)},toggleControls(t){const{controls:e}=this.elements;if(e&&this.config.hideControls){const i=this.touch&&this.lastSeekTime+2e3>Date.now();this.toggleControls(Boolean(t||this.loading||this.paused||e.pressed||e.hover||i))}},migrateStyles(){Object.values(R({},this.media.style)).filter(t=>!h.empty(t)&&h.string(t)&&t.startsWith("--plyr")).forEach(t=>{this.elements.container.style.setProperty(t,this.media.style.getPropertyValue(t)),this.media.style.removeProperty(t)}),h.empty(this.media.style)&&this.media.removeAttribute("style")}};class ap{constructor(e){_(this,"firstTouch",()=>{const{player:i}=this,{elements:s}=i;i.touch=!0,W(s.container,i.config.classNames.isTouch,!0)}),_(this,"setTabFocus",i=>{const{player:s}=this,{elements:r}=s,{key:a,type:n,timeStamp:o}=i;if(clearTimeout(this.focusTimer),n==="keydown"&&a!=="Tab")return;n==="keydown"&&(this.lastKeyDown=o);const c=o-this.lastKeyDown<=20;(n!=="focus"||c)&&((()=>{const l=s.config.classNames.tabFocus;W(xt.call(s,`.${l}`),l,!1)})(),n!=="focusout"&&(this.focusTimer=setTimeout(()=>{const l=document.activeElement;r.container.contains(l)&&W(document.activeElement,s.config.classNames.tabFocus,!0)},10)))}),_(this,"global",(i=!0)=>{const{player:s}=this;s.config.keyboard.global&&St.call(s,window,"keydown keyup",this.handleKey,i,!1),St.call(s,document.body,"click",this.toggleMenu,i),cr.call(s,document.body,"touchstart",this.firstTouch),St.call(s,document.body,"keydown focus blur focusout",this.setTabFocus,i,!1,!0)}),_(this,"container",()=>{const{player:i}=this,{config:s,elements:r,timers:a}=i;!s.keyboard.global&&s.keyboard.focused&&H.call(i,r.container,"keydown keyup",this.handleKey,!1),H.call(i,r.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen",c=>{const{controls:l}=r;l&&c.type==="enterfullscreen"&&(l.pressed=!1,l.hover=!1);let d=0;["touchstart","touchmove","mousemove"].includes(c.type)&&(Z.toggleControls.call(i,!0),d=i.touch?3e3:2e3),clearTimeout(a.controls),a.controls=setTimeout(()=>Z.toggleControls.call(i,!1),d)});const n=()=>{if(!i.isVimeo||i.config.vimeo.premium)return;const c=r.wrapper,{active:l}=i.fullscreen,[d,u]=hr.call(i),p=eo(`aspect-ratio: ${d} / ${u}`);if(!l)return void(p?(c.style.width=null,c.style.height=null):(c.style.maxWidth=null,c.style.margin=null));const[m,g]=Gu(),f=m/g>d/u;p?(c.style.width=f?"auto":"100%",c.style.height=f?"100%":"auto"):(c.style.maxWidth=f?g/u*d+"px":null,c.style.margin=f?"0 auto":null)},o=()=>{clearTimeout(a.resized),a.resized=setTimeout(n,50)};H.call(i,r.container,"enterfullscreen exitfullscreen",c=>{const{target:l}=i.fullscreen;l===r.container&&(!i.isEmbed&&h.empty(i.config.ratio)||(n(),(c.type==="enterfullscreen"?H:Ui).call(i,window,"resize",o)))})}),_(this,"media",()=>{const{player:i}=this,{elements:s}=i;if(H.call(i,i.media,"timeupdate seeking seeked",a=>M.timeUpdate.call(i,a)),H.call(i,i.media,"durationchange loadeddata loadedmetadata",a=>M.durationUpdate.call(i,a)),H.call(i,i.media,"ended",()=>{i.isHTML5&&i.isVideo&&i.config.resetOnEnd&&(i.restart(),i.pause())}),H.call(i,i.media,"progress playing seeking seeked",a=>M.updateProgress.call(i,a)),H.call(i,i.media,"volumechange",a=>M.updateVolume.call(i,a)),H.call(i,i.media,"playing play pause ended emptied timeupdate",a=>Z.checkPlaying.call(i,a)),H.call(i,i.media,"waiting canplay seeked playing",a=>Z.checkLoading.call(i,a)),i.supported.ui&&i.config.clickToPlay&&!i.isAudio){const a=X.call(i,`.${i.config.classNames.video}`);if(!h.element(a))return;H.call(i,s.container,"click",n=>{([s.container,a].includes(n.target)||a.contains(n.target))&&(i.touch&&i.config.hideControls||(i.ended?(this.proxy(n,i.restart,"restart"),this.proxy(n,()=>{Be(i.play())},"play")):this.proxy(n,()=>{Be(i.togglePlay())},"play")))})}i.supported.ui&&i.config.disableContextMenu&&H.call(i,s.wrapper,"contextmenu",a=>{a.preventDefault()},!1),H.call(i,i.media,"volumechange",()=>{i.storage.set({volume:i.volume,muted:i.muted})}),H.call(i,i.media,"ratechange",()=>{M.updateSetting.call(i,"speed"),i.storage.set({speed:i.speed})}),H.call(i,i.media,"qualitychange",a=>{M.updateSetting.call(i,"quality",null,a.detail.quality)}),H.call(i,i.media,"ready qualitychange",()=>{M.setDownloadUrl.call(i)});const r=i.config.events.concat(["keyup","keydown"]).join(" ");H.call(i,i.media,r,a=>{let{detail:n={}}=a;a.type==="error"&&(n=i.media.error),E.call(i,s.container,a.type,!0,n)})}),_(this,"proxy",(i,s,r)=>{const{player:a}=this,n=a.config.listeners[r];let o=!0;h.function(n)&&(o=n.call(a,i)),o!==!1&&h.function(s)&&s.call(a,i)}),_(this,"bind",(i,s,r,a,n=!0)=>{const{player:o}=this,c=o.config.listeners[a],l=h.function(c);H.call(o,i,s,d=>this.proxy(d,r,a),n&&!l)}),_(this,"controls",()=>{const{player:i}=this,{elements:s}=i,r=re.isIE?"change":"input";if(s.buttons.play&&Array.from(s.buttons.play).forEach(a=>{this.bind(a,"click",()=>{Be(i.togglePlay())},"play")}),this.bind(s.buttons.restart,"click",i.restart,"restart"),this.bind(s.buttons.rewind,"click",()=>{i.lastSeekTime=Date.now(),i.rewind()},"rewind"),this.bind(s.buttons.fastForward,"click",()=>{i.lastSeekTime=Date.now(),i.forward()},"fastForward"),this.bind(s.buttons.mute,"click",()=>{i.muted=!i.muted},"mute"),this.bind(s.buttons.captions,"click",()=>i.toggleCaptions()),this.bind(s.buttons.download,"click",()=>{E.call(i,i.media,"download")},"download"),this.bind(s.buttons.fullscreen,"click",()=>{i.fullscreen.toggle()},"fullscreen"),this.bind(s.buttons.pip,"click",()=>{i.pip="toggle"},"pip"),this.bind(s.buttons.airplay,"click",i.airplay,"airplay"),this.bind(s.buttons.settings,"click",a=>{a.stopPropagation(),a.preventDefault(),M.toggleMenu.call(i,a)},null,!1),this.bind(s.buttons.settings,"keyup",a=>{["Space","Enter"].includes(a.key)&&(a.key!=="Enter"?(a.preventDefault(),a.stopPropagation(),M.toggleMenu.call(i,a)):M.focusFirstMenuItem.call(i,null,!0))},null,!1),this.bind(s.settings.menu,"keydown",a=>{a.key==="Escape"&&M.toggleMenu.call(i,a)}),this.bind(s.inputs.seek,"mousedown mousemove",a=>{const n=s.progress.getBoundingClientRect(),o=100/n.width*(a.pageX-n.left);a.currentTarget.setAttribute("seek-value",o)}),this.bind(s.inputs.seek,"mousedown mouseup keydown keyup touchstart touchend",a=>{const n=a.currentTarget,o="play-on-seeked";if(h.keyboardEvent(a)&&!["ArrowLeft","ArrowRight"].includes(a.key))return;i.lastSeekTime=Date.now();const c=n.hasAttribute(o),l=["mouseup","touchend","keyup"].includes(a.type);c&&l?(n.removeAttribute(o),Be(i.play())):!l&&i.playing&&(n.setAttribute(o,""),i.pause())}),re.isIos){const a=xt.call(i,'input[type="range"]');Array.from(a).forEach(n=>this.bind(n,r,o=>qn(o.target)))}this.bind(s.inputs.seek,r,a=>{const n=a.currentTarget;let o=n.getAttribute("seek-value");h.empty(o)&&(o=n.value),n.removeAttribute("seek-value"),i.currentTime=o/n.max*i.duration},"seek"),this.bind(s.progress,"mouseenter mouseleave mousemove",a=>M.updateSeekTooltip.call(i,a)),this.bind(s.progress,"mousemove touchmove",a=>{const{previewThumbnails:n}=i;n&&n.loaded&&n.startMove(a)}),this.bind(s.progress,"mouseleave touchend click",()=>{const{previewThumbnails:a}=i;a&&a.loaded&&a.endMove(!1,!0)}),this.bind(s.progress,"mousedown touchstart",a=>{const{previewThumbnails:n}=i;n&&n.loaded&&n.startScrubbing(a)}),this.bind(s.progress,"mouseup touchend",a=>{const{previewThumbnails:n}=i;n&&n.loaded&&n.endScrubbing(a)}),re.isWebkit&&Array.from(xt.call(i,'input[type="range"]')).forEach(a=>{this.bind(a,"input",n=>M.updateRangeFill.call(i,n.target))}),i.config.toggleInvert&&!h.element(s.display.duration)&&this.bind(s.display.currentTime,"click",()=>{i.currentTime!==0&&(i.config.invertTime=!i.config.invertTime,M.timeUpdate.call(i))}),this.bind(s.inputs.volume,r,a=>{i.volume=a.target.value},"volume"),this.bind(s.controls,"mouseenter mouseleave",a=>{s.controls.hover=!i.touch&&a.type==="mouseenter"}),s.fullscreen&&Array.from(s.fullscreen.children).filter(a=>!a.contains(s.container)).forEach(a=>{this.bind(a,"mouseenter mouseleave",n=>{s.controls&&(s.controls.hover=!i.touch&&n.type==="mouseenter")})}),this.bind(s.controls,"mousedown mouseup touchstart touchend touchcancel",a=>{s.controls.pressed=["mousedown","touchstart"].includes(a.type)}),this.bind(s.controls,"focusin",()=>{const{config:a,timers:n}=i;W(s.controls,a.classNames.noTransition,!0),Z.toggleControls.call(i,!0),setTimeout(()=>{W(s.controls,a.classNames.noTransition,!1)},0);const o=this.touch?3e3:4e3;clearTimeout(n.controls),n.controls=setTimeout(()=>Z.toggleControls.call(i,!1),o)}),this.bind(s.inputs.volume,"wheel",a=>{const n=a.webkitDirectionInvertedFromDevice,[o,c]=[a.deltaX,-a.deltaY].map(u=>n?-u:u),l=Math.sign(Math.abs(o)>Math.abs(c)?o:c);i.increaseVolume(l/50);const{volume:d}=i.media;(l===1&&d<1||l===-1&&d>0)&&a.preventDefault()},"volume",!1)}),this.player=e,this.lastKey=null,this.focusTimer=null,this.lastKeyDown=null,this.handleKey=this.handleKey.bind(this),this.toggleMenu=this.toggleMenu.bind(this),this.setTabFocus=this.setTabFocus.bind(this),this.firstTouch=this.firstTouch.bind(this)}handleKey(e){const{player:i}=this,{elements:s}=i,{key:r,type:a,altKey:n,ctrlKey:o,metaKey:c,shiftKey:l}=e,d=a==="keydown",u=d&&r===this.lastKey;if(!(n||o||c||l)&&!!r){if(d){const m=document.activeElement;if(h.element(m)){const{editable:g}=i.config.selectors,{seek:f}=s.inputs;if(m!==f&&ht(m,g)||e.key==="Space"&&ht(m,'button, [role^="menuitem"]'))return}switch(["Space","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","0","1","2","3","4","5","6","7","8","9","c","f","k","l","m"].includes(r)&&(e.preventDefault(),e.stopPropagation()),r){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":u||(p=parseInt(r,10),i.currentTime=i.duration/10*p);break;case"Space":case"k":u||Be(i.togglePlay());break;case"ArrowUp":i.increaseVolume(.1);break;case"ArrowDown":i.decreaseVolume(.1);break;case"m":u||(i.muted=!i.muted);break;case"ArrowRight":i.forward();break;case"ArrowLeft":i.rewind();break;case"f":i.fullscreen.toggle();break;case"c":u||i.toggleCaptions();break;case"l":i.loop=!i.loop}r==="Escape"&&!i.fullscreen.usingNative&&i.fullscreen.active&&i.fullscreen.toggle(),this.lastKey=r}else this.lastKey=null;var p}}toggleMenu(e){M.toggleMenu.call(this.player,e)}}function np(t,e){return t(e={exports:{}},e.exports),e.exports}var op=np(function(t,e){t.exports=function(){var i=function(){},s={},r={},a={};function n(p,m){p=p.push?p:[p];var g,f,b,v=[],x=p.length,y=x;for(g=function(k,z){z.length&&v.push(k),--y||m(v)};x--;)f=p[x],(b=r[f])?g(f,b):(a[f]=a[f]||[]).push(g)}function o(p,m){if(p){var g=a[p];if(r[p]=m,g)for(;g.length;)g[0](p,m),g.splice(0,1)}}function c(p,m){p.call&&(p={success:p}),m.length?(p.error||i)(m):(p.success||i)(p)}function l(p,m,g,f){var b,v,x=document,y=g.async,k=(g.numRetries||0)+1,z=g.before||i,T=p.replace(/[\?|#].*$/,""),O=p.replace(/^(css|img)!/,"");f=f||0,/(^css!|\.css$)/.test(T)?((v=x.createElement("link")).rel="stylesheet",v.href=O,(b="hideFocus"in v)&&v.relList&&(b=0,v.rel="preload",v.as="style")):/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(T)?(v=x.createElement("img")).src=O:((v=x.createElement("script")).src=p,v.async=y===void 0||y),v.onload=v.onerror=v.onbeforeload=function(te){var G=te.type[0];if(b)try{v.sheet.cssText.length||(G="e")}catch(xe){xe.code!=18&&(G="e")}if(G=="e"){if((f+=1)<k)return l(p,m,g,f)}else if(v.rel=="preload"&&v.as=="style")return v.rel="stylesheet";m(p,G,te.defaultPrevented)},z(p,v)!==!1&&x.head.appendChild(v)}function d(p,m,g){var f,b,v=(p=p.push?p:[p]).length,x=v,y=[];for(f=function(k,z,T){if(z=="e"&&y.push(k),z=="b"){if(!T)return;y.push(k)}--v||m(y)},b=0;b<x;b++)l(p[b],f,g)}function u(p,m,g){var f,b;if(m&&m.trim&&(f=m),b=(f?g:m)||{},f){if(f in s)throw"LoadJS";s[f]=!0}function v(x,y){d(p,function(k){c(b,k),x&&c({success:x,error:y},k),o(f,k)},b)}if(b.returnPromise)return new Promise(v);v()}return u.ready=function(p,m){return n(p,function(g){c(m,g)}),u},u.done=function(p){o(p,[])},u.reset=function(){s={},r={},a={}},u.isDefined=function(p){return p in s},u}()});function dr(t){return new Promise((e,i)=>{op(t,{success:e,error:i})})}function lp(t){return h.empty(t)?null:h.number(Number(t))?t:t.match(/^.*(vimeo.com\/|video\/)(\d+).*/)?RegExp.$2:t}function cp(t){const e=t.match(/^.*(vimeo.com\/|video\/)(\d+)(\?.*&*h=|\/)+([\d,a-f]+)/);return e&&e.length===5?e[4]:null}function Et(t){t&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===t&&(this.media.paused=!t,E.call(this,this.media,t?"play":"pause"))}const Ps={setup(){const t=this;W(t.elements.wrapper,t.config.classNames.embed,!0),t.options.speed=t.config.speed.options,It.call(t),h.object(window.Vimeo)?Ps.ready.call(t):dr(t.config.urls.vimeo.sdk).then(()=>{Ps.ready.call(t)}).catch(e=>{t.debug.warn("Vimeo SDK (player.js) failed to load",e)})},ready(){const t=this,e=t.config.vimeo,x=e,{premium:i,referrerPolicy:s}=x,r=wr(x,["premium","referrerPolicy"]);let a=t.media.getAttribute("src"),n="";h.empty(a)?(a=t.media.getAttribute(t.config.attributes.embed.id),n=t.media.getAttribute(t.config.attributes.embed.hash)):n=cp(a);const o=n?{h:n}:{};i&&Object.assign(r,{controls:!1,sidedock:!1});const c=oo(R(R({loop:t.config.loop.active,autoplay:t.autoplay,muted:t.muted,gesture:"media",playsinline:!this.config.fullscreen.iosNative},o),r)),l=lp(a),d=N("iframe"),u=Es(t.config.urls.vimeo.iframe,l,c);if(d.setAttribute("src",u),d.setAttribute("allowfullscreen",""),d.setAttribute("allow",["autoplay","fullscreen","picture-in-picture","encrypted-media","accelerometer","gyroscope"].join("; ")),h.empty(s)||d.setAttribute("referrerPolicy",s),i||!e.customControls)d.setAttribute("data-poster",t.poster),t.media=Ai(d,t.media);else{const y=N("div",{class:t.config.classNames.embedContainer,"data-poster":t.poster});y.appendChild(d),t.media=Ai(y,t.media)}e.customControls||ri(Es(t.config.urls.vimeo.api,u)).then(y=>{!h.empty(y)&&y.thumbnail_url&&Z.setPoster.call(t,y.thumbnail_url).catch(()=>{})}),t.embed=new window.Vimeo.Player(d,{autopause:t.config.autopause,muted:t.muted}),t.media.paused=!0,t.media.currentTime=0,t.supported.ui&&t.embed.disableTextTrack(),t.media.play=()=>(Et.call(t,!0),t.embed.play()),t.media.pause=()=>(Et.call(t,!1),t.embed.pause()),t.media.stop=()=>{t.pause(),t.currentTime=0};let{currentTime:p}=t.media;Object.defineProperty(t.media,"currentTime",{get:()=>p,set(y){const{embed:k,media:z,paused:T,volume:O}=t,te=T&&!k.hasPlayed;z.seeking=!0,E.call(t,z,"seeking"),Promise.resolve(te&&k.setVolume(0)).then(()=>k.setCurrentTime(y)).then(()=>te&&k.pause()).then(()=>te&&k.setVolume(O)).catch(()=>{})}});let m=t.config.speed.selected;Object.defineProperty(t.media,"playbackRate",{get:()=>m,set(y){t.embed.setPlaybackRate(y).then(()=>{m=y,E.call(t,t.media,"ratechange")}).catch(()=>{t.options.speed=[1]})}});let{volume:g}=t.config;Object.defineProperty(t.media,"volume",{get:()=>g,set(y){t.embed.setVolume(y).then(()=>{g=y,E.call(t,t.media,"volumechange")})}});let{muted:f}=t.config;Object.defineProperty(t.media,"muted",{get:()=>f,set(y){const k=!!h.boolean(y)&&y;t.embed.setVolume(k?0:t.config.volume).then(()=>{f=k,E.call(t,t.media,"volumechange")})}});let b,{loop:v}=t.config;Object.defineProperty(t.media,"loop",{get:()=>v,set(y){const k=h.boolean(y)?y:t.config.loop.active;t.embed.setLoop(k).then(()=>{v=k})}}),t.embed.getVideoUrl().then(y=>{b=y,M.setDownloadUrl.call(t)}).catch(y=>{this.debug.warn(y)}),Object.defineProperty(t.media,"currentSrc",{get:()=>b}),Object.defineProperty(t.media,"ended",{get:()=>t.currentTime===t.duration}),Promise.all([t.embed.getVideoWidth(),t.embed.getVideoHeight()]).then(y=>{const[k,z]=y;t.embed.ratio=io(k,z),It.call(this)}),t.embed.setAutopause(t.config.autopause).then(y=>{t.config.autopause=y}),t.embed.getVideoTitle().then(y=>{t.config.title=y,Z.setTitle.call(this)}),t.embed.getCurrentTime().then(y=>{p=y,E.call(t,t.media,"timeupdate")}),t.embed.getDuration().then(y=>{t.media.duration=y,E.call(t,t.media,"durationchange")}),t.embed.getTextTracks().then(y=>{t.media.textTracks=y,F.setup.call(t)}),t.embed.on("cuechange",({cues:y=[]})=>{const k=y.map(z=>ep(z.text));F.updateCues.call(t,k)}),t.embed.on("loaded",()=>{t.embed.getPaused().then(y=>{Et.call(t,!y),y||E.call(t,t.media,"playing")}),h.element(t.embed.element)&&t.supported.ui&&t.embed.element.setAttribute("tabindex",-1)}),t.embed.on("bufferstart",()=>{E.call(t,t.media,"waiting")}),t.embed.on("bufferend",()=>{E.call(t,t.media,"playing")}),t.embed.on("play",()=>{Et.call(t,!0),E.call(t,t.media,"playing")}),t.embed.on("pause",()=>{Et.call(t,!1)}),t.embed.on("timeupdate",y=>{t.media.seeking=!1,p=y.seconds,E.call(t,t.media,"timeupdate")}),t.embed.on("progress",y=>{t.media.buffered=y.percent,E.call(t,t.media,"progress"),parseInt(y.percent,10)===1&&E.call(t,t.media,"canplaythrough"),t.embed.getDuration().then(k=>{k!==t.media.duration&&(t.media.duration=k,E.call(t,t.media,"durationchange"))})}),t.embed.on("seeked",()=>{t.media.seeking=!1,E.call(t,t.media,"seeked")}),t.embed.on("ended",()=>{t.media.paused=!0,E.call(t,t.media,"ended")}),t.embed.on("error",y=>{t.media.error=y,E.call(t,t.media,"error")}),e.customControls&&setTimeout(()=>Z.build.call(t),0)}};function hp(t){return h.empty(t)?null:t.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)?RegExp.$2:t}function Pt(t){t&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===t&&(this.media.paused=!t,E.call(this,this.media,t?"play":"pause"))}function dp(t){return t.noCookie?"https://www.youtube-nocookie.com":window.location.protocol==="http:"?"http://www.youtube.com":void 0}const xi={setup(){if(W(this.elements.wrapper,this.config.classNames.embed,!0),h.object(window.YT)&&h.function(window.YT.Player))xi.ready.call(this);else{const t=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=()=>{h.function(t)&&t(),xi.ready.call(this)},dr(this.config.urls.youtube.sdk).catch(e=>{this.debug.warn("YouTube API failed to load",e)})}},getTitle(t){ri(Es(this.config.urls.youtube.api,t)).then(e=>{if(h.object(e)){const{title:i,height:s,width:r}=e;this.config.title=i,Z.setTitle.call(this),this.embed.ratio=io(r,s)}It.call(this)}).catch(()=>{It.call(this)})},ready(){const t=this,e=t.config.youtube,i=t.media&&t.media.getAttribute("id");if(!h.empty(i)&&i.startsWith("youtube-"))return;let s=t.media.getAttribute("src");h.empty(s)&&(s=t.media.getAttribute(this.config.attributes.embed.id));const r=hp(s),a=N("div",{id:qu(t.provider),"data-poster":e.customControls?t.poster:void 0});if(t.media=Ai(a,t.media),e.customControls){const n=o=>`https://i.ytimg.com/vi/${r}/${o}default.jpg`;vi(n("maxres"),121).catch(()=>vi(n("sd"),121)).catch(()=>vi(n("hq"))).then(o=>Z.setPoster.call(t,o.src)).then(o=>{o.includes("maxres")||(t.elements.poster.style.backgroundSize="cover")}).catch(()=>{})}t.embed=new window.YT.Player(t.media,{videoId:r,host:dp(e),playerVars:J({},{autoplay:t.config.autoplay?1:0,hl:t.config.hl,controls:t.supported.ui&&e.customControls?0:1,disablekb:1,playsinline:t.config.fullscreen.iosNative?0:1,cc_load_policy:t.captions.active?1:0,cc_lang_pref:t.config.captions.language,widget_referrer:window?window.location.href:null},e),events:{onError(n){if(!t.media.error){const o=n.data,c={2:"The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.",5:"The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.",100:"The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.",101:"The owner of the requested video does not allow it to be played in embedded players.",150:"The owner of the requested video does not allow it to be played in embedded players."}[o]||"An unknown error occured";t.media.error={code:o,message:c},E.call(t,t.media,"error")}},onPlaybackRateChange(n){const o=n.target;t.media.playbackRate=o.getPlaybackRate(),E.call(t,t.media,"ratechange")},onReady(n){if(h.function(t.media.play))return;const o=n.target;xi.getTitle.call(t,r),t.media.play=()=>{Pt.call(t,!0),o.playVideo()},t.media.pause=()=>{Pt.call(t,!1),o.pauseVideo()},t.media.stop=()=>{o.stopVideo()},t.media.duration=o.getDuration(),t.media.paused=!0,t.media.currentTime=0,Object.defineProperty(t.media,"currentTime",{get:()=>Number(o.getCurrentTime()),set(u){t.paused&&!t.embed.hasPlayed&&t.embed.mute(),t.media.seeking=!0,E.call(t,t.media,"seeking"),o.seekTo(u)}}),Object.defineProperty(t.media,"playbackRate",{get:()=>o.getPlaybackRate(),set(u){o.setPlaybackRate(u)}});let{volume:c}=t.config;Object.defineProperty(t.media,"volume",{get:()=>c,set(u){c=u,o.setVolume(100*c),E.call(t,t.media,"volumechange")}});let{muted:l}=t.config;Object.defineProperty(t.media,"muted",{get:()=>l,set(u){const p=h.boolean(u)?u:l;l=p,o[p?"mute":"unMute"](),o.setVolume(100*c),E.call(t,t.media,"volumechange")}}),Object.defineProperty(t.media,"currentSrc",{get:()=>o.getVideoUrl()}),Object.defineProperty(t.media,"ended",{get:()=>t.currentTime===t.duration});const d=o.getAvailablePlaybackRates();t.options.speed=d.filter(u=>t.config.speed.options.includes(u)),t.supported.ui&&e.customControls&&t.media.setAttribute("tabindex",-1),E.call(t,t.media,"timeupdate"),E.call(t,t.media,"durationchange"),clearInterval(t.timers.buffering),t.timers.buffering=setInterval(()=>{t.media.buffered=o.getVideoLoadedFraction(),(t.media.lastBuffered===null||t.media.lastBuffered<t.media.buffered)&&E.call(t,t.media,"progress"),t.media.lastBuffered=t.media.buffered,t.media.buffered===1&&(clearInterval(t.timers.buffering),E.call(t,t.media,"canplaythrough"))},200),e.customControls&&setTimeout(()=>Z.build.call(t),50)},onStateChange(n){const o=n.target;switch(clearInterval(t.timers.playing),t.media.seeking&&[1,2].includes(n.data)&&(t.media.seeking=!1,E.call(t,t.media,"seeked")),n.data){case-1:E.call(t,t.media,"timeupdate"),t.media.buffered=o.getVideoLoadedFraction(),E.call(t,t.media,"progress");break;case 0:Pt.call(t,!1),t.media.loop?(o.stopVideo(),o.playVideo()):E.call(t,t.media,"ended");break;case 1:e.customControls&&!t.config.autoplay&&t.media.paused&&!t.embed.hasPlayed?t.media.pause():(Pt.call(t,!0),E.call(t,t.media,"playing"),t.timers.playing=setInterval(()=>{E.call(t,t.media,"timeupdate")},50),t.media.duration!==o.getDuration()&&(t.media.duration=o.getDuration(),E.call(t,t.media,"durationchange")));break;case 2:t.muted||t.embed.unMute(),Pt.call(t,!1);break;case 3:E.call(t,t.media,"waiting")}E.call(t,t.elements.container,"statechange",!1,{code:n.data})}}})}},co={setup(){this.media?(W(this.elements.container,this.config.classNames.type.replace("{0}",this.type),!0),W(this.elements.container,this.config.classNames.provider.replace("{0}",this.provider),!0),this.isEmbed&&W(this.elements.container,this.config.classNames.type.replace("{0}","video"),!0),this.isVideo&&(this.elements.wrapper=N("div",{class:this.config.classNames.video}),Xn(this.media,this.elements.wrapper),this.elements.poster=N("div",{class:this.config.classNames.poster}),this.elements.wrapper.appendChild(this.elements.poster)),this.isHTML5?Ke.setup.call(this):this.isYouTube?xi.setup.call(this):this.isVimeo&&Ps.setup.call(this)):this.debug.warn("No media element found!")}};class up{constructor(e){_(this,"load",()=>{this.enabled&&(h.object(window.google)&&h.object(window.google.ima)?this.ready():dr(this.player.config.urls.googleIMA.sdk).then(()=>{this.ready()}).catch(()=>{this.trigger("error",new Error("Google IMA SDK failed to load"))}))}),_(this,"ready",()=>{var i;this.enabled||((i=this).manager&&i.manager.destroy(),i.elements.displayContainer&&i.elements.displayContainer.destroy(),i.elements.container.remove()),this.startSafetyTimer(12e3,"ready()"),this.managerPromise.then(()=>{this.clearSafetyTimer("onAdsManagerLoaded()")}),this.listeners(),this.setupIMA()}),_(this,"setupIMA",()=>{this.elements.container=N("div",{class:this.player.config.classNames.ads}),this.player.elements.container.appendChild(this.elements.container),google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),google.ima.settings.setLocale(this.player.config.ads.language),google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.player.config.playsinline),this.elements.displayContainer=new google.ima.AdDisplayContainer(this.elements.container,this.player.media),this.loader=new google.ima.AdsLoader(this.elements.displayContainer),this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,i=>this.onAdsManagerLoaded(i),!1),this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,i=>this.onAdError(i),!1),this.requestAds()}),_(this,"requestAds",()=>{const{container:i}=this.player.elements;try{const s=new google.ima.AdsRequest;s.adTagUrl=this.tagUrl,s.linearAdSlotWidth=i.offsetWidth,s.linearAdSlotHeight=i.offsetHeight,s.nonLinearAdSlotWidth=i.offsetWidth,s.nonLinearAdSlotHeight=i.offsetHeight,s.forceNonLinearFullSlot=!1,s.setAdWillPlayMuted(!this.player.muted),this.loader.requestAds(s)}catch(s){this.onAdError(s)}}),_(this,"pollCountdown",(i=!1)=>{if(!i)return clearInterval(this.countdownTimer),void this.elements.container.removeAttribute("data-badge-text");this.countdownTimer=setInterval(()=>{const s=Wi(Math.max(this.manager.getRemainingTime(),0)),r=`${K.get("advertisement",this.player.config)} - ${s}`;this.elements.container.setAttribute("data-badge-text",r)},100)}),_(this,"onAdsManagerLoaded",i=>{if(!this.enabled)return;const s=new google.ima.AdsRenderingSettings;s.restoreCustomPlaybackStateOnAdBreakComplete=!0,s.enablePreloading=!0,this.manager=i.getAdsManager(this.player,s),this.cuePoints=this.manager.getCuePoints(),this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,r=>this.onAdError(r)),Object.keys(google.ima.AdEvent.Type).forEach(r=>{this.manager.addEventListener(google.ima.AdEvent.Type[r],a=>this.onAdEvent(a))}),this.trigger("loaded")}),_(this,"addCuePoints",()=>{h.empty(this.cuePoints)||this.cuePoints.forEach(i=>{if(i!==0&&i!==-1&&i<this.player.duration){const s=this.player.elements.progress;if(h.element(s)){const r=100/this.player.duration*i,a=N("span",{class:this.player.config.classNames.cues});a.style.left=`${r.toString()}%`,s.appendChild(a)}}})}),_(this,"onAdEvent",i=>{const{container:s}=this.player.elements,r=i.getAd(),a=i.getAdData();switch((n=>{E.call(this.player,this.player.media,`ads${n.replace(/_/g,"").toLowerCase()}`)})(i.type),i.type){case google.ima.AdEvent.Type.LOADED:this.trigger("loaded"),this.pollCountdown(!0),r.isLinear()||(r.width=s.offsetWidth,r.height=s.offsetHeight);break;case google.ima.AdEvent.Type.STARTED:this.manager.setVolume(this.player.volume);break;case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:this.player.ended?this.loadAds():this.loader.contentComplete();break;case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:this.pauseContent();break;case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:this.pollCountdown(),this.resumeContent();break;case google.ima.AdEvent.Type.LOG:a.adError&&this.player.debug.warn(`Non-fatal ad error: ${a.adError.getMessage()}`)}}),_(this,"onAdError",i=>{this.cancel(),this.player.debug.warn("Ads error",i)}),_(this,"listeners",()=>{const{container:i}=this.player.elements;let s;this.player.on("canplay",()=>{this.addCuePoints()}),this.player.on("ended",()=>{this.loader.contentComplete()}),this.player.on("timeupdate",()=>{s=this.player.currentTime}),this.player.on("seeked",()=>{const r=this.player.currentTime;h.empty(this.cuePoints)||this.cuePoints.forEach((a,n)=>{s<a&&a<r&&(this.manager.discardAdBreak(),this.cuePoints.splice(n,1))})}),window.addEventListener("resize",()=>{this.manager&&this.manager.resize(i.offsetWidth,i.offsetHeight,google.ima.ViewMode.NORMAL)})}),_(this,"play",()=>{const{container:i}=this.player.elements;this.managerPromise||this.resumeContent(),this.managerPromise.then(()=>{this.manager.setVolume(this.player.volume),this.elements.displayContainer.initialize();try{this.initialized||(this.manager.init(i.offsetWidth,i.offsetHeight,google.ima.ViewMode.NORMAL),this.manager.start()),this.initialized=!0}catch(s){this.onAdError(s)}}).catch(()=>{})}),_(this,"resumeContent",()=>{this.elements.container.style.zIndex="",this.playing=!1,Be(this.player.media.play())}),_(this,"pauseContent",()=>{this.elements.container.style.zIndex=3,this.playing=!0,this.player.media.pause()}),_(this,"cancel",()=>{this.initialized&&this.resumeContent(),this.trigger("error"),this.loadAds()}),_(this,"loadAds",()=>{this.managerPromise.then(()=>{this.manager&&this.manager.destroy(),this.managerPromise=new Promise(i=>{this.on("loaded",i),this.player.debug.log(this.manager)}),this.initialized=!1,this.requestAds()}).catch(()=>{})}),_(this,"trigger",(i,...s)=>{const r=this.events[i];h.array(r)&&r.forEach(a=>{h.function(a)&&a.apply(this,s)})}),_(this,"on",(i,s)=>(h.array(this.events[i])||(this.events[i]=[]),this.events[i].push(s),this)),_(this,"startSafetyTimer",(i,s)=>{this.player.debug.log(`Safety timer invoked from: ${s}`),this.safetyTimer=setTimeout(()=>{this.cancel(),this.clearSafetyTimer("startSafetyTimer()")},i)}),_(this,"clearSafetyTimer",i=>{h.nullOrUndefined(this.safetyTimer)||(this.player.debug.log(`Safety timer cleared from: ${i}`),clearTimeout(this.safetyTimer),this.safetyTimer=null)}),this.player=e,this.config=e.config.ads,this.playing=!1,this.initialized=!1,this.elements={container:null,displayContainer:null},this.manager=null,this.loader=null,this.cuePoints=null,this.events={},this.safetyTimer=null,this.countdownTimer=null,this.managerPromise=new Promise((i,s)=>{this.on("loaded",i),this.on("error",s)}),this.load()}get enabled(){const{config:e}=this;return this.player.isHTML5&&this.player.isVideo&&e.enabled&&(!h.empty(e.publisherId)||h.url(e.tagUrl))}get tagUrl(){const{config:e}=this;return h.url(e.tagUrl)?e.tagUrl:`https://go.aniview.com/api/adserver6/vast/?${oo({AV_PUBLISHERID:"58c25bb0073ef448b1087ad6",AV_CHANNELID:"5a0458dc28a06145e4519d21",AV_URL:window.location.hostname,cb:Date.now(),AV_WIDTH:640,AV_HEIGHT:480,AV_CDIM2:e.publisherId})}`}}function ho(t=0,e=0,i=255){return Math.min(Math.max(t,e),i)}const pp=t=>{const e=[];return t.split(/\r\n\r\n|\n\n|\r\r/).forEach(i=>{const s={};i.split(/\r\n|\n|\r/).forEach(r=>{if(h.number(s.startTime)){if(!h.empty(r.trim())&&h.empty(s.text)){const a=r.trim().split("#xywh=");[s.text]=a,a[1]&&([s.x,s.y,s.w,s.h]=a[1].split(","))}}else{const a=r.match(/([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})( ?--> ?)([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})/);a&&(s.startTime=60*Number(a[1]||0)*60+60*Number(a[2])+Number(a[3])+Number(`0.${a[4]}`),s.endTime=60*Number(a[6]||0)*60+60*Number(a[7])+Number(a[8])+Number(`0.${a[9]}`))}}),s.text&&e.push(s)}),e},la=(t,e)=>{const i={};return t>e.width/e.height?(i.width=e.width,i.height=1/t*e.width):(i.height=e.height,i.width=t*e.height),i};class zs{constructor(e){_(this,"load",()=>{this.player.elements.display.seekTooltip&&(this.player.elements.display.seekTooltip.hidden=this.enabled),this.enabled&&this.getThumbnails().then(()=>{this.enabled&&(this.render(),this.determineContainerAutoSizing(),this.loaded=!0)})}),_(this,"getThumbnails",()=>new Promise(i=>{const{src:s}=this.player.config.previewThumbnails;if(h.empty(s))throw new Error("Missing previewThumbnails.src config attribute");const r=()=>{this.thumbnails.sort((a,n)=>a.height-n.height),this.player.debug.log("Preview thumbnails",this.thumbnails),i()};if(h.function(s))s(a=>{this.thumbnails=a,r()});else{const a=(h.string(s)?[s]:s).map(n=>this.getThumbnail(n));Promise.all(a).then(r)}})),_(this,"getThumbnail",i=>new Promise(s=>{ri(i).then(r=>{const a={frames:pp(r),height:null,urlPrefix:""};a.frames[0].text.startsWith("/")||a.frames[0].text.startsWith("http://")||a.frames[0].text.startsWith("https://")||(a.urlPrefix=i.substring(0,i.lastIndexOf("/")+1));const n=new Image;n.onload=()=>{a.height=n.naturalHeight,a.width=n.naturalWidth,this.thumbnails.push(a),s()},n.src=a.urlPrefix+a.frames[0].text})})),_(this,"startMove",i=>{if(this.loaded&&h.event(i)&&["touchmove","mousemove"].includes(i.type)&&this.player.media.duration){if(i.type==="touchmove")this.seekTime=this.player.media.duration*(this.player.elements.inputs.seek.value/100);else{var s,r;const a=this.player.elements.progress.getBoundingClientRect(),n=100/a.width*(i.pageX-a.left);this.seekTime=this.player.media.duration*(n/100),this.seekTime<0&&(this.seekTime=0),this.seekTime>this.player.media.duration-1&&(this.seekTime=this.player.media.duration-1),this.mousePosX=i.pageX,this.elements.thumb.time.innerText=Wi(this.seekTime);const o=(s=this.player.config.markers)===null||s===void 0||(r=s.points)===null||r===void 0?void 0:r.find(({time:c})=>c===Math.round(this.seekTime));o&&this.elements.thumb.time.insertAdjacentHTML("afterbegin",`${o.label}<br>`)}this.showImageAtCurrentTime()}}),_(this,"endMove",()=>{this.toggleThumbContainer(!1,!0)}),_(this,"startScrubbing",i=>{(h.nullOrUndefined(i.button)||i.button===!1||i.button===0)&&(this.mouseDown=!0,this.player.media.duration&&(this.toggleScrubbingContainer(!0),this.toggleThumbContainer(!1,!0),this.showImageAtCurrentTime()))}),_(this,"endScrubbing",()=>{this.mouseDown=!1,Math.ceil(this.lastTime)===Math.ceil(this.player.media.currentTime)?this.toggleScrubbingContainer(!1):cr.call(this.player,this.player.media,"timeupdate",()=>{this.mouseDown||this.toggleScrubbingContainer(!1)})}),_(this,"listeners",()=>{this.player.on("play",()=>{this.toggleThumbContainer(!1,!0)}),this.player.on("seeked",()=>{this.toggleThumbContainer(!1)}),this.player.on("timeupdate",()=>{this.lastTime=this.player.media.currentTime})}),_(this,"render",()=>{this.elements.thumb.container=N("div",{class:this.player.config.classNames.previewThumbnails.thumbContainer}),this.elements.thumb.imageContainer=N("div",{class:this.player.config.classNames.previewThumbnails.imageContainer}),this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);const i=N("div",{class:this.player.config.classNames.previewThumbnails.timeContainer});this.elements.thumb.time=N("span",{},"00:00"),i.appendChild(this.elements.thumb.time),this.elements.thumb.imageContainer.appendChild(i),h.element(this.player.elements.progress)&&this.player.elements.progress.appendChild(this.elements.thumb.container),this.elements.scrubbing.container=N("div",{class:this.player.config.classNames.previewThumbnails.scrubbingContainer}),this.player.elements.wrapper.appendChild(this.elements.scrubbing.container)}),_(this,"destroy",()=>{this.elements.thumb.container&&this.elements.thumb.container.remove(),this.elements.scrubbing.container&&this.elements.scrubbing.container.remove()}),_(this,"showImageAtCurrentTime",()=>{this.mouseDown?this.setScrubbingContainerSize():this.setThumbContainerSizeAndPos();const i=this.thumbnails[0].frames.findIndex(a=>this.seekTime>=a.startTime&&this.seekTime<=a.endTime),s=i>=0;let r=0;this.mouseDown||this.toggleThumbContainer(s),s&&(this.thumbnails.forEach((a,n)=>{this.loadedImages.includes(a.frames[i].text)&&(r=n)}),i!==this.showingThumb&&(this.showingThumb=i,this.loadImage(r)))}),_(this,"loadImage",(i=0)=>{const s=this.showingThumb,r=this.thumbnails[i],{urlPrefix:a}=r,n=r.frames[s],o=r.frames[s].text,c=a+o;if(this.currentImageElement&&this.currentImageElement.dataset.filename===o)this.showImage(this.currentImageElement,n,i,s,o,!1),this.currentImageElement.dataset.index=s,this.removeOldImages(this.currentImageElement);else{this.loadingImage&&this.usingSprites&&(this.loadingImage.onload=null);const l=new Image;l.src=c,l.dataset.index=s,l.dataset.filename=o,this.showingThumbFilename=o,this.player.debug.log(`Loading image: ${c}`),l.onload=()=>this.showImage(l,n,i,s,o,!0),this.loadingImage=l,this.removeOldImages(l)}}),_(this,"showImage",(i,s,r,a,n,o=!0)=>{this.player.debug.log(`Showing thumb: ${n}. num: ${a}. qual: ${r}. newimg: ${o}`),this.setImageSizeAndOffset(i,s),o&&(this.currentImageContainer.appendChild(i),this.currentImageElement=i,this.loadedImages.includes(n)||this.loadedImages.push(n)),this.preloadNearby(a,!0).then(this.preloadNearby(a,!1)).then(this.getHigherQuality(r,i,s,n))}),_(this,"removeOldImages",i=>{Array.from(this.currentImageContainer.children).forEach(s=>{if(s.tagName.toLowerCase()!=="img")return;const r=this.usingSprites?500:1e3;if(s.dataset.index!==i.dataset.index&&!s.dataset.deleting){s.dataset.deleting=!0;const{currentImageContainer:a}=this;setTimeout(()=>{a.removeChild(s),this.player.debug.log(`Removing thumb: ${s.dataset.filename}`)},r)}})}),_(this,"preloadNearby",(i,s=!0)=>new Promise(r=>{setTimeout(()=>{const a=this.thumbnails[0].frames[i].text;if(this.showingThumbFilename===a){let n;n=s?this.thumbnails[0].frames.slice(i):this.thumbnails[0].frames.slice(0,i).reverse();let o=!1;n.forEach(c=>{const l=c.text;if(l!==a&&!this.loadedImages.includes(l)){o=!0,this.player.debug.log(`Preloading thumb filename: ${l}`);const{urlPrefix:d}=this.thumbnails[0],u=d+l,p=new Image;p.src=u,p.onload=()=>{this.player.debug.log(`Preloaded thumb filename: ${l}`),this.loadedImages.includes(l)||this.loadedImages.push(l),r()}}}),o||r()}},300)})),_(this,"getHigherQuality",(i,s,r,a)=>{if(i<this.thumbnails.length-1){let n=s.naturalHeight;this.usingSprites&&(n=r.h),n<this.thumbContainerHeight&&setTimeout(()=>{this.showingThumbFilename===a&&(this.player.debug.log(`Showing higher quality thumb for: ${a}`),this.loadImage(i+1))},300)}}),_(this,"toggleThumbContainer",(i=!1,s=!1)=>{const r=this.player.config.classNames.previewThumbnails.thumbContainerShown;this.elements.thumb.container.classList.toggle(r,i),!i&&s&&(this.showingThumb=null,this.showingThumbFilename=null)}),_(this,"toggleScrubbingContainer",(i=!1)=>{const s=this.player.config.classNames.previewThumbnails.scrubbingContainerShown;this.elements.scrubbing.container.classList.toggle(s,i),i||(this.showingThumb=null,this.showingThumbFilename=null)}),_(this,"determineContainerAutoSizing",()=>{(this.elements.thumb.imageContainer.clientHeight>20||this.elements.thumb.imageContainer.clientWidth>20)&&(this.sizeSpecifiedInCSS=!0)}),_(this,"setThumbContainerSizeAndPos",()=>{const{imageContainer:i}=this.elements.thumb;if(this.sizeSpecifiedInCSS){if(i.clientHeight>20&&i.clientWidth<20){const s=Math.floor(i.clientHeight*this.thumbAspectRatio);i.style.width=`${s}px`}else if(i.clientHeight<20&&i.clientWidth>20){const s=Math.floor(i.clientWidth/this.thumbAspectRatio);i.style.height=`${s}px`}}else{const s=Math.floor(this.thumbContainerHeight*this.thumbAspectRatio);i.style.height=`${this.thumbContainerHeight}px`,i.style.width=`${s}px`}this.setThumbContainerPos()}),_(this,"setThumbContainerPos",()=>{const i=this.player.elements.progress.getBoundingClientRect(),s=this.player.elements.container.getBoundingClientRect(),{container:r}=this.elements.thumb,a=s.left-i.left+10,n=s.right-i.left-r.clientWidth-10,o=this.mousePosX-i.left-r.clientWidth/2,c=ho(o,a,n);r.style.left=`${c}px`,r.style.setProperty("--preview-arrow-offset",o-c+"px")}),_(this,"setScrubbingContainerSize",()=>{const{width:i,height:s}=la(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});this.elements.scrubbing.container.style.width=`${i}px`,this.elements.scrubbing.container.style.height=`${s}px`}),_(this,"setImageSizeAndOffset",(i,s)=>{if(!this.usingSprites)return;const r=this.thumbContainerHeight/s.h;i.style.height=i.naturalHeight*r+"px",i.style.width=i.naturalWidth*r+"px",i.style.left=`-${s.x*r}px`,i.style.top=`-${s.y*r}px`}),this.player=e,this.thumbnails=[],this.loaded=!1,this.lastMouseMoveTime=Date.now(),this.mouseDown=!1,this.loadedImages=[],this.elements={thumb:{},scrubbing:{}},this.load()}get enabled(){return this.player.isHTML5&&this.player.isVideo&&this.player.config.previewThumbnails.enabled}get currentImageContainer(){return this.mouseDown?this.elements.scrubbing.container:this.elements.thumb.imageContainer}get usingSprites(){return Object.keys(this.thumbnails[0].frames[0]).includes("w")}get thumbAspectRatio(){return this.usingSprites?this.thumbnails[0].frames[0].w/this.thumbnails[0].frames[0].h:this.thumbnails[0].width/this.thumbnails[0].height}get thumbContainerHeight(){if(this.mouseDown){const{height:e}=la(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});return e}return this.sizeSpecifiedInCSS?this.elements.thumb.imageContainer.clientHeight:Math.floor(this.player.media.clientWidth/this.thumbAspectRatio/4)}get currentImageElement(){return this.mouseDown?this.currentScrubbingImageElement:this.currentThumbnailImageElement}set currentImageElement(e){this.mouseDown?this.currentScrubbingImageElement=e:this.currentThumbnailImageElement=e}}const Ds={insertElements(t,e){h.string(e)?ra(t,this.media,{src:e}):h.array(e)&&e.forEach(i=>{ra(t,this.media,i)})},change(t){Jn(t,"sources.length")?(Ke.cancelRequests.call(this),this.destroy.call(this,()=>{this.options.quality=[],He(this.media),this.media=null,h.element(this.elements.container)&&this.elements.container.removeAttribute("class");const{sources:e,type:i}=t,[{provider:s=qe.html5,src:r}]=e,a=s==="html5"?i:"div",n=s==="html5"?{}:{src:r};Object.assign(this,{provider:s,type:i,supported:q.check(i,s,this.config.playsinline),media:N(a,n)}),this.elements.container.appendChild(this.media),h.boolean(t.autoplay)&&(this.config.autoplay=t.autoplay),this.isHTML5&&(this.config.crossorigin&&this.media.setAttribute("crossorigin",""),this.config.autoplay&&this.media.setAttribute("autoplay",""),h.empty(t.poster)||(this.poster=t.poster),this.config.loop.active&&this.media.setAttribute("loop",""),this.config.muted&&this.media.setAttribute("muted",""),this.config.playsinline&&this.media.setAttribute("playsinline","")),Z.addStyleHook.call(this),this.isHTML5&&Ds.insertElements.call(this,"source",e),this.config.title=t.title,co.setup.call(this),this.isHTML5&&Object.keys(t).includes("tracks")&&Ds.insertElements.call(this,"track",t.tracks),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&Z.build.call(this),this.isHTML5&&this.media.load(),h.empty(t.previewThumbnails)||(Object.assign(this.config.previewThumbnails,t.previewThumbnails),this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new zs(this))),this.fullscreen.update()},!0)):this.debug.warn("Invalid source format")}};class Xt{constructor(e,i){if(_(this,"play",()=>h.function(this.media.play)?(this.ads&&this.ads.enabled&&this.ads.managerPromise.then(()=>this.ads.play()).catch(()=>Be(this.media.play())),this.media.play()):null),_(this,"pause",()=>this.playing&&h.function(this.media.pause)?this.media.pause():null),_(this,"togglePlay",o=>(h.boolean(o)?o:!this.playing)?this.play():this.pause()),_(this,"stop",()=>{this.isHTML5?(this.pause(),this.restart()):h.function(this.media.stop)&&this.media.stop()}),_(this,"restart",()=>{this.currentTime=0}),_(this,"rewind",o=>{this.currentTime-=h.number(o)?o:this.config.seekTime}),_(this,"forward",o=>{this.currentTime+=h.number(o)?o:this.config.seekTime}),_(this,"increaseVolume",o=>{const c=this.media.muted?0:this.volume;this.volume=c+(h.number(o)?o:0)}),_(this,"decreaseVolume",o=>{this.increaseVolume(-o)}),_(this,"airplay",()=>{q.airplay&&this.media.webkitShowPlaybackTargetPicker()}),_(this,"toggleControls",o=>{if(this.supported.ui&&!this.isAudio){const c=ki(this.elements.container,this.config.classNames.hideControls),l=o===void 0?void 0:!o,d=W(this.elements.container,this.config.classNames.hideControls,l);if(d&&h.array(this.config.controls)&&this.config.controls.includes("settings")&&!h.empty(this.config.settings)&&M.toggleMenu.call(this,!1),d!==c){const u=d?"controlshidden":"controlsshown";E.call(this,this.media,u)}return!d}return!1}),_(this,"on",(o,c)=>{H.call(this,this.elements.container,o,c)}),_(this,"once",(o,c)=>{cr.call(this,this.elements.container,o,c)}),_(this,"off",(o,c)=>{Ui(this.elements.container,o,c)}),_(this,"destroy",(o,c=!1)=>{if(!this.ready)return;const l=()=>{document.body.style.overflow="",this.embed=null,c?(Object.keys(this.elements).length&&(He(this.elements.buttons.play),He(this.elements.captions),He(this.elements.controls),He(this.elements.wrapper),this.elements.buttons.play=null,this.elements.captions=null,this.elements.controls=null,this.elements.wrapper=null),h.function(o)&&o()):(Yu.call(this),Ke.cancelRequests.call(this),Ai(this.elements.original,this.elements.container),E.call(this,this.elements.original,"destroyed",!0),h.function(o)&&o.call(this.elements.original),this.ready=!1,setTimeout(()=>{this.elements=null,this.media=null},200))};this.stop(),clearTimeout(this.timers.loading),clearTimeout(this.timers.controls),clearTimeout(this.timers.resized),this.isHTML5?(Z.toggleNativeControls.call(this,!0),l()):this.isYouTube?(clearInterval(this.timers.buffering),clearInterval(this.timers.playing),this.embed!==null&&h.function(this.embed.destroy)&&this.embed.destroy(),l()):this.isVimeo&&(this.embed!==null&&this.embed.unload().then(l),setTimeout(l,200))}),_(this,"supports",o=>q.mime.call(this,o)),this.timers={},this.ready=!1,this.loading=!1,this.failed=!1,this.touch=q.touch,this.media=e,h.string(this.media)&&(this.media=document.querySelectorAll(this.media)),(window.jQuery&&this.media instanceof jQuery||h.nodeList(this.media)||h.array(this.media))&&(this.media=this.media[0]),this.config=J({},lo,Xt.defaults,i||{},(()=>{try{return JSON.parse(this.media.getAttribute("data-plyr-config"))}catch{return{}}})()),this.elements={container:null,fullscreen:null,captions:null,buttons:{},display:{},progress:{},inputs:{},settings:{popup:null,menu:null,panels:{},buttons:{}}},this.captions={active:null,currentTrack:-1,meta:new WeakMap},this.fullscreen={active:!1},this.options={speed:[],quality:[]},this.debug=new rp(this.config.debug),this.debug.log("Config",this.config),this.debug.log("Support",q),h.nullOrUndefined(this.media)||!h.element(this.media))return void this.debug.error("Setup failed: no suitable element passed");if(this.media.plyr)return void this.debug.warn("Target already setup");if(!this.config.enabled)return void this.debug.error("Setup failed: disabled by config");if(!q.check().api)return void this.debug.error("Setup failed: no support");const s=this.media.cloneNode(!0);s.autoplay=!1,this.elements.original=s;const r=this.media.tagName.toLowerCase();let a=null,n=null;switch(r){case"div":if(a=this.media.querySelector("iframe"),h.element(a)){if(n=no(a.getAttribute("src")),this.provider=sp(n.toString()),this.elements.container=this.media,this.media=a,this.elements.container.className="",n.search.length){const o=["1","true"];o.includes(n.searchParams.get("autoplay"))&&(this.config.autoplay=!0),o.includes(n.searchParams.get("loop"))&&(this.config.loop.active=!0),this.isYouTube?(this.config.playsinline=o.includes(n.searchParams.get("playsinline")),this.config.youtube.hl=n.searchParams.get("hl")):this.config.playsinline=!0}}else this.provider=this.media.getAttribute(this.config.attributes.embed.provider),this.media.removeAttribute(this.config.attributes.embed.provider);if(h.empty(this.provider)||!Object.values(qe).includes(this.provider))return void this.debug.error("Setup failed: Invalid provider");this.type=hs.video;break;case"video":case"audio":this.type=r,this.provider=qe.html5,this.media.hasAttribute("crossorigin")&&(this.config.crossorigin=!0),this.media.hasAttribute("autoplay")&&(this.config.autoplay=!0),(this.media.hasAttribute("playsinline")||this.media.hasAttribute("webkit-playsinline"))&&(this.config.playsinline=!0),this.media.hasAttribute("muted")&&(this.config.muted=!0),this.media.hasAttribute("loop")&&(this.config.loop.active=!0);break;default:return void this.debug.error("Setup failed: unsupported type")}this.supported=q.check(this.type,this.provider,this.config.playsinline),this.supported.api?(this.eventListeners=[],this.listeners=new ap(this),this.storage=new Jt(this),this.media.plyr=this,h.element(this.elements.container)||(this.elements.container=N("div",{tabindex:0}),Xn(this.media,this.elements.container)),Z.migrateStyles.call(this),Z.addStyleHook.call(this),co.setup.call(this),this.config.debug&&H.call(this,this.elements.container,this.config.events.join(" "),o=>{this.debug.log(`event: ${o.type}`)}),this.fullscreen=new Ve(this),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&Z.build.call(this),this.listeners.container(),this.listeners.global(),this.config.ads.enabled&&(this.ads=new up(this)),this.isHTML5&&this.config.autoplay&&this.once("canplay",()=>Be(this.play())),this.lastSeekTime=0,this.config.previewThumbnails.enabled&&(this.previewThumbnails=new zs(this))):this.debug.error("Setup failed: no support")}get isHTML5(){return this.provider===qe.html5}get isEmbed(){return this.isYouTube||this.isVimeo}get isYouTube(){return this.provider===qe.youtube}get isVimeo(){return this.provider===qe.vimeo}get isVideo(){return this.type===hs.video}get isAudio(){return this.type===hs.audio}get playing(){return Boolean(this.ready&&!this.paused&&!this.ended)}get paused(){return Boolean(this.media.paused)}get stopped(){return Boolean(this.paused&&this.currentTime===0)}get ended(){return Boolean(this.media.ended)}set currentTime(e){if(!this.duration)return;const i=h.number(e)&&e>0;this.media.currentTime=i?Math.min(e,this.duration):0,this.debug.log(`Seeking to ${this.currentTime} seconds`)}get currentTime(){return Number(this.media.currentTime)}get buffered(){const{buffered:e}=this.media;return h.number(e)?e:e&&e.length&&this.duration>0?e.end(0)/this.duration:0}get seeking(){return Boolean(this.media.seeking)}get duration(){const e=parseFloat(this.config.duration),i=(this.media||{}).duration,s=h.number(i)&&i!==1/0?i:0;return e||s}set volume(e){let i=e;h.string(i)&&(i=Number(i)),h.number(i)||(i=this.storage.get("volume")),h.number(i)||({volume:i}=this.config),i>1&&(i=1),i<0&&(i=0),this.config.volume=i,this.media.volume=i,!h.empty(e)&&this.muted&&i>0&&(this.muted=!1)}get volume(){return Number(this.media.volume)}set muted(e){let i=e;h.boolean(i)||(i=this.storage.get("muted")),h.boolean(i)||(i=this.config.muted),this.config.muted=i,this.media.muted=i}get muted(){return Boolean(this.media.muted)}get hasAudio(){return!this.isHTML5||!!this.isAudio||Boolean(this.media.mozHasAudio)||Boolean(this.media.webkitAudioDecodedByteCount)||Boolean(this.media.audioTracks&&this.media.audioTracks.length)}set speed(e){let i=null;h.number(e)&&(i=e),h.number(i)||(i=this.storage.get("speed")),h.number(i)||(i=this.config.speed.selected);const{minimumSpeed:s,maximumSpeed:r}=this;i=ho(i,s,r),this.config.speed.selected=i,setTimeout(()=>{this.media&&(this.media.playbackRate=i)},0)}get speed(){return Number(this.media.playbackRate)}get minimumSpeed(){return this.isYouTube?Math.min(...this.options.speed):this.isVimeo?.5:.0625}get maximumSpeed(){return this.isYouTube?Math.max(...this.options.speed):this.isVimeo?2:16}set quality(e){const i=this.config.quality,s=this.options.quality;if(!s.length)return;let r=[!h.empty(e)&&Number(e),this.storage.get("quality"),i.selected,i.default].find(h.number),a=!0;if(!s.includes(r)){const n=Kn(s,r);this.debug.warn(`Unsupported quality option: ${r}, using ${n} instead`),r=n,a=!1}i.selected=r,this.media.quality=r,a&&this.storage.set({quality:r})}get quality(){return this.media.quality}set loop(e){const i=h.boolean(e)?e:this.config.loop.active;this.config.loop.active=i,this.media.loop=i}get loop(){return Boolean(this.media.loop)}set source(e){Ds.change.call(this,e)}get source(){return this.media.currentSrc}get download(){const{download:e}=this.config.urls;return h.url(e)?e:this.source}set download(e){h.url(e)&&(this.config.urls.download=e,M.setDownloadUrl.call(this))}set poster(e){this.isVideo?Z.setPoster.call(this,e,!1).catch(()=>{}):this.debug.warn("Poster can only be set for video")}get poster(){return this.isVideo?this.media.getAttribute("poster")||this.media.getAttribute("data-poster"):null}get ratio(){if(!this.isVideo)return null;const e=Ti(hr.call(this));return h.array(e)?e.join(":"):e}set ratio(e){this.isVideo?h.string(e)&&to(e)?(this.config.ratio=Ti(e),It.call(this)):this.debug.error(`Invalid aspect ratio specified (${e})`):this.debug.warn("Aspect ratio can only be set for video")}set autoplay(e){this.config.autoplay=h.boolean(e)?e:this.config.autoplay}get autoplay(){return Boolean(this.config.autoplay)}toggleCaptions(e){F.toggle.call(this,e,!1)}set currentTrack(e){F.set.call(this,e,!1),F.setup.call(this)}get currentTrack(){const{toggled:e,currentTrack:i}=this.captions;return e?i:-1}set language(e){F.setLanguage.call(this,e,!1)}get language(){return(F.getCurrentTrack.call(this)||{}).language}set pip(e){if(!q.pip)return;const i=h.boolean(e)?e:!this.pip;h.function(this.media.webkitSetPresentationMode)&&this.media.webkitSetPresentationMode(i?cs.active:cs.inactive),h.function(this.media.requestPictureInPicture)&&(!this.pip&&i?this.media.requestPictureInPicture():this.pip&&!i&&document.exitPictureInPicture())}get pip(){return q.pip?h.empty(this.media.webkitPresentationMode)?this.media===document.pictureInPictureElement:this.media.webkitPresentationMode===cs.active:null}setPreviewThumbnails(e){this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),Object.assign(this.config.previewThumbnails,e),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new zs(this))}static supported(e,i,s){return q.check(e,i,s)}static loadSprite(e,i){return ro(e,i)}static setup(e,i={}){let s=null;return h.string(e)?s=Array.from(document.querySelectorAll(e)):h.nodeList(e)?s=Array.from(e):h.array(e)&&(s=e.filter(h.element)),h.empty(s)?null:s.map(r=>new Xt(r,i))}}Xt.defaults=Wu(lo);function gp(t){let e,i,s;return{c(){e=Ct("video"),i=Ct("source"),Pn(i.src,s=t[3])||C(i,"src",s),C(i,"type",t[2]),C(e,"data-app-kind","Plyr"),C(e,"crossorigin","anonymous"),e.playsInline=!0,C(e,"data-poster",t[4])},m(r,a){At(r,e,a),V(e,i),t[8](e)},p:st,d(r){r&&ft(e),t[8](null)}}}function mp(t){let e,i,s;return{c(){e=Ct("audio"),i=Ct("source"),Pn(i.src,s=t[3])||C(i,"src",s),C(i,"type",t[2]),C(e,"data-app-kind","Plyr"),C(e,"crossorigin","anonymous"),C(e,"data-poster",t[4])},m(r,a){At(r,e,a),V(e,i),t[7](e)},p:st,d(r){r&&ft(e),t[7](null)}}}function fp(t){let e,i,s=JSON.stringify({src:t[3],type:t[0].state.type})+"",r;return{c(){e=Ct("div"),i=Is(`Invalid "src" or "type".
|
126
|
-
`),r=Is(s),C(e,"data-app-kind","Plyr"),C(e,"class","plyr--audio")},m(a,n){At(a,e,n),V(e,i),V(e,r)},p(a,n){n&1&&s!==(s=JSON.stringify({src:a[3],type:a[0].state.type})+"")&&Jd(r,s)},d(a){a&&ft(e)}}}function bp(t){let e;return{c(){e=Ct("div"),C(e,"data-app-kind","Plyr"),C(e,"class","plyr__video-embed"),C(e,"data-plyr-provider","youtube"),C(e,"data-plyr-embed-id",t[3]),C(e,"data-poster",t[4])},m(i,s){At(i,e,s),t[6](e)},p:st,d(i){i&&ft(e),t[6](null)}}}function yp(t){let e,i,s,r;function a(c,l){return c[0].state.provider==="youtube"?bp:c[2]?(e==null&&(e=!!c[2].startsWith("audio/")),e?mp:gp):fp}let n=a(t),o=n(t);return s=new bu({}),{c(){o.c(),i=Gd(),au(s.$$.fragment)},m(c,l){o.m(c,l),At(c,i,l),Vn(s,c,l),r=!0},p(c,[l]){n===(n=a(c))&&o?o.p(c,l):(o.d(1),o=n(c),o&&(o.c(),o.m(i.parentNode,i)))},i(c){r||(Ln(s.$$.fragment,c),r=!0)},o(c){ru(s.$$.fragment,c),r=!1},d(c){o.d(c),c&&ft(i),$n(s,c)}}}function wp(t,e,i){let{storage:s}=e,{sync:r}=e;const a=s.state.provider?void 0:s.state.type||cu(s.state.src),{src:n,poster:o}=s.state,c=lu.includes(String(a).toLowerCase());let l,d;Xd(async()=>{if(l){if(c&&pu(l)){const g=await uu();g.loadSource(n),g.attachMedia(l)}d=new Xt(l,{fullscreen:{enabled:!1},controls:["play","progress","current-time","mute","volume"],clickToPlay:!1,youtube:{autoplay:!0},loadSprite:!1}),i(5,r.player=d,r)}}),Kd(()=>{try{r.dispose(),d==null||d.destroy()}catch(g){console.warn("[Plyr] destroy plyr error",g)}});function u(g){Ht[g?"unshift":"push"](()=>{l=g,i(1,l)})}function p(g){Ht[g?"unshift":"push"](()=>{l=g,i(1,l)})}function m(g){Ht[g?"unshift":"push"](()=>{l=g,i(1,l)})}return t.$$set=g=>{"storage"in g&&i(0,s=g.storage),"sync"in g&&i(5,r=g.sync)},[s,l,a,n,o,r,u,p,m]}class vp extends Bn{constructor(e){super();jn(this,e,wp,yp,En,{storage:0,sync:5})}}class xp{constructor(e){this.context=e,this.behavior="owner",this._skip_next_play_pause=0,this._sync_timer=0,this._interval=1e3,this._blink=0,this._player=null,this._buffering=!1,this._throttle=0,this._dispatch_time_again=!1,this._buffering_timer=0,this._disposer=null;const i=e.room,s=e.displayer;this.uid=i?i.uid:"",this.getTimestamp=i?()=>i.calibrationTimestamp:()=>s.beginTimestamp+s.progressTime,this._disposer=this.context.storage.addStateChangedListener(this.syncAll.bind(this))}dispose(){this._disposer&&this._disposer(),this._disposer=null,clearInterval(this._sync_timer),clearTimeout(this._buffering_timer)}get player(){return this._player}set player(e){this._player=e,e&&e.once("ready",this.setupPlayer.bind(this,e))}setupPlayer(e){this.registerListeners(e),this.watchUserInputs(e),this._sync_timer=setInterval(this.syncAll.bind(this),this._interval)}syncAll(){const{behavior:e,player:i,context:s}=this;if(!i)return;const{storage:r}=s,{currentTime:a,hostTime:n,muted:o,paused:c,volume:l,owner:d}=r.state;e==="owner"&&d===this.uid||(c!==i.paused&&!this._skip_next_play_pause&&(console.log("< sync paused",c),c?i.pause():hu(i)),o!==i.muted&&(console.log("< sync muted",o),i.muted=o),l!==i.volume&&(console.log("< sync volume",l),i.volume=l),!this._buffering&&(c?Math.abs(i.currentTime-a)>.5&&(console.log("< sync current time (paused)",a),i.currentTime=a):this.syncCurrentTime(n,a,i)))}watchUserInputs(e){const i=e.elements.controls,s=mu(e.elements.buttons.play),r=i==null?void 0:i.querySelector('input[data-plyr="seek"]'),a=i==null?void 0:i.querySelector('button[data-plyr="mute"]'),n=i==null?void 0:i.querySelector('input[data-plyr="volume"]');this.fixSeekBarOnInit(r,e),s==null||s.addEventListener("click",()=>{this.behavior==="owner"&&this.dispatchOwner(),this.dispatchPlayPause(e)}),r==null||r.addEventListener("change",()=>{this.behavior==="owner"&&this.dispatchOwner(),this.dispatchSeek(e,r)}),a==null||a.addEventListener("click",()=>{this.behavior==="owner"&&this.dispatchOwner(),this.dispatchVolume(e)}),n==null||n.addEventListener("change",()=>{this.behavior==="owner"&&this.dispatchOwner(),this.dispatchVolume(e)})}fixSeekBarOnInit(e,i){const{currentTime:s}=this.context.storage.state;if(i.duration&&s&&e){const r=100*s/i.duration;e.value=r.toFixed(2)}}registerListeners(e){e.on("ended",()=>{e.stop(),this.context.storage.setState({paused:!0,currentTime:0})}),e.on("waiting",()=>{this._buffering=!0,this._buffering_timer=setTimeout(this.clearBuffering.bind(this),this._interval/2)}),e.on("playing",()=>{this._buffering=!1}),e.on("timeupdate",()=>{this.isOwner()&&this.dispatchCurrentTime(e)}),e.on("volumechange",()=>{this.isOwner()&&this.dispatchVolume(e)}),e.on("play",()=>{this.isOwner()&&this.dispatchPlayPause(e)}),e.on("pause",()=>{this.isOwner()&&this.dispatchPlayPause(e)})}clearBuffering(){this._buffering=!1,this._buffering_timer=0}dispatchOwner(){this.context.storage.state.owner!==this.uid&&(console.log("> set owner",this.uid),this.context.storage.setState({owner:this.uid}))}dispatchPlayPause(e){console.log("> set paused",e.paused),this.context.storage.setState({hostTime:this.getTimestamp(),currentTime:e.currentTime,paused:e.paused}),clearTimeout(this._skip_next_play_pause),this._skip_next_play_pause=setTimeout(this.skipNextPlayPause.bind(this),500)}skipNextPlayPause(){this._skip_next_play_pause=0}dispatchVolume(e){console.log("> set volume",e.volume),this.context.storage.setState({muted:e.muted,volume:e.volume})}dispatchSeek(e,i){const s=i.valueAsNumber*e.duration/100;console.log("> set current time (seek)",s),this.context.storage.setState({hostTime:this.getTimestamp(),currentTime:s})}dispatchCurrentTime(e){if(this._throttle){this._dispatch_time_again=!0;return}console.log("> set current time",e.currentTime),this.context.storage.setState({hostTime:this.getTimestamp(),currentTime:e.currentTime}),this._throttle=setTimeout(this.clearThrottle.bind(this,e),1e3)}clearThrottle(e){this._throttle=0,this._dispatch_time_again&&(this._dispatch_time_again=!1,this.dispatchCurrentTime(e))}isOwner(){return this.behavior==="owner"&&this.context.storage.state.owner===this.uid}syncCurrentTime(e,i,s){const r=this.getTimestamp();if(r&&e){const a=i+(r-e)/1e3;Math.abs(a-s.currentTime)>1?(console.log("< sync current time (playing)",a),s.currentTime=a,this._blink++,this._blink>3&&this.updateSyncInterval(!0)):this.updateSyncInterval(!1)}}updateSyncInterval(e){this._blink=0,this._interval=gu(this._interval+(e?2e3:-2e3),1e3,15e3),clearTimeout(this._sync_timer),this._sync_timer=setInterval(this.syncAll.bind(this),this._interval)}}var Sp=(()=>`@charset "UTF-8";@keyframes plyr-progress{to{background-position:25px 0;background-position:var(--plyr-progress-loading-size,25px) 0}}@keyframes plyr-popup{0%{opacity:.5;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes plyr-fade-in{0%{opacity:0}to{opacity:1}}.plyr{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;align-items:center;direction:ltr;display:flex;flex-direction:column;font-family:inherit;font-family:var(--plyr-font-family,inherit);font-variant-numeric:tabular-nums;font-weight:400;font-weight:var(--plyr-font-weight-regular,400);line-height:1.7;line-height:var(--plyr-line-height,1.7);max-width:100%;min-width:200px;position:relative;text-shadow:none;transition:box-shadow .3s ease;z-index:0}.plyr audio,.plyr iframe,.plyr video{display:block;height:100%;width:100%}.plyr button{font:inherit;line-height:inherit;width:auto}.plyr:focus{outline:0}.plyr--full-ui{box-sizing:border-box}.plyr--full-ui *,.plyr--full-ui :after,.plyr--full-ui :before{box-sizing:inherit}.plyr--full-ui a,.plyr--full-ui button,.plyr--full-ui input,.plyr--full-ui label{touch-action:manipulation}.plyr__badge{background:#4a5464;background:var(--plyr-badge-background,#4a5464);border-radius:2px;border-radius:var(--plyr-badge-border-radius,2px);color:#fff;color:var(--plyr-badge-text-color,#fff);font-size:9px;font-size:var(--plyr-font-size-badge,9px);line-height:1;padding:3px 4px}.plyr--full-ui ::-webkit-media-text-track-container{display:none}.plyr__captions{animation:plyr-fade-in .3s ease;bottom:0;display:none;font-size:13px;font-size:var(--plyr-font-size-small,13px);left:0;padding:10px;padding:var(--plyr-control-spacing,10px);position:absolute;text-align:center;transition:transform .4s ease-in-out;width:100%}.plyr__captions span:empty{display:none}@media (min-width:480px){.plyr__captions{font-size:15px;font-size:var(--plyr-font-size-base,15px);padding:20px;padding:calc(var(--plyr-control-spacing, 10px)*2)}}@media (min-width:768px){.plyr__captions{font-size:18px;font-size:var(--plyr-font-size-large,18px)}}.plyr--captions-active .plyr__captions{display:block}.plyr:not(.plyr--hide-controls) .plyr__controls:not(:empty)~.plyr__captions{transform:translateY(-40px);transform:translateY(calc(var(--plyr-control-spacing, 10px)*-4))}.plyr__caption{background:rgba(0,0,0,.8);background:var(--plyr-captions-background,rgba(0,0,0,.8));border-radius:2px;-webkit-box-decoration-break:clone;box-decoration-break:clone;color:#fff;color:var(--plyr-captions-text-color,#fff);line-height:185%;padding:.2em .5em;white-space:pre-wrap}.plyr__caption div{display:inline}.plyr__control{background:transparent;border:0;border-radius:3px;border-radius:var(--plyr-control-radius,3px);color:inherit;cursor:pointer;flex-shrink:0;overflow:visible;padding:7px;padding:calc(var(--plyr-control-spacing, 10px)*.7);position:relative;transition:all .3s ease}.plyr__control svg{fill:currentColor;display:block;height:18px;height:var(--plyr-control-icon-size,18px);pointer-events:none;width:18px;width:var(--plyr-control-icon-size,18px)}.plyr__control:focus{outline:0}.plyr__control.plyr__tab-focus{outline:3px dotted #00b2ff;outline:var(--plyr-tab-focus-color,var(--plyr-color-main,var(--plyr-color-main,#00b2ff))) dotted 3px;outline-offset:2px}a.plyr__control{text-decoration:none}.plyr__control.plyr__control--pressed .icon--not-pressed,.plyr__control.plyr__control--pressed .label--not-pressed,.plyr__control:not(.plyr__control--pressed) .icon--pressed,.plyr__control:not(.plyr__control--pressed) .label--pressed,a.plyr__control:after,a.plyr__control:before{display:none}.plyr--full-ui ::-webkit-media-controls{display:none}.plyr__controls{align-items:center;display:flex;justify-content:flex-end;text-align:center}.plyr__controls .plyr__progress__container{flex:1;min-width:0}.plyr__controls .plyr__controls__item{margin-left:2.5px;margin-left:calc(var(--plyr-control-spacing, 10px)/4)}.plyr__controls .plyr__controls__item:first-child{margin-left:0;margin-right:auto}.plyr__controls .plyr__controls__item.plyr__progress__container{padding-left:2.5px;padding-left:calc(var(--plyr-control-spacing, 10px)/4)}.plyr__controls .plyr__controls__item.plyr__time{padding:0 5px;padding:0 calc(var(--plyr-control-spacing, 10px)/2)}.plyr__controls .plyr__controls__item.plyr__progress__container:first-child,.plyr__controls .plyr__controls__item.plyr__time+.plyr__time,.plyr__controls .plyr__controls__item.plyr__time:first-child{padding-left:0}.plyr [data-plyr=airplay],.plyr [data-plyr=captions],.plyr [data-plyr=fullscreen],.plyr [data-plyr=pip],.plyr__controls:empty{display:none}.plyr--airplay-supported [data-plyr=airplay],.plyr--captions-enabled [data-plyr=captions],.plyr--fullscreen-enabled [data-plyr=fullscreen],.plyr--pip-supported [data-plyr=pip]{display:inline-block}.plyr__menu{display:flex;position:relative}.plyr__menu .plyr__control svg{transition:transform .3s ease}.plyr__menu .plyr__control[aria-expanded=true] svg{transform:rotate(90deg)}.plyr__menu .plyr__control[aria-expanded=true] .plyr__tooltip{display:none}.plyr__menu__container{animation:plyr-popup .2s ease;background:hsla(0,0%,100%,.9);background:var(--plyr-menu-background,hsla(0,0%,100%,.9));border-radius:4px;bottom:100%;box-shadow:0 1px 2px #00000026;box-shadow:var(--plyr-menu-shadow,0 1px 2px rgba(0,0,0,.15));color:#4a5464;color:var(--plyr-menu-color,#4a5464);font-size:15px;font-size:var(--plyr-font-size-base,15px);margin-bottom:10px;position:absolute;right:-3px;text-align:left;white-space:nowrap;z-index:3}.plyr__menu__container>div{overflow:hidden;transition:height .35s cubic-bezier(.4,0,.2,1),width .35s cubic-bezier(.4,0,.2,1)}.plyr__menu__container:after{border:4px solid transparent;border-top-color:#ffffffe6;border:var(--plyr-menu-arrow-size,4px) solid transparent;border-top-color:var(--plyr-menu-background,hsla(0,0%,100%,.9));content:"";height:0;position:absolute;right:14px;right:calc(var(--plyr-control-icon-size, 18px)/2 + var(--plyr-control-spacing, 10px)*.7 - var(--plyr-menu-arrow-size, 4px)/2);top:100%;width:0}.plyr__menu__container [role=menu]{padding:7px;padding:calc(var(--plyr-control-spacing, 10px)*.7)}.plyr__menu__container [role=menuitem],.plyr__menu__container [role=menuitemradio]{margin-top:2px}.plyr__menu__container [role=menuitem]:first-child,.plyr__menu__container [role=menuitemradio]:first-child{margin-top:0}.plyr__menu__container .plyr__control{align-items:center;color:#4a5464;color:var(--plyr-menu-color,#4a5464);display:flex;font-size:13px;font-size:var(--plyr-font-size-menu,var(--plyr-font-size-small,13px));padding:4.66667px 10.5px;padding:calc(var(--plyr-control-spacing, 10px)*.7/1.5) calc(var(--plyr-control-spacing, 10px)*.7*1.5);-webkit-user-select:none;user-select:none;width:100%}.plyr__menu__container .plyr__control>span{align-items:inherit;display:flex;width:100%}.plyr__menu__container .plyr__control:after{border:4px solid transparent;border:var(--plyr-menu-item-arrow-size,4px) solid transparent;content:"";position:absolute;top:50%;transform:translateY(-50%)}.plyr__menu__container .plyr__control--forward{padding-right:28px;padding-right:calc(var(--plyr-control-spacing, 10px)*.7*4)}.plyr__menu__container .plyr__control--forward:after{border-left-color:#728197;border-left-color:var(--plyr-menu-arrow-color,#728197);right:6.5px;right:calc(var(--plyr-control-spacing, 10px)*.7*1.5 - var(--plyr-menu-item-arrow-size, 4px))}.plyr__menu__container .plyr__control--forward.plyr__tab-focus:after,.plyr__menu__container .plyr__control--forward:hover:after{border-left-color:currentColor}.plyr__menu__container .plyr__control--back{font-weight:400;font-weight:var(--plyr-font-weight-regular,400);margin:7px;margin:calc(var(--plyr-control-spacing, 10px)*.7);margin-bottom:3.5px;margin-bottom:calc(var(--plyr-control-spacing, 10px)*.7/2);padding-left:28px;padding-left:calc(var(--plyr-control-spacing, 10px)*.7*4);position:relative;width:calc(100% - 14px);width:calc(100% - var(--plyr-control-spacing, 10px)*.7*2)}.plyr__menu__container .plyr__control--back:after{border-right-color:#728197;border-right-color:var(--plyr-menu-arrow-color,#728197);left:6.5px;left:calc(var(--plyr-control-spacing, 10px)*.7*1.5 - var(--plyr-menu-item-arrow-size, 4px))}.plyr__menu__container .plyr__control--back:before{background:#dcdfe5;background:var(--plyr-menu-back-border-color,#dcdfe5);box-shadow:0 1px #fff;box-shadow:0 1px 0 var(--plyr-menu-back-border-shadow-color,#fff);content:"";height:1px;left:0;margin-top:3.5px;margin-top:calc(var(--plyr-control-spacing, 10px)*.7/2);overflow:hidden;position:absolute;right:0;top:100%}.plyr__menu__container .plyr__control--back.plyr__tab-focus:after,.plyr__menu__container .plyr__control--back:hover:after{border-right-color:currentColor}.plyr__menu__container .plyr__control[role=menuitemradio]{padding-left:7px;padding-left:calc(var(--plyr-control-spacing, 10px)*.7)}.plyr__menu__container .plyr__control[role=menuitemradio]:after,.plyr__menu__container .plyr__control[role=menuitemradio]:before{border-radius:100%}.plyr__menu__container .plyr__control[role=menuitemradio]:before{background:rgba(0,0,0,.1);content:"";display:block;flex-shrink:0;height:16px;margin-right:10px;margin-right:var(--plyr-control-spacing,10px);transition:all .3s ease;width:16px}.plyr__menu__container .plyr__control[role=menuitemradio]:after{background:#fff;border:0;height:6px;left:12px;opacity:0;top:50%;transform:translateY(-50%) scale(0);transition:transform .3s ease,opacity .3s ease;width:6px}.plyr__menu__container .plyr__control[role=menuitemradio][aria-checked=true]:before{background:#00b2ff;background:var(--plyr-control-toggle-checked-background,var(--plyr-color-main,var(--plyr-color-main,#00b2ff)))}.plyr__menu__container .plyr__control[role=menuitemradio][aria-checked=true]:after{opacity:1;transform:translateY(-50%) scale(1)}.plyr__menu__container .plyr__control[role=menuitemradio].plyr__tab-focus:before,.plyr__menu__container .plyr__control[role=menuitemradio]:hover:before{background:rgba(35,40,47,.1)}.plyr__menu__container .plyr__menu__value{align-items:center;display:flex;margin-left:auto;margin-right:calc(-7px + 2);margin-right:calc(var(--plyr-control-spacing, 10px)*.7*-1 - -2);overflow:hidden;padding-left:24.5px;padding-left:calc(var(--plyr-control-spacing, 10px)*.7*3.5);pointer-events:none}.plyr--full-ui input[type=range]{-webkit-appearance:none;appearance:none;background:transparent;border:0;border-radius:26px;border-radius:calc(var(--plyr-range-thumb-height, 13px)*2);color:#00b2ff;color:var(--plyr-range-fill-background,var(--plyr-color-main,var(--plyr-color-main,#00b2ff)));display:block;height:19px;height:calc(var(--plyr-range-thumb-active-shadow-width, 3px)*2 + var(--plyr-range-thumb-height, 13px));margin:0;min-width:0;padding:0;transition:box-shadow .3s ease;width:100%}.plyr--full-ui input[type=range]::-webkit-slider-runnable-track{background:transparent;background-image:linear-gradient(90deg,currentColor 0,transparent 0);background-image:linear-gradient(to right,currentColor var(--value,0),transparent var(--value,0));border:0;border-radius:2.5px;border-radius:calc(var(--plyr-range-track-height, 5px)/2);height:5px;height:var(--plyr-range-track-height,5px);-webkit-transition:box-shadow .3s ease;transition:box-shadow .3s ease;-webkit-user-select:none;user-select:none}.plyr--full-ui input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;background:#fff;background:var(--plyr-range-thumb-background,#fff);border:0;border-radius:100%;box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2));height:13px;height:var(--plyr-range-thumb-height,13px);margin-top:-4px;margin-top:calc((var(--plyr-range-thumb-height, 13px) - var(--plyr-range-track-height, 5px))/2*-1);position:relative;-webkit-transition:all .2s ease;transition:all .2s ease;width:13px;width:var(--plyr-range-thumb-height,13px)}.plyr--full-ui input[type=range]::-moz-range-track{background:transparent;border:0;border-radius:2.5px;border-radius:calc(var(--plyr-range-track-height, 5px)/2);height:5px;height:var(--plyr-range-track-height,5px);-moz-transition:box-shadow .3s ease;transition:box-shadow .3s ease;user-select:none}.plyr--full-ui input[type=range]::-moz-range-thumb{background:#fff;background:var(--plyr-range-thumb-background,#fff);border:0;border-radius:100%;box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2));height:13px;height:var(--plyr-range-thumb-height,13px);position:relative;-moz-transition:all .2s ease;transition:all .2s ease;width:13px;width:var(--plyr-range-thumb-height,13px)}.plyr--full-ui input[type=range]::-moz-range-progress{background:currentColor;border-radius:2.5px;border-radius:calc(var(--plyr-range-track-height, 5px)/2);height:5px;height:var(--plyr-range-track-height,5px)}.plyr--full-ui input[type=range]::-ms-track{color:transparent}.plyr--full-ui input[type=range]::-ms-fill-upper,.plyr--full-ui input[type=range]::-ms-track{background:transparent;border:0;border-radius:2.5px;border-radius:calc(var(--plyr-range-track-height, 5px)/2);height:5px;height:var(--plyr-range-track-height,5px);-ms-transition:box-shadow .3s ease;transition:box-shadow .3s ease;user-select:none}.plyr--full-ui input[type=range]::-ms-fill-lower{background:transparent;background:currentColor;border:0;border-radius:2.5px;border-radius:calc(var(--plyr-range-track-height, 5px)/2);height:5px;height:var(--plyr-range-track-height,5px);-ms-transition:box-shadow .3s ease;transition:box-shadow .3s ease;user-select:none}.plyr--full-ui input[type=range]::-ms-thumb{background:#fff;background:var(--plyr-range-thumb-background,#fff);border:0;border-radius:100%;box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2));height:13px;height:var(--plyr-range-thumb-height,13px);margin-top:0;position:relative;-ms-transition:all .2s ease;transition:all .2s ease;width:13px;width:var(--plyr-range-thumb-height,13px)}.plyr--full-ui input[type=range]::-ms-tooltip{display:none}.plyr--full-ui input[type=range]::-moz-focus-outer{border:0}.plyr--full-ui input[type=range]:focus{outline:0}.plyr--full-ui input[type=range].plyr__tab-focus::-webkit-slider-runnable-track{outline:3px dotted #00b2ff;outline:var(--plyr-tab-focus-color,var(--plyr-color-main,var(--plyr-color-main,#00b2ff))) dotted 3px;outline-offset:2px}.plyr--full-ui input[type=range].plyr__tab-focus::-moz-range-track{outline:3px dotted #00b2ff;outline:var(--plyr-tab-focus-color,var(--plyr-color-main,var(--plyr-color-main,#00b2ff))) dotted 3px;outline-offset:2px}.plyr--full-ui input[type=range].plyr__tab-focus::-ms-track{outline:3px dotted #00b2ff;outline:var(--plyr-tab-focus-color,var(--plyr-color-main,var(--plyr-color-main,#00b2ff))) dotted 3px;outline-offset:2px}.plyr__poster{background-color:#000;background-color:var(--plyr-video-background,var(--plyr-video-background,#000));background-position:50% 50%;background-repeat:no-repeat;background-size:contain;height:100%;left:0;opacity:0;position:absolute;top:0;transition:opacity .2s ease;width:100%;z-index:1}.plyr--stopped.plyr__poster-enabled .plyr__poster{opacity:1}.plyr--youtube.plyr--paused.plyr__poster-enabled:not(.plyr--stopped) .plyr__poster{display:none}.plyr__time{font-size:13px;font-size:var(--plyr-font-size-time,var(--plyr-font-size-small,13px))}.plyr__time+.plyr__time:before{content:"\\2044";margin-right:10px;margin-right:var(--plyr-control-spacing,10px)}@media (max-width:767px){.plyr__time+.plyr__time{display:none}}.plyr__tooltip{background:hsla(0,0%,100%,.9);background:var(--plyr-tooltip-background,hsla(0,0%,100%,.9));border-radius:5px;border-radius:var(--plyr-tooltip-radius,5px);bottom:100%;box-shadow:0 1px 2px #00000026;box-shadow:var(--plyr-tooltip-shadow,0 1px 2px rgba(0,0,0,.15));color:#4a5464;color:var(--plyr-tooltip-color,#4a5464);font-size:13px;font-size:var(--plyr-font-size-small,13px);font-weight:400;font-weight:var(--plyr-font-weight-regular,400);left:50%;line-height:1.3;margin-bottom:10px;margin-bottom:calc(var(--plyr-control-spacing, 10px)/2*2);opacity:0;padding:5px 7.5px;padding:calc(var(--plyr-control-spacing, 10px)/2) calc(var(--plyr-control-spacing, 10px)/2*1.5);pointer-events:none;position:absolute;transform:translate(-50%,10px) scale(.8);transform-origin:50% 100%;transition:transform .2s ease .1s,opacity .2s ease .1s;white-space:nowrap;z-index:2}.plyr__tooltip:before{border-left:4px solid transparent;border-left:var(--plyr-tooltip-arrow-size,4px) solid transparent;border-right:4px solid transparent;border-right:var(--plyr-tooltip-arrow-size,4px) solid transparent;border-top:4px solid hsla(0,0%,100%,.9);border-top:var(--plyr-tooltip-arrow-size,4px) solid var(--plyr-tooltip-background,hsla(0,0%,100%,.9));bottom:-4px;bottom:calc(var(--plyr-tooltip-arrow-size, 4px)*-1);content:"";height:0;left:50%;position:absolute;transform:translate(-50%);width:0;z-index:2}.plyr .plyr__control.plyr__tab-focus .plyr__tooltip,.plyr .plyr__control:hover .plyr__tooltip,.plyr__tooltip--visible{opacity:1;transform:translate(-50%) scale(1)}.plyr .plyr__control:hover .plyr__tooltip{z-index:3}.plyr__controls>.plyr__control:first-child .plyr__tooltip,.plyr__controls>.plyr__control:first-child+.plyr__control .plyr__tooltip{left:0;transform:translateY(10px) scale(.8);transform-origin:0 100%}.plyr__controls>.plyr__control:first-child .plyr__tooltip:before,.plyr__controls>.plyr__control:first-child+.plyr__control .plyr__tooltip:before{left:16px;left:calc(var(--plyr-control-icon-size, 18px)/2 + var(--plyr-control-spacing, 10px)*.7)}.plyr__controls>.plyr__control:last-child .plyr__tooltip{left:auto;right:0;transform:translateY(10px) scale(.8);transform-origin:100% 100%}.plyr__controls>.plyr__control:last-child .plyr__tooltip:before{left:auto;right:16px;right:calc(var(--plyr-control-icon-size, 18px)/2 + var(--plyr-control-spacing, 10px)*.7);transform:translate(50%)}.plyr__controls>.plyr__control:first-child .plyr__tooltip--visible,.plyr__controls>.plyr__control:first-child+.plyr__control .plyr__tooltip--visible,.plyr__controls>.plyr__control:first-child+.plyr__control.plyr__tab-focus .plyr__tooltip,.plyr__controls>.plyr__control:first-child+.plyr__control:hover .plyr__tooltip,.plyr__controls>.plyr__control:first-child.plyr__tab-focus .plyr__tooltip,.plyr__controls>.plyr__control:first-child:hover .plyr__tooltip,.plyr__controls>.plyr__control:last-child .plyr__tooltip--visible,.plyr__controls>.plyr__control:last-child.plyr__tab-focus .plyr__tooltip,.plyr__controls>.plyr__control:last-child:hover .plyr__tooltip{transform:translate(0) scale(1)}.plyr__progress{left:6.5px;left:calc(var(--plyr-range-thumb-height, 13px)*.5);margin-right:13px;margin-right:var(--plyr-range-thumb-height,13px);position:relative}.plyr__progress input[type=range],.plyr__progress__buffer{margin-left:-6.5px;margin-left:calc(var(--plyr-range-thumb-height, 13px)*-.5);margin-right:-6.5px;margin-right:calc(var(--plyr-range-thumb-height, 13px)*-.5);width:calc(100% + 13px);width:calc(100% + var(--plyr-range-thumb-height, 13px))}.plyr__progress input[type=range]{position:relative;z-index:2}.plyr__progress .plyr__tooltip{left:0;max-width:120px;overflow-wrap:break-word;white-space:normal}.plyr__progress__buffer{-webkit-appearance:none;background:transparent;border:0;border-radius:100px;height:5px;height:var(--plyr-range-track-height,5px);left:0;margin-top:-2.5px;margin-top:calc((var(--plyr-range-track-height, 5px)/2)*-1);padding:0;position:absolute;top:50%}.plyr__progress__buffer::-webkit-progress-bar{background:transparent}.plyr__progress__buffer::-webkit-progress-value{background:currentColor;border-radius:100px;min-width:5px;min-width:var(--plyr-range-track-height,5px);-webkit-transition:width .2s ease;transition:width .2s ease}.plyr__progress__buffer::-moz-progress-bar{background:currentColor;border-radius:100px;min-width:5px;min-width:var(--plyr-range-track-height,5px);-moz-transition:width .2s ease;transition:width .2s ease}.plyr__progress__buffer::-ms-fill{border-radius:100px;-ms-transition:width .2s ease;transition:width .2s ease}.plyr--loading .plyr__progress__buffer{animation:plyr-progress 1s linear infinite;background-image:linear-gradient(-45deg,rgba(35,40,47,.6) 25%,transparent 0,transparent 50%,rgba(35,40,47,.6) 0,rgba(35,40,47,.6) 75%,transparent 0,transparent);background-image:linear-gradient(-45deg,var(--plyr-progress-loading-background,rgba(35,40,47,.6)) 25%,transparent 25%,transparent 50%,var(--plyr-progress-loading-background,rgba(35,40,47,.6)) 50%,var(--plyr-progress-loading-background,rgba(35,40,47,.6)) 75%,transparent 75%,transparent);background-repeat:repeat-x;background-size:25px 25px;background-size:var(--plyr-progress-loading-size,25px) var(--plyr-progress-loading-size,25px);color:transparent}.plyr--video.plyr--loading .plyr__progress__buffer{background-color:#ffffff40;background-color:var(--plyr-video-progress-buffered-background,hsla(0,0%,100%,.25))}.plyr--audio.plyr--loading .plyr__progress__buffer{background-color:#c1c8d199;background-color:var(--plyr-audio-progress-buffered-background,rgba(193,200,209,.6))}.plyr__progress__marker{background-color:#fff;background-color:var(--plyr-progress-marker-background,#fff);border-radius:1px;height:5px;height:var(--plyr-range-track-height,5px);position:absolute;top:50%;transform:translate(-50%,-50%);width:3px;width:var(--plyr-progress-marker-width,3px);z-index:3}.plyr__volume{align-items:center;display:flex;max-width:110px;min-width:80px;position:relative;width:20%}.plyr__volume input[type=range]{margin-left:5px;margin-left:calc(var(--plyr-control-spacing, 10px)/2);margin-right:5px;margin-right:calc(var(--plyr-control-spacing, 10px)/2);position:relative;z-index:2}.plyr--is-ios .plyr__volume{min-width:0;width:auto}.plyr--audio{display:block}.plyr--audio .plyr__controls{background:#fff;background:var(--plyr-audio-controls-background,#fff);border-radius:inherit;color:#4a5464;color:var(--plyr-audio-control-color,#4a5464);padding:10px;padding:var(--plyr-control-spacing,10px)}.plyr--audio .plyr__control.plyr__tab-focus,.plyr--audio .plyr__control:hover,.plyr--audio .plyr__control[aria-expanded=true]{background:#00b2ff;background:var(--plyr-audio-control-background-hover,var(--plyr-color-main,var(--plyr-color-main,#00b2ff)));color:#fff;color:var(--plyr-audio-control-color-hover,#fff)}.plyr--full-ui.plyr--audio input[type=range]::-webkit-slider-runnable-track{background-color:#c1c8d199;background-color:var(--plyr-audio-range-track-background,var(--plyr-audio-progress-buffered-background,rgba(193,200,209,.6)))}.plyr--full-ui.plyr--audio input[type=range]::-moz-range-track{background-color:#c1c8d199;background-color:var(--plyr-audio-range-track-background,var(--plyr-audio-progress-buffered-background,rgba(193,200,209,.6)))}.plyr--full-ui.plyr--audio input[type=range]::-ms-track{background-color:#c1c8d199;background-color:var(--plyr-audio-range-track-background,var(--plyr-audio-progress-buffered-background,rgba(193,200,209,.6)))}.plyr--full-ui.plyr--audio input[type=range]:active::-webkit-slider-thumb{box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33,0 0 0 3px #23282f1a;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2)),0 0 0 var(--plyr-range-thumb-active-shadow-width,3px) var(--plyr-audio-range-thumb-active-shadow-color,rgba(35,40,47,.1))}.plyr--full-ui.plyr--audio input[type=range]:active::-moz-range-thumb{box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33,0 0 0 3px #23282f1a;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2)),0 0 0 var(--plyr-range-thumb-active-shadow-width,3px) var(--plyr-audio-range-thumb-active-shadow-color,rgba(35,40,47,.1))}.plyr--full-ui.plyr--audio input[type=range]:active::-ms-thumb{box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33,0 0 0 3px #23282f1a;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2)),0 0 0 var(--plyr-range-thumb-active-shadow-width,3px) var(--plyr-audio-range-thumb-active-shadow-color,rgba(35,40,47,.1))}.plyr--audio .plyr__progress__buffer{color:#c1c8d199;color:var(--plyr-audio-progress-buffered-background,rgba(193,200,209,.6))}.plyr--video{background:#000;background:var(--plyr-video-background,var(--plyr-video-background,#000));overflow:hidden}.plyr--video.plyr--menu-open{overflow:visible}.plyr__video-wrapper{background:#000;background:var(--plyr-video-background,var(--plyr-video-background,#000));height:100%;margin:auto;overflow:hidden;position:relative;width:100%}.plyr__video-embed,.plyr__video-wrapper--fixed-ratio{aspect-ratio:16/9}@supports not (aspect-ratio:16/9){.plyr__video-embed,.plyr__video-wrapper--fixed-ratio{height:0;padding-bottom:56.25%;position:relative}}.plyr__video-embed iframe,.plyr__video-wrapper--fixed-ratio video{border:0;height:100%;left:0;position:absolute;top:0;width:100%}.plyr--full-ui .plyr__video-embed>.plyr__video-embed__container{padding-bottom:240%;position:relative;transform:translateY(-38.28125%)}.plyr--video .plyr__controls{background:linear-gradient(transparent,rgba(0,0,0,.75));background:var(--plyr-video-controls-background,linear-gradient(transparent,rgba(0,0,0,.75)));border-bottom-left-radius:inherit;border-bottom-right-radius:inherit;bottom:0;color:#fff;color:var(--plyr-video-control-color,#fff);left:0;padding:5px;padding:calc(var(--plyr-control-spacing, 10px)/2);padding-top:20px;padding-top:calc(var(--plyr-control-spacing, 10px)*2);position:absolute;right:0;transition:opacity .4s ease-in-out,transform .4s ease-in-out;z-index:3}@media (min-width:480px){.plyr--video .plyr__controls{padding:10px;padding:var(--plyr-control-spacing,10px);padding-top:35px;padding-top:calc(var(--plyr-control-spacing, 10px)*3.5)}}.plyr--video.plyr--hide-controls .plyr__controls{opacity:0;pointer-events:none;transform:translateY(100%)}.plyr--video .plyr__control.plyr__tab-focus,.plyr--video .plyr__control:hover,.plyr--video .plyr__control[aria-expanded=true]{background:#00b2ff;background:var(--plyr-video-control-background-hover,var(--plyr-color-main,var(--plyr-color-main,#00b2ff)));color:#fff;color:var(--plyr-video-control-color-hover,#fff)}.plyr__control--overlaid{background:#00b2ff;background:var(--plyr-video-control-background-hover,var(--plyr-color-main,var(--plyr-color-main,#00b2ff)));border:0;border-radius:100%;color:#fff;color:var(--plyr-video-control-color,#fff);display:none;left:50%;opacity:.9;padding:15px;padding:calc(var(--plyr-control-spacing, 10px)*1.5);position:absolute;top:50%;transform:translate(-50%,-50%);transition:.3s;z-index:2}.plyr__control--overlaid svg{left:2px;position:relative}.plyr__control--overlaid:focus,.plyr__control--overlaid:hover{opacity:1}.plyr--playing .plyr__control--overlaid{opacity:0;visibility:hidden}.plyr--full-ui.plyr--video .plyr__control--overlaid{display:block}.plyr--full-ui.plyr--video input[type=range]::-webkit-slider-runnable-track{background-color:#ffffff40;background-color:var(--plyr-video-range-track-background,var(--plyr-video-progress-buffered-background,hsla(0,0%,100%,.25)))}.plyr--full-ui.plyr--video input[type=range]::-moz-range-track{background-color:#ffffff40;background-color:var(--plyr-video-range-track-background,var(--plyr-video-progress-buffered-background,hsla(0,0%,100%,.25)))}.plyr--full-ui.plyr--video input[type=range]::-ms-track{background-color:#ffffff40;background-color:var(--plyr-video-range-track-background,var(--plyr-video-progress-buffered-background,hsla(0,0%,100%,.25)))}.plyr--full-ui.plyr--video input[type=range]:active::-webkit-slider-thumb{box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33,0 0 0 3px #ffffff80;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2)),0 0 0 var(--plyr-range-thumb-active-shadow-width,3px) var(--plyr-audio-range-thumb-active-shadow-color,hsla(0,0%,100%,.5))}.plyr--full-ui.plyr--video input[type=range]:active::-moz-range-thumb{box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33,0 0 0 3px #ffffff80;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2)),0 0 0 var(--plyr-range-thumb-active-shadow-width,3px) var(--plyr-audio-range-thumb-active-shadow-color,hsla(0,0%,100%,.5))}.plyr--full-ui.plyr--video input[type=range]:active::-ms-thumb{box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33,0 0 0 3px #ffffff80;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2)),0 0 0 var(--plyr-range-thumb-active-shadow-width,3px) var(--plyr-audio-range-thumb-active-shadow-color,hsla(0,0%,100%,.5))}.plyr--video .plyr__progress__buffer{color:#ffffff40;color:var(--plyr-video-progress-buffered-background,hsla(0,0%,100%,.25))}.plyr:fullscreen{background:#000;border-radius:0!important;height:100%;margin:0;width:100%}.plyr:fullscreen video{height:100%}.plyr:fullscreen .plyr__control .icon--exit-fullscreen{display:block}.plyr:fullscreen .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr:fullscreen.plyr--hide-controls{cursor:none}@media (min-width:1024px){.plyr:fullscreen .plyr__captions{font-size:21px;font-size:var(--plyr-font-size-xlarge,21px)}}.plyr--fullscreen-fallback{background:#000;border-radius:0!important;bottom:0;display:block;height:100%;left:0;margin:0;position:fixed;right:0;top:0;width:100%;z-index:10000000}.plyr--fullscreen-fallback video{height:100%}.plyr--fullscreen-fallback .plyr__control .icon--exit-fullscreen{display:block}.plyr--fullscreen-fallback .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr--fullscreen-fallback.plyr--hide-controls{cursor:none}@media (min-width:1024px){.plyr--fullscreen-fallback .plyr__captions{font-size:21px;font-size:var(--plyr-font-size-xlarge,21px)}}.plyr__ads{border-radius:inherit;bottom:0;cursor:pointer;left:0;overflow:hidden;position:absolute;right:0;top:0;z-index:-1}.plyr__ads>div,.plyr__ads>div iframe{height:100%;position:absolute;width:100%}.plyr__ads:after{background:#23282f;border-radius:2px;bottom:10px;bottom:var(--plyr-control-spacing,10px);color:#fff;content:attr(data-badge-text);font-size:11px;padding:2px 6px;pointer-events:none;position:absolute;right:10px;right:var(--plyr-control-spacing,10px);z-index:3}.plyr__ads:empty:after{display:none}.plyr__cues{background:currentColor;display:block;height:5px;height:var(--plyr-range-track-height,5px);left:0;opacity:.8;position:absolute;top:50%;transform:translateY(-50%);width:3px;z-index:3}.plyr__preview-thumb{background-color:#ffffffe6;background-color:var(--plyr-tooltip-background,hsla(0,0%,100%,.9));border-radius:5px;border-radius:var(--plyr-tooltip-radius,5px);bottom:100%;box-shadow:0 1px 2px #00000026;box-shadow:var(--plyr-tooltip-shadow,0 1px 2px rgba(0,0,0,.15));margin-bottom:10px;margin-bottom:calc(var(--plyr-control-spacing, 10px)/2*2);opacity:0;padding:3px;pointer-events:none;position:absolute;transform:translateY(10px) scale(.8);transform-origin:50% 100%;transition:transform .2s ease .1s,opacity .2s ease .1s;z-index:2}.plyr__preview-thumb--is-shown{opacity:1;transform:translate(0) scale(1)}.plyr__preview-thumb:before{border-left:4px solid transparent;border-left:var(--plyr-tooltip-arrow-size,4px) solid transparent;border-right:4px solid transparent;border-right:var(--plyr-tooltip-arrow-size,4px) solid transparent;border-top:4px solid hsla(0,0%,100%,.9);border-top:var(--plyr-tooltip-arrow-size,4px) solid var(--plyr-tooltip-background,hsla(0,0%,100%,.9));bottom:-4px;bottom:calc(var(--plyr-tooltip-arrow-size, 4px)*-1);content:"";height:0;left:calc(50% + var(--preview-arrow-offset));position:absolute;transform:translate(-50%);width:0;z-index:2}.plyr__preview-thumb__image-container{background:#c1c8d1;border-radius:4px;border-radius:calc(var(--plyr-tooltip-radius, 5px) - 1px);overflow:hidden;position:relative;z-index:0}.plyr__preview-thumb__image-container img,.plyr__preview-thumb__image-container:after{height:100%;left:0;position:absolute;top:0;width:100%}.plyr__preview-thumb__image-container:after{border-radius:inherit;box-shadow:inset 0 0 0 1px #00000026;content:"";pointer-events:none}.plyr__preview-thumb__image-container img{max-height:none;max-width:none}.plyr__preview-thumb__time-container{background:linear-gradient(transparent,rgba(0,0,0,.75));background:var(--plyr-video-controls-background,linear-gradient(transparent,rgba(0,0,0,.75)));border-bottom-left-radius:4px;border-bottom-left-radius:calc(var(--plyr-tooltip-radius, 5px) - 1px);border-bottom-right-radius:4px;border-bottom-right-radius:calc(var(--plyr-tooltip-radius, 5px) - 1px);bottom:0;left:0;line-height:1.1;padding:20px 6px 6px;position:absolute;right:0;z-index:3}.plyr__preview-thumb__time-container span{color:#fff;font-size:13px;font-size:var(--plyr-font-size-time,var(--plyr-font-size-small,13px))}.plyr__preview-scrubbing{bottom:0;filter:blur(1px);height:100%;left:0;margin:auto;opacity:0;overflow:hidden;pointer-events:none;position:absolute;right:0;top:0;transition:opacity .3s ease;width:100%;z-index:1}.plyr__preview-scrubbing--is-shown{opacity:1}.plyr__preview-scrubbing img{height:100%;left:0;max-height:none;max-width:none;-o-object-fit:contain;object-fit:contain;position:absolute;top:0;width:100%}.plyr--no-transition{transition:none!important}.plyr__sr-only{clip:rect(1px,1px,1px,1px);border:0!important;height:1px!important;overflow:hidden;padding:0!important;position:absolute!important;width:1px!important}.plyr [hidden]{display:none!important}.plyr--video{width:100%;height:100%}.plyr--audio{width:100%;height:100%;display:flex;align-items:stretch;justify-content:center;background-color:#fff}.telebox-color-scheme-dark .plyr--audio{color-scheme:dark;background-color:#121212;--plyr-audio-controls-background: #121212;--plyr-audio-control-color: #eee}
|
127
|
-
`)();const Mp={volume:1,paused:!0,muted:!1,currentTime:0},Ni={kind:"Plyr",config:{minwidth:300,minheight:80},setup(t){const e=t.storage;if(e.ensureState(Mp),!e.state.src){t.emitter.emit("destroy",{error:new Error('[Plyr]: missing "src"')});return}!e.state.type&&!e.state.provider&&console.warn('[Plyr]: missing "type", will guess from file extension');const i=t.box;i.mountStyles(Sp);const s=new xp(t),r=new vp({target:i.$content,props:{storage:t.storage,sync:s}});t.emitter.on("destroy",()=>{try{s.dispose(),r.$destroy()}catch{}})}},Cp=()=>{le.register({kind:_i.kind,src:_i}),le.register({kind:Ni.kind,src:Ni})},Ls={DocsViewer:_i.kind,MediaPlayer:Ni.kind},Ip={[Ls.DocsViewer]:_i,[Ls.MediaPlayer]:Ni};const uo=new Jc({emitter:P}),$=class extends S.InvisiblePlugin{constructor(t){super(t);this.version="1.0.0-canary.38",this.dependencies={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"1.0.0-alpha.33",emittery:"^0.11.0",lodash:"^4.17.21","p-retry":"^4.6.2","side-effect-manager":"^1.1.1",uuid:"^7.0.3","value-enhancer":"^1.3.2"},peerDependencies:{"white-web-sdk":"^2.16.0"},devDependencies:{"@netless/app-docs-viewer":"^0.3.0","@netless/app-plyr":"0.2.0","@playwright/test":"^1.23.2","@rollup/plugin-commonjs":"^20.0.0","@rollup/plugin-node-resolve":"^13.0.4","@rollup/plugin-url":"^6.1.0","@sveltejs/vite-plugin-svelte":"^1.0.0-next.49","@tsconfig/svelte":"^2.0.1","@types/debug":"^4.1.7","@types/lodash":"^4.14.182","@types/lodash-es":"^4.17.6","@types/node":"^18.0.3","@types/uuid":"^8.3.4","@typescript-eslint/eslint-plugin":"^4.30.0","@typescript-eslint/parser":"^4.30.0","@vitest/ui":"^0.14.2",cypress:"^8.7.0",dotenv:"^10.0.0",eslint:"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-svelte3":"^3.2.0",jsdom:"^19.0.0",less:"^4.1.3",prettier:"^2.3.2","prettier-plugin-svelte":"^2.4.0","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-styles":"^3.14.1",svelte:"^3.42.4",typescript:"^4.5.5",vite:"^2.5.3","vite-plugin-dts":"^1.2.1",vitest:"^0.18.0","white-web-sdk":"2.16.26"}},this.emitter=Q,this.viewMode=S.ViewMode.Broadcaster,this.viewMode$=new w.Val(S.ViewMode.Broadcaster),this.isReplay=S.isPlayer(this.displayer),this.containerSizeRatio=$.containerSizeRatio,$.displayer=t.displayer,window.NETLESS_DEPS={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"1.0.0-alpha.33",emittery:"^0.11.0",lodash:"^4.17.21","p-retry":"^4.6.2","side-effect-manager":"^1.1.1",uuid:"^7.0.3","value-enhancer":"^1.3.2"},peerDependencies:{"white-web-sdk":"^2.16.0"},devDependencies:{"@netless/app-docs-viewer":"^0.3.0","@netless/app-plyr":"0.2.0","@playwright/test":"^1.23.2","@rollup/plugin-commonjs":"^20.0.0","@rollup/plugin-node-resolve":"^13.0.4","@rollup/plugin-url":"^6.1.0","@sveltejs/vite-plugin-svelte":"^1.0.0-next.49","@tsconfig/svelte":"^2.0.1","@types/debug":"^4.1.7","@types/lodash":"^4.14.182","@types/lodash-es":"^4.17.6","@types/node":"^18.0.3","@types/uuid":"^8.3.4","@typescript-eslint/eslint-plugin":"^4.30.0","@typescript-eslint/parser":"^4.30.0","@vitest/ui":"^0.14.2",cypress:"^8.7.0",dotenv:"^10.0.0",eslint:"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-svelte3":"^3.2.0",jsdom:"^19.0.0",less:"^4.1.3",prettier:"^2.3.2","prettier-plugin-svelte":"^2.4.0","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-styles":"^3.14.1",svelte:"^3.42.4",typescript:"^4.5.5",vite:"^2.5.3","vite-plugin-dts":"^1.2.1",vitest:"^0.18.0","white-web-sdk":"2.16.26"}}}static async mount(t){var a;const e=t.room;$.container=t.container;const i=t.debug,s=t.cursor;$.params=t,$.displayer=t.room,cl();let r;if(S.isRoom(e)){if(e.phase!==S.RoomPhase.Connected)throw new Error("[WindowManager]: Room only Connected can be mount");e.phase===S.RoomPhase.Connected&&e.isWritable&&(e.disableSerialization=!1),r=await this.initManager(e)}if($.isCreated)throw new Error("[WindowManager]: Already created cannot be created again");if(this.debug=Boolean(i),Je("Already insert room",r),S.isRoom(this.displayer)){if(!r)throw new Error("[WindowManager]: init InvisiblePlugin failed")}else await No.default(async n=>{if(r=await e.getInvisiblePlugin($.kind),!r)throw Je(`manager is empty. retrying ${n}`),new Error},{retries:10});if(!r)throw new Error("[WindowManager]: create manager failed");t.containerSizeRatio&&($.containerSizeRatio=t.containerSizeRatio),r.containerSizeRatio=$.containerSizeRatio,await r.ensureAttributes(),r.appManager=new yl(r),r._pageState=new qc(r.appManager),r.cursorManager=new Gc(r.appManager,Boolean(s),t.applianceIcons),r.boxManager=Mc(r,Q,P,Ue,{collectorContainer:t.collectorContainer,collectorStyles:t.collectorStyles,prefersColorScheme:t.prefersColorScheme,stageRatio:$.containerSizeRatio,containerStyle:t.containerStyle,stageStyle:t.stageStyle,fullscreen:t.fullscreen}),(a=r.appManager)==null||a.setBoxManager(r.boxManager),t.container&&r.bindContainer(t.container),Xc(e,r),P.emit("onCreated"),$.isCreated=!0;try{await Vo()}catch(n){console.warn("[WindowManager]: indexedDB open failed"),console.log(n)}return r}static async initManager(t){let e=t.getInvisiblePlugin($.kind);if(!e&&S.isRoom(t))if(t.isWritable===!1){try{await t.setWritable(!0)}catch{throw new Error("[WindowManger]: room must be switched to be writable")}e=await Tr(t),e==null||e.ensureAttributes(),await Si(500),await t.setWritable(!1)}else e=await Tr(t);return e}static initContainer(t,e,i){$.container||($.container=t);const{playground:s,mainViewElement:r}=ll(t,e);if($.playground=s,i){const a=document.createElement("style");a.textContent=i,s.appendChild(a)}return r}static get registered(){return pe.registered}bindContainer(t){var e,i,s,r,a,n;if(S.isRoom(this.displayer)&&this.room.phase!==S.RoomPhase.Connected)throw new xa;if($.isCreated&&$.container)$.container.firstChild&&t.appendChild($.container.firstChild);else{const o=(e=this.boxManager)==null?void 0:e.teleBoxManager.$stage;if($.params&&o){const c=$.params,l=$.initContainer(t,o,c.overwriteStyles);this.boxManager&&$.playground&&this.boxManager.setRoot($.playground),this.bindMainView(l,c.disableCameraTransform),$.playground&&((i=this.cursorManager)==null||i.setupWrapper($.playground))}}P.emit("updateManagerRect"),(s=this.appManager)==null||s.refresh(),(r=this.appManager)==null||r.resetMaximized(),(a=this.appManager)==null||a.resetMinimized(),(n=this.appManager)==null||n.displayerWritableListener(!this.room.isWritable),$.container=t}bindCollectorContainer(t){$.isCreated&&this.boxManager?this.boxManager.setCollector(t):$.params&&($.params.collectorContainer=t)}static register(t){return pe.register(t)}static unregister(t){return pe.unregister(t)}async addApp(t){if(this.appManager)return this.appManager.rootDirRemoving?new Promise((e,i)=>{P.once("rootDirRemoved").then(async()=>{try{const s=await this._addApp(t);e(s)}catch(s){i(s.message)}})}):this._addApp(t);throw new de}async _addApp(t){var e,i,s;if(this.appManager){if(!t.kind||typeof t.kind!="string")throw new ba;const r=await((e=pe.appClasses.get(t.kind))==null?void 0:e());if(r&&((i=r.config)==null?void 0:i.singleton)&&this.appManager.appProxies.has(t.kind))throw new ma;const a=this.setupScenePath(t,this.appManager);return a===void 0?void 0:((s=t==null?void 0:t.options)!=null&&s.scenePath&&(t.options.scenePath=Ko(t.options.scenePath)),await this.appManager.addApp(t,Boolean(a)))}else throw new de}setupScenePath(t,e){let i=!1;if(t.options){const{scenePath:s,scenes:r}=t.options;if(s){if(!Xo(s))throw new wa;const a=Object.keys(this.apps||{});for(const n of a){const o=e.store.getAppScenePath(n);if(o&&o===s){if(console.warn(`[WindowManager]: ScenePath ${s} Already opened`),this.boxManager){const c=this.boxManager.getTopBox();c&&this.boxManager.setZIndex(n,c.zIndex+1,!1)}return}}}s&&r&&r.length>0&&(this.isDynamicPPT(r)?(i=!0,ut(this.displayer)[s]||vt(this.room,s,r)):ut(this.displayer)[s]||vt(this.room,s,[{name:r[0].name}])),s&&r===void 0&&vt(this.room,s,[{}])}return i}async setMainViewScenePath(t){this.appManager&&await this.appManager.setMainViewScenePath(t)}async setMainViewSceneIndex(t){this.appManager&&await this.appManager.setMainViewSceneIndex(t)}async nextPage(){if(this.appManager){const t=this.mainViewSceneIndex+1;return t>=this.mainViewScenesLength?(console.warn("[WindowManager]: current page is the last page"),!1):(await this.appManager.setMainViewSceneIndex(t),!0)}else return!1}async prevPage(){if(this.appManager){const t=this.mainViewSceneIndex-1;return t<0?(console.warn("[WindowManager]: current page is the first page"),!1):(await this.appManager.setMainViewSceneIndex(t),!0)}else return!1}async jumpPage(t){return this.appManager?t<0||t>=this.pageState.length?(console.warn(`[WindowManager]: index ${t} out of range`),!1):(await this.appManager.setMainViewSceneIndex(t),!0):!1}async addPage(t){if(this.appManager){const e=t==null?void 0:t.after,i=t==null?void 0:t.scene;if(e){const s=this.mainViewSceneIndex+1;this.room.putScenes(we,[i||{}],s)}else this.room.putScenes(we,[i||{}])}}async removePage(t){if(this.appManager){const e=t===void 0?this.pageState.index:t;return this.pageState.length===1?(console.warn("[WindowManager]: can not remove the last page"),!1):e<0||e>=this.pageState.length?(console.warn(`[WindowManager]: index ${t} out of range`),!1):this.appManager.removeSceneByIndex(e)}else return!1}getMainViewScenePath(){var t;return(t=this.appManager)==null?void 0:t.store.getMainViewScenePath()}getMainViewSceneIndex(){var t;return(t=this.appManager)==null?void 0:t.store.getMainViewSceneIndex()}setReadonly(t){var e;this.readonly=t,(e=this.boxManager)==null||e.setReadonly(t),P.emit("setReadonly",t)}switchMainViewToWriter(){var t;return(t=this.appManager)==null?void 0:t.mainViewProxy.mainViewClickHandler()}onAppDestroy(t,e){qo(`destroy-${t}`,e)}setViewMode(t){var i;Je("setViewMode",t);const e=(i=this.appManager)==null?void 0:i.mainViewProxy;t===S.ViewMode.Broadcaster&&(this.canOperate&&(e==null||e.storeCurrentCamera()),e==null||e.start()),t===S.ViewMode.Freedom&&(e==null||e.stop()),this.viewMode=t,this.viewMode$.setValue(t)}setBoxState(t){if(!!this.canOperate)switch(t){case"normal":this.setMaximized(!1),this.setMinimized(!1);break;case"maximized":this.setMaximized(!0),this.setMinimized(!1);break;case"minimized":this.setMinimized(!0);break}}setMaximized(t){var e;!this.canOperate||(e=this.boxManager)==null||e.setMaximized(t,!1)}setMinimized(t){var e;!this.canOperate||(e=this.boxManager)==null||e.setMinimized(t,!1)}get mainView(){if(this.appManager)return this.appManager.mainViewProxy.view;throw new de}get camera(){if(this.appManager)return this.appManager.mainViewProxy.view.camera;throw new de}get baseCamera(){if(this.appManager)return this.appManager.mainViewProxy.camera$.value;throw new de}get baseSize(){if(this.appManager)return this.appManager.mainViewProxy.size$.value;throw new de}get cameraState(){if(this.appManager)return this.appManager.mainViewProxy.cameraState;throw new de}get apps(){var t;return(t=this.appManager)==null?void 0:t.store.apps()}get boxState(){var t;if(this.appManager)return(t=this.appManager.boxManager)==null?void 0:t.boxState;throw new de}get darkMode(){var t,e;return Boolean((e=(t=this.appManager)==null?void 0:t.boxManager)==null?void 0:e.darkMode)}get prefersColorScheme(){var t;if(this.appManager)return(t=this.appManager.boxManager)==null?void 0:t.prefersColorScheme;throw new de}get fullscreen(){var t;if(this.appManager)return(t=this.appManager.boxManager)==null?void 0:t.teleBoxManager.fullscreen;throw new de}get focused(){return this.attributes.focus}get focusedView(){var t,e;return((e=(t=this.appManager)==null?void 0:t.focusApp)==null?void 0:e.view)||this.mainView}get mainViewSceneIndex(){var t;return((t=this._pageState)==null?void 0:t.index)||0}get mainViewSceneDir(){var t;if(this.appManager)return(t=this.appManager)==null?void 0:t.getMainViewSceneDir();throw new de}get topApp(){var t,e;return(e=(t=this.boxManager)==null?void 0:t.getTopBox())==null?void 0:e.id}get mainViewScenesLength(){var t;return((t=this._pageState)==null?void 0:t.length)||0}get canRedoSteps(){var t;return((t=this.focusedView)==null?void 0:t.canRedoSteps)||0}get canUndoSteps(){var t;return((t=this.focusedView)==null?void 0:t.canUndoSteps)||0}get sceneState(){if(this.appManager)return this.appManager.sceneState;throw new de}get pageState(){if(this._pageState)return this._pageState.toObject();throw new de}queryAll(){var t;return Array.from(((t=this.appManager)==null?void 0:t.appProxies.values())||[])}queryOne(t){var e;return(e=this.appManager)==null?void 0:e.appProxies.get(t)}async closeApp(t){var e;return(e=this.appManager)==null?void 0:e.closeApp(t)}moveCamera(t){var s;const e=R({},this.mainView.camera),i=R(R({},e),t);if(!I.isEqual(i,e)&&!!this.appManager)if(t.animationMode===S.AnimationMode.Immediately)this.appManager.mainViewProxy.storeCamera(R({id:this.appManager.uid},i));else{const r=this.appManager.mainViewProxy.size$.value,a=(s=this.boxManager)==null?void 0:s.stageRect;let n;t.scale&&r&&a&&(n=t.scale*Ei(r,a)),n?this.mainView.moveCamera(he(R({},t),{scale:n})):this.mainView.moveCamera(t),this.appManager.dispatchInternalEvent(Y.MoveCamera,t),setTimeout(()=>{!this.appManager||this.appManager.mainViewProxy.storeCamera(R({id:this.appManager.uid},i))},200)}}convertToPointInWorld(t){return this.mainView.convertToPointInWorld(t)}setCameraBound(t){this.mainView.setCameraBound(t)}onDestroy(){this._destroy()}destroy(){this._destroy()}_destroy(){var t,e,i;(t=this.appManager)==null||t.destroy(),(e=this.cursorManager)==null||e.destroy(),$.container=void 0,$.isCreated=!1,$.playground&&((i=$.playground.parentNode)==null||i.removeChild($.playground)),$.params=void 0,Je("Destroyed")}bindMainView(t,e){var i;this.appManager&&(this.appManager.bindMainView(t,Boolean(e)),(i=this.cursorManager)==null||i.setMainViewDivElement(t))}get canOperate(){return S.isRoom(this.displayer)?this.displayer.isWritable&&this.displayer.phase===S.RoomPhase.Connected:!1}get room(){return this.displayer}safeSetAttributes(t){this.canOperate&&this.setAttributes(t)}safeUpdateAttributes(t,e){this.canOperate&&this.updateAttributes(t,e)}setPrefersColorScheme(t){var e,i;(i=(e=this.appManager)==null?void 0:e.boxManager)==null||i.setPrefersColorScheme(t)}setFullscreen(t){var e,i;(i=(e=this.appManager)==null?void 0:e.boxManager)==null||i.teleBoxManager.setFullscreen(t)}cleanCurrentScene(){var t;(t=this.focusedView)==null||t.cleanCurrentScene()}redo(){var t;return((t=this.focusedView)==null?void 0:t.redo())||0}undo(){var t;return((t=this.focusedView)==null?void 0:t.undo())||0}delete(){var t;(t=this.focusedView)==null||t.delete()}copy(){var t;(t=this.focusedView)==null||t.copy()}paste(){var t;(t=this.focusedView)==null||t.paste()}duplicate(){var t;(t=this.focusedView)==null||t.duplicate()}insertText(t,e,i){var s;return((s=this.focusedView)==null?void 0:s.insertText(t,e,i))||""}insertImage(t){var e;return(e=this.focusedView)==null?void 0:e.insertImage(t)}completeImageUpload(t,e){var i;return(i=this.focusedView)==null?void 0:i.completeImageUpload(t,e)}lockImage(t,e){var i;return(i=this.focusedView)==null?void 0:i.lockImage(t,e)}lockImages(t){var e;return(e=this.focusedView)==null?void 0:e.lockImages(t)}refresh(){var t;this._refresh(),(t=this.appManager)==null||t.dispatchInternalEvent(Y.Refresh)}_refresh(){var t,e;(t=this.appManager)==null||t.mainViewProxy.rebind(),$.container&&this.bindContainer($.container),(e=this.appManager)==null||e.refresher.refresh()}setContainerSizeRatio(t){if(!I.isNumber(t))throw new Error(`[WindowManager]: updateContainerSizeRatio error, ratio must be a number. but got ${t}`);$.containerSizeRatio=t,this.containerSizeRatio=t,P.emit("containerSizeRatioUpdate",t)}setContainerStyle(t){var e;(e=this.boxManager)==null||e.teleBoxManager.setContainerStyle(t)}setStageStyle(t){var e;(e=this.boxManager)==null||e.teleBoxManager.setStageStyle(t)}setBaseSize(t){var e;(e=this.appManager)==null||e.mainViewProxy.setMainViewSize(t)}createPPTHandler(){return{onPageJumpTo:(t,e)=>{var i,s,r,a;(a=(r=(s=(i=this.appManager)==null?void 0:i.focusApp)==null?void 0:s.appContext)==null?void 0:r.whiteBoardView)==null||a.jumpPage(e)},onPageToNext:()=>{var t,e,i,s;this.focused&&((s=(i=(e=(t=this.appManager)==null?void 0:t.focusApp)==null?void 0:e.appContext)==null?void 0:i.whiteBoardView)==null||s.nextPage())},onPageToPrev:()=>{var t,e,i,s;this.focused&&((s=(i=(e=(t=this.appManager)==null?void 0:t.focusApp)==null?void 0:e.appContext)==null?void 0:i.whiteBoardView)==null||s.prevPage())}}}isDynamicPPT(t){var i,s;const e=(s=(i=t[0])==null?void 0:i.ppt)==null?void 0:s.src;return e==null?void 0:e.startsWith("pptx://")}async ensureAttributes(){I.isNull(this.attributes)&&await Si(50),I.isObject(this.attributes)&&(this.attributes[ee.Apps]||this.safeSetAttributes({[ee.Apps]:{}}),this.attributes[ee.Cursors]||this.safeSetAttributes({[ee.Cursors]:{}}),this.attributes._mainScenePath||this.safeSetAttributes({_mainScenePath:pa}),this.attributes._mainSceneIndex||this.safeSetAttributes({_mainSceneIndex:0}),this.attributes[ee.Registered]||this.safeSetAttributes({[ee.Registered]:{}}))}};let le=$;le.kind="WindowManager";le.debug=!1;le.containerSizeRatio=zo;le.isCreated=!1;Cp();exports.AppCreateError=ma;exports.AppManagerNotInitError=de;exports.AppNotRegisterError=sl;exports.BindContainerRoomPhaseInvalidError=xa;exports.BoxManagerNotFoundError=va;exports.BoxNotCreatedError=ya;exports.BuiltinApps=Ls;exports.BuiltinAppsMap=Ip;exports.InvalidScenePath=wa;exports.ParamsInvalidError=ba;exports.WhiteWebSDKInvalidError=fa;exports.WindowManager=le;exports.calculateNextIndex=Vs;exports.reconnectRefresher=uo;
|
123
|
+
}`)(),Ua=(t=>(t.Light="light",t.Dark="dark",t.Auto="auto",t))(Ua||{}),se=(t=>(t.Normal="normal",t.Minimized="minimized",t.Maximized="maximized",t))(se||{}),ue=(t=>(t.DarkMode="dark_mode",t.PrefersColorScheme="prefers_color_scheme",t.Close="close",t.Focus="focus",t.Blur="blur",t.IntrinsicMove="intrinsic_move",t.IntrinsicResize="intrinsic_resize",t.ZIndex="z_index",t.State="state",t.Minimized="minimized",t.Maximized="maximized",t.Readonly="readonly",t.Destroyed="destroyed",t))(ue||{}),je=(t=>(t.Close="close",t.Maximize="maximize",t.Minimize="minimize",t))(je||{}),De=(t=>(t.North="n",t.South="s",t.West="w",t.East="e",t.NorthWest="nw",t.NorthEast="ne",t.SouthEast="se",t.SouthWest="sw",t))(De||{});const rs="dh";function wt(t,e,i){return Math.min(Math.max(t,e),i)}function Rt(t){t.stopPropagation(),t.cancelable&&t.preventDefault()}let gc=1;function mc(){return`New Box ${gc++}`}class Wa{constructor({readonly$:e,state$:i,title$:s,buttons:r,onEvent:a,onDragStart:n,namespace:o="telebox"}){this.sideEffect=new ve.SideEffectManager,this.lastTitleBarClick={timestamp:0,clientX:-100,clientY:-100},this.handleTitleBarClick=c=>{var l;if(!c.isPrimary||this.readonly$.value||c.button!==0||(l=c.target.dataset)!=null&&l.teleTitleBarNoDblClick)return;Rt(c);const d=Date.now();d-this.lastTitleBarClick.timestamp<=500?Math.abs(c.clientX-this.lastTitleBarClick.clientX)<=5&&Math.abs(c.clientY-this.lastTitleBarClick.clientY)<=5&&this.onEvent&&this.onEvent({type:je.Maximize}):this.onDragStart&&this.onDragStart(c),this.lastTitleBarClick.timestamp=d,this.lastTitleBarClick.clientX=c.clientX,this.lastTitleBarClick.clientY=c.clientY},this.readonly$=e,this.state$=i,this.title$=s,this.onEvent=a,this.onDragStart=n,this.namespace=o,this.buttons=r||[{type:je.Minimize,iconClassName:this.wrapClassName("titlebar-icon-minimize")},{type:je.Maximize,iconClassName:this.wrapClassName("titlebar-icon-maximize"),isActive:c=>c===se.Maximized},{type:je.Close,iconClassName:this.wrapClassName("titlebar-icon-close")}],this.$dragArea=this.renderDragArea()}render(){if(!this.$titleBar){this.$titleBar=document.createElement("div"),this.$titleBar.className=this.wrapClassName("titlebar");const e=document.createElement("div");e.className=this.wrapClassName("title-area"),e.dataset.teleBoxHandle=rs;const i=document.createElement("h1");i.className=this.wrapClassName("title"),i.dataset.teleBoxHandle=rs,e.appendChild(i),e.appendChild(this.$dragArea);const s=document.createElement("div");s.className=this.wrapClassName("titlebar-btns"),this.buttons.forEach(({iconClassName:r},a)=>{const n=String(a),o=document.createElement("button");o.className=`${this.wrapClassName("titlebar-btn")} ${r}`,o.dataset.teleTitleBarBtnIndex=n,o.dataset.teleTitleBarNoDblClick="true",s.appendChild(o)}),this.sideEffect.addDisposer(this.title$.subscribe(r=>{i.textContent=r,i.title=r}),"render-title"),this.sideEffect.addDisposer(this.state$.subscribe(r=>{this.buttons.forEach((a,n)=>{var o;a.isActive&&((o=s.children[n])==null||o.classList.toggle("is-active",a.isActive(r)))})}),"render-state-btns"),this.sideEffect.addEventListener(s,"click",r=>{var a;if(this.readonly$.value)return;const n=r.target,o=Number((a=n.dataset)==null?void 0:a.teleTitleBarBtnIndex);if(!Number.isNaN(o)&&o<this.buttons.length){Rt(r);const c=this.buttons[o];this.onEvent&&this.onEvent({type:c.type,value:c.value})}},{},"render-btns-container-click"),this.$titleBar.appendChild(e),this.$titleBar.appendChild(s)}return this.$titleBar}renderDragArea(){const e=document.createElement("div");return e.className=this.wrapClassName("drag-area"),e.dataset.teleBoxHandle=rs,this.sideEffect.addEventListener(e,"pointerdown",this.handleTitleBarClick),e}dragHandle(){return this.$titleBar}wrapClassName(e){return`${this.namespace}-${e}`}destroy(){this.sideEffect.flushAll(),this.$titleBar&&(this.$titleBar=void 0,this.onDragStart=void 0,this.onEvent=void 0)}}function Ha([t,e]){if(e<=0||t.width<=0||t.height<=0)return t;const i=t.width*e;if(i===t.height)return t;if(i<t.height)return{x:0,y:(t.height-i)/2,width:t.width,height:i};const s=t.height/e;return{x:(t.width-s)/2,y:0,width:s,height:t.height}}const fc=window.ResizeObserver||ha.ResizeObserver;class bc{constructor({id:e=ve.genUID(),title:i=mc(),namespace:s="telebox",visible:r=!0,width:a=.5,height:n=.5,minWidth:o=0,minHeight:c=0,x:l=.1,y:d=.1,resizable:u=!0,draggable:p=!0,boxRatio:m=-1,focus:g=!1,zIndex:f=100,stageRatio:b=null,enableShadowDOM:v=!0,titleBar:x,content:y,stage:k,footer:z,styles:T,userStyles:O,bodyStyle:te=null,stageStyle:G=null,darkMode$:xe,fence$:Re,root:me,rootRect$:Ie,managerMinimized$:fe,managerMaximized$:_e,managerReadonly$:be,managerStageRect$:ye,managerStageRatio$:Me,defaultBoxBodyStyle$:Ae,defaultBoxStageStyle$:Se,collectorRect$:ot}){this.events=new rt.default,this._delegateEvents=new rt.default,this.handleTrackStart=D=>{var U;return(U=this._handleTrackStart)==null?void 0:U.call(this,D)},this._sideEffect=new ve.SideEffectManager,this.id=e,this.namespace=s,this.enableShadowDOM=v;const Oe=new w.ValManager;this._sideEffect.addDisposer(()=>Oe.destroy());const Qe=new w.Val(i),bt=new w.Val(r),A=new w.Val(u),R=new w.Val(p),ke=new w.Val(m),Ce=new w.Val(f),Tt=new w.Val(g),yt=new w.Val(null),pr=new w.Val(null),gr=new w.Val(null),Hi=w.combine([yt,_e],([D,U])=>D!=null?D:U),ai=w.combine([pr,fe],([D,U])=>D!=null?D:U),Fi=w.combine([gr,be],([D,U])=>D!=null?D:U),Zi=w.combine([ai,Hi],([D,U])=>D?se.Minimized:U?se.Maximized:se.Normal),Yi=new w.Val({width:wt(o,0,1),height:wt(c,0,1)},{compare:Ne}),po=w.combine([Yi,ye],([D,U])=>({width:D.width*U.width,height:D.height*U.height}),{compare:Ne}),ni=new w.Val({width:a,height:n},{compare:Ne});this._sideEffect.addDisposer(Yi.reaction((D,U)=>{ni.setValue({width:Math.max(a,D.width),height:Math.max(n,D.height)},U)}));const Qi=new w.Val({x:l,y:d},{compare:Ne}),Gi=w.combine([ni,ye],([D,U])=>({width:U.width*D.width,height:U.height*D.height}),{compare:Ne}),Nt=w.combine([Qi,ye],([D,U])=>({x:D.x*U.width,y:D.y*U.height}),{compare:Ne}),go=new w.Val(te),mo=new w.Val(G),fo=new w.Val(null),mr=new w.Val(ye.value,{compare:Ne}),fr=new w.Val(b),bo=w.combine([fr,Me],([D,U])=>D!=null?D:U),yo=w.combine([mr,bo],Ha,{compare:Ne}),wo={darkMode:xe,fence:Re,rootRect:Ie,managerMinimized:fe,managerMaximized:_e,managerReadonly:be,managerStageRect:ye,managerStageRatio:Me,defaultBoxBodyStyle:Ae,defaultBoxStageStyle:Se,collectorRect:ot};w.withReadonlyValueEnhancer(this,wo);const vo={zIndex:Ce,focus:Tt,state:Zi,minSize:Yi,pxMinSize:po,intrinsicSize:ni,intrinsicCoord:Qi,pxIntrinsicSize:Gi,pxIntrinsicCoord:Nt,bodyRect:mr,stageRect:yo,minimized:ai,maximized:Hi,readonly:Fi};w.withReadonlyValueEnhancer(this,vo,Oe);const xo={title:Qe,visible:bt,resizable:A,draggable:R,boxRatio:ke,boxMinimized:pr,boxMaximized:yt,boxReadonly:gr,stageRatio:fr,bodyStyle:go,stageStyle:mo};w.withValueEnhancer(this,xo,Oe),this.titleBar=x||new Wa({readonly$:Fi,state$:Zi,title$:Qe,namespace:this.namespace,onDragStart:D=>{var U;return(U=this._handleTrackStart)==null?void 0:U.call(this,D)},onEvent:D=>this._delegateEvents.emit(D.type)}),this._sideEffect.addDisposer(w.combine([ke,ai]).subscribe(([D,U])=>{!U&&D>0&&this.transform(Nt.value.x,Nt.value.y,Gi.value.width,Gi.value.height)})),this._sideEffect.addDisposer(Re.subscribe(D=>{D&&this.move(Nt.value.x,Nt.value.y)})),this.$box=this._render(),fo.setValue(this.$content.parentElement),y&&this.mountContent(y),k&&this.mountStage(k),z&&this.mountFooter(z),T&&this.mountStyles(T),O&&this.mountUserStyles(O),me.appendChild(this.$box);const Ge=(D,U)=>{this._sideEffect.addDisposer(D.reaction((Mo,So)=>{So||this.events.emit(U,Mo)}))};Ge(xe,ue.DarkMode),Ge(Fi,ue.Readonly),Ge(Ce,ue.ZIndex),Ge(ai,ue.Minimized),Ge(Hi,ue.Maximized),Ge(Zi,ue.State),Ge(ni,ue.IntrinsicResize),Ge(Qi,ue.IntrinsicMove),this._sideEffect.addDisposer([bt.reaction((D,U)=>{!U&&!D&&this.events.emit(ue.Close)}),Tt.reaction((D,U)=>{U||this.events.emit(D?ue.Focus:ue.Blur)})])}get minWidth(){return this._minSize$.value.width}get minHeight(){return this._minSize$.value.height}setMinWidth(e,i=!1){this._minSize$.setValue({width:e,height:this.minHeight},i)}setMinHeight(e,i=!1){this._minSize$.setValue({width:this.minWidth,height:e},i)}resize(e,i,s=!1){this._intrinsicSize$.setValue({width:Math.max(e,this.minWidth),height:Math.max(i,this.minHeight)},s)}get intrinsicX(){return this._intrinsicCoord$.value.x}get intrinsicY(){return this._intrinsicCoord$.value.y}get intrinsicWidth(){return this._intrinsicSize$.value.width}get intrinsicHeight(){return this._intrinsicSize$.value.height}move(e,i,s=!1){let r,a;const n=this.managerStageRect,o=this.pxIntrinsicSize;this.fence?(r=wt(e,0,n.width-o.width),a=wt(i,0,n.height-o.height)):(r=wt(e,-(o.width-120),0+n.width-20),a=wt(i,0,0+n.height-20)),this._intrinsicCoord$.setValue({x:r/n.width,y:a/n.height},s)}transform(e,i,s,r,a=!1){const n=this.managerStageRect;if(s=Math.max(s,this.pxMinSize.width),r=Math.max(r,this.pxMinSize.height),this.boxRatio>0){const o=this.boxRatio*s;i!==this.pxIntrinsicCoord.y&&(i-=o-r),r=o}i<0&&(i=0,r=this.pxIntrinsicSize.height),this.move(e,i,a),this._intrinsicSize$.setValue({width:s/n.width,height:r/n.height},a)}mountContent(e){var i;(i=this.$authorContent)==null||i.remove(),this.$authorContent=e,this.$content.appendChild(e)}unmountContent(){this.$authorContent&&(this.$authorContent.remove(),this.$authorContent=void 0)}mountStage(e){var i;(i=this.$authorStage)==null||i.remove(),this.$authorStage=e,this.$stage||(this.$stage=this._renderStage()),this.$stage.appendChild(e),this.$stage.parentElement||this.$body.appendChild(this.$stage)}unmountStage(){var e;this.$authorStage&&(this.$authorStage.remove(),this.$authorStage=void 0),(e=this.$stage)==null||e.remove()}mountFooter(e){var i;(i=this.$authorFooter)==null||i.remove(),this.$authorFooter=e,this.$footer.appendChild(e)}unmountFooter(){this.$authorFooter&&(this.$authorFooter.remove(),this.$authorFooter=void 0)}mountStyles(e){this.$styles.textContent=e}unmountStyles(){this.$styles.textContent=""}mountUserStyles(e){this.$userStyles.textContent=e}unmountUserStyles(){this.$userStyles.textContent=""}_render(){if(this.$box)return this.$box;const e=(b,v)=>this._sideEffect.addDisposer([this._readonly$.subscribe(x=>b.classList.toggle(this.wrapClassName("readonly"),x)),this._draggable$.subscribe(x=>b.classList.toggle(this.wrapClassName("no-drag"),!x)),this._resizable$.subscribe(x=>b.classList.toggle(this.wrapClassName("no-resize"),!x)),this._focus$.subscribe(x=>b.classList.toggle(this.wrapClassName("blur"),!x)),this._darkMode$.subscribe(x=>{b.classList.toggle(this.wrapClassName("color-scheme-dark"),x),b.classList.toggle(this.wrapClassName("color-scheme-light"),!x)})],v);this.$box=document.createElement("div"),this.$box.classList.add(this.wrapClassName("box")),e(this.$box,"bind-box-state"),this._sideEffect.add(()=>{const b=this.wrapClassName("minimized"),v=this.wrapClassName("maximized"),x="box-maximized-timer";return this._state$.subscribe(y=>{this.$box.classList.toggle(b,y===se.Minimized),y===se.Maximized?(this._sideEffect.flush(x),this.$box.classList.toggle(v,!0)):this._sideEffect.setTimeout(()=>{this.$box.classList.toggle(v,!1)},0,x)})}),this._sideEffect.addDisposer(this._visible$.subscribe(b=>{this.$box.style.display=b?"block":"none"})),this._sideEffect.addDisposer(this._zIndex$.subscribe(b=>{this.$box.style.zIndex=String(b)})),this.$box.dataset.teleBoxID=this.id;const i=uc(this.$box),s=w.combine([this._maximized$,this._minimized$,this._pxIntrinsicSize$,this._pxIntrinsicCoord$,this._collectorRect$,this._rootRect$,this._managerStageRect$],([b,v,x,y,k,z,T])=>{const O=b?{x:-T.x,y:-T.y,width:z.width,height:z.height,scaleX:1,scaleY:1}:{x:y.x,y:y.y,width:x.width,height:x.height,scaleX:1,scaleY:1};if(v&&k){const{width:te,height:G}=b?this.rootRect:x;O.x=k.x-te/2+k.width/2-T.x,O.y=k.y-G/2+k.height/2-T.y,O.scaleX=k.width/te,O.scaleY=k.height/G}return O},{compare:Ne}),r=s.value;this.$box.style.width=r.width+"px",this.$box.style.height=r.height+"px",this.$box.style.transform=`translate(${r.x-10}px,${r.y-10}px)`,this._sideEffect.addDisposer(s.subscribe(b=>{i.set(b)}));const a=document.createElement("div");a.className=this.wrapClassName("box-main"),this.$box.appendChild(a);const n=document.createElement("div");n.className=this.wrapClassName("titlebar-wrap"),n.appendChild(this.titleBar.render()),this.$titleBar=n;const o=document.createElement("div");o.className=this.wrapClassName("body-wrap"),this.$body=o;const c=document.createElement("style");this.$styles=c,o.appendChild(c);const l=document.createElement("style");this.$userStyles=l,o.appendChild(l);const d=document.createElement("div");d.className=this.wrapClassName("content")+" tele-fancy-scrollbar",this.$content=d,this._sideEffect.addDisposer(w.combine([this._bodyStyle$,this._defaultBoxBodyStyle$],([b,v])=>b!=null?b:v).subscribe(b=>d.style.cssText=b||"")),o.appendChild(d);const u=document.createElement("div");u.className=this.wrapClassName("footer-wrap"),this.$footer=u,a.appendChild(n);const p=document.createElement("div");p.className=this.wrapClassName("main"),this.$main=p,a.appendChild(p);const m=document.createElement("div");m.className=this.wrapClassName("quarantine-outer"),p.appendChild(m);const g=document.createElement("div");if(g.className=this.wrapClassName("quarantine"),g.appendChild(o),g.appendChild(u),this.enableShadowDOM){e(g,"bind-quarantine-state");const b=document.createElement("style");b.textContent=pc,g.insertBefore(b,g.firstChild),m.attachShadow({mode:"open"}).appendChild(g)}else m.appendChild(g);this._renderResizeHandlers();const f=()=>{const b=o.getBoundingClientRect();this._bodyRect$.setValue({x:0,y:0,width:b.width,height:b.height})};return this._sideEffect.add(()=>{const b=new fc(()=>{this.minimized||f()});return b.observe(o),()=>b.disconnect()}),this._sideEffect.addDisposer(this._minimized$.reaction(b=>{b||this._sideEffect.setTimeout(f,400,"minimized-content-rect-fix")})),this.$box}_renderStage(){const e=document.createElement("div");e.className=this.wrapClassName("box-stage");const i=s=>{e.style.top=s.y+"px",e.style.left=s.x+"px",e.style.width=s.width+"px",e.style.height=s.height+"px"};return this._sideEffect.addDisposer([w.combine([this._stageStyle$,this._defaultBoxStageStyle$],([s,r])=>s!=null?s:r).subscribe(s=>{e.style.cssText=s||"",i(this._stageRect$.value)}),this._stageRect$.subscribe(i)],"box-stage-styles"),e}_renderResizeHandlers(){const e=document.createElement("div");e.className=this.wrapClassName("resize-handles"),Object.values(De).forEach(f=>{const b=document.createElement("div");b.className=this.wrapClassName(f)+" "+this.wrapClassName("resize-handle"),b.dataset.teleBoxHandle=f,e.appendChild(b)}),this.$box.appendChild(e);const i="handle-tracking-listener",s=this.wrapClassName("transforming");let r,a=0,n=0,o=0,c=0,l=0,d=0,u;const p=f=>{if(!f.isPrimary||this.state!==se.Normal)return;Rt(f);let{pageX:b,pageY:v}=f;v<0&&(v=0);const x=b-l,y=v-d;let{x:k,y:z}=this.pxIntrinsicCoord,{width:T,height:O}=this.pxIntrinsicSize;switch(u){case De.North:{z=n+y,O=c-y;break}case De.South:{O=c+y;break}case De.West:{k=a+x,T=o-x;break}case De.East:{T=o+x;break}case De.NorthWest:{k=a+x,z=n+y,T=o-x,O=c-y;break}case De.NorthEast:{z=n+y,T=o+x,O=c-y;break}case De.SouthEast:{T=o+x,O=c+y;break}case De.SouthWest:{k=a+x,T=o-x,O=c+y;break}default:{this.move(a+x,n+y);return}}this.transform(k,z,T,O)},m=f=>{!f.isPrimary||(u=void 0,r&&(Rt(f),this.$box.classList.toggle(s,!1),this._sideEffect.flush(i),r.remove()))},g=f=>{var b;if(!f.isPrimary||this.readonly||f.button!=null&&f.button!==0||!this.draggable||u||this.state!==se.Normal)return;const v=f.target;if((b=v.dataset)!=null&&b.teleBoxHandle){Rt(f),{x:a,y:n}=this.pxIntrinsicCoord,{width:o,height:c}=this.pxIntrinsicSize,{pageX:l,pageY:d}=f,u=v.dataset.teleBoxHandle,r||(r=document.createElement("div"));const x=u?this.wrapClassName(`cursor-${u}`):"";r.className=this.wrapClassName(`track-mask${x?` ${x}`:""}`),this.$box.appendChild(r),this.$box.classList.add(s),this._sideEffect.add(()=>(window.addEventListener("pointermove",p,{passive:!1}),window.addEventListener("pointerup",m,{passive:!1}),window.addEventListener("pointercancel",m,{passive:!1}),()=>{window.removeEventListener("pointermove",p),window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",m)}),i)}};this._handleTrackStart=g,this._sideEffect.addEventListener(e,"pointerdown",g,{},"box-resizeHandles-pointerdown")}async destroy(){this.$box.remove(),this._sideEffect.flushAll(),this._sideEffect.flushAll(),await this.events.emit(ue.Destroyed),this.events.clearListeners(),this._delegateEvents.clearListeners()}wrapClassName(e){return`${this.namespace}-${e}`}}var yc="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K";class wc{constructor({minimized$:e,readonly$:i,darkMode$:s,namespace:r="telebox",styles:a={},root:n,onClick:o}){this._sideEffect=new ve.SideEffectManager,this.namespace=r;const c=new w.ValManager;this._sideEffect.addDisposer(()=>c.destroy());const l=new w.Val(void 0),d=w.derive(e),u=new w.Val(a),p=new w.Val(document.createElement("button")),m={styles:u,$collector:p};w.withValueEnhancer(this,m,c);const g={rect:l,visible:d};w.withReadonlyValueEnhancer(this,g,c),p.value.className=this.wrapClassName("collector"),p.value.style.backgroundImage=`url('${yc}')`,this._sideEffect.addDisposer(p.subscribe(f=>{this._sideEffect.add(()=>(n.appendChild(f),()=>f.remove()),"telebox-collector-mount"),this._sideEffect.addEventListener(f,"click",()=>{i.value||o==null||o()},{},"telebox-collector-click"),this._sideEffect.addDisposer([d.subscribe(b=>{f.classList.toggle(this.wrapClassName("collector-visible"),b)}),i.subscribe(b=>{f.classList.toggle(this.wrapClassName("collector-readonly"),b)}),s.subscribe(b=>{f.classList.toggle(this.wrapClassName("color-scheme-dark"),b),f.classList.toggle(this.wrapClassName("color-scheme-light"),!b)}),u.subscribe(b=>{Object.keys(b).forEach(v=>{const x=b[v];x!=null&&(f.style[v]=x)})}),e.subscribe(b=>{if(b){const{x:v,y:x,width:y,height:k}=f.getBoundingClientRect(),z=n.getBoundingClientRect();l.setValue({x:v-z.x,y:x-z.y,width:y,height:k})}})],"telebox-collector-el")}))}destroy(){this._sideEffect.flushAll()}wrapClassName(e){return`${this.namespace}-${e}`}}var le=(t=>(t.Focused="focused",t.Blurred="blurred",t.Created="created",t.Removed="removed",t.State="state",t.Maximized="maximized",t.Minimized="minimized",t.IntrinsicMove="intrinsic_move",t.IntrinsicResize="intrinsic_resize",t.ZIndex="z_index",t.PrefersColorScheme="prefers_color_scheme",t.DarkMode="dark_mode",t))(le||{});class vc extends Wa{constructor(e){super(e);this.boxes$=e.boxes$,this.rootRect$=e.rootRect$,this.darkMode$=e.darkMode$,e.root.appendChild(this.render())}focusBox(e){var i;if(!(this.focusedBox&&this.focusedBox===e)){if(this.$titles&&this.state$.value===se.Maximized){const{children:s}=this.$titles.firstElementChild;for(let r=s.length-1;r>=0;r-=1){const a=s[r],n=(i=a.dataset)==null?void 0:i.teleBoxID;n&&(e&&n===e.id?a.classList.toggle(this.wrapClassName("titles-tab-focus"),!0):this.focusedBox&&n===this.focusedBox.id&&a.classList.toggle(this.wrapClassName("titles-tab-focus"),!1))}}this.focusedBox=e}}render(){if(this.$titleBar)return this.$titleBar;const e=super.render();e.classList.add(this.wrapClassName("max-titlebar")),this.sideEffect.addDisposer([w.combine([this.boxes$,this.state$]).subscribe(([s,r])=>{e.classList.toggle(this.wrapClassName("max-titlebar-active"),r===se.Maximized&&s.length>0)}),this.readonly$.subscribe(s=>{e.classList.toggle(this.wrapClassName("readonly"),s)}),w.combine([this.state$,this.boxes$]).subscribe(([s,r])=>{s===se.Maximized&&(e.classList.toggle(this.wrapClassName("max-titlebar-single-title"),r.length===1),r.length!==1&&e.replaceChild(this.renderTitles(),e.firstElementChild))})],"max-render");const i=document.createElement("div");return i.classList.add(this.wrapClassName("titles-area")),e.insertBefore(i,e.firstElementChild),e}destroy(){super.destroy(),this.$titles=void 0,this.focusedBox=void 0}renderTitles(){this.$titles=document.createElement("div"),this.$titles.className=this.wrapClassName("titles"),this.sideEffect.addEventListener(this.$titles,"wheel",s=>{s.currentTarget.scrollBy({left:s.deltaY>0?250:-250,behavior:"smooth"})},{passive:!1},"max-render-wheel-titles");const e=document.createElement("div");e.className=this.wrapClassName("titles-content"),this.$titles.appendChild(e);const i=this.boxes$.value.map(s=>{const r=document.createElement("button");return r.className=this.wrapClassName("titles-tab"),r.textContent=s.title,r.dataset.teleBoxID=s.id,r.dataset.teleTitleBarNoDblClick="true",this.focusedBox&&s.id===this.focusedBox.id&&r.classList.add(this.wrapClassName("titles-tab-focus")),e.appendChild(r),s._title$.reaction(a=>r.textContent=a)});return this.sideEffect.addDisposer(()=>i.forEach(s=>s()),"max-render-tab-titles"),this.$titles}}const xc=window.ResizeObserver||ha.ResizeObserver;class Mc{constructor({root:e=null,fullscreen:i=!1,prefersColorScheme:s=Ua.Light,minimized:r=!1,maximized:a=!1,fence:n=!0,collector:o,namespace:c="telebox",readonly:l=!1,stageRatio:d=-1,containerStyle:u="",stageStyle:p="",defaultBoxBodyStyle:m=null,defaultBoxStageStyle:g=null,theme:f={}}={}){this.events=new rt.default,this._sideEffect=new ve.SideEffectManager,this.namespace=c;const b=new w.ValManager;this._sideEffect.addDisposer(()=>b.destroy());const v=new w.Val(e),x=new w.Val(l),y=new w.Val(n),k=new w.Val(u),z=new w.Val(p),T=new w.Val(d),O=new w.Val(m),te=new w.Val(g),G=new w.Val(i),xe=new w.Val(r),Re=new w.Val(a),me=w.combine([Re,G],([A,R])=>R?!0:A),Ie=w.combine([xe,G],([A,R])=>R?!1:A);this.setMaximized=(A,R)=>Re.setValue(A,R),this.setMinimized=(A,R)=>xe.setValue(A,R);const fe=new w.Val({x:0,y:0,width:window.innerWidth,height:window.innerHeight},{compare:Ne});this._sideEffect.addDisposer(v.subscribe(A=>{this._sideEffect.add(()=>{if(!A)return()=>{};const R=new xc(()=>{const ke=A.getBoundingClientRect();fe.setValue({x:0,y:0,width:ke.width,height:ke.height})});return R.observe(A),()=>R.disconnect()},"calc-root-rect")}));const _e=w.combine([fe,T],Ha,{compare:Ne});this.boxes$=new w.Val([]),this.topBox$=new w.Val(void 0),this._sideEffect.addDisposer(this.boxes$.subscribe(A=>{if(A.length>0){const R=A.reduce((ke,Ce)=>ke.zIndex>Ce.zIndex?ke:Ce);this.topBox$.setValue(R)}else this.topBox$.setValue(void 0)}));const be=window.matchMedia("(prefers-color-scheme: dark)"),ye=new w.Val(!1);be&&(ye.setValue(be.matches),this._sideEffect.add(()=>{const A=R=>{ye.setValue(R.matches)};return be.addEventListener("change",A),()=>be.removeEventListener("change",A)}));const Me=new w.Val(s);this._sideEffect.addDisposer(Me.reaction((A,R)=>{R||this.events.emit(le.PrefersColorScheme,A)}));const Ae=w.combine([ye,Me],([A,R])=>R==="auto"?A:R==="dark"),Se=w.combine([Ie,me],([A,R])=>A?se.Minimized:R?se.Maximized:se.Normal),ot={darkMode:Ae,state:Se,root:v,rootRect:fe,stageRect:_e,minimized:Ie,maximized:me};w.withReadonlyValueEnhancer(this,ot,b);const Oe={fullscreen:G,prefersColorScheme:Me,readonly:x,fence:y,stageRatio:T,containerStyle:k,stageStyle:z,defaultBoxBodyStyle:O,defaultBoxStageStyle:te};w.withValueEnhancer(this,Oe,b);const Qe=this.wrapClassName("titlebar-icon-close"),bt=A=>{var R;if(!A.isPrimary||x.value)return;const ke=A.target;if(!!ke.tagName)for(let Ce=ke;Ce;Ce=Ce.parentElement){if(Ce.classList&&Ce.classList.contains(Qe))return;const Tt=(R=Ce.dataset)==null?void 0:R.teleBoxID;if(Tt){const yt=this.getBox(Tt);if(yt){this.focusBox(yt),this.makeBoxTop(yt);return}}}};this._sideEffect.addEventListener(window,"pointerdown",bt,!0),this.$container=document.createElement("div"),this.$container.className=this.wrapClassName("manager-container"),this.setTheme(f),this.$stage=document.createElement("div"),this.$stage.className=this.wrapClassName("manager-stage"),this.$container.appendChild(this.$stage),this._sideEffect.addDisposer([Ae.subscribe(A=>{this.$container.classList.toggle(this.wrapClassName("color-scheme-dark"),A),this.$container.classList.toggle(this.wrapClassName("color-scheme-light"),!A)}),G.subscribe(A=>{this.$container.classList.toggle(this.wrapClassName("is-fullscreen"),Boolean(A))}),w.combine([this.boxes$,G],([A,R])=>R==="no-titlebar"||R===!0&&A.length<=1).subscribe(A=>{this.$container.classList.toggle(this.wrapClassName("hide-fullscreen-titlebar"),A)}),me.subscribe(A=>{this.$container.classList.toggle(this.wrapClassName("is-maximized"),A)}),Ie.subscribe(A=>{this.$container.classList.toggle(this.wrapClassName("is-minimized"),A)}),k.subscribe(A=>{this.$container.style.cssText=A}),z.subscribe(A=>{this.$stage.style.cssText=A,this.$stage.style.width=_e.value.width+"px",this.$stage.style.height=_e.value.height+"px"}),_e.subscribe(A=>{this.$stage.style.width=A.width+"px",this.$stage.style.height=A.height+"px"}),v.subscribe(A=>{A?A.appendChild(this.$container):this.$container.parentElement&&this.$container.remove()})]),this.collector=o!=null?o:new wc({minimized$:Ie,readonly$:x,darkMode$:Ae,namespace:c,root:this.$container,onClick:()=>xe.setValue(!1)}),this.titleBar=new vc({namespace:this.namespace,title$:w.derive(this.topBox$,A=>(A==null?void 0:A.title)||""),boxes$:this.boxes$,darkMode$:Ae,readonly$:x,state$:Se,rootRect$:fe,root:this.$container,onEvent:A=>{switch(A.type){case je.Maximize:{this.setMaximized(!me.value);break}case je.Minimize:{this.setMinimized(!0);break}case ue.Close:{this.removeTopBox(),this.focusTopBox();break}}}}),this._sideEffect.addDisposer([Se.reaction((A,R)=>{R||this.events.emit(le.State,A)}),me.reaction((A,R)=>{R||this.events.emit(le.Maximized,A)}),Ie.reaction((A,R)=>{R||this.events.emit(le.Minimized,A)}),Ae.reaction((A,R)=>{R||this.events.emit(le.DarkMode,A)})])}get boxes(){return this.boxes$.value}get topBox(){return this.topBox$.value}setState(e,i=!1){switch(e){case se.Maximized:{this.setMinimized(!1,i),this.setMaximized(!0,i);break}case se.Minimized:{this.setMinimized(!0,i),this.setMaximized(!1,i);break}default:{this.setMinimized(!1,i),this.setMaximized(!1,i);break}}return this}create(e={},i=!0){const s=new bc(oe(j(j({zIndex:this.topBox?this.topBox.zIndex+1:100},e),i?this.smartPosition(e):{}),{namespace:this.namespace,root:this.$stage,darkMode$:this._darkMode$,fence$:this._fence$,rootRect$:this._rootRect$,managerStageRect$:this._stageRect$,managerStageRatio$:this._stageRatio$,managerMaximized$:this._maximized$,managerMinimized$:this._minimized$,managerReadonly$:this._readonly$,collectorRect$:this.collector._rect$,defaultBoxBodyStyle$:this._defaultBoxBodyStyle$,defaultBoxStageStyle$:this._defaultBoxStageStyle$}));return s.focus&&(this.focusBox(s),i&&this.makeBoxTop(s)),this.boxes$.setValue([...this.boxes,s]),this._sideEffect.addDisposer([s._delegateEvents.on(je.Maximize,()=>{this.setMaximized(!this.maximized)}),s._delegateEvents.on(je.Minimize,()=>{this.setMinimized(!0)}),s._delegateEvents.on(je.Close,()=>{this.remove(s),this.focusTopBox()}),s._intrinsicCoord$.reaction((r,a)=>{a||this.events.emit(le.IntrinsicMove,s)}),s._intrinsicSize$.reaction((r,a)=>{a||this.events.emit(le.IntrinsicResize,s)}),s._zIndex$.reaction((r,a)=>{if(this.boxes.length>0){const n=this.boxes.reduce((o,c)=>o.zIndex>c.zIndex?o:c);this.topBox$.setValue(n)}a||this.events.emit(le.ZIndex,s)})]),this.events.emit(le.Created,s),s}query(e){return e?this.boxes.filter(this.teleBoxMatcher(e)):[...this.boxes]}queryOne(e){return e?this.boxes.find(this.teleBoxMatcher(e)):this.boxes[0]}update(e,i,s=!1){const r=this.boxes.find(a=>a.id===e);if(r)return this.updateBox(r,i,s)}updateAll(e,i=!1){this.boxes.forEach(s=>{this.updateBox(s,e,i)})}remove(e,i=!1){const s=this.getBoxIndex(e);if(s>=0){const r=this.boxes.slice(),a=r.splice(s,1);return this.boxes$.setValue(r),a.forEach(n=>n.destroy()),i||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(le.Removed,a)),a[0]}}removeTopBox(){if(this.topBox)return this.remove(this.topBox)}removeAll(e=!1){const i=this.boxes$.value;return this.boxes$.setValue([]),i.forEach(s=>s.destroy()),e||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(le.Removed,i)),i}setTheme(e){Object.keys(e).forEach(i=>{var s;this.$container.style.setProperty(`--tele-${i}`,(s=e[i])!=null?s:null)})}mount(e){this._root$.setValue(e)}unmount(){this._root$.setValue(null)}destroy(e=!1){this.events.clearListeners(),this._sideEffect.flushAll(),this.removeAll(e),this.collector.destroy(),this.titleBar.destroy()}wrapClassName(e){return`${this.namespace}-${e}`}focusBox(e,i=!1){const s=this.getBox(e);s&&(this.boxes.forEach(r=>{if(s===r){let a=!1;s.focus||(a=!0,s._focus$.setValue(!0,i)),a&&!i&&this.events.emit(le.Focused,s)}else r.focus&&this.blurBox(r,i)}),this.titleBar.focusBox(s))}focusTopBox(){if(this.topBox&&!this.topBox.focus)return this.focusBox(this.topBox)}blurBox(e,i=!1){const s=this.getBox(e);s&&(s.focus&&(s._focus$.setValue(!1,i),i||this.events.emit(le.Blurred,s)),this.titleBar.focusedBox===s&&this.titleBar.focusBox())}blurAll(e=!1){this.boxes.forEach(i=>{i.focus&&(i._focus$.setValue(!1,e),e||this.events.emit(le.Blurred,i))}),this.titleBar.focusedBox&&this.titleBar.focusBox()}teleBoxMatcher(e){const i=Object.keys(e);return s=>i.every(r=>e[r]===s[r])}updateBox(e,i,s=!1){var r,a,n,o,c,l;(i.x!=null||i.y!=null)&&e._intrinsicCoord$.setValue({x:(r=i.x)!=null?r:e.intrinsicX,y:(a=i.y)!=null?a:e.intrinsicY},s),(i.width!=null||i.height!=null)&&e._intrinsicSize$.setValue({width:(n=i.width)!=null?n:e.intrinsicWidth,height:(o=i.height)!=null?o:e.intrinsicHeight},s),i.title!=null&&e._title$.setValue(i.title),i.visible!=null&&e._visible$.setValue(i.visible,s),i.resizable!=null&&e._resizable$.setValue(i.resizable,s),i.draggable!=null&&e._draggable$.setValue(i.draggable,s),i.boxRatio!=null&&e._boxRatio$.setValue(i.boxRatio,s),i.zIndex!=null&&e._zIndex$.setValue(i.zIndex,s),i.stageRatio!==void 0&&e.setStageRatio(i.stageRatio,s),i.content!=null&&e.mountContent(i.content),i.footer!=null&&e.mountFooter(i.footer),(i.minHeight!=null||i.minWidth!=null)&&e._minSize$.setValue({width:(c=i.minWidth)!=null?c:e.minWidth,height:(l=i.minHeight)!=null?l:e.minHeight},s)}smartPosition(e){let{x:i,y:s}=e;const{width:r=.5,height:a=.5}=e,n=this.stageRect,o=this.topBox;if(i==null){let c=20;if(o){const l=o.pxIntrinsicCoord.x+20,d=r*n.width;l+d<=n.width&&(c=l)}i=c/n.width}if(s==null){let c=20;if(o){const l=o.pxIntrinsicCoord.y+20,d=a*n.height;l+d<=n.height&&(c=l)}s=c/n.height}return{x:i,y:s,width:r,height:a}}makeBoxTop(e,i=!1){this.topBox&&e!==this.topBox&&e._zIndex$.setValue(this.topBox.zIndex+1,i)}getBoxIndex(e){return typeof e=="string"?this.boxes.findIndex(i=>i.id===e):this.boxes.findIndex(i=>i===e)}getBox(e){return typeof e=="string"?this.boxes.find(i=>i.id===e):e}}const Sc=(t,e,i,s,r)=>new Cc({safeSetAttributes:a=>t.safeSetAttributes(a),updateAppState:(...a)=>{var n;return(n=t.appManager)==null?void 0:n.store.updateAppState(...a)},canOperate:()=>t.canOperate,notifyContainerRectUpdate:a=>{var n;return(n=t.appManager)==null?void 0:n.notifyContainerRectUpdate(a)},cleanFocus:()=>{var a;return(a=t.appManager)==null?void 0:a.store.cleanFocus()},setAppFocus:a=>{var n;return(n=t.appManager)==null?void 0:n.store.setAppFocus(a,!0)},callbacks:e,emitter:i,boxEmitter:s},r);class Cc{constructor(e,i){this.context=e,this.sideEffectManager=new ve.SideEffectManager;const{emitter:s,callbacks:r,boxEmitter:a}=e;this.teleBoxManager=this.setupBoxManager(i),this.sideEffectManager.add(()=>[this.teleBoxManager.onValChanged("state",n=>{r.emit("boxStateChange",n),s.emit("boxStateChange",n)}),this.teleBoxManager.onValChanged("darkMode",n=>{r.emit("darkModeChange",n)}),this.teleBoxManager.onValChanged("prefersColorScheme",n=>{r.emit("prefersColorSchemeChange",n)}),this.teleBoxManager.onValChanged("minimized",(n,o)=>{if(!o)if(this.context.safeSetAttributes({minimized:n}),n)this.context.cleanFocus(),this.blurAllBox();else{const c=this.getTopBox();c&&(this.context.setAppFocus(c.id),this.focusBox({appId:c.id},!1))}}),this.teleBoxManager.onValChanged("maximized",(n,o)=>{o||this.context.safeSetAttributes({maximized:n})}),this.teleBoxManager.events.on("removed",n=>{n.forEach(o=>{a.emit("close",{appId:o.id})})}),this.teleBoxManager.events.on("intrinsic_move",C.debounce(n=>{a.emit("move",{appId:n.id,x:n.intrinsicX,y:n.intrinsicY})},50)),this.teleBoxManager.events.on("intrinsic_resize",C.debounce(n=>{a.emit("resize",{appId:n.id,width:n.intrinsicWidth,height:n.intrinsicHeight})},200)),this.teleBoxManager.events.on("focused",n=>{n&&(this.canOperate?a.emit("focus",{appId:n.id}):this.teleBoxManager.blurBox(n.id))}),this.teleBoxManager.events.on("z_index",n=>{this.context.updateAppState(n.id,Ee.ZIndex,n.zIndex)}),s.on("containerSizeRatioUpdate",n=>{this.teleBoxManager._stageRatio$.setValue(n)}),this.teleBoxManager._fullscreen$.reaction(n=>{r.emit("fullscreenChange",n)})])}get canOperate(){return this.context.canOperate()}get boxState(){return this.teleBoxManager.state}get maximized(){return this.teleBoxManager.maximized}get minimized(){return this.teleBoxManager.minimized}get darkMode(){return this.teleBoxManager.darkMode}get prefersColorScheme(){return this.teleBoxManager.prefersColorScheme}get boxSize(){return this.teleBoxManager.boxes.length}get stageRect(){return this.teleBoxManager.stageRect}get stageRect$(){return this.teleBoxManager._stageRect$}createBox(e){var u,p,m;if(!this.teleBoxManager)return;let{minwidth:i=Eo,minheight:s=Po,enableShadowDOM:r=!0}=(u=e.app.config)!=null?u:{};const{width:a,height:n}=(p=e.app.config)!=null?p:{},o=((m=e.options)==null?void 0:m.title)||e.appId,c=this.teleBoxManager.rootRect;i>1&&(i=i/c.width),s>1&&(s=s/c.height);const l={title:o,minWidth:i,minHeight:s,width:a,height:n,id:e.appId,enableShadowDOM:r},d=this.teleBoxManager.create(l,e.smartPosition);return this.context.emitter.emit(`${e.appId}${Y.WindowCreated}`),d}setupBoxManager(e){const i=ce.playground,s={stageRatio:e==null?void 0:e.stageRatio,root:i,fence:!1,prefersColorScheme:e==null?void 0:e.prefersColorScheme};e!=null&&e.containerStyle&&(s.containerStyle=e.containerStyle),e!=null&&e.stageStyle&&(s.stageStyle=e.stageStyle),e!=null&&e.fullscreen&&(s.fullscreen=e.fullscreen),(e==null?void 0:e.defaultBoxBodyStyle)!==void 0&&(s.defaultBoxBodyStyle=e.defaultBoxBodyStyle),(e==null?void 0:e.defaultBoxStageStyle)!==void 0&&(s.defaultBoxStageStyle=e.defaultBoxStageStyle),e!=null&&e.theme&&(s.theme=e.theme);const r=new Mc(s);this.teleBoxManager&&this.teleBoxManager.destroy(),this.teleBoxManager=r;const a=e==null?void 0:e.collectorContainer;return a&&this.teleBoxManager.collector.set$collector(a),e!=null&&e.collectorStyles&&this.teleBoxManager.collector.setStyles(e.collectorStyles),r}getBox(e){return this.teleBoxManager.queryOne({id:e})}closeBox(e,i=!1){return this.teleBoxManager.remove(e,i)}boxIsFocus(e){const i=this.getBox(e);return i==null?void 0:i.focus}getFocusBox(){return this.teleBoxManager.query({focus:!0})[0]}getTopBox(){return this.teleBoxManager.topBox}updateBoxState(e){if(!e)return;const i=this.getBox(e.id);i&&(e.size&&i._intrinsicSize$.setValue(e.size,!0),e.position&&i._intrinsicCoord$.setValue(e.position,!0),e.zIndex&&i._zIndex$.setValue(e.zIndex,!0),setTimeout(()=>{e.focus&&this.teleBoxManager.focusBox(i.id,!0),e.maximized!=null&&this.teleBoxManager.setMaximized(Boolean(e.maximized),!0),e.minimized!=null&&this.teleBoxManager.setMinimized(Boolean(e.minimized),!0)},50),this.context.callbacks.emit("boxStateChange",this.teleBoxManager.state))}moveBox({appId:e,x:i,y:s}){const r=this.getBox(e);r&&r._intrinsicCoord$.setValue({x:i,y:s},!0)}focusBox({appId:e},i=!0){this.teleBoxManager.focusBox(e,i)}resizeBox({appId:e,width:i,height:s,skipUpdate:r}){const a=this.getBox(e);a&&a._intrinsicSize$.setValue({width:i,height:s},r)}setBoxMinSize(e){this.teleBoxManager.update(e.appId,{minWidth:e.minWidth,minHeight:e.minHeight},!0)}setBoxTitle(e){this.teleBoxManager.update(e.appId,{title:e.title},!0)}blurAllBox(){this.teleBoxManager.blurAll()}updateAll(e){this.teleBoxManager.updateAll(e)}setMaximized(e,i=!0){e!==this.maximized&&this.teleBoxManager.setMaximized(e,i)}setMinimized(e,i=!0){this.teleBoxManager.setMinimized(e,i)}focusTopBox(){if(this.teleBoxManager.query().length>=1){const i=this.getTopBox();i&&this.focusBox({appId:i.id},!1)}}updateBox(e,i,s=!0){this.teleBoxManager.update(e,i,s)}setReadonly(e){this.teleBoxManager.setReadonly(e)}setPrefersColorScheme(e){this.teleBoxManager.setPrefersColorScheme(e)}setZIndex(e,i,s=!0){this.teleBoxManager.update(e,{zIndex:i},s)}setRoot(e){this.teleBoxManager._root$.setValue(e)}setCollector(e){this.teleBoxManager.collector.set$collector(e)}destroy(){this.sideEffectManager.flushAll(),this.teleBoxManager.destroy()}}function Si(){}function Fa(t){return t()}function $r(){return Object.create(null)}function Di(t){t.forEach(Fa)}function Ic(t){return typeof t=="function"}function _c(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let ci;function Ci(t,e){return ci||(ci=document.createElement("a")),ci.href=e,t===ci.href}function Ac(t){return Object.keys(t).length===0}function We(t,e){t.appendChild(e)}function Li(t,e,i){t.insertBefore(e,i||null)}function Kt(t){t.parentNode.removeChild(t)}function et(t){return document.createElement(t)}function Qs(t){return document.createTextNode(t)}function vs(){return Qs(" ")}function ie(t,e,i){i==null?t.removeAttribute(e):t.getAttribute(e)!==i&&t.setAttribute(e,i)}function kc(t){return Array.from(t.childNodes)}function Za(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function ne(t,e,i,s){i===null?t.style.removeProperty(e):t.style.setProperty(e,i,s?"important":"")}let Gs;function Ot(t){Gs=t}const Dt=[],jr=[],fi=[],Br=[],Tc=Promise.resolve();let xs=!1;function Nc(){xs||(xs=!0,Tc.then(Ya))}function Ms(t){fi.push(t)}const as=new Set;let hi=0;function Ya(){const t=Gs;do{for(;hi<Dt.length;){const e=Dt[hi];hi++,Ot(e),Ec(e.$$)}for(Ot(null),Dt.length=0,hi=0;jr.length;)jr.pop()();for(let e=0;e<fi.length;e+=1){const i=fi[e];as.has(i)||(as.add(i),i())}fi.length=0}while(Dt.length);for(;Br.length;)Br.pop()();xs=!1,as.clear(),Ot(t)}function Ec(t){if(t.fragment!==null){t.update(),Di(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(Ms)}}const Pc=new Set;function zc(t,e){t&&t.i&&(Pc.delete(t),t.i(e))}function Dc(t,e,i,s){const{fragment:r,on_mount:a,on_destroy:n,after_update:o}=t.$$;r&&r.m(e,i),s||Ms(()=>{const c=a.map(Fa).filter(Ic);n?n.push(...c):Di(c),t.$$.on_mount=[]}),o.forEach(Ms)}function Lc(t,e){const i=t.$$;i.fragment!==null&&(Di(i.on_destroy),i.fragment&&i.fragment.d(e),i.on_destroy=i.fragment=null,i.ctx=[])}function Vc(t,e){t.$$.dirty[0]===-1&&(Dt.push(t),Nc(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function $c(t,e,i,s,r,a,n,o=[-1]){const c=Gs;Ot(t);const l=t.$$={fragment:null,ctx:null,props:a,update:Si,not_equal:r,bound:$r(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:$r(),dirty:o,skip_bound:!1,root:e.target||c.$$.root};n&&n(l.root);let d=!1;if(l.ctx=i?i(t,e.props||{},(u,p,...m)=>{const g=m.length?m[0]:p;return l.ctx&&r(l.ctx[u],l.ctx[u]=g)&&(!l.skip_bound&&l.bound[u]&&l.bound[u](g),d&&Vc(t,u)),p}):[],l.update(),d=!0,Di(l.before_update),l.fragment=s?s(l.ctx):!1,e.target){if(e.hydrate){const u=kc(e.target);l.fragment&&l.fragment.l(u),u.forEach(Kt)}else l.fragment&&l.fragment.c();e.intro&&zc(t.$$.fragment),Dc(t,e.target,e.anchor,e.customElement),Ya()}Ot(c)}class jc{$destroy(){Lc(this,1),this.$destroy=Si}$on(e,i){const s=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return s.push(i),()=>{const r=s.indexOf(i);r!==-1&&s.splice(r,1)}}$set(e){this.$$set&&!Ac(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function Rr(t){let e,i,s,r,a,n,o=t[14]&&Or(t),c=t[15]&&Ur(t);return{c(){e=et("div"),i=et("div"),o&&o.c(),s=vs(),r=et("span"),a=Qs(t[0]),n=vs(),c&&c.c(),ne(r,"overflow","hidden"),ne(r,"white-space","nowrap"),ne(r,"text-overflow","ellipsis"),ne(r,"max-width","80px"),ie(i,"class",t[8]),ne(i,"background-color",t[2]),ne(i,"color",t[9]),ne(i,"opacity",t[11]),ie(e,"class","netless-window-manager-cursor-name")},m(l,d){Li(l,e,d),We(e,i),o&&o.m(i,null),We(i,s),We(i,r),We(r,a),We(i,n),c&&c.m(i,null)},p(l,d){l[14]?o?o.p(l,d):(o=Or(l),o.c(),o.m(i,s)):o&&(o.d(1),o=null),d&1&&Za(a,l[0]),l[15]?c?c.p(l,d):(c=Ur(l),c.c(),c.m(i,null)):c&&(c.d(1),c=null),d&256&&ie(i,"class",l[8]),d&4&&ne(i,"background-color",l[2]),d&512&&ne(i,"color",l[9]),d&2048&&ne(i,"opacity",l[11])},d(l){l&&Kt(e),o&&o.d(),c&&c.d()}}}function Or(t){let e,i;return{c(){e=et("img"),ie(e,"class","netless-window-manager-cursor-selector-avatar"),ie(e,"style",t[16]()),Ci(e.src,i=t[7])||ie(e,"src",i),ie(e,"alt","avatar")},m(s,r){Li(s,e,r)},p(s,r){r&128&&!Ci(e.src,i=s[7])&&ie(e,"src",i)},d(s){s&&Kt(e)}}}function Ur(t){let e,i;return{c(){e=et("span"),i=Qs(t[1]),ie(e,"class","netless-window-manager-cursor-tag-name"),ne(e,"background-color",t[10])},m(s,r){Li(s,e,r),We(e,i)},p(s,r){r&2&&Za(i,s[1]),r&1024&&ne(e,"background-color",s[10])},d(s){s&&Kt(e)}}}function Bc(t){let e,i,s,r,a,n,o=!t[12]&&Rr(t);return{c(){e=et("div"),o&&o.c(),i=vs(),s=et("div"),r=et("img"),ie(r,"class",a="netless-window-manager-cursor-"+t[3]+"-image"),Ci(r.src,n=t[6])||ie(r,"src",n),ie(r,"alt",t[3]),ie(s,"class","cursor-image-wrapper"),ie(e,"class","netless-window-manager-cursor-mid"),ne(e,"transform","translateX("+t[4]+"px) translateY("+t[5]+"px)"),ne(e,"display",t[13])},m(c,l){Li(c,e,l),o&&o.m(e,null),We(e,i),We(e,s),We(s,r)},p(c,[l]){c[12]?o&&(o.d(1),o=null):o?o.p(c,l):(o=Rr(c),o.c(),o.m(e,i)),l&8&&a!==(a="netless-window-manager-cursor-"+c[3]+"-image")&&ie(r,"class",a),l&64&&!Ci(r.src,n=c[6])&&ie(r,"src",n),l&8&&ie(r,"alt",c[3]),l&48&&ne(e,"transform","translateX("+c[4]+"px) translateY("+c[5]+"px)"),l&8192&&ne(e,"display",c[13])},i:Si,o:Si,d(c){c&&Kt(e),o&&o.d()}}}function Rc(t,e,i){let s,r,a,n,o,{cursorName:c}=e,{tagName:l}=e,{backgroundColor:d}=e,{appliance:u}=e,{x:p}=e,{y:m}=e,{src:g}=e,{visible:f}=e,{avatar:b}=e,{theme:v}=e,{color:x}=e,{cursorTagBackgroundColor:y}=e,{opacity:k}=e;const z=()=>Object.entries({width:(s?19:28)+"px",height:(s?19:28)+"px",position:s?"initial":"absolute","border-color":s?"white":d,"margin-right":(s?4:0)+"px"}).map(([T,O])=>`${T}: ${O}`).join(";");return t.$$set=T=>{"cursorName"in T&&i(0,c=T.cursorName),"tagName"in T&&i(1,l=T.tagName),"backgroundColor"in T&&i(2,d=T.backgroundColor),"appliance"in T&&i(3,u=T.appliance),"x"in T&&i(4,p=T.x),"y"in T&&i(5,m=T.y),"src"in T&&i(6,g=T.src),"visible"in T&&i(17,f=T.visible),"avatar"in T&&i(7,b=T.avatar),"theme"in T&&i(8,v=T.theme),"color"in T&&i(9,x=T.color),"cursorTagBackgroundColor"in T&&i(10,y=T.cursorTagBackgroundColor),"opacity"in T&&i(11,k=T.opacity)},t.$$.update=()=>{t.$$.dirty&1&&(s=!C.isEmpty(c)),t.$$.dirty&2&&i(15,r=!C.isEmpty(l)),t.$$.dirty&128&&i(14,a=!C.isEmpty(b)),t.$$.dirty&131072&&i(13,n=f?"initial":"none"),t.$$.dirty&8&&i(12,o=u===M.ApplianceNames.laserPointer)},[c,l,d,u,p,m,g,b,v,x,y,k,o,n,a,r,z,f]}class Oc extends jc{constructor(e){super();$c(this,e,Rc,Bc,_c,{cursorName:0,tagName:1,backgroundColor:2,appliance:3,x:4,y:5,src:6,visible:17,avatar:7,theme:8,color:9,cursorTagBackgroundColor:10,opacity:11})}}class Uc{constructor(e,i,s,r){this.manager=e,this.memberId=i,this.cursorManager=s,this.wrapper=r,this.move=a=>{var n,o;if(a.type==="main"){const c=(n=this.manager.boxManager)==null?void 0:n.stageRect;this.component&&c&&(this.autoHidden(),this.moveCursor(a,c,this.manager.mainView))}else{const c=this.cursorManager.focusView,l=(o=c==null?void 0:c.divElement)==null?void 0:o.getBoundingClientRect(),d=c==null?void 0:c.camera;c&&l&&d&&this.component&&(this.autoHidden(),this.moveCursor(a,l,c))}},this.leave=()=>{this.hide()},this.updateMember(),this.createCursor(),this.autoHidden()}moveCursor(e,i,s){var c,l;const{x:r,y:a,type:n}=e,o=s==null?void 0:s.screen.convertPointToScreen(r,a);if(o){let d=o.x-2,u=o.y-18;if(n==="app"){const p=this.cursorManager.playgroundRect;p&&(d=d+i.x-p.x,u=u+i.y-p.y)}else d=d+i.x,u=u+i.y;o.x<0||o.x>i.width||o.y<0||o.y>i.height?(c=this.component)==null||c.$set({visible:!1,x:d,y:u}):(l=this.component)==null||l.$set({visible:!0,x:d,y:u})}}get memberApplianceName(){var e,i;return(i=(e=this.member)==null?void 0:e.memberState)==null?void 0:i.currentApplianceName}get memberColor(){var i,s;return`rgb(${(s=(i=this.member)==null?void 0:i.memberState)==null?void 0:s.strokeColor.join(",")})`}get payload(){var e;return(e=this.member)==null?void 0:e.payload}get memberCursorName(){var e,i;return((e=this.payload)==null?void 0:e.nickName)||((i=this.payload)==null?void 0:i.cursorName)||this.memberId}get memberTheme(){var e;return(e=this.payload)!=null&&e.theme?"netless-window-manager-cursor-inner-mellow":"netless-window-manager-cursor-inner"}get memberCursorTextColor(){var e;return((e=this.payload)==null?void 0:e.cursorTextColor)||"#FFFFFF"}get memberCursorTagBackgroundColor(){var e;return((e=this.payload)==null?void 0:e.cursorTagBackgroundColor)||this.memberColor}get memberAvatar(){var e;return(e=this.payload)==null?void 0:e.avatar}get memberOpacity(){return!this.memberCursorName&&!this.memberAvatar?0:1}get memberTagName(){var e;return(e=this.payload)==null?void 0:e.cursorTagName}autoHidden(){this.timer&&clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.hide()},1e3*10)}async createCursor(){this.member&&this.wrapper&&(this.component=new Oc({target:this.wrapper,props:this.initProps()}))}initProps(){return{x:0,y:0,appliance:this.memberApplianceName,avatar:this.memberAvatar,src:this.getIcon(),visible:!1,backgroundColor:this.memberColor,cursorName:this.memberCursorName,theme:this.memberTheme,color:this.memberCursorTextColor,cursorTagBackgroundColor:this.memberCursorTagBackgroundColor,opacity:this.memberOpacity,tagName:this.memberTagName}}getIcon(){if(this.member){const e=this.cursorManager.applianceIcons;return e[this.memberApplianceName||M.ApplianceNames.shape]||e[M.ApplianceNames.shape]}}updateMember(){return this.member=Ca(this.manager.room,this.memberId),this.updateComponent(),this.member}updateComponent(){var e;(e=this.component)==null||e.$set(C.omit(this.initProps(),["x","y"]))}destroy(){this.component&&this.component.$destroy(),this.cursorManager.cursorInstances.delete(this.memberId),this.timer&&clearTimeout(this.timer)}hide(){this.component&&(this.component.$set({visible:!1}),this.destroy())}}var Wc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAYAAADFeBvrAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAYISURBVHgB7ZpNSCtXFIBPEuvz+dMGpYUKD/sWFX+Qti6kK7Hqpm6e9q0rIoIUFUShPLV10VZx4+JZqa9v20LBhdq9fyBUCtKNPH8qYl2IOw3G38Rkek4y15y5uTOZJDOWggcOSSYzN/ebc+45554JwIM8iBCPyTEP+86T4vyMfsRN4b+nQTKIJp0vzuGvlpID7os8EQNEIBD4oKio6Bm9DwaDv/v9/n/076JgbtWUYPchwrW8qD7UnOvr6wFNkpubm+/wu7f0c7y6mrnlvQufxB0Iau7V1dX3BDA/P6/V1dVpzc3N2uLiIofK1c8VYHys/wRKBUN3/hGHqaysNOjc3FwMis6hc0FtLTHuvYLxCCZgci8uLn4wg5Gh6Fy8Jk+/NkcCAlAAuUkoW4g0B+d5tLS05O/r67O8eGxsDNra2uDy8nKsoKCAwCIQDxQa0yTxgrvCYXyTk5Ml+Orf2dlJeeHIyAigFSE/P38ELfUNqNdSkjgF5FF89jL1TU1NlQwODl5gZPujp6cHWltbUw7Koc7Pz8mkZpHPFeFrJuZeqLnoMoPoZqe0JjDP/IZgnyLUG/o8NDRkuo5Ua2pjY6MC4oFCFf1cA0oKzRSOp6enRfTaGh0d/QxBt+1CUVgnOTs7+xrHfQzGyOcKkK3QTJMnQffZ6e/v/xwttmsHqqmpKXbdycnJCxy7ABLh3FEgVZ6hZJhnFZoFFMF0d3c/w7v+dyookXBnZ2c/xvHfhriVcvXfdBRItsxjnOhYqjwjoAimq6vrCysoGofk+Ph4Esd/F/UdiFtJAGUd2DygTpp5dmBUUJ2dnc9VUALm8PDwJY7/BPU9VD8k3M4RC6kskxZMKigKIMLN9vf3p3H8DyWgfEhEOwOQD9IXOTz7EObbwsLC4YWFBRgeHrY9ECXYo6MjaGlpKWlsbPxkYGDgRW1tbSEWquVlZWXBzc3Nl1VVVa8hXiXc6ioqBqGaPDk7AACJTRZ3NS9lcUp86cJwoSQ7Pj4Op6enfxUXF3/V0NCQv7q6GsCvwrqGUG/01xAD4+VQTOxaSF43d5bBOisrGBJRCtXX17+/trb268rKSgASFgmz97KFkmo6OztWuVyPweiWGc4WRkhFRQVEIpHg8vJyQAIQVlLBROVxvBYQHsXnO8tk62ZcyN0wecLBwcEvYHSzEPscBqOLCRhLC4n9uqaA8UAWAcAKhtbQ3t7eTHl5+Y9gtAp3twhT056CDMQ7MRzIFTeTYKb1yYYVQFH9VdzsqNmYKpfTJBDX3Ixgdnd3XyHMT2AMALJlBBSPaMpNngrIsTyTCgaj288YDGakictrxizvKFNOjgSSBLS+vv6UYHDb7DgMVgsChjTEgCIKGG4ZU+EWkgNBzN1qamq+pAMTExPgFMzW1tZrhHkFyWE5KxgSszx0527RaDRmOSpRshEOU11dPQPG8CwHARHJlMnTSrwSRFIlfXt7m3V5ngJGuJtqzaQtZkFBVNJezN5ZAdmwjKo2k9tVtrcI3OXk4tPgcg7ChCDZ1URgMOu72Xa5VFHOkymQhWVU60YVmjN6wiC7k6p+S1syCACOwJBYFaexV+yhBekNPsMBO6KAEeE4BMaCU67RsoYhSbXgaT//ht709vZCaWmp6YkEbLFmVJWzas04+iBL7EKpm0J7duqu0B7+CTUpNJuyvb1NCfMj1CqI9wLKUOlOUMeG+gGFkHii4HizUF4z/KFUrPsJ8WbEIyx7nnZ0dDynME6BAuce09iFHo+GrnmGltltb2//E4wVAN82y7vOjKOZXSBhJdHNiT3TYWD8OY2PTUJkdd7MkJMnT5wZVQF2RFX6yBMUdzPMvvfqxz3sXHF+GNT9ANXit/10O1sgHkZvdQAOKvs9B5L7ARELGAAXLSTvM8QExTE+YbHe+HURhZp1aRyF4CJXClbbWwGketgkW9VsY+YaiBCVhfgE+XvxRwgZSM4jUVCDZFQ9pytmXR8hUTB2gnidx4XffVWydN0yQjwmx/jkAZJBrIBI5J7ZvQGZWUgVSuU/EqmOAzicKNMVu816DdRWUV1/7xAP8n+SfwF3Du3NF2sYhwAAAABJRU5ErkJggg==",Hc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADEAAAAxCAYAAABznEEcAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAZoSURBVHgB7VlLSCRXFL3ljNEhEXTGhMQJmOjCz8ZNVLKICz9xIYhCNi7UgINkGEk2En8hW5cBUQNxo05GAoKikuCAmvGzGMdPcCUGjDPxD/4Vv/3JvWW97luvq7ur+hMZ8MKlqrteNfe8e965970GuLVbC5kpJr53+hjHx9yY3TUxJgLMAQG4ITARfp5T4Mri4uL9q6urnxwOxz/oY5eXl1/Pzs7e195X2FX4jZsIhAK7gx5ps9m6nGj9/f3OtbU1pzAE0318fPwVjYHrrN7R3AjU/wpOBwA9Cmf/9ejoqDMtLU31iooKGdA+ATo4OMiXAEWAHhBAGEApXj4rPAik0vPt7e0vCgoKPH4gMzMTSktLIS8vD2JiYgABvcHMTZyennbHxsaOg3udOJmLzwqEYB0ZgRCZENm4u7e39yQuLq65srISZmZmvP5Ybm4u5OfnQ0lJyXWUCAgzNLS+vt6SnJz8WgvYwV5xSlcRgyVg3ha2Dkxzc3MvfZmVlQW+bGxsDBobGyE7O1u94uJPjIqKqklKSvrbbrfPnp+ff7e8vJwMnlSTKWfJjDKhywJo6wLp0YcZ+dyIUr7s4cOHLsrRlQwBTSBFuzc2NiZYhjjVAIyzZBqEwgCQv0OOM/gNzuiP/ijlDxBRjgClpqa6AF1cXDydmpoaLCws3JcAGYHyC4JMzoKaibKysvienp6FtrY2IA/WCFB5ebkqCHSvARo8Ozt7igIxwIJ2gJ+seFMnDoIyEUV+dHT0G3qWVUr5M043DdAB0m2IKZwAYpgZX+qkywR6NFbuR0iDxmAoZRUQKRxSLTMnJ8eIaqqSeVMnIYUOdu+sq6vrp4f+VCoYo8khZaNs01VRlERUu2/BrWAA7sl2Anink1Ao18JGjyY/PDx8hq1GZqgp5c2mp6chMjLy2b179x7hRzvoqeUUwXIzqq4O5nZsNUaEbIbLqPLTou/s7FTvT05OpsA9sXJG1AVsZDwjutqBIN6gUlWjxod8XRBNKXgsrqpqYZfwEqX9h8TExD7wbFm8LmzxHQ0QHSlXKZVSqFC/hkqlaKapTaGgCQTK7PHW1lb/wsLC86KiokkccoV+qV1tcE0pO7AWxmhTxBszDzqRr66ujqanp2cRpQLNBgUsCh8BwQ54bn5+/s+mpqa+4eHhfS1gb52vwuP0trPjhSZCBtLQ0NA3MDDQQIFYAUHBYhuvzjpVbJr1lZWVP3p7e19UVVXNgHumXYrI4uBx6Yqevz02b0FcRQ8CoBQF3dXVpQLZ3d39C7n+ora29vfJyclDYFnWgFyxK3cxhss/+KoT/N6DVkQpKypFGUCp3Ozo6HgSHx//GLW/BwHsg57zl5pzADajwLn52mPL1ZHPloMoRYPMFL6EhAR18e7s7MxVV1fPsAAp4Avteq7dC/c1+wKI4g+EfGzDM+EYHBw8RDrNiA2QL6upqVGvKJ2/gHu2L1nA5wwEB2YDfSYMO1x/px0cgEc2zBY+eo67u6H29vZ/wU2VC8l58JxKNjDOgojNEp08aFVfX++3l6JMEdDx8fEB0FNIBsDXBc8ArwuW1EkeI1RKdLWmCx+1DhkZGRvR0dFfSsHKxYtnW0iqvJAN9xNm6MR/QO5sfapUSkqKmqW5ubmfwVgyZdpw/vPZl2kUEAinBMSUStG+gwra0NDQSynQKyloIxnlewafjDFLJzLRBJqiFMnqyMgIbG5uDuD996Dnv8iAPOMAPmbcm5lVJwA/vZRMKZGZlpaWVtAvUL4GZMqE1fjRJrUd76LHoX+InlhcXPwZnWW2tra6jjrpiBM3UK/weQr6J+gfodMh9HtwncG7YLA3CMSsLmxx5WuDCt8B7vZeicInTjCWlpb6wc15mfey7oc9E8LElpVmMgb9AXoC+qcTExOPKRu4NlTHs6Q10GfhgfYOvRsJQZ76BWMKuDtaolQs+gfoH6Mn436gDg+e+5BKXUQx/C5Je/a+NpbeiQJPKgUdlNXx/BCBKxVdxW5Q0I3XBqFKRhU4KLtjYawi3csuTKdc4FnIXNvKUJkVEGRG20QZAAUpA5DbaYAQLmQzfzxyk/ffdnCD4NWVnGdE7kQBQvQHC5lVEDxgMaM29lkxGCNLKrDnIbFAMkFmBIaDkHstU41coGZ1TZD5UjReCGUAYbNgdNqoXZB/T67yYbFAMiGML3BhYeH8rb0t9h/zgcTBcTNGiQAAAABJRU5ErkJggg==",Fc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAYAAADFeBvrAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAgrSURBVHgB7ZprTBRXFIDP7gIt8lQppTwE5V0KaAn6o1pqNGkDDTEmTUhsgKRp+gNJw68CFkLbVC2QkDS+gD8KJdWmARvbFBNNWpuIRGPFWBXQRMPDqIki+KLATs+ZnTvcvXtnX8w2beJJToaduTP3fHPOPffcOwC8kP+2WCDwIvahGFxTuN8KmNSZmULPNjLeqF9F8rdPkIEGEn+r+vjx46LQ0NA8/Dsader58+e/h4WFDWntFO7ot6fMFAt3JLWi2lCDpqamCux2+2+KROj82NhYGrXT2lu5Z/DP/deFByElA4Pv3LlTiHY/nJ6eVnbv3q1s2bJFyc7OVrZu3arU1dUp4+PjxPUQoT+g9tp9PkMFgpo9kxljHRoaWp2Xl3duYmIiurKyEvDoclNCQgIcPnxYPc7MzHwcGRnZhaft4Ag7O9fUbRhaITCie4lgcnNzT7qDIaHz27dvh+vXr0NEREQneqoCHKFnAR+8ZCaQGGq2CxcurCGYycnJZHcwTNAzUFFRoUJFRUV1IFQ5OKBsXB9uxSwgl0TQ3d29Yt26dccwoyVXV1d7hGEiQmGi2AzOUHx/hob4K2yuYS9G987s7OwPISEh7xPM6dOnwVfBsIMjR45AZmbmo5s3b76Xnp7+J55egMVxBSAZT0v1ED+76yn66dOnLQSzd+9ev2BIyFP0MjBco1JTU/sxfFeDazp3cYgZHmKqdoaGNISHh9fv378fSJcqlPV6e3sBJ+I/goOD34VFL0k95Y+HxPHCYGxmw5DQ2NuzZw8EBQVtunXr1jvgwUP+hhz/QDXMMCNVE8zx48dNg2FCz6QQjI2N/RA8VBFmANnu3btXihnpG8pM9fX1EAi5du0aeWkVOAMBCF7yN+R0z4yOjq6NiYlpp9CgdBtIwXpPH6vgDKWLt0CygtM6MDCwBuUYZSKaOCksAiVY9wFOBePgDOOytPAGSKzNVCCC2bBhw69YdK7ypgpYimzbtk2dl7CM+hFcveOUHDylbTFO1YdhFbByx44dA1QFUP0VSJj4+Hjo6+sDq9U6iEmHKvFZTedQ50GYbN15SITVlwNlZWUnLRZL8s6dOwMOQ9UCTtKTra2ttdppt9V2kMF5cbmsjxuM43bMNrmUzc6fP6+GQiDGDoOJi4ubwb4qm5ubafyIE6nLxGqTPEsGo1cBOGNX0TyDYafC0CyOaxcVziyh53Z2dkJycvLMvn37PmpoaBgFR4jxYSbWdVIgI89Iq4CjR48CZjlYv369+tssqI6ODsjPz4f+/v668vLycxrEHHfkYdwC8SB6mGEV8Cl64cuuri5oa2tTG+EyGjZu3AiXLl1qefDgwV8lJSUFZkDV1tZCcXExXLx4sbWoqKgPFj0zx8GI9ZwO5W4M6ekZYeqpaqbqmaSqqkpNpcPDw4dwzfM9nrLduHEjEs+X0XV/Sx96LnqE1kLtBQUF3eDwCO8dGQyzV5rl+JyuegfXI29jRotiRlKnpFghHMzKyjqotVXS0tLacKPjF3bdHxjSq1evduAkepAD+ZsDYlC8V5w8ZBVg+PPq2MGMlkInqE4joTf45MmT4YyMjAPcA+ltLSQlJX2BafxnX6HI29QeK44TOTk57mCYZ0QoJ8OBM4yB6dkNkwGlSygsLFQvYtYB3BTMxFL+M+0eFgZqp4mJiU2+QKGX1fGIk/QIrn0aYXGsyDxjmAyMhO2jhaCGoUbX1NSkLSwsPMJqV8Fspu6lIZS6OYhjiOLwdU7fQM1HfRPD7wS1obZ0j0xpb4726Z49ezaJf2/S7s9ATUGNR41BjdJseRnke3WGwhrRTS9pD1mOGoeG15BxOOfoxuCkp0Ih6NeaEaSZGlieJyiCoc1FgsGldokGk8nBvAKOrWIGQ5uPsm0tt0BWDiicAaGuGhkZ+YqMw9StGzU4OKhCnT179hNsswY1FTXdE5QEJhc1S3tGogazXLOBwQSBl3tzIhQPtAL1VQJCTcNx8y1vHIUghSKFZE9PT7H2dlM1b+Wgrr1y5Uq77J75+fnplpaWMg2ch4nlYEI5z7hdensDpI4hrYNErcMMXJ32koG4ztf3pultz83NjWG99Ra2WQ0OL2VjZjwgeufUqVOqV8+cOdPIwdBLSNJeHg8TAh5WqJ6EfSmgt7IMNRJ1JThiOlnrOAMHshprmMKdoGSCpb9s3B3SYLIFGIqICJB7xisYi+RvfiypXw40DWGdlJaWRmMd141hk8V2OWm7ieYTXhBc3+BgaZyqAISjOYxSMVvXsBTNlzdiNQDgRao2AtK3pjggpmrqbGpqSsLPIN/dv38/gaBwUjTshMHcvn27JyUlpRmc5xpPMD599LIYnLNyUKKndKjGxsakXbt2deMCLIE8IVvs0YRM1fjdu3d/wrXN5+BcnzEgvor2uN3rjzAYMp5lPEoQlE5fA0fWo8GfhlCbKVFQ1pKNIfzcOHH58mWqaimVUwJI0+6n59D4pIlzmdZPMPiZzXjDjX47Le5g0Uu8x2zgPqWyKpjVe7x3+AUbq9NYjQbgp2dsBud5o8TP7d5kHAWcQchQfoEmLgn8HjOiBIF7o5hI1x6CEbLNP3bdqYAF44JzyWLzcN1i8DcT/o3awbm8Fz3DAy2A62INwPV/E3wWdx5inmBHuwChCBD6R2JwHge80TIQRQLjt7e8DTkGZgfX8cUMZTDAteFDkveaIlzjX9ySQs8X18r2t2VHUURPKoICmDR+eCO9aSdmOIub3/w9RgpgUpiJhvraXpa6jZKHGEqyusw0GLFzX+5RhN/8kYnMSNMMfyH/V/kHST6OYVElTPAAAAAASUVORK5CYII=",Zc="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDBweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDAgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT5zaGFwZS1jdXJzb3I8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz4KICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0icGF0aC0xIj48L3BhdGg+CiAgICAgICAgPGZpbHRlciB4PSItNjQuNiUiIHk9Ii01OS41JSIgd2lkdGg9IjIyOS4zJSIgaGVpZ2h0PSIyNDYuMSUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0yIj4KICAgICAgICAgICAgPGZlTW9ycGhvbG9neSByYWRpdXM9IjEiIG9wZXJhdG9yPSJkaWxhdGUiIGluPSJTb3VyY2VBbHBoYSIgcmVzdWx0PSJzaGFkb3dTcHJlYWRPdXRlcjEiPjwvZmVNb3JwaG9sb2d5PgogICAgICAgICAgICA8ZmVPZmZzZXQgZHg9IjAiIGR5PSIyIiBpbj0ic2hhZG93U3ByZWFkT3V0ZXIxIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSI+PC9mZU9mZnNldD4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMyIgaW49InNoYWRvd09mZnNldE91dGVyMSIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlR2F1c3NpYW5CbHVyPgogICAgICAgICAgICA8ZmVDb21wb3NpdGUgaW49InNoYWRvd0JsdXJPdXRlcjEiIGluMj0iU291cmNlQWxwaGEiIG9wZXJhdG9yPSJvdXQiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbXBvc2l0ZT4KICAgICAgICAgICAgPGZlQ29sb3JNYXRyaXggdmFsdWVzPSIwIDAgMCAwIDAgICAwIDAgMCAwIDAgICAwIDAgMCAwIDAgIDAgMCAwIDAuMTYgMCIgdHlwZT0ibWF0cml4IiBpbj0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbG9yTWF0cml4PgogICAgICAgIDwvZmlsdGVyPgogICAgPC9kZWZzPgogICAgPGcgaWQ9Iumhtemdoi00IiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0iV2hpdGVib2FyZC1HdWlkZWxpbmVzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMzQ0LjAwMDAwMCwgLTc1MS4wMDAwMDApIj4KICAgICAgICAgICAgPGcgaWQ9InNoYXBlLWN1cnNvciIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMzQ0LjAwMDAwMCwgNzUxLjAwMDAwMCkiPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9ouWkh+S7vS00NCIgZmlsbD0iI0ZGRkZGRiIgb3BhY2l0eT0iMC4wMSIgeD0iMCIgeT0iMCIgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIiByeD0iMiI+PC9yZWN0PgogICAgICAgICAgICAgICAgPGcgaWQ9IuW9oueKtue7k+WQiCIgZmlsbC1ydWxlPSJub256ZXJvIj4KICAgICAgICAgICAgICAgICAgICA8dXNlIGZpbGw9ImJsYWNrIiBmaWxsLW9wYWNpdHk9IjEiIGZpbHRlcj0idXJsKCNmaWx0ZXItMikiIHhsaW5rOmhyZWY9IiNwYXRoLTEiPjwvdXNlPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIxIiBkPSJNMjAsMjEgQzIwLjQ4NTQxMDMsMjEgMjAuODk4MDg1LDIxLjM0Nzk5OTMgMjAuOTg5OTQ3OSwyMS44NjU0ODc3IEwyMSwyMiBMMjEsMjcgQzIxLDI3LjU1MjI4NDcgMjAuNTUyMjg0NywyOCAyMCwyOCBDMTkuNTE0NTg5NywyOCAxOS4xMDE5MTUsMjcuNjUyMDAwNyAxOS4wMTAwNTIxLDI3LjEzNDUxMjMgTDE5LDI3IEwxOSwyMiBDMTksMjEuNDQ3NzE1MyAxOS40NDc3MTUzLDIxIDIwLDIxIFogTTI3LDE5IEMyNy41NTIyODQ3LDE5IDI4LDE5LjQ0NzcxNTMgMjgsMjAgQzI4LDIwLjQ4NTQxMDMgMjcuNjUyMDAwNywyMC44OTgwODUgMjcuMTM0NTEyMywyMC45ODk5NDc5IEwyNywyMSBMMjIsMjEgQzIxLjQ0NzcxNTMsMjEgMjEsMjAuNTUyMjg0NyAyMSwyMCBDMjEsMTkuNTE0NTg5NyAyMS4zNDc5OTkzLDE5LjEwMTkxNSAyMS44NjU0ODc3LDE5LjAxMDA1MjEgTDIyLDE5IEwyNywxOSBaIE0xOCwxOSBDMTguNTUyMjg0NywxOSAxOSwxOS40NDc3MTUzIDE5LDIwIEMxOSwyMC40ODU0MTAzIDE4LjY1MjAwMDcsMjAuODk4MDg1IDE4LjEzNDUxMjMsMjAuOTg5OTQ3OSBMMTgsMjEgTDEzLDIxIEMxMi40NDc3MTUzLDIxIDEyLDIwLjU1MjI4NDcgMTIsMjAgQzEyLDE5LjUxNDU4OTcgMTIuMzQ3OTk5MywxOS4xMDE5MTUgMTIuODY1NDg3NywxOS4wMTAwNTIxIEwxMywxOSBMMTgsMTkgWiBNMjAsMTIgQzIwLjQ4NTQxMDMsMTIgMjAuODk4MDg1LDEyLjM0Nzk5OTMgMjAuOTg5OTQ3OSwxMi44NjU0ODc3IEwyMSwxMyBMMjEsMTggQzIxLDE4LjU1MjI4NDcgMjAuNTUyMjg0NywxOSAyMCwxOSBDMTkuNTE0NTg5NywxOSAxOS4xMDE5MTUsMTguNjUyMDAwNyAxOS4wMTAwNTIxLDE4LjEzNDUxMjMgTDE5LDE4IEwxOSwxMyBDMTksMTIuNDQ3NzE1MyAxOS40NDc3MTUzLDEyIDIwLDEyIFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9oiIgZmlsbD0iI0ZGRkZGRiIgeD0iMTguNSIgeT0iMTciIHdpZHRoPSIzIiBoZWlnaHQ9IjYiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaIiIGZpbGw9IiNGRkZGRkYiIHg9IjE3IiB5PSIxOC41IiB3aWR0aD0iNiIgaGVpZ2h0PSIzIj48L3JlY3Q+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0i5b2i54q257uT5ZCIIiBmaWxsPSIjMjEyMzI0IiBmaWxsLXJ1bGU9Im5vbnplcm8iPjwvcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",Yc="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDdweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDcgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT50ZXh0LWN1cnNvcjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxwYXRoIGQ9Ik0xNiwyNi41IEMxNS43MjM4NTc2LDI2LjUgMTUuNSwyNi4yNzYxNDI0IDE1LjUsMjYgQzE1LjUsMjUuNzU0NTQwMSAxNS42NzY4NzUyLDI1LjU1MDM5MTYgMTUuOTEwMTI0NCwyNS41MDgwNTU3IEwxNiwyNS41IEwxOS41LDI1LjUgTDE5LjUsMTQuNSBMMTYsMTQuNSBDMTUuNzIzODU3NiwxNC41IDE1LjUsMTQuMjc2MTQyNCAxNS41LDE0IEMxNS41LDEzLjc1NDU0MDEgMTUuNjc2ODc1MiwxMy41NTAzOTE2IDE1LjkxMDEyNDQsMTMuNTA4MDU1NyBMMTYsMTMuNSBMMjQsMTMuNSBDMjQuMjc2MTQyNCwxMy41IDI0LjUsMTMuNzIzODU3NiAyNC41LDE0IEMyNC41LDE0LjI0NTQ1OTkgMjQuMzIzMTI0OCwxNC40NDk2MDg0IDI0LjA4OTg3NTYsMTQuNDkxOTQ0MyBMMjQsMTQuNSBMMjAuNSwxNC41IEwyMC41LDI1LjUgTDI0LDI1LjUgQzI0LjI3NjE0MjQsMjUuNSAyNC41LDI1LjcyMzg1NzYgMjQuNSwyNiBDMjQuNSwyNi4yNDU0NTk5IDI0LjMyMzEyNDgsMjYuNDQ5NjA4NCAyNC4wODk4NzU2LDI2LjQ5MTk0NDMgTDI0LDI2LjUgTDE2LDI2LjUgWiIgaWQ9InBhdGgtMSI+PC9wYXRoPgogICAgICAgIDxmaWx0ZXIgeD0iLTI4NC4wJSIgeT0iLTgxLjUlIiB3aWR0aD0iNjY4LjElIiBoZWlnaHQ9IjI5My45JSIgZmlsdGVyVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiBpZD0iZmlsdGVyLTIiPgogICAgICAgICAgICA8ZmVNb3JwaG9sb2d5IHJhZGl1cz0iMSIgb3BlcmF0b3I9ImRpbGF0ZSIgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd1NwcmVhZE91dGVyMSI+PC9mZU1vcnBob2xvZ3k+CiAgICAgICAgICAgIDxmZU9mZnNldCBkeD0iMCIgZHk9IjIiIGluPSJzaGFkb3dTcHJlYWRPdXRlcjEiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIj48L2ZlT2Zmc2V0PgogICAgICAgICAgICA8ZmVHYXVzc2lhbkJsdXIgc3RkRGV2aWF0aW9uPSIzIiBpbj0ic2hhZG93T2Zmc2V0T3V0ZXIxIiByZXN1bHQ9InNoYWRvd0JsdXJPdXRlcjEiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgICAgIDxmZUNvbXBvc2l0ZSBpbj0ic2hhZG93Qmx1ck91dGVyMSIgaW4yPSJTb3VyY2VBbHBoYSIgb3BlcmF0b3I9Im91dCIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29tcG9zaXRlPgogICAgICAgICAgICA8ZmVDb2xvck1hdHJpeCB2YWx1ZXM9IjAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgMCAwIDAgMC4xNiAwIiB0eXBlPSJtYXRyaXgiIGluPSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29sb3JNYXRyaXg+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iLTQiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJXaGl0ZWJvYXJkLUd1aWRlbGluZXMiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zODguMDAwMDAwLCAtNjcyLjAwMDAwMCkiPgogICAgICAgICAgICA8ZyBpZD0idGV4dC1jdXJzb3IiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDM5Mi4wMDAwMDAsIDY3Mi4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaLlpIfku70tNDAiIGZpbGw9IiNGRkZGRkYiIG9wYWNpdHk9IjAuMDEiIHg9IjAiIHk9IjAiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcng9IjIiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgiIGZpbGwtcnVsZT0ibm9uemVybyI+CiAgICAgICAgICAgICAgICAgICAgPHVzZSBmaWxsPSJibGFjayIgZmlsbC1vcGFjaXR5PSIxIiBmaWx0ZXI9InVybCgjZmlsdGVyLTIpIiB4bGluazpocmVmPSIjcGF0aC0xIj48L3VzZT4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMSIgZD0iTTE5LDI1IEwxOSwxNSBMMTYsMTUgQzE1LjQ0NzcxNTMsMTUgMTUsMTQuNTUyMjg0NyAxNSwxNCBDMTUsMTMuNTE0NTg5NyAxNS4zNDc5OTkzLDEzLjEwMTkxNSAxNS44NjU0ODc3LDEzLjAxMDA1MjEgTDE2LDEzIEwyNCwxMyBDMjQuNTUyMjg0NywxMyAyNSwxMy40NDc3MTUzIDI1LDE0IEMyNSwxNC40ODU0MTAzIDI0LjY1MjAwMDcsMTQuODk4MDg1IDI0LjEzNDUxMjMsMTQuOTg5OTQ3OSBMMjQsMTUgTDIxLDE1IEwyMSwyNSBMMjQsMjUgQzI0LjU1MjI4NDcsMjUgMjUsMjUuNDQ3NzE1MyAyNSwyNiBDMjUsMjYuNDg1NDEwMyAyNC42NTIwMDA3LDI2Ljg5ODA4NSAyNC4xMzQ1MTIzLDI2Ljk4OTk0NzkgTDI0LDI3IEwxNiwyNyBDMTUuNDQ3NzE1MywyNyAxNSwyNi41NTIyODQ3IDE1LDI2IEMxNSwyNS41MTQ1ODk3IDE1LjM0Nzk5OTMsMjUuMTAxOTE1IDE1Ljg2NTQ4NzcsMjUuMDEwMDUyMSBMMTYsMjUgTDE5LDI1IFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=",Qc="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjhweCIgaGVpZ2h0PSIyOHB4IiB2aWV3Qm94PSIwIDAgMjggMjgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDU1LjEgKDc4MTM2KSAtIGh0dHBzOi8vc2tldGNoYXBwLmNvbSAtLT4KICAgIDx0aXRsZT7nvJbnu4QgMjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxmaWx0ZXIgeD0iLTEyMC4wJSIgeT0iLTEyMC4wJSIgd2lkdGg9IjM0MC4wJSIgaGVpZ2h0PSIzNDAuMCUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0xIj4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iNCIgaW49IlNvdXJjZUdyYXBoaWMiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9Iue8lue7hC0yIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg5LjAwMDAwMCwgOS4wMDAwMDApIiBmaWxsPSIjRkYwMTAwIj4KICAgICAgICAgICAgPGNpcmNsZSBpZD0i5qSt5ZyG5b2iIiBmaWx0ZXI9InVybCgjZmlsdGVyLTEpIiBjeD0iNSIgY3k9IjUiIHI9IjUiPjwvY2lyY2xlPgogICAgICAgICAgICA8cGF0aCBkPSJNNSw4IEM2LjY1Njg1NDI1LDggOCw2LjY1Njg1NDI1IDgsNSBDOCwzLjM0MzE0NTc1IDYuNjU2ODU0MjUsMiA1LDIgQzMuMzQzMTQ1NzUsMiAyLDMuMzQzMTQ1NzUgMiw1IEMyLDYuNjU2ODU0MjUgMy4zNDMxNDU3NSw4IDUsOCBaIE01LDYuMjg1NzE0MjkgQzQuMjg5OTE5NjEsNi4yODU3MTQyOSAzLjcxNDI4NTcxLDUuNzEwMDgwMzkgMy43MTQyODU3MSw1IEMzLjcxNDI4NTcxLDQuMjg5OTE5NjEgNC4yODk5MTk2MSwzLjcxNDI4NTcxIDUsMy43MTQyODU3MSBDNS43MTAwODAzOSwzLjcxNDI4NTcxIDYuMjg1NzE0MjksNC4yODk5MTk2MSA2LjI4NTcxNDI5LDUgQzYuMjg1NzE0MjksNS43MTAwODAzOSA1LjcxMDA4MDM5LDYuMjg1NzE0MjkgNSw2LjI4NTcxNDI5IFoiIGlkPSLmpK3lnIblvaIiIGZpbGwtcnVsZT0ibm9uemVybyI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+";const Wr={[M.ApplianceNames.pencil]:Wc,[M.ApplianceNames.selector]:Hc,[M.ApplianceNames.eraser]:Fc,[M.ApplianceNames.shape]:Zc,[M.ApplianceNames.text]:Yc,[M.ApplianceNames.laserPointer]:Qc};class Gc{constructor(e,i,s){var a;this.manager=e,this.enableCursor=i,this.cursorInstances=new Map,this.sideEffectManager=new ve.SideEffectManager,this.store=this.manager.store,this.applianceIcons=Wr,this.onCursorMove=n=>{const o=this.initCursorInstance(n.uid);if(n.state===pa.Leave)o.leave();else{const c=o.updateMember();this.canMoveCursor(c)&&o.move(n.position)}},this.initCursorInstance=n=>{let o=this.cursorInstances.get(n);return o||(o=new Uc(this.manager,n,this,ce.playground),this.cursorInstances.set(n,o)),o},this.mouseMoveListener=C.throttle(n=>{n.pointerType==="touch"&&!n.isPrimary||this.updateCursor(this.getType(n),n.clientX,n.clientY)},48),this.getPoint=(n,o,c)=>{var d;const l=(d=n==null?void 0:n.divElement)==null?void 0:d.getBoundingClientRect();if(l)return n==null?void 0:n.convertToPointInWorld({x:o-l.x,y:c-l.y})},this.getType=n=>{var l;const o=n.target,c=this.manager.focusApp;switch(o.parentElement){case this.mainViewElement:return{type:"main"};case((l=c==null?void 0:c.view)==null?void 0:l.divElement):return{type:"app"};default:return{type:"main"}}},this.mouseLeaveListener=()=>{this.hideCursor(this.manager.uid)},this.roomMembers=(a=this.manager.room)==null?void 0:a.state.roomMembers;const r=ce.playground;r&&this.setupWrapper(r),this.sideEffectManager.add(()=>P.on("cursorMove",this.onCursorMove)),this.sideEffectManager.add(()=>P.on("playgroundSizeChange",()=>this.updateContainerRect())),s&&(this.applianceIcons=j(j({},Wr),s))}canMoveCursor(e){const i=(e==null?void 0:e.memberState.currentApplianceName)===M.ApplianceNames.laserPointer;return this.enableCursor||i}setupWrapper(e){this.sideEffectManager.add(()=>(e.addEventListener("pointerenter",this.mouseMoveListener),e.addEventListener("pointermove",this.mouseMoveListener),e.addEventListener("pointerleave",this.mouseLeaveListener),()=>{e.removeEventListener("pointerenter",this.mouseMoveListener),e.removeEventListener("pointermove",this.mouseMoveListener),e.removeEventListener("pointerleave",this.mouseLeaveListener)})),this.updateContainerRect()}setMainViewDivElement(e){this.mainViewElement=e}get boxState(){return this.store.getBoxState()}get focusView(){var e;return(e=this.manager.focusApp)==null?void 0:e.view}updateCursor(e,i,s){if(this.wrapperRect&&this.manager.canOperate){const r=e.type==="main"?this.manager.mainView:this.focusView,a=this.getPoint(r,i,s);a&&this.manager.dispatchInternalEvent(Y.CursorMove,{uid:this.manager.uid,position:{x:a.x,y:a.y,type:e.type}})}}updateContainerRect(){var e,i;this.wrapperRect=(e=this.manager.boxManager)==null?void 0:e.stageRect,this.playgroundRect=(i=ce.playground)==null?void 0:i.getBoundingClientRect()}deleteCursor(e){this.store.cleanCursor(e);const i=this.cursorInstances.get(e);i&&i.destroy()}hideCursor(e){const i=this.cursorInstances.get(e);i&&i.hide()}destroy(){this.sideEffectManager.flushAll(),this.cursorInstances.size&&(this.cursorInstances.forEach(e=>{e.destroy()}),this.cursorInstances.clear())}}class qc{constructor(e){this.manager=e,P.on("changePageState",()=>{Q.emit("pageStateChange",this.toObject())})}get index(){var e;return((e=this.manager)==null?void 0:e.store.getMainViewSceneIndex())||0}get length(){var e;return((e=this.manager)==null?void 0:e.mainViewScenesLength)||0}toObject(){return{index:this.index>=this.length?this.length-1:this.index,length:this.length}}}class Jc{constructor(e){this.ctx=e,this.reactors=new Map,this.disposers=new Map,this.onPhaseChanged=i=>{var s,r;i===M.RoomPhase.Reconnecting&&this.ctx.emitter.emit("startReconnect"),i===M.RoomPhase.Connected&&this.phase===M.RoomPhase.Reconnecting&&((s=this.room)!=null&&s.isWritable?(r=this.room)==null||r.dispatchMagixEvent(qi,{}):this.onReconnected()),this.phase=i},this.onReconnected=C.debounce(()=>{this._onReconnected()},1e3),this._onReconnected=()=>{Je("onReconnected refresh reactors"),this.releaseDisposers(),this.reactors.forEach((i,s)=>{C.isFunction(i)&&this.disposers.set(s,i())}),this.ctx.emitter.emit("onReconnected")}}setRoom(e){this.room=e,this.phase=e==null?void 0:e.phase,e&&(e.callbacks.off("onPhaseChanged",this.onPhaseChanged),e.callbacks.on("onPhaseChanged",this.onPhaseChanged),e.addMagixEventListener(qi,i=>{i.authorId===e.observerId&&this.onReconnected()},{fireSelfEventAfterCommit:!0}))}setContext(e){this.ctx=e}releaseDisposers(){this.disposers.forEach(e=>{C.isFunction(e)&&e()}),this.disposers.clear()}refresh(){this._onReconnected()}add(e,i){const s=this.disposers.get(e);return s&&C.isFunction(s)&&s(),C.isFunction(i)&&(this.reactors.set(e,i),this.disposers.set(e,i())),()=>this.remove(e)}remove(e){this.reactors.has(e)&&this.reactors.delete(e);const i=this.disposers.get(e);i&&(C.isFunction(i)&&i(),this.disposers.delete(e))}hasReactor(e){return this.reactors.has(e)}destroy(){var e,i;(e=this.room)==null||e.callbacks.off("onPhaseChanged",this.onPhaseChanged),(i=this.room)==null||i.removeMagixEventListener(qi,this.onReconnected),this.releaseDisposers()}}const Xc=(t,e)=>{if(M.isPlayer(t))eh(t);else{if(t=t,Object.getOwnPropertyDescriptor(t,"disableCameraTransform"))return;Object.defineProperty(t,"disableCameraTransform",{get(){return e.mainView.disableCameraTransform},set(s){e.mainView.disableCameraTransform=s}}),Object.defineProperty(t,"canUndoSteps",{get(){return e.canUndoSteps}}),Object.defineProperty(t,"canRedoSteps",{get(){return e.canRedoSteps}}),t.moveCamera=s=>e.moveCamera(s),t.moveCameraToContain=(...s)=>e.moveCameraToContain(...s),t.convertToPointInWorld=(...s)=>e.mainView.convertToPointInWorld(...s),t.setCameraBound=(...s)=>e.mainView.setCameraBound(...s),t.scenePreview=(...s)=>e.mainView.scenePreview(...s),t.fillSceneSnapshot=(...s)=>e.mainView.fillSceneSnapshot(...s),t.generateScreenshot=(...s)=>e.mainView.generateScreenshot(...s),t.setMemberState=(...s)=>e.mainView.setMemberState(...s),t.redo=()=>e.redo(),t.undo=()=>e.undo(),t.cleanCurrentScene=()=>e.cleanCurrentScene(),t.delete=()=>e.delete(),t.copy=()=>e.copy(),t.paste=()=>e.paste(),t.duplicate=()=>e.duplicate(),t.insertImage=(...s)=>e.insertImage(...s),t.completeImageUpload=(...s)=>e.completeImageUpload(...s),t.insertText=(...s)=>e.insertText(...s),t.lockImage=(...s)=>e.lockImage(...s),t.lockImages=(...s)=>e.lockImages(...s),Kc(t,e),t.dynamicPpt.slideStateAdapter.pptHandler||(t.dynamicPpt.slideStateAdapter.pptHandler=e.createPPTHandler())}},Kc=(t,e)=>{const i=t.removeScenes;t.removeScenes=(s,r)=>{var n;s===we&&((n=e.appManager)==null||n.updateRootDirRemoving(!0));const a=i.call(t,s);return P.emit("removeScenes",{scenePath:s,index:r}),a}},eh=t=>{const e=t.seekToProgressTime;async function i(s){await P.emit("seekStart");const r=await e.call(t,s);return P.emit("seek",s),r}t.seekToProgressTime=i};var th=(()=>`.netless-app-docs-viewer-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;font-family:PingFang SC,Source Han Sans SC,Microsoft YaHei,Helvetica Neue,Noto Sans CJK SC,WenQuanYi Micro Hei,sans-serif}.netless-app-docs-viewer-footer-btn{box-sizing:border-box;width:26px;height:26px;font-size:0;margin:0;padding:3px;border:none;border-radius:1px;outline:none;color:currentColor;background:transparent;transition:background .4s;cursor:pointer;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-docs-viewer-footer-btn:hover{background:rgba(237,237,240,.9)}@media (hover: none){.netless-app-docs-viewer-footer-btn:hover{background:transparent!important}}.netless-app-docs-viewer-footer-btn>svg{width:100%;height:100%}.netless-app-docs-viewer-footer-btn>svg:nth-of-type(2){display:none}.netless-app-docs-viewer-footer-btn.netless-app-docs-viewer-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-docs-viewer-footer-btn.netless-app-docs-viewer-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-docs-viewer-footer-btn~.netless-app-docs-viewer-footer-btn{margin-left:15px}.netless-app-docs-viewer-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-docs-viewer-page-number{display:flex;align-items:center;height:26px;margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-docs-viewer-page-number-input{border:none;outline:none;width:3em;margin:0;padding:0 .5em 0 2px;text-align:right;font-size:13px;line-height:1;font-weight:400;font-family:inherit;border-radius:2px;color:currentColor;font-family:PingFang SC,Source Han Sans SC,Microsoft YaHei,Helvetica Neue,Noto Sans CJK SC,WenQuanYi Micro Hei,sans-serif;background:transparent;transition:background .4s;user-select:text;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-docs-viewer-page-number-input:hover,.netless-app-docs-viewer-page-number-input:focus,.netless-app-docs-viewer-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-footer-btn{cursor:not-allowed}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-footer-btn:hover{background:transparent}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input{cursor:not-allowed}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:hover,.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:focus,.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:active{background:transparent;box-shadow:none}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-page-number-input:disabled{color:inherit}.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:active,.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:focus,.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input:hover{color:currentColor;background:#25282e}.telebox-color-scheme-dark .netless-app-docs-viewer-footer{border-top:none}.telebox-color-scheme-dark .netless-app-docs-viewer-footer-btn:hover{background:#212126}.netless-app-docs-viewer-preview.netless-app-docs-viewer-preview-active{transform:translate(0)}.netless-app-docs-viewer-content{position:relative;height:100%;overflow:hidden}.netless-app-docs-viewer-preview-mask{position:absolute;z-index:10200;top:0;left:0;width:100%;height:100%}.netless-app-docs-viewer-preview{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;position:absolute;z-index:10300;top:0;left:0;width:33%;max-width:200px;height:100%;padding-top:10px;transform:translate(-100%);background:rgba(237,237,240,.9);box-shadow:inset -1px 0 #0000001c;transition:transform .4s}.netless-app-docs-viewer-preview-active .netless-app-docs-viewer-preview-mask{display:block}.netless-app-docs-viewer-preview-active .netless-app-docs-viewer-preview{transform:translate(0)}.netless-app-docs-viewer-preview-page{position:relative;display:block;width:55%;margin-bottom:10px;font-size:0;color:transparent;outline:none;border:7px solid transparent;border-radius:4px;transition:border-color .3s;user-select:none}.netless-app-docs-viewer-preview-page:hover,.netless-app-docs-viewer-preview-page.netless-app-docs-viewer-preview-page-active{border-color:#444e601a}.netless-app-docs-viewer-preview-page>img{width:100%;height:auto;box-sizing:border-box;border:1px solid rgba(0,0,0,.5);border-radius:1px;background-color:#fff;box-shadow:0 2px 8px #0000004d}.netless-app-docs-viewer-preview-page-name{position:absolute;top:1px;left:-10px;transform:translate(-100%);text-align:right;font-size:12px;user-select:none}.telebox-color-scheme-dark .netless-app-docs-viewer-preview{background:rgba(50,50,50,.9)}.netless-app-docs-viewer-static-scrollbar{box-sizing:border-box;position:absolute;top:0;right:0;z-index:2147483647;width:16px;min-height:30px;margin:0;padding:0 0 0 8px;border:none;outline:none;opacity:0;background:transparent;transition:opacity .4s 3s,transform .1s;user-select:none;touch-action:none}.netless-app-docs-viewer-static-scrollbar:after{content:"";display:block;width:8px;height:100%;border-radius:4px;background:rgba(68,78,96,.4);box-shadow:1px 1px 8px #ffffffb3;transition:background .4s}.netless-app-docs-viewer-static-scrollbar.netless-app-docs-viewer-static-scrolling{opacity:1;transition:opacity .4s,transform .1s}.netless-app-docs-viewer-static-scrollbar.netless-app-docs-viewer-static-scrollbar-dragging{opacity:1;transition:opacity .4s 3s!important}.netless-app-docs-viewer-static-scrollbar.netless-app-docs-viewer-static-scrollbar-dragging:after{background:rgba(68,78,96,.6)}.netless-app-docs-viewer-static-scrollbar:hover:after,.netless-app-docs-viewer-static-scrollbar:focus:after{background:rgba(68,78,96,.5)}.netless-app-docs-viewer-static-scrollbar:active:after{background:rgba(68,78,96,.6)}.telebox-body-wrap:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:opacity .4s,transform .1s}.telebox-readonly .netless-app-docs-viewer-static-scrollbar{display:none}.page-renderer-pages-container{position:relative;width:100%;height:100%}.page-renderer-page{position:absolute;top:0;left:0;background-position:center;background-size:cover;background-repeat:no-repeat}.page-renderer-pages-container.is-hwa .page-renderer-page{will-change:transform}.page-renderer-page-img{display:block;width:100%;height:auto;user-select:none}.netless-app-docs-viewer-static-pages{overflow:hidden;position:relative;height:100%;user-select:none}.netless-app-docs-viewer-static-page{display:block;width:100%;height:auto;user-select:none}.netless-app-docs-viewer-dynamic-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden}.netless-app-docs-viewer-dynamic-wb-view .cursor-clicker .ppt-event-source{cursor:pointer}
|
124
|
+
`)();const Qa="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",ih=Qa.length,Hr=Array(20),sh=()=>{for(let t=0;t<20;t++)Hr[t]=Qa.charAt(Math.random()*ih);return Hr.join("")};function Fr(t){try{return t()}catch(e){console.error(e)}}class gt{constructor(){this.disposers=new Map}addDisposer(e,i=this.genUID()){return this.flush(i),this.disposers.set(i,Array.isArray(e)?()=>e.forEach(Fr):e),i}add(e,i=this.genUID()){const s=e();return s?this.addDisposer(s,i):i}addEventListener(e,i,s,r,a=this.genUID()){return e.addEventListener(i,s,r),this.addDisposer(()=>e.removeEventListener(i,s,r),a),a}setTimeout(e,i,s=this.genUID()){const r=window.setTimeout(()=>{this.remove(s),e()},i);return this.addDisposer(()=>window.clearTimeout(r),s)}setInterval(e,i,s=this.genUID()){const r=window.setInterval(e,i);return this.addDisposer(()=>window.clearInterval(r),s)}remove(e){const i=this.disposers.get(e);return this.disposers.delete(e),i}flush(e){const i=this.remove(e);if(i)try{i()}catch(s){console.error(s)}}flushAll(){this.disposers.forEach(Fr),this.disposers.clear()}genUID(){let e;do e=sh();while(this.disposers.has(e));return e}}var rh=Object.defineProperty,ah=Object.defineProperties,nh=Object.getOwnPropertyDescriptors,Zr=Object.getOwnPropertySymbols,oh=Object.prototype.hasOwnProperty,lh=Object.prototype.propertyIsEnumerable,Ss=(t,e,i)=>e in t?rh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Ga=(t,e)=>{for(var i in e||(e={}))oh.call(e,i)&&Ss(t,i,e[i]);if(Zr)for(var i of Zr(e))lh.call(e,i)&&Ss(t,i,e[i]);return t},qa=(t,e)=>ah(t,nh(e)),tt=(t,e,i)=>(Ss(t,typeof e!="symbol"?e+"":e,i),i);class ch{constructor(e){tt(this,"_subscribers"),tt(this,"_bSub"),tt(this,"_bSubDisposer"),this._bSub=e}get size(){return this._subscribers?this._subscribers.size:0}invoke(e,i){this._subscribers&&this._subscribers.forEach(s=>s(e,i))}add(e){this._bSub&&(!this._subscribers||this._subscribers.size<=0)&&(this._bSubDisposer=this._bSub()),this._subscribers||(this._subscribers=new Set),this._subscribers.add(e)}remove(e){if(this._subscribers&&this._subscribers.delete(e),this._subscribers&&this._subscribers.size<=0&&this._bSubDisposer){const i=this._bSubDisposer;this._bSubDisposer=null,i()}}clear(){if(this._subscribers&&this._subscribers.clear(),this._bSubDisposer){const e=this._bSubDisposer;this._bSubDisposer=null,e()}}destroy(){this.clear()}}class qs{constructor(e,i){tt(this,"_subscribers"),tt(this,"_value"),this._value=e;let s;if(i&&(i.compare&&(this.compare=i.compare),i.beforeSubscribe)){const r=i.beforeSubscribe,a=this._setValue.bind(this);s=()=>r(a)}this._subscribers=new ch(s)}_setValue(e,i){this.compare(e,this._value)||(this._value=e,this._subscribers.invoke(e,i))}get value(){return this._value}reaction(e){return this._subscribers.add(e),()=>{this._subscribers.remove(e)}}subscribe(e,i){const s=this.reaction(e);return e(this._value,i),s}destroy(){this._subscribers.destroy()}unsubscribe(e){this._subscribers.remove(e)}get size(){return this._subscribers.size}compare(e,i){return e===i}}class Fe extends qs{constructor(){super(...arguments);tt(this,"setValue",this._setValue)}}class hh extends qs{constructor(e,i,s={}){super(i(e.value),qa(Ga({},s),{beforeSubscribe:r=>{const a=e.subscribe((n,o)=>r(i(n),o));if(s.beforeSubscribe){const n=s.beforeSubscribe(r);if(n)return()=>{a(),n()}}return a}}));tt(this,"_srcValue"),this._srcValue=()=>i(e.value)}get value(){if(this.size<=0){const e=this._srcValue();return this.compare(e,this._value)?this._value:e}return this._value}}function Ut(t,e=s=>s,i={}){return new hh(t,e,i)}class dh extends qs{constructor(e,i,s={}){super(i(ns(e)),qa(Ga({},s),{beforeSubscribe:r=>{let a=ns(e);r(i(a));const n=e.map((c,l)=>c.reaction((d,u)=>{a=a.slice(),a[l]=d,r(i(a),u)})),o=()=>n.forEach(c=>c());if(s.beforeSubscribe){const c=s.beforeSubscribe(r);if(c)return()=>{o(),c()}}return o}}));tt(this,"_srcValue"),this._srcValue=()=>i(ns(e))}get value(){if(this.size<=0){const e=this._srcValue();return this.compare(e,this._value)?this._value:e}return this._value}}function ns(t){return t.map(uh)}function uh(t){return t.value}function Pe(t,e=s=>s,i={}){return new dh(t,e,i)}function Ja(t){t.onValChanged||(t.onValChanged=ph)}function ph(t,e){const i=this[`_${t}$`]||this[t];if(!(i!=null&&i.reaction))throw new TypeError(`"${t}" is not related to a Val in this instance`);return i.reaction(e)}function gh(t,e,i){Object.keys(e).forEach(s=>{mh(t,s,e[s]),i&&i.attach(e[s])}),Ja(t)}function mh(t,e,i){return Object.defineProperties(t,{[e]:{get(){return i.value}},[`_${e}$`]:{value:i}}),t}function fh(t,e,i){Object.keys(e).forEach(s=>{bh(t,s,e[s]),i&&i.attach(e[s])}),Ja(t)}function bh(t,e,i){return Object.defineProperties(t,{[e]:{get(){return i.value},set(s){i.setValue(s)}},[`_${e}$`]:{value:i},[`set${yh(e)}`]:{value:(s,r)=>i.setValue(s,r)}}),t}function yh(t){return t[0].toUpperCase()+t.slice(1)}const at=typeof window!="undefined",Xa=at&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),Ka=at&&"IntersectionObserver"in window,en=at&&"classList"in document.createElement("p"),tn=at&&window.devicePixelRatio>1,wh={elements_selector:".lazy",container:Xa||at?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_bg_hidpi:"bg-hidpi",data_bg_multi:"bg-multi",data_bg_multi_hidpi:"bg-multi-hidpi",data_bg_set:"bg-set",data_poster:"poster",class_applied:"applied",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_entered:"entered",class_exited:"exited",unobserve_completed:!0,unobserve_entered:!1,cancel_on_exit:!0,callback_enter:null,callback_exit:null,callback_applied:null,callback_loading:null,callback_loaded:null,callback_error:null,callback_finish:null,callback_cancel:null,use_native:!1,restore_on_error:!1},sn=t=>Object.assign({},wh,t),Yr=function(t,e){let i;const s="LazyLoad::Initialized",r=new t(e);try{i=new CustomEvent(s,{detail:{instance:r}})}catch{i=document.createEvent("CustomEvent"),i.initCustomEvent(s,!1,!1,{instance:r})}window.dispatchEvent(i)},vh=(t,e)=>{if(!!e)if(!e.length)Yr(t,e);else for(let i=0,s;s=e[i];i+=1)Yr(t,s)},Ze="src",Js="srcset",Xs="sizes",rn="poster",ei="llOriginalAttrs",an="data",Ks="loading",nn="loaded",on="applied",xh="entered",er="error",ln="native",cn="data-",hn="ll-status",ge=(t,e)=>t.getAttribute(cn+e),Mh=(t,e,i)=>{var s=cn+e;if(i===null){t.removeAttribute(s);return}t.setAttribute(s,i)},ti=t=>ge(t,hn),mt=(t,e)=>Mh(t,hn,e),Vi=t=>mt(t,null),tr=t=>ti(t)===null,Sh=t=>ti(t)===Ks,Ch=t=>ti(t)===er,ir=t=>ti(t)===ln,Ih=[Ks,nn,on,er],_h=t=>Ih.indexOf(ti(t))>=0,nt=(t,e,i,s)=>{if(!!t){if(s!==void 0){t(e,i,s);return}if(i!==void 0){t(e,i);return}t(e)}},_t=(t,e)=>{if(en){t.classList.add(e);return}t.className+=(t.className?" ":"")+e},$e=(t,e)=>{if(en){t.classList.remove(e);return}t.className=t.className.replace(new RegExp("(^|\\s+)"+e+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},Ah=t=>{t.llTempImage=document.createElement("IMG")},kh=t=>{delete t.llTempImage},dn=t=>t.llTempImage,$i=(t,e)=>{if(!e)return;const i=e._observer;!i||i.unobserve(t)},Th=t=>{t.disconnect()},Nh=(t,e,i)=>{e.unobserve_entered&&$i(t,i)},sr=(t,e)=>{!t||(t.loadingCount+=e)},Eh=t=>{!t||(t.toLoadCount-=1)},un=(t,e)=>{!t||(t.toLoadCount=e)},Ph=t=>t.loadingCount>0,zh=t=>t.toLoadCount>0,pn=t=>{let e=[];for(let i=0,s;s=t.children[i];i+=1)s.tagName==="SOURCE"&&e.push(s);return e},rr=(t,e)=>{const i=t.parentNode;if(!i||i.tagName!=="PICTURE")return;pn(i).forEach(e)},gn=(t,e)=>{pn(t).forEach(e)},ji=[Ze],mn=[Ze,rn],Gt=[Ze,Js,Xs],fn=[an],Bi=t=>!!t[ei],bn=t=>t[ei],yn=t=>delete t[ei],St=(t,e)=>{if(Bi(t))return;const i={};e.forEach(s=>{i[s]=t.getAttribute(s)}),t[ei]=i},Dh=t=>{Bi(t)||(t[ei]={backgroundImage:t.style.backgroundImage})},Lh=(t,e,i)=>{if(!i){t.removeAttribute(e);return}t.setAttribute(e,i)},pt=(t,e)=>{if(!Bi(t))return;const i=bn(t);e.forEach(s=>{Lh(t,s,i[s])})},Vh=t=>{if(!Bi(t))return;const e=bn(t);t.style.backgroundImage=e.backgroundImage},wn=(t,e,i)=>{_t(t,e.class_applied),mt(t,on),i&&(e.unobserve_completed&&$i(t,e),nt(e.callback_applied,t,i))},vn=(t,e,i)=>{_t(t,e.class_loading),mt(t,Ks),i&&(sr(i,1),nt(e.callback_loading,t,i))},it=(t,e,i)=>{!i||t.setAttribute(e,i)},Qr=(t,e)=>{it(t,Xs,ge(t,e.data_sizes)),it(t,Js,ge(t,e.data_srcset)),it(t,Ze,ge(t,e.data_src))},$h=(t,e)=>{rr(t,i=>{St(i,Gt),Qr(i,e)}),St(t,Gt),Qr(t,e)},jh=(t,e)=>{St(t,ji),it(t,Ze,ge(t,e.data_src))},Bh=(t,e)=>{gn(t,i=>{St(i,ji),it(i,Ze,ge(i,e.data_src))}),St(t,mn),it(t,rn,ge(t,e.data_poster)),it(t,Ze,ge(t,e.data_src)),t.load()},Rh=(t,e)=>{St(t,fn),it(t,an,ge(t,e.data_src))},Oh=(t,e,i)=>{const s=ge(t,e.data_bg),r=ge(t,e.data_bg_hidpi),a=tn&&r?r:s;!a||(t.style.backgroundImage=`url("${a}")`,dn(t).setAttribute(Ze,a),vn(t,e,i))},Uh=(t,e,i)=>{const s=ge(t,e.data_bg_multi),r=ge(t,e.data_bg_multi_hidpi),a=tn&&r?r:s;!a||(t.style.backgroundImage=a,wn(t,e,i))},Wh=(t,e,i)=>{const s=ge(t,e.data_bg_set);if(!s)return;const r=s.split("|");let a=r.map(n=>`image-set(${n})`);t.style.backgroundImage=a.join(),t.style.backgroundImage===""&&(a=r.map(n=>`-webkit-image-set(${n})`),t.style.backgroundImage=a.join()),wn(t,e,i)},xn={IMG:$h,IFRAME:jh,VIDEO:Bh,OBJECT:Rh},Hh=(t,e)=>{const i=xn[t.tagName];!i||i(t,e)},Fh=(t,e,i)=>{const s=xn[t.tagName];!s||(s(t,e),vn(t,e,i))},Zh=["IMG","IFRAME","VIDEO","OBJECT"],Yh=t=>Zh.indexOf(t.tagName)>-1,Mn=(t,e)=>{e&&!Ph(e)&&!zh(e)&&nt(t.callback_finish,e)},Gr=(t,e,i)=>{t.addEventListener(e,i),t.llEvLisnrs[e]=i},Qh=(t,e,i)=>{t.removeEventListener(e,i)},ar=t=>!!t.llEvLisnrs,Gh=(t,e,i)=>{ar(t)||(t.llEvLisnrs={});const s=t.tagName==="VIDEO"?"loadeddata":"load";Gr(t,s,e),Gr(t,"error",i)},Cs=t=>{if(!ar(t))return;const e=t.llEvLisnrs;for(let i in e){const s=e[i];Qh(t,i,s)}delete t.llEvLisnrs},Sn=(t,e,i)=>{kh(t),sr(i,-1),Eh(i),$e(t,e.class_loading),e.unobserve_completed&&$i(t,i)},qh=(t,e,i,s)=>{const r=ir(e);Sn(e,i,s),_t(e,i.class_loaded),mt(e,nn),nt(i.callback_loaded,e,s),r||Mn(i,s)},Jh=(t,e,i,s)=>{const r=ir(e);Sn(e,i,s),_t(e,i.class_error),mt(e,er),nt(i.callback_error,e,s),i.restore_on_error&&pt(e,Gt),r||Mn(i,s)},nr=(t,e,i)=>{const s=dn(t)||t;if(ar(s))return;Gh(s,n=>{qh(n,t,e,i),Cs(s)},n=>{Jh(n,t,e,i),Cs(s)})},Xh=(t,e,i)=>{Ah(t),nr(t,e,i),Dh(t),Oh(t,e,i),Uh(t,e,i),Wh(t,e,i)},Kh=(t,e,i)=>{nr(t,e,i),Fh(t,e,i)},or=(t,e,i)=>{Yh(t)?Kh(t,e,i):Xh(t,e,i)},ed=(t,e,i)=>{t.setAttribute("loading","lazy"),nr(t,e,i),Hh(t,e),mt(t,ln)},qr=t=>{t.removeAttribute(Ze),t.removeAttribute(Js),t.removeAttribute(Xs)},td=t=>{rr(t,e=>{qr(e)}),qr(t)},Cn=t=>{rr(t,e=>{pt(e,Gt)}),pt(t,Gt)},id=t=>{gn(t,e=>{pt(e,ji)}),pt(t,mn),t.load()},sd=t=>{pt(t,ji)},rd=t=>{pt(t,fn)},ad={IMG:Cn,IFRAME:sd,VIDEO:id,OBJECT:rd},nd=t=>{const e=ad[t.tagName];if(!e){Vh(t);return}e(t)},od=(t,e)=>{tr(t)||ir(t)||($e(t,e.class_entered),$e(t,e.class_exited),$e(t,e.class_applied),$e(t,e.class_loading),$e(t,e.class_loaded),$e(t,e.class_error))},ld=(t,e)=>{nd(t),od(t,e),Vi(t),yn(t)},cd=(t,e,i,s)=>{!i.cancel_on_exit||!Sh(t)||t.tagName==="IMG"&&(Cs(t),td(t),Cn(t),$e(t,i.class_loading),sr(s,-1),Vi(t),nt(i.callback_cancel,t,e,s))},hd=(t,e,i,s)=>{const r=_h(t);mt(t,xh),_t(t,i.class_entered),$e(t,i.class_exited),Nh(t,i,s),nt(i.callback_enter,t,e,s),!r&&or(t,i,s)},dd=(t,e,i,s)=>{tr(t)||(_t(t,i.class_exited),cd(t,e,i,s),nt(i.callback_exit,t,e,s))},ud=["IMG","IFRAME","VIDEO"],In=t=>t.use_native&&"loading"in HTMLImageElement.prototype,pd=(t,e,i)=>{t.forEach(s=>{ud.indexOf(s.tagName)!==-1&&ed(s,e,i)}),un(i,0)},gd=t=>t.isIntersecting||t.intersectionRatio>0,md=t=>({root:t.container===document?null:t.container,rootMargin:t.thresholds||t.threshold+"px"}),fd=(t,e,i)=>{t.forEach(s=>gd(s)?hd(s.target,s,e,i):dd(s.target,s,e,i))},bd=(t,e)=>{e.forEach(i=>{t.observe(i)})},yd=(t,e)=>{Th(t),bd(t,e)},wd=(t,e)=>{!Ka||In(t)||(e._observer=new IntersectionObserver(i=>{fd(i,t,e)},md(t)))},_n=t=>Array.prototype.slice.call(t),Ii=t=>t.container.querySelectorAll(t.elements_selector),vd=t=>_n(t).filter(tr),xd=t=>Ch(t),Md=t=>_n(t).filter(xd),Jr=(t,e)=>vd(t||Ii(e)),Sd=(t,e)=>{Md(Ii(t)).forEach(s=>{$e(s,t.class_error),Vi(s)}),e.update()},Cd=(t,e)=>{!at||(e._onlineHandler=()=>{Sd(t,e)},window.addEventListener("online",e._onlineHandler))},Id=t=>{!at||window.removeEventListener("online",t._onlineHandler)},ii=function(t,e){const i=sn(t);this._settings=i,this.loadingCount=0,wd(i,this),Cd(i,this),this.update(e)};ii.prototype={update:function(t){const e=this._settings,i=Jr(t,e);if(un(this,i.length),Xa||!Ka){this.loadAll(i);return}if(In(e)){pd(i,e,this);return}yd(this._observer,i)},destroy:function(){this._observer&&this._observer.disconnect(),Id(this),Ii(this._settings).forEach(t=>{yn(t)}),delete this._observer,delete this._settings,delete this._onlineHandler,delete this.loadingCount,delete this.toLoadCount},loadAll:function(t){const e=this._settings;Jr(t,e).forEach(s=>{$i(s,this),or(s,e,this)})},restoreAll:function(){const t=this._settings;Ii(t).forEach(e=>{ld(e,t)})}};ii.load=(t,e)=>{const i=sn(e);or(t,i)};ii.resetStatus=t=>{Vi(t)};at&&vh(ii,window.lazyLoadOptions);class _d{constructor({namespace:e,pages$:i,sideEffect:s,readonly$:r,events:a,wrapClassName:n,root:o,pagesIndex$:c}){this.showPreview$=new Fe(!1),this.namespace=e,this.pages$=i,this.sideEffect=s,this.readonly$=r,this.events=a,this.wrapClassName=n,this.sideEffect.addDisposer(this.events.on("togglePreview",()=>{this.showPreview$.setValue(!this.showPreview$.value)})),this.sideEffect.addDisposer(this.showPreview$.subscribe(l=>{this.sideEffect.add(()=>{const d=this.renderPreview(),u=this.renderPreviewMask();if(l){o.appendChild(d),o.appendChild(u),d.scrollTop;const p=d.querySelector("."+this.wrapClassName(`preview-page-${c.value}`));return p&&d.scrollTo({top:p.offsetTop-16}),d.classList.toggle(this.wrapClassName("preview-active"),!0),this.previewLazyLoad=new ii({container:this.$preview,elements_selector:"."+this.wrapClassName("preview-page>img")}),()=>{var m;return(m=this.previewLazyLoad)==null?void 0:m.destroy()}}else return d.classList.toggle(this.wrapClassName("preview-active"),!1),this.sideEffect.setTimeout(()=>{d.remove(),u.remove()},500,"preview-remove"),null},"preview-lazyload")}))}destroy(){var e,i;(e=this.$preview)==null||e.remove(),(i=this.$previewMask)==null||i.remove()}renderPreview(){if(this.$preview)return this.$preview;const e=document.createElement("div");return e.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=e,this.sideEffect.addEventListener(e,"wheel",i=>i.stopPropagation(),{passive:!1}),this.sideEffect.addDisposer(this.pages$.subscribe(i=>{var s;this.sideEffect.add(()=>{const r=i.map((a,n)=>{var o;const c=(o=a.thumbnail)!=null?o:a.src.startsWith("ppt")?void 0:a.src;if(!c)return;const l=String(n),d=document.createElement("a");d.className=this.wrapClassName("preview-page")+" "+this.wrapClassName(`preview-page-${n}`),d.setAttribute("href","#"),d.dataset.pageIndex=l;const u=document.createElement("span");u.className=this.wrapClassName("preview-page-name"),u.textContent=String(n+1),u.dataset.pageIndex=l;const p=document.createElement("img");return p.width=a.width,p.height=a.height,p.dataset.src=c,p.dataset.pageIndex=l,d.appendChild(p),d.appendChild(u),e.appendChild(d),d});return()=>r.forEach(a=>a==null?void 0:a.remove())},"render-preview-pages"),(s=this.previewLazyLoad)==null||s.update()})),this.sideEffect.addEventListener(e,"click",i=>{var s;if(this.readonly$.value)return;const r=(s=i.target.dataset)==null?void 0:s.pageIndex;r&&(i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation(),this.events.emit("jumpPage",Number(r)),this.showPreview$.setValue(!1))}),e}renderPreviewMask(){if(this.$previewMask)return this.$previewMask;const e=document.createElement("div");return e.className=this.wrapClassName("preview-mask"),this.$previewMask=e,this.sideEffect.addEventListener(e,"click",i=>{this.readonly$.value||i.target===e&&this.showPreview$.setValue(!1)}),e}}function Ad(t){const e="http://www.w3.org/2000/svg",i=document.createElementNS(e,"svg");i.setAttribute("class",`${t}-footer-icon-sidebar`),i.setAttribute("viewBox","0 0 64 64");const s=document.createElementNS(e,"path");return s.setAttribute("fill","currentColor"),s.setAttribute("d","M50 8H14c-3.309 0-6 2.691-6 6v36c0 3.309 2.691 6 6 6h36c3.309 0 6-2.691 6-6V14c0-3.309-2.691-6-6-6zM12 50V14c0-1.103.897-2 2-2h8v40h-8c-1.103 0-2-.897-2-2zm40 0c0 1.103-.897 2-2 2H26V12h24c1.103 0 2 .897 2 2z"),i.appendChild(s),i}function kd(t){const e="http://www.w3.org/2000/svg",i=document.createElementNS(e,"svg");i.setAttribute("class",`${t}-footer-icon-arrow-left`),i.setAttribute("viewBox","0 0 500 500");const s=document.createElementNS(e,"path");return s.setAttribute("fill","currentColor"),s.setAttribute("d","M177.81 249.959L337.473 90.295c2.722-2.865 2.651-7.378-.143-10.1-2.793-2.65-7.163-2.65-9.956 0l-164.75 164.75c-2.793 2.793-2.793 7.306 0 10.1l164.75 164.75c2.865 2.722 7.378 2.65 10.099-.143 2.651-2.794 2.651-7.163 0-9.957L177.809 249.959z"),i.appendChild(s),i}function Td(t){const e="http://www.w3.org/2000/svg",i=document.createElementNS(e,"svg");i.setAttribute("class",`${t}-footer-icon-arrow-right`),i.setAttribute("viewBox","0 0 500 500");const s=document.createElementNS(e,"path");return s.setAttribute("fill","currentColor"),s.setAttribute("d","M322.19 250.041L162.527 409.705c-2.722 2.865-2.651 7.378.143 10.1 2.793 2.65 7.163 2.65 9.956 0l164.75-164.75c2.793-2.793 2.793-7.306 0-10.1l-164.75-164.75c-2.865-2.722-7.378-2.65-10.099.143-2.651 2.794-2.651 7.163 0 9.957l159.664 159.736z"),i.appendChild(s),i}function Nd(t){const e="http://www.w3.org/2000/svg",i=document.createElementNS(e,"svg");i.setAttribute("class",`${t}-footer-icon-play`),i.setAttribute("viewBox","0 0 500 500");const s=document.createElementNS(e,"path");return s.setAttribute("fill","currentColor"),s.setAttribute("d","M418.158 257.419L174.663 413.33c-6.017 3.919-15.708 3.772-21.291-.29-2.791-2.018-4.295-4.483-4.295-7.084V94.109c0-5.65 6.883-10.289 15.271-10.289 4.298 0 8.391 1.307 11.181 3.332l242.629 155.484c6.016 3.917 6.451 10.292.649 14.491-.216.154-.432.154-.649.292zM170.621 391.288l223.116-141.301L170.71 107.753l-.089 283.535z"),i.appendChild(s),i}function Ed(t){const e="http://www.w3.org/2000/svg",i=document.createElementNS(e,"svg");i.setAttribute("class",`${t}-footer-icon-pause`),i.setAttribute("viewBox","0 0 500 500");const s=document.createElementNS(e,"path");return s.setAttribute("fill","currentColor"),s.setAttribute("d","M312.491 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261zM165.257 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261z"),i.appendChild(s),i}class Pd{constructor({namespace:e,pages$:i,sideEffect:s,readonly$:r,events:a,playable:n,wrapClassName:o,pagesIndex$:c,root:l}){this.namespace=e,this.pages$=i,this.sideEffect=s,this.readonly$=r,this.events=a,this.wrapClassName=o,this.pagesIndex$=c,this.playable=n,this.$footer=this.render(),l.appendChild(this.$footer)}destroy(){this.$footer.remove()}render(){const e=document.createElement("div");e.className=this.wrapClassName("footer"),this.sideEffect.addDisposer(this.readonly$.subscribe(l=>e.classList.toggle(this.wrapClassName("readonly"),l)));const i=this.renderFooterBtn("btn-sidebar",Ad(this.namespace));this.sideEffect.addEventListener(i,"click",()=>{this.readonly$.value||this.events.emit("togglePreview")}),e.appendChild(i),this.sideEffect.addDisposer(this.pages$.subscribe(l=>{const d=l.some(u=>u.thumbnail||!u.src.startsWith("ppt"));i.style.display=d?"":"none"}));const s=document.createElement("div");s.className=this.wrapClassName("page-jumps");const r=this.renderFooterBtn("btn-page-back",kd(this.namespace));if(this.sideEffect.addEventListener(r,"click",()=>{this.readonly$.value||this.events.emit("back")}),s.appendChild(r),this.playable){const l=this.renderFooterBtn("btn-page-play",Nd(this.namespace),Ed(this.namespace));this.sideEffect.addEventListener(l,"click",()=>{this.readonly$.value||(l.classList.toggle(this.wrapClassName("footer-btn-playing"),!0),this.events.emit("play"),this.sideEffect.setTimeout(()=>l.classList.toggle(this.wrapClassName("footer-btn-playing"),!1),500,"returnPlay"))}),s.appendChild(l)}const a=this.renderFooterBtn("btn-page-next",Td(this.namespace));this.sideEffect.addEventListener(a,"click",()=>{this.readonly$.value||this.events.emit("next")}),s.appendChild(a);const n=document.createElement("div");n.className=this.wrapClassName("page-number");const o=document.createElement("input");o.className=this.wrapClassName("page-number-input"),this.sideEffect.addDisposer(this.readonly$.subscribe(l=>o.disabled=l)),this.sideEffect.addDisposer(this.pagesIndex$.subscribe(l=>o.value=String(l+1))),this.sideEffect.addEventListener(o,"focus",()=>{o.select()}),this.sideEffect.addEventListener(o,"change",()=>{if(this.readonly$.value)return;const l=Number(o.value)-1;l>=0&&this.events.emit("jumpPage",l)});const c=document.createElement("span");return this.sideEffect.addDisposer(this.pages$.subscribe(l=>{c.textContent=" / "+l.length})),n.appendChild(o),n.appendChild(c),e.appendChild(s),e.appendChild(n),e}renderFooterBtn(e,i,s){const r=document.createElement("button");return r.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(e),r.appendChild(i),s&&r.appendChild(s),r}}class zd{constructor(){this.listeners=new Map,this.relayListeners=new Set}emit(e,i){var s;(s=this.listeners.get(e))==null||s.forEach(r=>r(i))}on(e,i){let s=this.listeners.get(e);return s||(s=new Set,this.listeners.set(e,s)),s.add(i),s.size===1&&this.relayListeners.forEach(r=>r.start(e)),()=>{this.off(e,i)}}off(e,i){const s=this.listeners.get(e);if(s){const r=s.delete(i);return s.size<=0&&(this.listeners.delete(e),this.relayListeners.forEach(a=>a.dispose(e))),r}return!1}clear(e){var i;e?(i=this.listeners.get(e))==null||i.clear():this.listeners.clear()}count(e){var i;if(e)return((i=this.listeners.get(e))==null?void 0:i.size)||0;{let s=0;return this.listeners.forEach(r=>{s+=r.size}),s}}remit(e,i){let s;const r={start:a=>{a===e&&(s=i(this))},dispose:a=>{s&&(!a||a===e)&&s()}};return this.relayListeners.add(r),()=>{this.relayListeners.delete(r),s&&s()}}destroy(){this.clear(),this.relayListeners.forEach(e=>e.dispose()),this.relayListeners.clear()}}class An{constructor({readonly$:e,pagesIndex$:i,box:s,pages:r=[],playable:a}){this.wrapClassName=o=>`${this.namespace}-${o}`,this.namespace="netless-app-docs-viewer",this.sideEffect=new gt,this.events=new zd;const n=new Fe(r);fh(this,{pages:n}),this.preview=new _d({pages$:n,readonly$:e,pagesIndex$:i,root:s.$body,sideEffect:this.sideEffect,events:this.events,namespace:this.namespace,wrapClassName:this.wrapClassName}),this.footer=new Pd({pages$:n,readonly$:e,playable:a,pagesIndex$:i,root:s.$footer,namespace:this.namespace,sideEffect:this.sideEffect,events:this.events,wrapClassName:this.wrapClassName})}destroy(){this.preview.destroy(),this.footer.destroy(),this.sideEffect.flushAll(),this.events.destroy()}}function Xe(t,e,i){return Math.min(Math.max(t,e),i)}function Xr(t){return t.touches?t.touches[0]:t}function kn(t){t.stopPropagation(),t.cancelable&&t.preventDefault()}function Tn(t,e){return t.width===e.width&&t.height===e.height}class Dd{constructor(e){var i,s,r;this.velocity=0,this._paused=!0,this._animationFrameID=null,this._loopTimestamp=0,this.looper=a=>{var n;if(this._paused)return;let o=Math.floor((a-this._loopTimestamp)/1e3*60)+1;for(this._loopTimestamp=a;o-- >0;)this.stepper();(n=this.onStep)==null||n.call(this,this.current),this._paused?this._animationFrameID=null:this._animationFrameID=window.requestAnimationFrame(this.looper)},this.current=(i=e.start)!=null?i:0,this.target=this.current,this.stiffness=(s=e.stiffness)!=null?s:170,this.damping=(r=e.damping)!=null?r:26,this.onStep=e.onStep}get paused(){return this._paused}stepTo(e,i){var s;this._paused&&i!=null&&(this.current=i),this._paused=!1,this.target=e,(s=this.onStep)==null||s.call(this,this.current),this._loopTimestamp=Date.now(),this._animationFrameID=window.requestAnimationFrame(this.looper)}pause(){this._paused=!0,this._animationFrameID!=null&&window.cancelAnimationFrame(this._animationFrameID)}destroy(){this.pause(),this.onStep=void 0}stepper(){const e=-this.stiffness*(this.current-this.target),i=-this.damping*this.velocity,s=this.velocity+(e+i)/60,r=this.current+s/60;Math.abs(s-0)<.01&&Math.abs(r-this.target)<.01?(this.current=this.target,this.velocity=0,this._paused=!0):(this.current=r,this.velocity=s)}}class Ld{constructor(e,i,s,r,a,n){this.index=e,this.lastVisit=Date.now(),this.sideEffect=new gt;const o=Ut(i,p=>p[e]||{width:0,height:0}),c=Pe([o,s],([p,m])=>(m.width-p.width)/2),l=Pe([a,n],([p,m])=>(p[e]||0)-m),d=document.createElement("div");d.className="page-renderer-page",d.dataset.index=`${e}`;const u=document.createElement("img");u.className="page-renderer-page-img",d.appendChild(u),this.sideEffect.addDisposer([Pe([o,r]).subscribe(([p,m])=>{d.style.width=`${p.width*m}px`,d.style.height=`${p.height*m}px`}),o.subscribe(p=>{p.thumbnail&&(d.style.backgroundImage=`url("${p.thumbnail}")`),u.width=p.width,u.height=p.height,u.src=p.src}),Pe([c,l,r]).subscribe(([p,m,g])=>{d.style.transform=`translate(${p*g}px, ${m*g}px)`})]),this.$page=d}destroy(){this.sideEffect.flushAll(),this.$page.remove()}}const Vd=window.requestIdleCallback||(t=>window.setTimeout(t,5e3)),$d=window.cancelIdleCallback||window.clearTimeout;class jd{constructor(e,i,s,r,a){this.pages$=e,this.pagesSize$=i,this.scale$=s,this.pagesYs$=r,this.pagesScrollTop$=a,this.els=new Map,this.maxElCount=200,this.gcTimer=null,this.gc=()=>{var n;if(this.gcTimer=null,this.els.size>this.maxElCount){const o=[...this.els.values()].sort((c,l)=>l.lastVisit-c.lastVisit);for(let c=Math.floor(this.maxElCount/4);c<o.length;c++)(n=this.els.get(o[c].index))==null||n.destroy(),this.els.delete(o[c].index)}}}getEl(e){let i=this.els.get(e);return i||(i=new Ld(e,this.pages$,this.pagesSize$,this.scale$,this.pagesYs$,this.pagesScrollTop$),this.els.set(e,i)),i.lastVisit=Date.now(),this.els.size>this.maxElCount&&this.gcTimer===null&&(this.gcTimer=Vd(this.gc)),i}destroy(){this.els.forEach(e=>e.destroy()),this.els.clear(),this.gcTimer!==null&&($d(this.gcTimer),this.gcTimer=null)}}class Bd{constructor({pagesScrollTop$:e,containerRect$:i,pages$:s,pagesSize$:r}){this.sideEffect=new gt,s=Ut(s,m=>m.map(g=>{if(g.thumbnail)return g;try{const f=new URL(g.src);return f.searchParams.set("x-oss-process","image/resize,l_50"),oe(j({},g),{thumbnail:f.toString()})}catch(f){return console.error(f),g}}));const a=Ut(s,m=>{const g=Array(m.length);for(let f=0;f<m.length;f++)g[f]=f>0?g[f-1]+m[f-1].height:0;return g}),n=Ut(s,m=>{let g=1/0;for(let f=m.length-1;f>=0;f--)m[f].height<=g&&(g=m[f].height);return g}),o=Pe([e,a,s],([m,g,f])=>{for(let b=0;b<g.length;b++)if(g[b]+f[b].height-m>=.001)return b;return g.length-1}),c=Pe([i,r],([m,g])=>m.width/g.width||1),l=Pe([s,i,n,c],([m,g,f,b])=>Xe(Math.ceil(g.height/b/f/2),1,m.length));gh(this,{pagesScrollTop:e,containerRect:i,pages:s,pagesSize:r,pagesIndex:o,pagesYs:a,pagesMinHeight:n,scale:c}),this.pageElManager=new jd(s,r,c,a,e),this.$pages=this.renderPages();const d=new Fe(!1);this.sideEffect.addDisposer(d.subscribe(m=>this.$pages.classList.toggle("is-hwa",m)));const u=()=>d.setValue(!1),p=()=>{this.sideEffect.setTimeout(u,1e3,"turn-off-hwa"),d.setValue(!0)};this.sideEffect.addDisposer(Pe([o,l,s]).subscribe(([m,g,f])=>{p();const b=Math.max(m-g,0),v=Math.min(m+g,f.length-1);for(let x=0;x<this.$pages.children.length;x++){const y=this.$pages.children[x],k=Number(y.dataset.index);k>=b&&k<=v||(y.remove(),x--)}for(let x=b;x<=v;x++){const y=this.pageElManager.getEl(x);y.$page.parentElement!==this.$pages&&this.$pages.appendChild(y.$page)}}))}renderPages(){const e=document.createElement("div");return e.className="page-renderer-pages-container",this.sideEffect.addDisposer(this._containerRect$.subscribe(i=>{e.style.width=`${i.width}px`,e.style.height=`${i.height}px`}),"render-pages-size"),e}destroy(){this.sideEffect.flushAll(),this.$pages.remove(),this.pageElManager.destroy()}}const Rd=30;class Od{constructor({pagesScrollTop$:e,containerRect$:i,stageRect$:s,pagesSize$:r,readonly$:a,scrollbarMinHeight:n=Rd,wrapClassName:o,onDragScroll:c}){this.sideEffect=new gt,this.scrolling$=new Fe(!1),this.pagesScrollTop$=e,this.containerRect$=i,this.stageRect$=s,this.pagesSize$=r,this.scrollbarMinHeight=n,this.readonly$=a,this.wrapClassName=o,this.onDragScroll=c,this.scrollbarHeight$=Pe([i,s,r],([l,d,u])=>Xe(d.height/(d.width/u.width*u.height)*l.height,n,l.height)),this.scrollTop$=Pe([i,s,r,this.scrollbarHeight$,this.pagesScrollTop$],([l,d,u,p,m])=>Xe(m/(u.height-u.width/d.width*d.height)*(l.height-p),0,l.height-p)),this.$scrollbar=this.renderScrollbar()}mount(e){e.appendChild(this.$scrollbar)}destroy(){this.$scrollbar.remove(),this.onDragScroll=void 0,this.sideEffect.flushAll()}renderScrollbar(){const e=document.createElement("button");e.className=this.wrapClassName("scrollbar"),e.style.minHeight=`${this.scrollbarMinHeight}px`,this.sideEffect.addDisposer([this.scrollbarHeight$.subscribe(s=>{e.style.height=`${s}px`}),this.scrollTop$.subscribe(s=>{this.scrolling$.setValue(!0),this.sideEffect.setTimeout(()=>this.scrolling$.setValue(!1),100,"reset-scrolling");const r=()=>e.style.transform=`translateY(${s}px)`;window.requestAnimationFrame?window.requestAnimationFrame(r):r()}),this.scrolling$.subscribe(s=>{e.classList.toggle(this.wrapClassName("scrolling"),s)})]);const i=s=>{if(!s.isPrimary||this.readonly$.value||s.button!=null&&s.button!==0)return;kn(s);const r=this.wrapClassName("scrollbar-dragging");e.classList.toggle(r,!0);const a=this.pagesScrollTop$.value,{clientY:n}=Xr(s),o=l=>{if(!l.isPrimary||this.readonly$.value)return;const{clientY:d}=Xr(l),u=d-n;Math.abs(u)>0&&this.onDragScroll&&this.onDragScroll(a+u/this.containerRect$.value.height*this.pagesSize$.value.height)},c=l=>{!l.isPrimary||(e.classList.toggle(r,!1),window.removeEventListener("pointermove",o,!0),window.removeEventListener("pointerup",c,!0),window.removeEventListener("pointercancel",c,!0))};window.addEventListener("pointermove",o,!0),window.addEventListener("pointerup",c,!0),window.addEventListener("pointercancel",c,!0)};return this.sideEffect.addEventListener(e,"pointerdown",i),e}}class Ud{constructor({whiteboard:e,readonly$:i,box:s,pages:r,pagesScrollTop:a=0,onUserScroll:n}){this.sideEffect=new gt,this.userScrolling=!1,this.whiteboard=e,this.readonly$=i,this.box=s,this.pages=r,this.onUserScroll=n;const o=()=>{var l;this.userScrolling=!1,(l=this.onUserScroll)==null||l.call(this,this.pagesScrollTop$.value)};this.debounceOnUserScroll=()=>{this.userScrolling=!0,this.sideEffect.setTimeout(o,80,"debounceOnUserScroll")};const c=new Fe(r);this.pagesScrollTop$=new Fe(a),this.pagesSize$=Ut(c,l=>{let d=0,u=0;for(let p=l.length-1;p>=0;p--){const m=l[p];m.width>d&&(d=m.width),u+=m.height}return{width:Math.max(1,d),height:Math.max(1,u)}},{compare:Tn}),this.pageRenderer=new Bd({pagesScrollTop$:this.pagesScrollTop$,containerRect$:s._stageRect$,pages$:c,pagesSize$:this.pagesSize$}),this.viewer=new An({readonly$:i,pagesIndex$:this.pageRenderer._pagesIndex$,box:s,pages:r,playable:!1}),this.sideEffect.addDisposer([this.viewer.events.on("next",()=>{this.userScrollByPercent(.8)}),this.viewer.events.on("back",()=>{this.userScrollByPercent(-.8)})]),this.scrollbar=new Od({pagesScrollTop$:this.pagesScrollTop$,containerRect$:s._bodyRect$,stageRect$:s._stageRect$,pagesSize$:this.pagesSize$,readonly$:i,wrapClassName:this.wrapClassName.bind(this),onDragScroll:l=>{this.pageScrollTo(l),this.debounceOnUserScroll()}}),this.pageScrollStepper=new Dd({start:this.pagesScrollTop$.value,onStep:l=>{this.pageScrollTo(l)}}),this.sideEffect.addDisposer(this.viewer.events.on("jumpPage",l=>this.userScrollToPageIndex(l))),this.render(),this.setupScrollListener(),this.sideEffect.setTimeout(()=>{this.userScrolling||this.pageScrollTo(this.pageRenderer.pagesScrollTop)},100)}get pagesScrollTop(){return this.pagesScrollTop$.value}destroy(){this.sideEffect.flushAll(),this.pageScrollStepper.destroy(),this.onUserScroll=void 0,this.viewer.destroy(),this.pageRenderer.destroy(),this.scrollbar.destroy()}syncPageScrollTop(e){!this.userScrolling&&e>=0&&Math.abs(this.pagesScrollTop$.value-e)>.01&&this.pageScrollStepper.stepTo(e,this.pagesScrollTop$.value)}render(){this.box.$content.style.overflow="hidden",this.box.mountStage(this.pageRenderer.$pages),this.scrollbar.mount(this.box.$body)}pageScrollTo(e){const i=this.whiteboard.view.size.height/2/this.pageRenderer.scale;this.whiteboard.view.moveCamera({centerY:Xe(e+i,i,this.pagesSize$.value.height-i),animationMode:"immediately"})}userScrollToPageIndex(e){var i;if(e=Xe(e,0,this.pages.length-1),!this.readonly$.value&&!Number.isNaN(e)){const s=this.pageRenderer.pagesYs[e];s>=0&&((i=this.onUserScroll)==null||i.call(this,s+5/this.pageRenderer.scale))}}userScrollByPercent(e){var i;this.readonly$.value||(i=this.onUserScroll)==null||i.call(this,Xe(this.pageRenderer.pagesScrollTop+this.pageRenderer.containerRect.height/this.pageRenderer.scale*Xe(e,-1,1),0,this.pageRenderer.pagesSize.height-this.pageRenderer.containerRect.height/this.pageRenderer.scale))}setupScrollListener(){this.sideEffect.addEventListener(this.box.$main,"wheel",e=>{kn(e),!this.readonly$.value&&this.pageScrollStepper.paused&&(this.pageScrollTo(this.pagesScrollTop+e.deltaY),this.debounceOnUserScroll())},{passive:!1}),this.sideEffect.addEventListener(this.box.$main,"touchmove",e=>{!this.readonly$.value&&e.touches.length>1&&this.debounceOnUserScroll()},{passive:!0,capture:!0}),this.sideEffect.add(()=>{const e=i=>{const{width:s,height:r}=this.whiteboard.view.size;if(s<=0||r<=0)return;const a=i.centerY-this.pageRenderer.containerRect.height/this.pageRenderer.scale/2;this.pagesScrollTop$.setValue(a)};return this.whiteboard.view.callbacks.on("onCameraUpdated",e),()=>this.whiteboard.view.callbacks.off("onCameraUpdated",e)}),this.sideEffect.addDisposer(this.box._stageRect$.subscribe(e=>{const{width:i,height:s}=this.pagesSize$.value;this.whiteboard.view.moveCameraToContain({originX:0,originY:this.pageRenderer.pagesScrollTop,width:i,height:e.height/this.pageRenderer.scale,animationMode:"immediately"}),this.whiteboard.view.setCameraBound({damping:1,maxContentMode:()=>this.pageRenderer.scale,minContentMode:()=>this.pageRenderer.scale,centerX:i/2,centerY:s/2,width:i,height:s})}),"whiteboard-size-update"),this.sideEffect.addEventListener(window,"keyup",e=>{if(!(this.readonly$.value||!this.box.focus||this.box.minimized))switch(e.key){case"PageDown":{this.userScrollByPercent(.8);break}case"PageUp":{this.userScrollByPercent(-.8);break}case"ArrowLeft":{this.userScrollByPercent(-.25);break}case"ArrowRight":{this.userScrollByPercent(.25);break}case"ArrowDown":{this.userScrollByPercent(.5);break}case"ArrowUp":{this.userScrollByPercent(-.5);break}}},{capture:!0})}wrapClassName(e){return"netless-app-docs-viewer-static-"+e}}class Wd{constructor({readonly$:e,context:i,whiteboard:s,box:r,pages:a}){this.sideEffect=new gt,this.context=i,this.whiteboard=s,this.box=r,this.pages=a;const n=new Fe(i.displayer.state.sceneState.index||0);this.pagesIndex$=n,this.sideEffect.add(()=>{const o=c=>{this.jumpToPage(c.index)};return this.context.emitter.on("sceneStateChange",o),()=>this.context.emitter.off("sceneStateChange",o)}),this.viewer=new An({readonly$:e,pagesIndex$:n,box:r,pages:a,playable:!0}),this.sideEffect.addDisposer([this.viewer.events.on("jumpPage",o=>this.jumpToPage(o,!0)),this.viewer.events.on("play",()=>{var o;return(o=this.context.room)==null?void 0:o.pptNextStep()}),this.viewer.events.on("back",()=>this.prevPage()),this.viewer.events.on("next",()=>this.nextPage())]),this.render(),this.sideEffect.addDisposer(n.subscribe((o,c)=>{var l,d;if(e.value)return;const u=this.context.getInitScenePath(),p=(d=(l=this.context.getScenes())==null?void 0:l[o])==null?void 0:d.name;if(u&&p&&this.context.setScenePath(`${u}/${p}`),c){const m=this.context.room;if(m){const g=m.state.globalState.__pptState;m.setGlobalState({__pptState:g&&{uuid:g.uuid,pageIndex:o,disableAutoPlay:g.disableAutoPlay}})}}}))}destroy(){this.sideEffect.flushAll(),this.viewer.destroy()}nextPage(){this.jumpToPage(this.pagesIndex$.value+1,!0)}prevPage(){this.jumpToPage(this.pagesIndex$.value-1,!0)}jumpToPage(e,i=!1){this.pagesIndex$.setValue(Xe(e,0,this.pages.length-1),i)}render(){var e;this.box.mountStage(document.createElement("div")),this.sideEffect.addEventListener(window,"keydown",s=>{var r;if(this.box.focus)switch(s.key){case"ArrowUp":case"ArrowLeft":{this.prevPage();break}case"ArrowRight":case"ArrowDown":{(r=this.context.room)==null||r.pptNextStep();break}}});const i=(e=this.whiteboard.view.divElement)==null?void 0:e.parentElement;i&&this.sideEffect.addEventListener(i,"click",s=>{var r;const a=this.context.room;if(a&&a.state.memberState.currentApplianceName==="clicker"){for(let n=s.target;n;n=n.parentElement)if((r=n.classList)!=null&&r.contains("ppt-event-source"))return;a.pptNextStep()}})}wrapClassName(e){return"netless-app-docs-viewer-dynamic-"+e}}const Hd="DocsViewer",_i={kind:Hd,setup(t){const e=t.box,i=t.getScenes();if(!i)throw new Error("[Docs Viewer]: scenes not found.");const s=new gt,r=i.map(({ppt:n})=>n?{width:n.width,height:n.height,src:n.src,thumbnail:n.previewURL}:null).filter(n=>Boolean(n));if(r.length<=0)throw new Error("[Docs Viewer]: empty scenes.");e.mountStyles(th);const a=new Fe(!t.isWritable);s.addDisposer(t.emitter.on("writableChange",n=>{a.setValue(!n)})),r[0].src.startsWith("ppt")?Zd(s,t,e,r,a):Fd(s,t,e,r,a),s.addDisposer(t.emitter.on("destroy",()=>{s.flushAll()}))}};function Fd(t,e,i,s,r){const a=e.createWhiteBoardView({syncCamera:!1});t.addDisposer(r.subscribe(l=>{a.view.disableCameraTransform=l}));const n=e.createStorage("static-docs-viewer",{pagesScrollTop:0}),o=new Ud({whiteboard:a,readonly$:r,box:i,pages:s,pagesScrollTop:n.state.pagesScrollTop,onUserScroll:l=>{e.isWritable&&n.setState({pagesScrollTop:l})}});t.addDisposer(()=>o.destroy()),t.addDisposer(n.addStateChangedListener(l=>{l.pagesScrollTop&&o.syncPageScrollTop(l.pagesScrollTop.newValue||0)}));let c=1;if(s.length>0){const{width:l,height:d}=s[0];d<=l?c=d/l:c=1/2*d/l}t.addDisposer(Pe([i._maximized$,i._managerStageRect$,i._intrinsicSize$],([l,d,u])=>l?c:u.height*(d.height/d.width)/u.width).subscribe(l=>{i.setStageRatio(l)}))}function Zd(t,e,i,s,r){const a=e.createWhiteBoardView();a.view.disableCameraTransform=!0;const n=new Wd({context:e,whiteboard:a,box:i,pages:s,readonly$:r});t.addDisposer(()=>n.destroy());const o=new Fe({width:s[0].width,height:s[0].height},{compare:Tn});if(t.addDisposer(n.pagesIndex$.subscribe(c=>{const l=s[c];l&&o.setValue({width:l.width,height:l.height})})),t.addDisposer(o.subscribe(c=>{r.value||a.setBaseRect(c)})),e.isAddApp){const c=t.add(()=>{const l=({width:d,height:u})=>{if(s.length>0&&i.state!=="maximized"){const{width:p,height:m}=s[0],f=m/p*d-u;f!==0&&e.isWritable&&e.emitter.emit("setBoxSize",{width:i.intrinsicWidth,height:i.intrinsicHeight+f/i.rootRect.height})}t.remove(c)};return a.view.callbacks.once("onSizeUpdated",l),()=>a.view.callbacks.off("onSizeUpdated",l)})}}function st(){}function Nn(t){return t()}function Kr(){return Object.create(null)}function Ri(t){t.forEach(Nn)}function Yd(t){return typeof t=="function"}function En(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let di;function Pn(t,e){return di||(di=document.createElement("a")),di.href=e,t===di.href}function Qd(t){return Object.keys(t).length===0}function V(t,e){t.appendChild(e)}function At(t,e,i){t.insertBefore(e,i||null)}function ft(t){t.parentNode.removeChild(t)}function Ct(t){return document.createElement(t)}function B(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Is(t){return document.createTextNode(t)}function Gd(){return Is(" ")}function I(t,e,i){i==null?t.removeAttribute(e):t.getAttribute(e)!==i&&t.setAttribute(e,i)}function qd(t){return Array.from(t.childNodes)}function Jd(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}let qt;function Wt(t){qt=t}function zn(){if(!qt)throw new Error("Function called outside component initialization");return qt}function Xd(t){zn().$$.on_mount.push(t)}function Kd(t){zn().$$.on_destroy.push(t)}const Lt=[],Ht=[],bi=[],ea=[],eu=Promise.resolve();let _s=!1;function tu(){_s||(_s=!0,eu.then(Dn))}function As(t){bi.push(t)}const os=new Set;let ui=0;function Dn(){const t=qt;do{for(;ui<Lt.length;){const e=Lt[ui];ui++,Wt(e),iu(e.$$)}for(Wt(null),Lt.length=0,ui=0;Ht.length;)Ht.pop()();for(let e=0;e<bi.length;e+=1){const i=bi[e];os.has(i)||(os.add(i),i())}bi.length=0}while(Lt.length);for(;ea.length;)ea.pop()();_s=!1,os.clear(),Wt(t)}function iu(t){if(t.fragment!==null){t.update(),Ri(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(As)}}const yi=new Set;let su;function Ln(t,e){t&&t.i&&(yi.delete(t),t.i(e))}function ru(t,e,i,s){if(t&&t.o){if(yi.has(t))return;yi.add(t),su.c.push(()=>{yi.delete(t),s&&(i&&t.d(1),s())}),t.o(e)}}function au(t){t&&t.c()}function Vn(t,e,i,s){const{fragment:r,on_mount:a,on_destroy:n,after_update:o}=t.$$;r&&r.m(e,i),s||As(()=>{const c=a.map(Nn).filter(Yd);n?n.push(...c):Ri(c),t.$$.on_mount=[]}),o.forEach(As)}function $n(t,e){const i=t.$$;i.fragment!==null&&(Ri(i.on_destroy),i.fragment&&i.fragment.d(e),i.on_destroy=i.fragment=null,i.ctx=[])}function nu(t,e){t.$$.dirty[0]===-1&&(Lt.push(t),tu(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function jn(t,e,i,s,r,a,n,o=[-1]){const c=qt;Wt(t);const l=t.$$={fragment:null,ctx:null,props:a,update:st,not_equal:r,bound:Kr(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:Kr(),dirty:o,skip_bound:!1,root:e.target||c.$$.root};n&&n(l.root);let d=!1;if(l.ctx=i?i(t,e.props||{},(u,p,...m)=>{const g=m.length?m[0]:p;return l.ctx&&r(l.ctx[u],l.ctx[u]=g)&&(!l.skip_bound&&l.bound[u]&&l.bound[u](g),d&&nu(t,u)),p}):[],l.update(),d=!0,Ri(l.before_update),l.fragment=s?s(l.ctx):!1,e.target){if(e.hydrate){const u=qd(e.target);l.fragment&&l.fragment.l(u),u.forEach(ft)}else l.fragment&&l.fragment.c();e.intro&&Ln(t.$$.fragment),Vn(t,e.target,e.anchor,e.customElement),Dn()}Wt(c)}class Bn{$destroy(){$n(this,1),this.$destroy=st}$on(e,i){const s=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return s.push(i),()=>{const r=s.indexOf(i);r!==-1&&s.splice(r,1)}}$set(e){this.$$set&&!Qd(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const ou={"3g2":"video/3gpp2","3gp":"video/3gpp","3gpp":"audio/3gpp",aac:"audio/x-aac",adp:"audio/adpcm",aif:"audio/x-aiff",aifc:"audio/x-aiff",aiff:"audio/x-aiff",amr:"audio/amr",asf:"video/x-ms-asf",asx:"video/x-ms-asf",au:"audio/basic",avi:"video/x-msvideo",caf:"audio/x-caf",dra:"audio/vnd.dra",dts:"audio/vnd.dts",dtshd:"audio/vnd.dts.hd",dvb:"video/vnd.dvb.file",eol:"audio/vnd.digital-winds",f4v:"video/x-f4v",flac:"audio/x-flac",fli:"video/x-fli",flv:"video/x-flv",fvt:"video/vnd.fvt",h261:"video/h261",h263:"video/h263",h264:"video/h264",jpgm:"video/jpm",jpgv:"video/jpeg",kar:"audio/midi",lvp:"audio/vnd.lucent.voice",m1v:"video/mpeg",m2a:"audio/mpeg",m2v:"video/mpeg",m3a:"audio/mpeg",m3u:"audio/x-mpegurl",m4a:"audio/mp4",m4s:"video/iso.segment",m4u:"video/vnd.mpegurl",m4v:"video/x-m4v",mid:"audio/midi",midi:"audio/midi",mj2:"video/mj2",mjp2:"video/mj2",mk3d:"video/x-matroska",mka:"audio/x-matroska",mks:"video/x-matroska",mkv:"video/x-matroska",mng:"video/x-mng",mov:"video/quicktime",movie:"video/x-sgi-movie",mp2:"audio/mpeg",mp2a:"audio/mpeg",mp3:"audio/mp3",mp4:"video/mp4",mp4a:"audio/mp4",mp4v:"video/mp4",mpe:"video/mpeg",mpeg:"video/mpeg",mpg:"video/mpeg",mpg4:"video/mp4",mpga:"audio/mpeg",mxmf:"audio/mobile-xmf",mxu:"video/vnd.mpegurl",oga:"audio/ogg",ogg:"audio/ogg",ogv:"video/ogg",opus:"audio/ogg",pya:"audio/vnd.ms-playready.media.pya",pyv:"video/vnd.ms-playready.media.pyv",qt:"video/quicktime",ra:"audio/x-pn-realaudio",ram:"audio/x-pn-realaudio",rip:"audio/vnd.rip",rmi:"audio/midi",rmp:"audio/x-pn-realaudio-plugin",s3m:"audio/s3m",sil:"audio/silk",smv:"video/x-smv",snd:"audio/basic",spx:"audio/ogg",ts:"video/mp2t",uva:"audio/vnd.dece.audio",uvh:"video/vnd.dece.hd",uvm:"video/vnd.dece.mobile",uvp:"video/vnd.dece.pd",uvs:"video/vnd.dece.sd",uvu:"video/vnd.uvvu.mp4",uvv:"video/vnd.dece.video",uvva:"audio/vnd.dece.audio",uvvh:"video/vnd.dece.hd",uvvm:"video/vnd.dece.mobile",uvvp:"video/vnd.dece.pd",uvvs:"video/vnd.dece.sd",uvvu:"video/vnd.uvvu.mp4",uvvv:"video/vnd.dece.video",viv:"video/vnd.vivo",vob:"video/x-ms-vob",wav:"audio/wav",wax:"audio/x-ms-wax",weba:"audio/webm",webm:"video/webm",wm:"video/x-ms-wm",wma:"audio/x-ms-wma",wmv:"video/x-ms-wmv",wmx:"video/x-ms-wmx",wvx:"video/x-ms-wvx",xm:"audio/xm",m3u8:"application/vnd.apple.mpegurl"},lu=["application/x-mpegurl","application/vnd.apple.mpegurl"];function cu(t){if(!t)return;const e=t.lastIndexOf(".");if(!~e)return;const i=t.slice(e+1);return ou[i]}async function hu(t){try{return await t.play(),!0}catch(e){return t.muted=!0,await t.play(),console.debug(e),!1}}function du(t){const e=document.createElement("script");return new Promise((i,s)=>{e.onload=()=>i(),e.onerror=s,e.src=t,document.head.appendChild(e)})}async function uu(){const t={loadSource(i){},attachMedia(i){}};let e=window.Hls;if(e===null||e===!1)return t;if(e===void 0&&(await du("https://cdn.jsdelivr.net/npm/hls.js"),e=window.Hls),typeof e=="function")try{return new e}catch(i){return console.debug(i),t}else return t}function pu(t){return"canPlayType"in t&&!t.canPlayType("application/vnd.apple.mpegurl")}function gu(t,e,i){return t<e?e:t>i?i:t}function mu(t){return Array.isArray(t)?t[0]:t}function fu(t){let e,i,s,r,a,n,o,c,l,d,u,p,m,g,f,b,v,x,y,k,z,T,O,te,G,xe,Re,me,Ie,fe,_e,be,ye,Me,Ae,Se,ot,Oe;return{c(){e=B("svg"),i=B("symbol"),s=B("path"),r=B("path"),a=B("symbol"),n=B("path"),o=B("symbol"),c=B("path"),l=B("symbol"),d=B("path"),u=B("symbol"),p=B("path"),m=B("symbol"),g=B("path"),f=B("symbol"),b=B("path"),v=B("symbol"),x=B("path"),y=B("symbol"),k=B("path"),z=B("symbol"),T=B("path"),O=B("symbol"),te=B("path"),G=B("symbol"),xe=B("path"),Re=B("path"),me=B("symbol"),Ie=B("path"),fe=B("symbol"),_e=B("path"),be=B("symbol"),ye=B("path"),Me=B("symbol"),Ae=B("path"),Se=B("symbol"),ot=B("path"),Oe=B("path"),I(s,"d","M16 1H2a1 1 0 00-1 1v10a1 1 0 001 1h3v-2H3V3h12v8h-2v2h3a1 1 0 001-1V2a1 1 0 00-1-1z"),I(r,"d","M4 17h10l-5-6z"),I(i,"id","plyr-airplay"),I(i,"viewBox","0 0 18 18"),I(n,"d","M1 1c-.6 0-1 .4-1 1v11c0 .6.4 1 1 1h4.6l2.7 2.7c.2.2.4.3.7.3.3 0 .5-.1.7-.3l2.7-2.7H17c.6 0 1-.4 1-1V2c0-.6-.4-1-1-1H1zm4.52 10.15c1.99 0 3.01-1.32 3.28-2.41l-1.29-.39c-.19.66-.78 1.45-1.99 1.45-1.14 0-2.2-.83-2.2-2.34 0-1.61 1.12-2.37 2.18-2.37 1.23 0 1.78.75 1.95 1.43l1.3-.41C8.47 4.96 7.46 3.76 5.5 3.76c-1.9 0-3.61 1.44-3.61 3.7 0 2.26 1.65 3.69 3.63 3.69zm7.57 0c1.99 0 3.01-1.32 3.28-2.41l-1.29-.39c-.19.66-.78 1.45-1.99 1.45-1.14 0-2.2-.83-2.2-2.34 0-1.61 1.12-2.37 2.18-2.37 1.23 0 1.78.75 1.95 1.43l1.3-.41c-.28-1.15-1.29-2.35-3.25-2.35-1.9 0-3.61 1.44-3.61 3.7 0 2.26 1.65 3.69 3.63 3.69z"),I(n,"fill-rule","evenodd"),I(n,"fill-opacity",".5"),I(a,"id","plyr-captions-off"),I(a,"viewBox","0 0 18 18"),I(c,"d","M1 1c-.6 0-1 .4-1 1v11c0 .6.4 1 1 1h4.6l2.7 2.7c.2.2.4.3.7.3.3 0 .5-.1.7-.3l2.7-2.7H17c.6 0 1-.4 1-1V2c0-.6-.4-1-1-1H1zm4.52 10.15c1.99 0 3.01-1.32 3.28-2.41l-1.29-.39c-.19.66-.78 1.45-1.99 1.45-1.14 0-2.2-.83-2.2-2.34 0-1.61 1.12-2.37 2.18-2.37 1.23 0 1.78.75 1.95 1.43l1.3-.41C8.47 4.96 7.46 3.76 5.5 3.76c-1.9 0-3.61 1.44-3.61 3.7 0 2.26 1.65 3.69 3.63 3.69zm7.57 0c1.99 0 3.01-1.32 3.28-2.41l-1.29-.39c-.19.66-.78 1.45-1.99 1.45-1.14 0-2.2-.83-2.2-2.34 0-1.61 1.12-2.37 2.18-2.37 1.23 0 1.78.75 1.95 1.43l1.3-.41c-.28-1.15-1.29-2.35-3.25-2.35-1.9 0-3.61 1.44-3.61 3.7 0 2.26 1.65 3.69 3.63 3.69z"),I(c,"fill-rule","evenodd"),I(o,"id","plyr-captions-on"),I(o,"viewBox","0 0 18 18"),I(d,"d","M9 13c.3 0 .5-.1.7-.3L15.4 7 14 5.6l-4 4V1H8v8.6l-4-4L2.6 7l5.7 5.7c.2.2.4.3.7.3zm-7 2h14v2H2z"),I(l,"id","plyr-download"),I(l,"viewBox","0 0 18 18"),I(p,"d","M10 3h3.6l-4 4L11 8.4l4-4V8h2V1h-7zM7 9.6l-4 4V10H1v7h7v-2H4.4l4-4z"),I(u,"id","plyr-enter-fullscreen"),I(u,"viewBox","0 0 18 18"),I(g,"d","M1 12h3.6l-4 4L2 17.4l4-4V17h2v-7H1zM16 .6l-4 4V1h-2v7h7V6h-3.6l4-4z"),I(m,"id","plyr-exit-fullscreen"),I(m,"viewBox","0 0 18 18"),I(b,"d","M7.875 7.171L0 1v16l7.875-6.171V17L18 9 7.875 1z"),I(f,"id","plyr-fast-forward"),I(f,"viewBox","0 0 18 18"),I(x,"d","M17 5.3c-.1 1.6-1.2 3.7-3.3 6.4-2.2 2.8-4 4.2-5.5 4.2-.9 0-1.7-.9-2.4-2.6C5 10.9 4.4 6 3 6c-.1 0-.5.3-1.2.8l-.8-1c.8-.7 3.5-3.4 4.7-3.5 1.2-.1 2 .7 2.3 2.5.3 2 .8 6.1 1.8 6.1.9 0 2.5-3.4 2.6-4 .1-.9-.3-1.9-2.3-1.1.8-2.6 2.3-3.8 4.5-3.8 1.7.1 2.5 1.2 2.4 3.3z"),I(v,"id","plyr-logo-vimeo"),I(v,"viewBox","0 0 18 18"),I(k,"d","M16.8 5.8c-.2-1.3-.8-2.2-2.2-2.4C12.4 3 9 3 9 3s-3.4 0-5.6.4C2 3.6 1.3 4.5 1.2 5.8 1 7.1 1 9 1 9s0 1.9.2 3.2c.2 1.3.8 2.2 2.2 2.4C5.6 15 9 15 9 15s3.4 0 5.6-.4c1.4-.3 2-1.1 2.2-2.4.2-1.3.2-3.2.2-3.2s0-1.9-.2-3.2zM7 12V6l5 3-5 3z"),I(y,"id","plyr-logo-youtube"),I(y,"viewBox","0 0 18 18"),I(T,"d","M12.4 12.5l2.1-2.1 2.1 2.1 1.4-1.4L15.9 9 18 6.9l-1.4-1.4-2.1 2.1-2.1-2.1L11 6.9 13.1 9 11 11.1zM3.786 6.008H.714C.286 6.008 0 6.31 0 6.76v4.512c0 .452.286.752.714.752h3.072l4.071 3.858c.5.3 1.143 0 1.143-.602V2.752c0-.601-.643-.977-1.143-.601L3.786 6.008z"),I(z,"id","plyr-muted"),I(z,"viewBox","0 0 18 18"),I(te,"d","M6 1H3c-.6 0-1 .4-1 1v14c0 .6.4 1 1 1h3c.6 0 1-.4 1-1V2c0-.6-.4-1-1-1zm6 0c-.6 0-1 .4-1 1v14c0 .6.4 1 1 1h3c.6 0 1-.4 1-1V2c0-.6-.4-1-1-1h-3z"),I(O,"id","plyr-pause"),I(O,"viewBox","0 0 18 18"),I(xe,"d","M13.293 3.293L7.022 9.564l1.414 1.414 6.271-6.271L17 7V1h-6z"),I(Re,"d","M13 15H3V5h5V3H2a1 1 0 00-1 1v12a1 1 0 001 1h12a1 1 0 001-1v-6h-2v5z"),I(G,"id","plyr-pip"),I(G,"viewBox","0 0 18 18"),I(Ie,"d","M15.562 8.1L3.87.225c-.818-.562-1.87 0-1.87.9v15.75c0 .9 1.052 1.462 1.87.9L15.563 9.9c.584-.45.584-1.35 0-1.8z"),I(me,"id","plyr-play"),I(me,"viewBox","0 0 18 18"),I(_e,"d","M9.7 1.2l.7 6.4 2.1-2.1c1.9 1.9 1.9 5.1 0 7-.9 1-2.2 1.5-3.5 1.5-1.3 0-2.6-.5-3.5-1.5-1.9-1.9-1.9-5.1 0-7 .6-.6 1.4-1.1 2.3-1.3l-.6-1.9C6 2.6 4.9 3.2 4 4.1 1.3 6.8 1.3 11.2 4 14c1.3 1.3 3.1 2 4.9 2 1.9 0 3.6-.7 4.9-2 2.7-2.7 2.7-7.1 0-9.9L16 1.9l-6.3-.7z"),I(fe,"id","plyr-restart"),I(fe,"viewBox","0 0 18 18"),I(ye,"d","M10.125 1L0 9l10.125 8v-6.171L18 17V1l-7.875 6.171z"),I(be,"id","plyr-rewind"),I(be,"viewBox","0 0 18 18"),I(Ae,"d","M16.135 7.784a2 2 0 01-1.23-2.969c.322-.536.225-.998-.094-1.316l-.31-.31c-.318-.318-.78-.415-1.316-.094a2 2 0 01-2.969-1.23C10.065 1.258 9.669 1 9.219 1h-.438c-.45 0-.845.258-.997.865a2 2 0 01-2.969 1.23c-.536-.322-.999-.225-1.317.093l-.31.31c-.318.318-.415.781-.093 1.317a2 2 0 01-1.23 2.969C1.26 7.935 1 8.33 1 8.781v.438c0 .45.258.845.865.997a2 2 0 011.23 2.969c-.322.536-.225.998.094 1.316l.31.31c.319.319.782.415 1.316.094a2 2 0 012.969 1.23c.151.607.547.865.997.865h.438c.45 0 .845-.258.997-.865a2 2 0 012.969-1.23c.535.321.997.225 1.316-.094l.31-.31c.318-.318.415-.781.094-1.316a2 2 0 011.23-2.969c.607-.151.865-.547.865-.997v-.438c0-.451-.26-.846-.865-.997zM9 12a3 3 0 110-6 3 3 0 010 6z"),I(Me,"id","plyr-settings"),I(Me,"viewBox","0 0 18 18"),I(ot,"d","M15.6 3.3c-.4-.4-1-.4-1.4 0-.4.4-.4 1 0 1.4C15.4 5.9 16 7.4 16 9c0 1.6-.6 3.1-1.8 4.3-.4.4-.4 1 0 1.4.2.2.5.3.7.3.3 0 .5-.1.7-.3C17.1 13.2 18 11.2 18 9s-.9-4.2-2.4-5.7z"),I(Oe,"d","M11.282 5.282a.909.909 0 000 1.316c.735.735.995 1.458.995 2.402 0 .936-.425 1.917-.995 2.487a.909.909 0 000 1.316c.145.145.636.262 1.018.156a.725.725 0 00.298-.156C13.773 11.733 14.13 10.16 14.13 9c0-.17-.002-.34-.011-.51-.053-.992-.319-2.005-1.522-3.208a.909.909 0 00-1.316 0zm-7.496.726H.714C.286 6.008 0 6.31 0 6.76v4.512c0 .452.286.752.714.752h3.072l4.071 3.858c.5.3 1.143 0 1.143-.602V2.752c0-.601-.643-.977-1.143-.601L3.786 6.008z"),I(Se,"id","plyr-volume"),I(Se,"viewBox","0 0 18 18"),I(e,"xmlns","http://www.w3.org/2000/svg"),I(e,"xmlns:xlink","http://www.w3.org/1999/xlink")},m(Qe,bt){At(Qe,e,bt),V(e,i),V(i,s),V(i,r),V(e,a),V(a,n),V(e,o),V(o,c),V(e,l),V(l,d),V(e,u),V(u,p),V(e,m),V(m,g),V(e,f),V(f,b),V(e,v),V(v,x),V(e,y),V(y,k),V(e,z),V(z,T),V(e,O),V(O,te),V(e,G),V(G,xe),V(G,Re),V(e,me),V(me,Ie),V(e,fe),V(fe,_e),V(e,be),V(be,ye),V(e,Me),V(Me,Ae),V(e,Se),V(Se,ot),V(Se,Oe)},p:st,i:st,o:st,d(Qe){Qe&&ft(e)}}}class bu extends Bn{constructor(e){super();jn(this,e,null,fu,En,{})}}function _(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function yu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ta(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}function wu(t,e,i){return e&&ta(t.prototype,e),i&&ta(t,i),t}function vu(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function ia(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,s)}return i}function sa(t){for(var e=1;e<arguments.length;e++){var i=arguments[e]!=null?arguments[e]:{};e%2?ia(Object(i),!0).forEach(function(s){vu(t,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ia(Object(i)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(i,s))})}return t}var ra={addCSS:!0,thumbWidth:15,watch:!0};function xu(t,e){return function(){return Array.from(document.querySelectorAll(e)).includes(this)}.call(t,e)}function Mu(t,e){if(t&&e){var i=new Event(e,{bubbles:!0});t.dispatchEvent(i)}}var si=function(t){return t!=null?t.constructor:null},lr=function(t,e){return!!(t&&e&&t instanceof e)},Rn=function(t){return t==null},On=function(t){return si(t)===Object},Su=function(t){return si(t)===Number&&!Number.isNaN(t)},Un=function(t){return si(t)===String},Cu=function(t){return si(t)===Boolean},Iu=function(t){return si(t)===Function},Wn=function(t){return Array.isArray(t)},Hn=function(t){return lr(t,NodeList)},_u=function(t){return lr(t,Element)},Au=function(t){return lr(t,Event)},ku=function(t){return Rn(t)||(Un(t)||Wn(t)||Hn(t))&&!t.length||On(t)&&!Object.keys(t).length},ae={nullOrUndefined:Rn,object:On,number:Su,string:Un,boolean:Cu,function:Iu,array:Wn,nodeList:Hn,element:_u,event:Au,empty:ku};function Tu(t){var e="".concat(t).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return e?Math.max(0,(e[1]?e[1].length:0)-(e[2]?+e[2]:0)):0}function Nu(t,e){if(1>e){var i=Tu(e);return parseFloat(t.toFixed(i))}return Math.round(t/e)*e}var Eu=function(){function t(e,i){yu(this,t),ae.element(e)?this.element=e:ae.string(e)&&(this.element=document.querySelector(e)),ae.element(this.element)&&ae.empty(this.element.rangeTouch)&&(this.config=sa({},ra,{},i),this.init())}return wu(t,[{key:"init",value:function(){t.enabled&&(this.config.addCSS&&(this.element.style.userSelect="none",this.element.style.webKitUserSelect="none",this.element.style.touchAction="manipulation"),this.listeners(!0),this.element.rangeTouch=this)}},{key:"destroy",value:function(){t.enabled&&(this.config.addCSS&&(this.element.style.userSelect="",this.element.style.webKitUserSelect="",this.element.style.touchAction=""),this.listeners(!1),this.element.rangeTouch=null)}},{key:"listeners",value:function(e){var i=this,s=e?"addEventListener":"removeEventListener";["touchstart","touchmove","touchend"].forEach(function(r){i.element[s](r,function(a){return i.set(a)},!1)})}},{key:"get",value:function(e){if(!t.enabled||!ae.event(e))return null;var i,s=e.target,r=e.changedTouches[0],a=parseFloat(s.getAttribute("min"))||0,n=parseFloat(s.getAttribute("max"))||100,o=parseFloat(s.getAttribute("step"))||1,c=s.getBoundingClientRect(),l=100/c.width*(this.config.thumbWidth/2)/100;return 0>(i=100/c.width*(r.clientX-c.left))?i=0:100<i&&(i=100),50>i?i-=(100-2*i)*l:50<i&&(i+=2*(i-50)*l),a+Nu(i/100*(n-a),o)}},{key:"set",value:function(e){t.enabled&&ae.event(e)&&!e.target.disabled&&(e.preventDefault(),e.target.value=this.get(e),Mu(e.target,e.type==="touchend"?"change":"input"))}}],[{key:"setup",value:function(e){var i=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},s=null;if(ae.empty(e)||ae.string(e)?s=Array.from(document.querySelectorAll(ae.string(e)?e:'input[type="range"]')):ae.element(e)?s=[e]:ae.nodeList(e)?s=Array.from(e):ae.array(e)&&(s=e.filter(ae.element)),ae.empty(s))return null;var r=sa({},ra,{},i);if(ae.string(e)&&r.watch){var a=new MutationObserver(function(n){Array.from(n).forEach(function(o){Array.from(o.addedNodes).forEach(function(c){ae.element(c)&&xu(c,e)&&new t(c,r)})})});a.observe(document.body,{childList:!0,subtree:!0})}return s.map(function(n){return new t(n,i)})}},{key:"enabled",get:function(){return"ontouchstart"in document.documentElement}}]),t}();const kt=t=>t!=null?t.constructor:null,Ye=(t,e)=>Boolean(t&&e&&t instanceof e),cr=t=>t==null,Fn=t=>kt(t)===Object,Pu=t=>kt(t)===Number&&!Number.isNaN(t),Oi=t=>kt(t)===String,zu=t=>kt(t)===Boolean,Zn=t=>kt(t)===Function,Yn=t=>Array.isArray(t),Du=t=>Ye(t,WeakMap),Qn=t=>Ye(t,NodeList),Lu=t=>kt(t)===Text,Vu=t=>Ye(t,Event),$u=t=>Ye(t,KeyboardEvent),ju=t=>Ye(t,window.TextTrackCue)||Ye(t,window.VTTCue),Bu=t=>Ye(t,TextTrack)||!cr(t)&&Oi(t.kind),Ru=t=>Ye(t,Promise)&&Zn(t.then),Ou=t=>t!==null&&typeof t=="object"&&t.nodeType===1&&typeof t.style=="object"&&typeof t.ownerDocument=="object",Gn=t=>cr(t)||(Oi(t)||Yn(t)||Qn(t))&&!t.length||Fn(t)&&!Object.keys(t).length,Uu=t=>{if(Ye(t,window.URL))return!0;if(!Oi(t))return!1;let e=t;t.startsWith("http://")&&t.startsWith("https://")||(e=`http://${t}`);try{return!Gn(new URL(e).hostname)}catch{return!1}};var h={nullOrUndefined:cr,object:Fn,number:Pu,string:Oi,boolean:zu,function:Zn,array:Yn,weakMap:Du,nodeList:Qn,element:Ou,textNode:Lu,event:Vu,keyboardEvent:$u,cue:ju,track:Bu,promise:Ru,url:Uu,empty:Gn};const ks=(()=>{const t=document.createElement("span"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},i=Object.keys(e).find(s=>t.style[s]!==void 0);return!!h.string(i)&&e[i]})();function qn(t,e){setTimeout(()=>{try{t.hidden=!0,t.offsetHeight,t.hidden=!1}catch{}},e)}const re={isIE:Boolean(window.document.documentMode),isEdge:window.navigator.userAgent.includes("Edge"),isWebkit:"WebkitAppearance"in document.documentElement.style&&!/Edge/.test(navigator.userAgent),isIPhone:/(iPhone|iPod)/gi.test(navigator.platform),isIos:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1||/(iPad|iPhone|iPod)/gi.test(navigator.platform)};function Wu(t){return JSON.parse(JSON.stringify(t))}function Jn(t,e){return e.split(".").reduce((i,s)=>i&&i[s],t)}function J(t={},...e){if(!e.length)return t;const i=e.shift();return h.object(i)?(Object.keys(i).forEach(s=>{h.object(i[s])?(Object.keys(t).includes(s)||Object.assign(t,{[s]:{}}),J(t[s],i[s])):Object.assign(t,{[s]:i[s]})}),J(t,...e)):t}function Xn(t,e){const i=t.length?t:[t];Array.from(i).reverse().forEach((s,r)=>{const a=r>0?e.cloneNode(!0):e,n=s.parentNode,o=s.nextSibling;a.appendChild(s),o?n.insertBefore(a,o):n.appendChild(a)})}function Ts(t,e){h.element(t)&&!h.empty(e)&&Object.entries(e).filter(([,i])=>!h.nullOrUndefined(i)).forEach(([i,s])=>t.setAttribute(i,s))}function N(t,e,i){const s=document.createElement(t);return h.object(e)&&Ts(s,e),h.string(i)&&(s.innerText=i),s}function Hu(t,e){h.element(t)&&h.element(e)&&e.parentNode.insertBefore(t,e.nextSibling)}function aa(t,e,i,s){h.element(e)&&e.appendChild(N(t,i,s))}function He(t){h.nodeList(t)||h.array(t)?Array.from(t).forEach(He):h.element(t)&&h.element(t.parentNode)&&t.parentNode.removeChild(t)}function wi(t){if(!h.element(t))return;let{length:e}=t.childNodes;for(;e>0;)t.removeChild(t.lastChild),e-=1}function Ai(t,e){return h.element(e)&&h.element(e.parentNode)&&h.element(t)?(e.parentNode.replaceChild(t,e),t):null}function Le(t,e){if(!h.string(t)||h.empty(t))return{};const i={},s=J({},e);return t.split(",").forEach(r=>{const a=r.trim(),n=a.replace(".",""),o=a.replace(/[[\]]/g,"").split("="),[c]=o,l=o.length>1?o[1].replace(/["']/g,""):"";switch(a.charAt(0)){case".":h.string(s.class)?i.class=`${s.class} ${n}`:i.class=n;break;case"#":i.id=a.replace("#","");break;case"[":i[c]=l}}),J(s,i)}function ct(t,e){if(!h.element(t))return;let i=e;h.boolean(i)||(i=!t.hidden),t.hidden=i}function W(t,e,i){if(h.nodeList(t))return Array.from(t).map(s=>W(s,e,i));if(h.element(t)){let s="toggle";return i!==void 0&&(s=i?"add":"remove"),t.classList[s](e),t.classList.contains(e)}return!1}function ki(t,e){return h.element(t)&&t.classList.contains(e)}function ht(t,e){const{prototype:i}=Element;return(i.matches||i.webkitMatchesSelector||i.mozMatchesSelector||i.msMatchesSelector||function(){return Array.from(document.querySelectorAll(e)).includes(this)}).call(t,e)}function Fu(t,e){const{prototype:i}=Element;return(i.closest||function(){let s=this;do{if(ht.matches(s,e))return s;s=s.parentElement||s.parentNode}while(s!==null&&s.nodeType===1);return null}).call(t,e)}function xt(t){return this.elements.container.querySelectorAll(t)}function X(t){return this.elements.container.querySelector(t)}function ls(t=null,e=!1){h.element(t)&&(t.focus({preventScroll:!0}),e&&W(t,this.config.classNames.tabFocus))}const na={"audio/ogg":"vorbis","audio/wav":"1","video/webm":"vp8, vorbis","video/mp4":"avc1.42E01E, mp4a.40.2","video/ogg":"theora"},q={audio:"canPlayType"in document.createElement("audio"),video:"canPlayType"in document.createElement("video"),check(t,e,i){const s=re.isIPhone&&i&&q.playsinline,r=q[t]||e!=="html5";return{api:r,ui:r&&q.rangeInput&&(t!=="video"||!re.isIPhone||s)}},pip:!(re.isIPhone||!h.function(N("video").webkitSetPresentationMode)&&(!document.pictureInPictureEnabled||N("video").disablePictureInPicture)),airplay:h.function(window.WebKitPlaybackTargetAvailabilityEvent),playsinline:"playsInline"in document.createElement("video"),mime(t){if(h.empty(t))return!1;const[e]=t.split("/");let i=t;if(!this.isHTML5||e!==this.type)return!1;Object.keys(na).includes(i)&&(i+=`; codecs="${na[t]}"`);try{return Boolean(i&&this.media.canPlayType(i).replace(/no/,""))}catch{return!1}},textTracks:"textTracks"in document.createElement("video"),rangeInput:(()=>{const t=document.createElement("input");return t.type="range",t.type==="range"})(),touch:"ontouchstart"in document.documentElement,transitions:ks!==!1,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches},Zu=(()=>{let t=!1;try{const e=Object.defineProperty({},"passive",{get:()=>(t=!0,null)});window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch{}return t})();function Mt(t,e,i,s=!1,r=!0,a=!1){if(!t||!("addEventListener"in t)||h.empty(e)||!h.function(i))return;const n=e.split(" ");let o=a;Zu&&(o={passive:r,capture:a}),n.forEach(c=>{this&&this.eventListeners&&s&&this.eventListeners.push({element:t,type:c,callback:i,options:o}),t[s?"addEventListener":"removeEventListener"](c,i,o)})}function H(t,e="",i,s=!0,r=!1){Mt.call(this,t,e,i,!0,s,r)}function Ui(t,e="",i,s=!0,r=!1){Mt.call(this,t,e,i,!1,s,r)}function hr(t,e="",i,s=!0,r=!1){const a=(...n)=>{Ui(t,e,a,s,r),i.apply(this,n)};Mt.call(this,t,e,a,!0,s,r)}function E(t,e="",i=!1,s={}){if(!h.element(t)||h.empty(e))return;const r=new CustomEvent(e,{bubbles:i,detail:oe(j({},s),{plyr:this})});t.dispatchEvent(r)}function Yu(){this&&this.eventListeners&&(this.eventListeners.forEach(t=>{const{element:e,type:i,callback:s,options:r}=t;e.removeEventListener(i,s,r)}),this.eventListeners=[])}function Qu(){return new Promise(t=>this.ready?setTimeout(t,0):H.call(this,this.elements.container,"ready",t)).then(()=>{})}function Be(t){h.promise(t)&&t.then(null,()=>{})}function Ns(t){return h.array(t)?t.filter((e,i)=>t.indexOf(e)===i):t}function Kn(t,e){return h.array(t)&&t.length?t.reduce((i,s)=>Math.abs(s-e)<Math.abs(i-e)?s:i):null}function eo(t){return!(!window||!window.CSS)&&window.CSS.supports(t)}const oa=[[1,1],[4,3],[3,4],[5,4],[4,5],[3,2],[2,3],[16,10],[10,16],[16,9],[9,16],[21,9],[9,21],[32,9],[9,32]].reduce((t,[e,i])=>oe(j({},t),{[e/i]:[e,i]}),{});function to(t){return h.array(t)||h.string(t)&&t.includes(":")?(h.array(t)?t:t.split(":")).map(Number).every(h.number):!1}function Ti(t){if(!h.array(t)||!t.every(h.number))return null;const[e,i]=t,s=(a,n)=>n===0?a:s(n,a%n),r=s(e,i);return[e/r,i/r]}function dr(t){const e=s=>to(s)?s.split(":").map(Number):null;let i=e(t);if(i===null&&(i=e(this.config.ratio)),i===null&&!h.empty(this.embed)&&h.array(this.embed.ratio)&&({ratio:i}=this.embed),i===null&&this.isHTML5){const{videoWidth:s,videoHeight:r}=this.media;i=[s,r]}return Ti(i)}function It(t){if(!this.isVideo)return{};const{wrapper:e}=this.elements,i=dr.call(this,t);if(!h.array(i))return{};const[s,r]=Ti(i),a=100/s*r;if(eo(`aspect-ratio: ${s}/${r}`)?e.style.aspectRatio=`${s}/${r}`:e.style.paddingBottom=`${a}%`,this.isVimeo&&!this.config.vimeo.premium&&this.supported.ui){const n=100/this.media.offsetWidth*parseInt(window.getComputedStyle(this.media).paddingBottom,10),o=(n-a)/(n/50);this.fullscreen.active?e.style.paddingBottom=null:this.media.style.transform=`translateY(-${o}%)`}else this.isHTML5&&e.classList.add(this.config.classNames.videoFixedRatio);return{padding:a,ratio:i}}function io(t,e,i=.05){const s=t/e,r=Kn(Object.keys(oa),s);return Math.abs(r-s)<=i?oa[r]:[t,e]}function Gu(){return[Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)]}const Ke={getSources(){return this.isHTML5?Array.from(this.media.querySelectorAll("source")).filter(t=>{const e=t.getAttribute("type");return!!h.empty(e)||q.mime.call(this,e)}):[]},getQualityOptions(){return this.config.quality.forced?this.config.quality.options:Ke.getSources.call(this).map(t=>Number(t.getAttribute("size"))).filter(Boolean)},setup(){if(!this.isHTML5)return;const t=this;t.options.speed=t.config.speed.options,h.empty(this.config.ratio)||It.call(t),Object.defineProperty(t.media,"quality",{get(){const e=Ke.getSources.call(t).find(i=>i.getAttribute("src")===t.source);return e&&Number(e.getAttribute("size"))},set(e){if(t.quality!==e){if(t.config.quality.forced&&h.function(t.config.quality.onChange))t.config.quality.onChange(e);else{const i=Ke.getSources.call(t).find(c=>Number(c.getAttribute("size"))===e);if(!i)return;const{currentTime:s,paused:r,preload:a,readyState:n,playbackRate:o}=t.media;t.media.src=i.getAttribute("src"),(a!=="none"||n)&&(t.once("loadedmetadata",()=>{t.speed=o,t.currentTime=s,r||Be(t.play())}),t.media.load())}E.call(t,t.media,"qualitychange",!1,{quality:e})}}})},cancelRequests(){this.isHTML5&&(He(Ke.getSources.call(this)),this.media.setAttribute("src",this.config.blankVideo),this.media.load(),this.debug.log("Cancelled network requests"))}};function qu(t){return`${t}-${Math.floor(1e4*Math.random())}`}function Es(t,...e){return h.empty(t)?t:t.toString().replace(/{(\d+)}/g,(i,s)=>e[s].toString())}function Ju(t,e){return t===0||e===0||Number.isNaN(t)||Number.isNaN(e)?0:(t/e*100).toFixed(2)}const Ft=(t="",e="",i="")=>t.replace(new RegExp(e.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),"g"),i.toString()),so=(t="")=>t.toString().replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase());function Xu(t=""){let e=t.toString();return e=Ft(e,"-"," "),e=Ft(e,"_"," "),e=so(e),Ft(e," ","")}function Ku(t=""){let e=t.toString();return e=Xu(e),e.charAt(0).toLowerCase()+e.slice(1)}function ep(t){const e=document.createDocumentFragment(),i=document.createElement("div");return e.appendChild(i),i.innerHTML=t,e.firstChild.innerText}function tp(t){const e=document.createElement("div");return e.appendChild(t),e.innerHTML}const la={pip:"PIP",airplay:"AirPlay",html5:"HTML5",vimeo:"Vimeo",youtube:"YouTube"},K={get(t="",e={}){if(h.empty(t)||h.empty(e))return"";let i=Jn(e.i18n,t);if(h.empty(i))return Object.keys(la).includes(t)?la[t]:"";const s={"{seektime}":e.seekTime,"{title}":e.title};return Object.entries(s).forEach(([r,a])=>{i=Ft(i,r,a)}),i}};class Jt{constructor(e){_(this,"get",i=>{if(!Jt.supported||!this.enabled)return null;const s=window.localStorage.getItem(this.key);if(h.empty(s))return null;const r=JSON.parse(s);return h.string(i)&&i.length?r[i]:r}),_(this,"set",i=>{if(!Jt.supported||!this.enabled||!h.object(i))return;let s=this.get();h.empty(s)&&(s={}),J(s,i);try{window.localStorage.setItem(this.key,JSON.stringify(s))}catch{}}),this.enabled=e.config.storage.enabled,this.key=e.config.storage.key}static get supported(){try{if(!("localStorage"in window))return!1;const e="___test";return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch{return!1}}}function ri(t,e="text"){return new Promise((i,s)=>{try{const r=new XMLHttpRequest;if(!("withCredentials"in r))return;r.addEventListener("load",()=>{if(e==="text")try{i(JSON.parse(r.responseText))}catch{i(r.responseText)}else i(r.response)}),r.addEventListener("error",()=>{throw new Error(r.status)}),r.open("GET",t,!0),r.responseType=e,r.send()}catch(r){s(r)}})}function ro(t,e){if(!h.string(t))return;const i=h.string(e);let s=!1;const r=()=>document.getElementById(e)!==null,a=(n,o)=>{n.innerHTML=o,i&&r()||document.body.insertAdjacentElement("afterbegin",n)};if(!i||!r()){const n=Jt.supported,o=document.createElement("div");if(o.setAttribute("hidden",""),i&&o.setAttribute("id",e),n){const c=window.localStorage.getItem(`cache-${e}`);if(s=c!==null,s){const l=JSON.parse(c);a(o,l.content)}}ri(t).then(c=>{if(!h.empty(c)){if(n)try{window.localStorage.setItem(`cache-${e}`,JSON.stringify({content:c}))}catch{}a(o,c)}}).catch(()=>{})}}const ao=t=>Math.trunc(t/60/60%60,10),ip=t=>Math.trunc(t%60,10);function Wi(t=0,e=!1,i=!1){if(!h.number(t))return Wi(void 0,e,i);const s=c=>`0${c}`.slice(-2);let r=ao(t);const a=(n=t,Math.trunc(n/60%60,10));var n;const o=ip(t);return r=e||r>0?`${r}:`:"",`${i&&t>0?"-":""}${r}${s(a)}:${s(o)}`}const S={getIconUrl(){const t=new URL(this.config.iconUrl,window.location),e=window.location.host?window.location.host:window.top.location.host,i=t.host!==e||re.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:i}},findElements(){try{return this.elements.controls=X.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:xt.call(this,this.config.selectors.buttons.play),pause:X.call(this,this.config.selectors.buttons.pause),restart:X.call(this,this.config.selectors.buttons.restart),rewind:X.call(this,this.config.selectors.buttons.rewind),fastForward:X.call(this,this.config.selectors.buttons.fastForward),mute:X.call(this,this.config.selectors.buttons.mute),pip:X.call(this,this.config.selectors.buttons.pip),airplay:X.call(this,this.config.selectors.buttons.airplay),settings:X.call(this,this.config.selectors.buttons.settings),captions:X.call(this,this.config.selectors.buttons.captions),fullscreen:X.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=X.call(this,this.config.selectors.progress),this.elements.inputs={seek:X.call(this,this.config.selectors.inputs.seek),volume:X.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:X.call(this,this.config.selectors.display.buffer),currentTime:X.call(this,this.config.selectors.display.currentTime),duration:X.call(this,this.config.selectors.display.duration)},h.element(this.elements.progress)&&(this.elements.display.seekTooltip=this.elements.progress.querySelector(`.${this.config.classNames.tooltip}`)),!0}catch(t){return this.debug.warn("It looks like there is a problem with your custom controls HTML",t),this.toggleNativeControls(!0),!1}},createIcon(t,e){const i="http://www.w3.org/2000/svg",s=S.getIconUrl.call(this),r=`${s.cors?"":s.url}#${this.config.iconPrefix}`,a=document.createElementNS(i,"svg");Ts(a,J(e,{"aria-hidden":"true",focusable:"false"}));const n=document.createElementNS(i,"use"),o=`${r}-${t}`;return"href"in n&&n.setAttributeNS("http://www.w3.org/1999/xlink","href",o),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o),a.appendChild(n),a},createLabel(t,e={}){const i=K.get(t,this.config);return N("span",oe(j({},e),{class:[e.class,this.config.classNames.hidden].filter(Boolean).join(" ")}),i)},createBadge(t){if(h.empty(t))return null;const e=N("span",{class:this.config.classNames.menu.value});return e.appendChild(N("span",{class:this.config.classNames.menu.badge},t)),e},createButton(t,e){const i=J({},e);let s=Ku(t);const r={element:"button",toggle:!1,label:null,icon:null,labelPressed:null,iconPressed:null};switch(["element","icon","label"].forEach(n=>{Object.keys(i).includes(n)&&(r[n]=i[n],delete i[n])}),r.element!=="button"||Object.keys(i).includes("type")||(i.type="button"),Object.keys(i).includes("class")?i.class.split(" ").some(n=>n===this.config.classNames.control)||J(i,{class:`${i.class} ${this.config.classNames.control}`}):i.class=this.config.classNames.control,t){case"play":r.toggle=!0,r.label="play",r.labelPressed="pause",r.icon="play",r.iconPressed="pause";break;case"mute":r.toggle=!0,r.label="mute",r.labelPressed="unmute",r.icon="volume",r.iconPressed="muted";break;case"captions":r.toggle=!0,r.label="enableCaptions",r.labelPressed="disableCaptions",r.icon="captions-off",r.iconPressed="captions-on";break;case"fullscreen":r.toggle=!0,r.label="enterFullscreen",r.labelPressed="exitFullscreen",r.icon="enter-fullscreen",r.iconPressed="exit-fullscreen";break;case"play-large":i.class+=` ${this.config.classNames.control}--overlaid`,s="play",r.label="play",r.icon="play";break;default:h.empty(r.label)&&(r.label=s),h.empty(r.icon)&&(r.icon=t)}const a=N(r.element);return r.toggle?(a.appendChild(S.createIcon.call(this,r.iconPressed,{class:"icon--pressed"})),a.appendChild(S.createIcon.call(this,r.icon,{class:"icon--not-pressed"})),a.appendChild(S.createLabel.call(this,r.labelPressed,{class:"label--pressed"})),a.appendChild(S.createLabel.call(this,r.label,{class:"label--not-pressed"}))):(a.appendChild(S.createIcon.call(this,r.icon)),a.appendChild(S.createLabel.call(this,r.label))),J(i,Le(this.config.selectors.buttons[s],i)),Ts(a,i),s==="play"?(h.array(this.elements.buttons[s])||(this.elements.buttons[s]=[]),this.elements.buttons[s].push(a)):this.elements.buttons[s]=a,a},createRange(t,e){const i=N("input",J(Le(this.config.selectors.inputs[t]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":K.get(t,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},e));return this.elements.inputs[t]=i,S.updateRangeFill.call(this,i),Eu.setup(i),i},createProgress(t,e){const i=N("progress",J(Le(this.config.selectors.display[t]),{min:0,max:100,value:0,role:"progressbar","aria-hidden":!0},e));if(t!=="volume"){i.appendChild(N("span",null,"0"));const s={played:"played",buffer:"buffered"}[t],r=s?K.get(s,this.config):"";i.innerText=`% ${r.toLowerCase()}`}return this.elements.display[t]=i,i},createTime(t,e){const i=Le(this.config.selectors.display[t],e),s=N("div",J(i,{class:`${i.class?i.class:""} ${this.config.classNames.display.time} `.trim(),"aria-label":K.get(t,this.config)}),"00:00");return this.elements.display[t]=s,s},bindMenuItemShortcuts(t,e){H.call(this,t,"keydown keyup",i=>{if(!["Space","ArrowUp","ArrowDown","ArrowRight"].includes(i.key)||(i.preventDefault(),i.stopPropagation(),i.type==="keydown"))return;const s=ht(t,'[role="menuitemradio"]');if(!s&&["Space","ArrowRight"].includes(i.key))S.showMenuPanel.call(this,e,!0);else{let r;i.key!=="Space"&&(i.key==="ArrowDown"||s&&i.key==="ArrowRight"?(r=t.nextElementSibling,h.element(r)||(r=t.parentNode.firstElementChild)):(r=t.previousElementSibling,h.element(r)||(r=t.parentNode.lastElementChild)),ls.call(this,r,!0))}},!1),H.call(this,t,"keyup",i=>{i.key==="Return"&&S.focusFirstMenuItem.call(this,null,!0)})},createMenuItem({value:t,list:e,type:i,title:s,badge:r=null,checked:a=!1}){const n=Le(this.config.selectors.inputs[i]),o=N("button",J(n,{type:"button",role:"menuitemradio",class:`${this.config.classNames.control} ${n.class?n.class:""}`.trim(),"aria-checked":a,value:t})),c=N("span");c.innerHTML=s,h.element(r)&&c.appendChild(r),o.appendChild(c),Object.defineProperty(o,"checked",{enumerable:!0,get:()=>o.getAttribute("aria-checked")==="true",set(l){l&&Array.from(o.parentNode.children).filter(d=>ht(d,'[role="menuitemradio"]')).forEach(d=>d.setAttribute("aria-checked","false")),o.setAttribute("aria-checked",l?"true":"false")}}),this.listeners.bind(o,"click keyup",l=>{if(!h.keyboardEvent(l)||l.key==="Space"){switch(l.preventDefault(),l.stopPropagation(),o.checked=!0,i){case"language":this.currentTrack=Number(t);break;case"quality":this.quality=t;break;case"speed":this.speed=parseFloat(t)}S.showMenuPanel.call(this,"home",h.keyboardEvent(l))}},i,!1),S.bindMenuItemShortcuts.call(this,o,i),e.appendChild(o)},formatTime(t=0,e=!1){return h.number(t)?Wi(t,ao(this.duration)>0,e):t},updateTimeDisplay(t=null,e=0,i=!1){h.element(t)&&h.number(e)&&(t.innerText=S.formatTime(e,i))},updateVolume(){this.supported.ui&&(h.element(this.elements.inputs.volume)&&S.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),h.element(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||this.volume===0))},setRange(t,e=0){h.element(t)&&(t.value=e,S.updateRangeFill.call(this,t))},updateProgress(t){if(!this.supported.ui||!h.event(t))return;let e=0;const i=(s,r)=>{const a=h.number(r)?r:0,n=h.element(s)?s:this.elements.display.buffer;if(h.element(n)){n.value=a;const o=n.getElementsByTagName("span")[0];h.element(o)&&(o.childNodes[0].nodeValue=a)}};if(t)switch(t.type){case"timeupdate":case"seeking":case"seeked":e=Ju(this.currentTime,this.duration),t.type==="timeupdate"&&S.setRange.call(this,this.elements.inputs.seek,e);break;case"playing":case"progress":i(this.elements.display.buffer,100*this.buffered)}},updateRangeFill(t){const e=h.event(t)?t.target:t;if(h.element(e)&&e.getAttribute("type")==="range"){if(ht(e,this.config.selectors.inputs.seek)){e.setAttribute("aria-valuenow",this.currentTime);const i=S.formatTime(this.currentTime),s=S.formatTime(this.duration),r=K.get("seekLabel",this.config);e.setAttribute("aria-valuetext",r.replace("{currentTime}",i).replace("{duration}",s))}else if(ht(e,this.config.selectors.inputs.volume)){const i=100*e.value;e.setAttribute("aria-valuenow",i),e.setAttribute("aria-valuetext",`${i.toFixed(1)}%`)}else e.setAttribute("aria-valuenow",e.value);re.isWebkit&&e.style.setProperty("--value",e.value/e.max*100+"%")}},updateSeekTooltip(t){var e,i;if(!this.config.tooltips.seek||!h.element(this.elements.inputs.seek)||!h.element(this.elements.display.seekTooltip)||this.duration===0)return;const s=this.elements.display.seekTooltip,r=`${this.config.classNames.tooltip}--visible`,a=d=>W(s,r,d);if(this.touch)return void a(!1);let n=0;const o=this.elements.progress.getBoundingClientRect();if(h.event(t))n=100/o.width*(t.pageX-o.left);else{if(!ki(s,r))return;n=parseFloat(s.style.left,10)}n<0?n=0:n>100&&(n=100);const c=this.duration/100*n;s.innerText=S.formatTime(c);const l=(e=this.config.markers)===null||e===void 0||(i=e.points)===null||i===void 0?void 0:i.find(({time:d})=>d===Math.round(c));l&&s.insertAdjacentHTML("afterbegin",`${l.label}<br>`),s.style.left=`${n}%`,h.event(t)&&["mouseenter","mouseleave"].includes(t.type)&&a(t.type==="mouseenter")},timeUpdate(t){const e=!h.element(this.elements.display.duration)&&this.config.invertTime;S.updateTimeDisplay.call(this,this.elements.display.currentTime,e?this.duration-this.currentTime:this.currentTime,e),t&&t.type==="timeupdate"&&this.media.seeking||S.updateProgress.call(this,t)},durationUpdate(){if(!this.supported.ui||!this.config.invertTime&&this.currentTime)return;if(this.duration>=2**32)return ct(this.elements.display.currentTime,!0),void ct(this.elements.progress,!0);h.element(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute("aria-valuemax",this.duration);const t=h.element(this.elements.display.duration);!t&&this.config.displayDuration&&this.paused&&S.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),t&&S.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),this.config.markers.enabled&&S.setMarkers.call(this),S.updateSeekTooltip.call(this)},toggleMenuButton(t,e){ct(this.elements.settings.buttons[t],!e)},updateSetting(t,e,i){const s=this.elements.settings.panels[t];let r=null,a=e;if(t==="captions")r=this.currentTrack;else{if(r=h.empty(i)?this[t]:i,h.empty(r)&&(r=this.config[t].default),!h.empty(this.options[t])&&!this.options[t].includes(r))return void this.debug.warn(`Unsupported value of '${r}' for ${t}`);if(!this.config[t].options.includes(r))return void this.debug.warn(`Disabled value of '${r}' for ${t}`)}if(h.element(a)||(a=s&&s.querySelector('[role="menu"]')),!h.element(a))return;this.elements.settings.buttons[t].querySelector(`.${this.config.classNames.menu.value}`).innerHTML=S.getLabel.call(this,t,r);const n=a&&a.querySelector(`[value="${r}"]`);h.element(n)&&(n.checked=!0)},getLabel(t,e){switch(t){case"speed":return e===1?K.get("normal",this.config):`${e}×`;case"quality":if(h.number(e)){const i=K.get(`qualityLabel.${e}`,this.config);return i.length?i:`${e}p`}return so(e);case"captions":return F.getLabel.call(this);default:return null}},setQualityMenu(t){if(!h.element(this.elements.settings.panels.quality))return;const e="quality",i=this.elements.settings.panels.quality.querySelector('[role="menu"]');h.array(t)&&(this.options.quality=Ns(t).filter(a=>this.config.quality.options.includes(a)));const s=!h.empty(this.options.quality)&&this.options.quality.length>1;if(S.toggleMenuButton.call(this,e,s),wi(i),S.checkMenu.call(this),!s)return;const r=a=>{const n=K.get(`qualityBadge.${a}`,this.config);return n.length?S.createBadge.call(this,n):null};this.options.quality.sort((a,n)=>{const o=this.config.quality.options;return o.indexOf(a)>o.indexOf(n)?1:-1}).forEach(a=>{S.createMenuItem.call(this,{value:a,list:i,type:e,title:S.getLabel.call(this,"quality",a),badge:r(a)})}),S.updateSetting.call(this,e,i)},setCaptionsMenu(){if(!h.element(this.elements.settings.panels.captions))return;const t="captions",e=this.elements.settings.panels.captions.querySelector('[role="menu"]'),i=F.getTracks.call(this),s=Boolean(i.length);if(S.toggleMenuButton.call(this,t,s),wi(e),S.checkMenu.call(this),!s)return;const r=i.map((a,n)=>({value:n,checked:this.captions.toggled&&this.currentTrack===n,title:F.getLabel.call(this,a),badge:a.language&&S.createBadge.call(this,a.language.toUpperCase()),list:e,type:"language"}));r.unshift({value:-1,checked:!this.captions.toggled,title:K.get("disabled",this.config),list:e,type:"language"}),r.forEach(S.createMenuItem.bind(this)),S.updateSetting.call(this,t,e)},setSpeedMenu(){if(!h.element(this.elements.settings.panels.speed))return;const t="speed",e=this.elements.settings.panels.speed.querySelector('[role="menu"]');this.options.speed=this.options.speed.filter(s=>s>=this.minimumSpeed&&s<=this.maximumSpeed);const i=!h.empty(this.options.speed)&&this.options.speed.length>1;S.toggleMenuButton.call(this,t,i),wi(e),S.checkMenu.call(this),i&&(this.options.speed.forEach(s=>{S.createMenuItem.call(this,{value:s,list:e,type:t,title:S.getLabel.call(this,"speed",s)})}),S.updateSetting.call(this,t,e))},checkMenu(){const{buttons:t}=this.elements.settings,e=!h.empty(t)&&Object.values(t).some(i=>!i.hidden);ct(this.elements.settings.menu,!e)},focusFirstMenuItem(t,e=!1){if(this.elements.settings.popup.hidden)return;let i=t;h.element(i)||(i=Object.values(this.elements.settings.panels).find(r=>!r.hidden));const s=i.querySelector('[role^="menuitem"]');ls.call(this,s,e)},toggleMenu(t){const{popup:e}=this.elements.settings,i=this.elements.buttons.settings;if(!h.element(e)||!h.element(i))return;const{hidden:s}=e;let r=s;if(h.boolean(t))r=t;else if(h.keyboardEvent(t)&&t.key==="Escape")r=!1;else if(h.event(t)){const a=h.function(t.composedPath)?t.composedPath()[0]:t.target,n=e.contains(a);if(n||!n&&t.target!==i&&r)return}i.setAttribute("aria-expanded",r),ct(e,!r),W(this.elements.container,this.config.classNames.menu.open,r),r&&h.keyboardEvent(t)?S.focusFirstMenuItem.call(this,null,!0):r||s||ls.call(this,i,h.keyboardEvent(t))},getMenuSize(t){const e=t.cloneNode(!0);e.style.position="absolute",e.style.opacity=0,e.removeAttribute("hidden"),t.parentNode.appendChild(e);const i=e.scrollWidth,s=e.scrollHeight;return He(e),{width:i,height:s}},showMenuPanel(t="",e=!1){const i=this.elements.container.querySelector(`#plyr-settings-${this.id}-${t}`);if(!h.element(i))return;const s=i.parentNode,r=Array.from(s.children).find(a=>!a.hidden);if(q.transitions&&!q.reducedMotion){s.style.width=`${r.scrollWidth}px`,s.style.height=`${r.scrollHeight}px`;const a=S.getMenuSize.call(this,i),n=o=>{o.target===s&&["width","height"].includes(o.propertyName)&&(s.style.width="",s.style.height="",Ui.call(this,s,ks,n))};H.call(this,s,ks,n),s.style.width=`${a.width}px`,s.style.height=`${a.height}px`}ct(r,!0),ct(i,!1),S.focusFirstMenuItem.call(this,i,e)},setDownloadUrl(){const t=this.elements.buttons.download;h.element(t)&&t.setAttribute("href",this.download)},create(t){const{bindMenuItemShortcuts:e,createButton:i,createProgress:s,createRange:r,createTime:a,setQualityMenu:n,setSpeedMenu:o,showMenuPanel:c}=S;this.elements.controls=null,h.array(this.config.controls)&&this.config.controls.includes("play-large")&&this.elements.container.appendChild(i.call(this,"play-large"));const l=N("div",Le(this.config.selectors.controls.wrapper));this.elements.controls=l;const d={class:"plyr__controls__item"};return Ns(h.array(this.config.controls)?this.config.controls:[]).forEach(u=>{if(u==="restart"&&l.appendChild(i.call(this,"restart",d)),u==="rewind"&&l.appendChild(i.call(this,"rewind",d)),u==="play"&&l.appendChild(i.call(this,"play",d)),u==="fast-forward"&&l.appendChild(i.call(this,"fast-forward",d)),u==="progress"){const p=N("div",{class:`${d.class} plyr__progress__container`}),m=N("div",Le(this.config.selectors.progress));if(m.appendChild(r.call(this,"seek",{id:`plyr-seek-${t.id}`})),m.appendChild(s.call(this,"buffer")),this.config.tooltips.seek){const g=N("span",{class:this.config.classNames.tooltip},"00:00");m.appendChild(g),this.elements.display.seekTooltip=g}this.elements.progress=m,p.appendChild(this.elements.progress),l.appendChild(p)}if(u==="current-time"&&l.appendChild(a.call(this,"currentTime",d)),u==="duration"&&l.appendChild(a.call(this,"duration",d)),u==="mute"||u==="volume"){let{volume:p}=this.elements;if(h.element(p)&&l.contains(p)||(p=N("div",J({},d,{class:`${d.class} plyr__volume`.trim()})),this.elements.volume=p,l.appendChild(p)),u==="mute"&&p.appendChild(i.call(this,"mute")),u==="volume"&&!re.isIos){const m={max:1,step:.05,value:this.config.volume};p.appendChild(r.call(this,"volume",J(m,{id:`plyr-volume-${t.id}`})))}}if(u==="captions"&&l.appendChild(i.call(this,"captions",d)),u==="settings"&&!h.empty(this.config.settings)){const p=N("div",J({},d,{class:`${d.class} plyr__menu`.trim(),hidden:""}));p.appendChild(i.call(this,"settings",{"aria-haspopup":!0,"aria-controls":`plyr-settings-${t.id}`,"aria-expanded":!1}));const m=N("div",{class:"plyr__menu__container",id:`plyr-settings-${t.id}`,hidden:""}),g=N("div"),f=N("div",{id:`plyr-settings-${t.id}-home`}),b=N("div",{role:"menu"});f.appendChild(b),g.appendChild(f),this.elements.settings.panels.home=f,this.config.settings.forEach(v=>{const x=N("button",J(Le(this.config.selectors.buttons.settings),{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--forward`,role:"menuitem","aria-haspopup":!0,hidden:""}));e.call(this,x,v),H.call(this,x,"click",()=>{c.call(this,v,!1)});const y=N("span",null,K.get(v,this.config)),k=N("span",{class:this.config.classNames.menu.value});k.innerHTML=t[v],y.appendChild(k),x.appendChild(y),b.appendChild(x);const z=N("div",{id:`plyr-settings-${t.id}-${v}`,hidden:""}),T=N("button",{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--back`});T.appendChild(N("span",{"aria-hidden":!0},K.get(v,this.config))),T.appendChild(N("span",{class:this.config.classNames.hidden},K.get("menuBack",this.config))),H.call(this,z,"keydown",O=>{O.key==="ArrowLeft"&&(O.preventDefault(),O.stopPropagation(),c.call(this,"home",!0))},!1),H.call(this,T,"click",()=>{c.call(this,"home",!1)}),z.appendChild(T),z.appendChild(N("div",{role:"menu"})),g.appendChild(z),this.elements.settings.buttons[v]=x,this.elements.settings.panels[v]=z}),m.appendChild(g),p.appendChild(m),l.appendChild(p),this.elements.settings.popup=m,this.elements.settings.menu=p}if(u==="pip"&&q.pip&&l.appendChild(i.call(this,"pip",d)),u==="airplay"&&q.airplay&&l.appendChild(i.call(this,"airplay",d)),u==="download"){const p=J({},d,{element:"a",href:this.download,target:"_blank"});this.isHTML5&&(p.download="");const{download:m}=this.config.urls;!h.url(m)&&this.isEmbed&&J(p,{icon:`logo-${this.provider}`,label:this.provider}),l.appendChild(i.call(this,"download",p))}u==="fullscreen"&&l.appendChild(i.call(this,"fullscreen",d))}),this.isHTML5&&n.call(this,Ke.getQualityOptions.call(this)),o.call(this),l},inject(){if(this.config.loadSprite){const r=S.getIconUrl.call(this);r.cors&&ro(r.url,"sprite-plyr")}this.id=Math.floor(1e4*Math.random());let t=null;this.elements.controls=null;const e={id:this.id,seektime:this.config.seekTime,title:this.config.title};let i=!0;h.function(this.config.controls)&&(this.config.controls=this.config.controls.call(this,e)),this.config.controls||(this.config.controls=[]),h.element(this.config.controls)||h.string(this.config.controls)?t=this.config.controls:(t=S.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:F.getLabel.call(this)}),i=!1);let s;if(i&&h.string(this.config.controls)&&(t=(r=>{let a=r;return Object.entries(e).forEach(([n,o])=>{a=Ft(a,`{${n}}`,o)}),a})(t)),h.string(this.config.selectors.controls.container)&&(s=document.querySelector(this.config.selectors.controls.container)),h.element(s)||(s=this.elements.container),s[h.element(t)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",t),h.element(this.elements.controls)||S.findElements.call(this),!h.empty(this.elements.buttons)){const r=a=>{const n=this.config.classNames.controlPressed;Object.defineProperty(a,"pressed",{enumerable:!0,get:()=>ki(a,n),set(o=!1){W(a,n,o)}})};Object.values(this.elements.buttons).filter(Boolean).forEach(a=>{h.array(a)||h.nodeList(a)?Array.from(a).filter(Boolean).forEach(r):r(a)})}if(re.isEdge&&qn(s),this.config.tooltips.controls){const{classNames:r,selectors:a}=this.config,n=`${a.controls.wrapper} ${a.labels} .${r.hidden}`,o=xt.call(this,n);Array.from(o).forEach(c=>{W(c,this.config.classNames.hidden,!1),W(c,this.config.classNames.tooltip,!0)})}},setMediaMetadata(){try{"mediaSession"in navigator&&(navigator.mediaSession.metadata=new window.MediaMetadata({title:this.config.mediaMetadata.title,artist:this.config.mediaMetadata.artist,album:this.config.mediaMetadata.album,artwork:this.config.mediaMetadata.artwork}))}catch{}},setMarkers(){var t,e;if(!this.duration||this.elements.markers)return;const i=(t=this.config.markers)===null||t===void 0||(e=t.points)===null||e===void 0?void 0:e.filter(({time:c})=>c>0&&c<this.duration);if(i==null||!i.length)return;const s=document.createDocumentFragment(),r=document.createDocumentFragment();let a=null;const n=`${this.config.classNames.tooltip}--visible`,o=c=>W(a,n,c);i.forEach(c=>{const l=N("span",{class:this.config.classNames.marker},""),d=c.time/this.duration*100+"%";a&&(l.addEventListener("mouseenter",()=>{c.label||(a.style.left=d,a.innerHTML=c.label,o(!0))}),l.addEventListener("mouseleave",()=>{o(!1)})),l.addEventListener("click",()=>{this.currentTime=c.time}),l.style.left=d,r.appendChild(l)}),s.appendChild(r),this.config.tooltips.seek||(a=N("span",{class:this.config.classNames.tooltip},""),s.appendChild(a)),this.elements.markers={points:r,tip:a},this.elements.progress.appendChild(s)}};function no(t,e=!0){let i=t;if(e){const s=document.createElement("a");s.href=i,i=s.href}try{return new URL(i)}catch{return null}}function oo(t){const e=new URLSearchParams;return h.object(t)&&Object.entries(t).forEach(([i,s])=>{e.set(i,s)}),e}const F={setup(){if(!this.supported.ui)return;if(!this.isVideo||this.isYouTube||this.isHTML5&&!q.textTracks)return void(h.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&S.setCaptionsMenu.call(this));if(h.element(this.elements.captions)||(this.elements.captions=N("div",Le(this.config.selectors.captions)),Hu(this.elements.captions,this.elements.wrapper)),re.isIE&&window.URL){const s=this.media.querySelectorAll("track");Array.from(s).forEach(r=>{const a=r.getAttribute("src"),n=no(a);n!==null&&n.hostname!==window.location.href.hostname&&["http:","https:"].includes(n.protocol)&&ri(a,"blob").then(o=>{r.setAttribute("src",window.URL.createObjectURL(o))}).catch(()=>{He(r)})})}const t=Ns((navigator.languages||[navigator.language||navigator.userLanguage||"en"]).map(s=>s.split("-")[0]));let e=(this.storage.get("language")||this.config.captions.language||"auto").toLowerCase();e==="auto"&&([e]=t);let i=this.storage.get("captions");if(h.boolean(i)||({active:i}=this.config.captions),Object.assign(this.captions,{toggled:!1,active:i,language:e,languages:t}),this.isHTML5){const s=this.config.captions.update?"addtrack removetrack":"removetrack";H.call(this,this.media.textTracks,s,F.update.bind(this))}setTimeout(F.update.bind(this),0)},update(){const t=F.getTracks.call(this,!0),{active:e,language:i,meta:s,currentTrackNode:r}=this.captions,a=Boolean(t.find(n=>n.language===i));this.isHTML5&&this.isVideo&&t.filter(n=>!s.get(n)).forEach(n=>{this.debug.log("Track added",n),s.set(n,{default:n.mode==="showing"}),n.mode==="showing"&&(n.mode="hidden"),H.call(this,n,"cuechange",()=>F.updateCues.call(this))}),(a&&this.language!==i||!t.includes(r))&&(F.setLanguage.call(this,i),F.toggle.call(this,e&&a)),this.elements&&W(this.elements.container,this.config.classNames.captions.enabled,!h.empty(t)),h.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&S.setCaptionsMenu.call(this)},toggle(t,e=!0){if(!this.supported.ui)return;const{toggled:i}=this.captions,s=this.config.classNames.captions.active,r=h.nullOrUndefined(t)?!i:t;if(r!==i){if(e||(this.captions.active=r,this.storage.set({captions:r})),!this.language&&r&&!e){const a=F.getTracks.call(this),n=F.findTrack.call(this,[this.captions.language,...this.captions.languages],!0);return this.captions.language=n.language,void F.set.call(this,a.indexOf(n))}this.elements.buttons.captions&&(this.elements.buttons.captions.pressed=r),W(this.elements.container,s,r),this.captions.toggled=r,S.updateSetting.call(this,"captions"),E.call(this,this.media,r?"captionsenabled":"captionsdisabled")}setTimeout(()=>{r&&this.captions.toggled&&(this.captions.currentTrackNode.mode="hidden")})},set(t,e=!0){const i=F.getTracks.call(this);if(t!==-1)if(h.number(t))if(t in i){if(this.captions.currentTrack!==t){this.captions.currentTrack=t;const s=i[t],{language:r}=s||{};this.captions.currentTrackNode=s,S.updateSetting.call(this,"captions"),e||(this.captions.language=r,this.storage.set({language:r})),this.isVimeo&&this.embed.enableTextTrack(r),E.call(this,this.media,"languagechange")}F.toggle.call(this,!0,e),this.isHTML5&&this.isVideo&&F.updateCues.call(this)}else this.debug.warn("Track not found",t);else this.debug.warn("Invalid caption argument",t);else F.toggle.call(this,!1,e)},setLanguage(t,e=!0){if(!h.string(t))return void this.debug.warn("Invalid language argument",t);const i=t.toLowerCase();this.captions.language=i;const s=F.getTracks.call(this),r=F.findTrack.call(this,[i]);F.set.call(this,s.indexOf(r),e)},getTracks(t=!1){return Array.from((this.media||{}).textTracks||[]).filter(e=>!this.isHTML5||t||this.captions.meta.has(e)).filter(e=>["captions","subtitles"].includes(e.kind))},findTrack(t,e=!1){const i=F.getTracks.call(this),s=n=>Number((this.captions.meta.get(n)||{}).default),r=Array.from(i).sort((n,o)=>s(o)-s(n));let a;return t.every(n=>(a=r.find(o=>o.language===n),!a)),a||(e?r[0]:void 0)},getCurrentTrack(){return F.getTracks.call(this)[this.currentTrack]},getLabel(t){let e=t;return!h.track(e)&&q.textTracks&&this.captions.toggled&&(e=F.getCurrentTrack.call(this)),h.track(e)?h.empty(e.label)?h.empty(e.language)?K.get("enabled",this.config):t.language.toUpperCase():e.label:K.get("disabled",this.config)},updateCues(t){if(!this.supported.ui)return;if(!h.element(this.elements.captions))return void this.debug.warn("No captions element to render to");if(!h.nullOrUndefined(t)&&!Array.isArray(t))return void this.debug.warn("updateCues: Invalid input",t);let e=t;if(!e){const s=F.getCurrentTrack.call(this);e=Array.from((s||{}).activeCues||[]).map(r=>r.getCueAsHTML()).map(tp)}const i=e.map(s=>s.trim()).join(`
|
125
|
+
`);if(i!==this.elements.captions.innerHTML){wi(this.elements.captions);const s=N("span",Le(this.config.selectors.caption));s.innerHTML=i,this.elements.captions.appendChild(s),E.call(this,this.media,"cuechange")}}},lo={enabled:!0,title:"",debug:!1,autoplay:!1,autopause:!0,playsinline:!0,seekTime:10,volume:1,muted:!1,duration:null,displayDuration:!0,invertTime:!0,toggleInvert:!0,ratio:null,clickToPlay:!0,hideControls:!0,resetOnEnd:!1,disableContextMenu:!0,loadSprite:!0,iconPrefix:"plyr",iconUrl:"https://cdn.plyr.io/3.7.2/plyr.svg",blankVideo:"https://cdn.plyr.io/static/blank.mp4",quality:{default:576,options:[4320,2880,2160,1440,1080,720,576,480,360,240],forced:!1,onChange:null},loop:{active:!1},speed:{selected:1,options:[.5,.75,1,1.25,1.5,1.75,2,4]},keyboard:{focused:!0,global:!1},tooltips:{controls:!1,seek:!0},captions:{active:!1,language:"auto",update:!1},fullscreen:{enabled:!0,fallback:!0,iosNative:!1},storage:{enabled:!0,key:"plyr"},controls:["play-large","play","progress","current-time","mute","volume","captions","settings","pip","airplay","fullscreen"],settings:["captions","quality","speed"],i18n:{restart:"Restart",rewind:"Rewind {seektime}s",play:"Play",pause:"Pause",fastForward:"Forward {seektime}s",seek:"Seek",seekLabel:"{currentTime} of {duration}",played:"Played",buffered:"Buffered",currentTime:"Current time",duration:"Duration",volume:"Volume",mute:"Mute",unmute:"Unmute",enableCaptions:"Enable captions",disableCaptions:"Disable captions",download:"Download",enterFullscreen:"Enter fullscreen",exitFullscreen:"Exit fullscreen",frameTitle:"Player for {title}",captions:"Captions",settings:"Settings",pip:"PIP",menuBack:"Go back to previous menu",speed:"Speed",normal:"Normal",quality:"Quality",loop:"Loop",start:"Start",end:"End",all:"All",reset:"Reset",disabled:"Disabled",enabled:"Enabled",advertisement:"Ad",qualityBadge:{2160:"4K",1440:"HD",1080:"HD",720:"HD",576:"SD",480:"SD"}},urls:{download:null,vimeo:{sdk:"https://player.vimeo.com/api/player.js",iframe:"https://player.vimeo.com/video/{0}?{1}",api:"https://vimeo.com/api/oembed.json?url={0}"},youtube:{sdk:"https://www.youtube.com/iframe_api",api:"https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}"},googleIMA:{sdk:"https://imasdk.googleapis.com/js/sdkloader/ima3.js"}},listeners:{seek:null,play:null,pause:null,restart:null,rewind:null,fastForward:null,mute:null,volume:null,captions:null,download:null,fullscreen:null,pip:null,airplay:null,speed:null,quality:null,loop:null,language:null},events:["ended","progress","stalled","playing","waiting","canplay","canplaythrough","loadstart","loadeddata","loadedmetadata","timeupdate","volumechange","play","pause","error","seeking","seeked","emptied","ratechange","cuechange","download","enterfullscreen","exitfullscreen","captionsenabled","captionsdisabled","languagechange","controlshidden","controlsshown","ready","statechange","qualitychange","adsloaded","adscontentpause","adscontentresume","adstarted","adsmidpoint","adscomplete","adsallcomplete","adsimpression","adsclick"],selectors:{editable:"input, textarea, select, [contenteditable]",container:".plyr",controls:{container:null,wrapper:".plyr__controls"},labels:"[data-plyr]",buttons:{play:'[data-plyr="play"]',pause:'[data-plyr="pause"]',restart:'[data-plyr="restart"]',rewind:'[data-plyr="rewind"]',fastForward:'[data-plyr="fast-forward"]',mute:'[data-plyr="mute"]',captions:'[data-plyr="captions"]',download:'[data-plyr="download"]',fullscreen:'[data-plyr="fullscreen"]',pip:'[data-plyr="pip"]',airplay:'[data-plyr="airplay"]',settings:'[data-plyr="settings"]',loop:'[data-plyr="loop"]'},inputs:{seek:'[data-plyr="seek"]',volume:'[data-plyr="volume"]',speed:'[data-plyr="speed"]',language:'[data-plyr="language"]',quality:'[data-plyr="quality"]'},display:{currentTime:".plyr__time--current",duration:".plyr__time--duration",buffer:".plyr__progress__buffer",loop:".plyr__progress__loop",volume:".plyr__volume--display"},progress:".plyr__progress",captions:".plyr__captions",caption:".plyr__caption"},classNames:{type:"plyr--{0}",provider:"plyr--{0}",video:"plyr__video-wrapper",embed:"plyr__video-embed",videoFixedRatio:"plyr__video-wrapper--fixed-ratio",embedContainer:"plyr__video-embed__container",poster:"plyr__poster",posterEnabled:"plyr__poster-enabled",ads:"plyr__ads",control:"plyr__control",controlPressed:"plyr__control--pressed",playing:"plyr--playing",paused:"plyr--paused",stopped:"plyr--stopped",loading:"plyr--loading",hover:"plyr--hover",tooltip:"plyr__tooltip",cues:"plyr__cues",marker:"plyr__progress__marker",hidden:"plyr__sr-only",hideControls:"plyr--hide-controls",isIos:"plyr--is-ios",isTouch:"plyr--is-touch",uiSupported:"plyr--full-ui",noTransition:"plyr--no-transition",display:{time:"plyr__time"},menu:{value:"plyr__menu__value",badge:"plyr__badge",open:"plyr--menu-open"},captions:{enabled:"plyr--captions-enabled",active:"plyr--captions-active"},fullscreen:{enabled:"plyr--fullscreen-enabled",fallback:"plyr--fullscreen-fallback"},pip:{supported:"plyr--pip-supported",active:"plyr--pip-active"},airplay:{supported:"plyr--airplay-supported",active:"plyr--airplay-active"},tabFocus:"plyr__tab-focus",previewThumbnails:{thumbContainer:"plyr__preview-thumb",thumbContainerShown:"plyr__preview-thumb--is-shown",imageContainer:"plyr__preview-thumb__image-container",timeContainer:"plyr__preview-thumb__time-container",scrubbingContainer:"plyr__preview-scrubbing",scrubbingContainerShown:"plyr__preview-scrubbing--is-shown"}},attributes:{embed:{provider:"data-plyr-provider",id:"data-plyr-embed-id",hash:"data-plyr-embed-hash"}},ads:{enabled:!1,publisherId:"",tagUrl:""},previewThumbnails:{enabled:!1,src:""},vimeo:{byline:!1,portrait:!1,title:!1,speed:!0,transparent:!1,customControls:!0,referrerPolicy:null,premium:!1},youtube:{rel:0,showinfo:0,iv_load_policy:3,modestbranding:1,customControls:!0,noCookie:!1},mediaMetadata:{title:"",artist:"",album:"",artwork:[]},markers:{enabled:!1,points:[]}},cs={active:"picture-in-picture",inactive:"inline"},qe={html5:"html5",youtube:"youtube",vimeo:"vimeo"},hs={audio:"audio",video:"video"};function sp(t){return/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(t)?qe.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(t)?qe.vimeo:null}const ds=()=>{};class rp{constructor(e=!1){this.enabled=window.console&&e,this.enabled&&this.log("Debugging enabled")}get log(){return this.enabled?Function.prototype.bind.call(console.log,console):ds}get warn(){return this.enabled?Function.prototype.bind.call(console.warn,console):ds}get error(){return this.enabled?Function.prototype.bind.call(console.error,console):ds}}class Ve{constructor(e){_(this,"onChange",()=>{if(!this.enabled)return;const i=this.player.elements.buttons.fullscreen;h.element(i)&&(i.pressed=this.active);const s=this.target===this.player.media?this.target:this.player.elements.container;E.call(this.player,s,this.active?"enterfullscreen":"exitfullscreen",!0)}),_(this,"toggleFallback",(i=!1)=>{if(i?this.scrollPosition={x:window.scrollX||0,y:window.scrollY||0}:window.scrollTo(this.scrollPosition.x,this.scrollPosition.y),document.body.style.overflow=i?"hidden":"",W(this.target,this.player.config.classNames.fullscreen.fallback,i),re.isIos){let s=document.head.querySelector('meta[name="viewport"]');const r="viewport-fit=cover";s||(s=document.createElement("meta"),s.setAttribute("name","viewport"));const a=h.string(s.content)&&s.content.includes(r);i?(this.cleanupViewport=!a,a||(s.content+=`,${r}`)):this.cleanupViewport&&(s.content=s.content.split(",").filter(n=>n.trim()!==r).join(","))}this.onChange()}),_(this,"trapFocus",i=>{if(re.isIos||!this.active||i.key!=="Tab")return;const s=document.activeElement,r=xt.call(this.player,"a[href], button:not(:disabled), input:not(:disabled), [tabindex]"),[a]=r,n=r[r.length-1];s!==n||i.shiftKey?s===a&&i.shiftKey&&(n.focus(),i.preventDefault()):(a.focus(),i.preventDefault())}),_(this,"update",()=>{if(this.enabled){let i;i=this.forceFallback?"Fallback (forced)":Ve.native?"Native":"Fallback",this.player.debug.log(`${i} fullscreen enabled`)}else this.player.debug.log("Fullscreen not supported and fallback disabled");W(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.enabled)}),_(this,"enter",()=>{this.enabled&&(re.isIos&&this.player.config.fullscreen.iosNative?this.player.isVimeo?this.player.embed.requestFullscreen():this.target.webkitEnterFullscreen():!Ve.native||this.forceFallback?this.toggleFallback(!0):this.prefix?h.empty(this.prefix)||this.target[`${this.prefix}Request${this.property}`]():this.target.requestFullscreen({navigationUI:"hide"}))}),_(this,"exit",()=>{if(this.enabled)if(re.isIos&&this.player.config.fullscreen.iosNative)this.target.webkitExitFullscreen(),Be(this.player.play());else if(!Ve.native||this.forceFallback)this.toggleFallback(!1);else if(this.prefix){if(!h.empty(this.prefix)){const i=this.prefix==="moz"?"Cancel":"Exit";document[`${this.prefix}${i}${this.property}`]()}}else(document.cancelFullScreen||document.exitFullscreen).call(document)}),_(this,"toggle",()=>{this.active?this.exit():this.enter()}),this.player=e,this.prefix=Ve.prefix,this.property=Ve.property,this.scrollPosition={x:0,y:0},this.forceFallback=e.config.fullscreen.fallback==="force",this.player.elements.fullscreen=e.config.fullscreen.container&&Fu(this.player.elements.container,e.config.fullscreen.container),H.call(this.player,document,this.prefix==="ms"?"MSFullscreenChange":`${this.prefix}fullscreenchange`,()=>{this.onChange()}),H.call(this.player,this.player.elements.container,"dblclick",i=>{h.element(this.player.elements.controls)&&this.player.elements.controls.contains(i.target)||this.player.listeners.proxy(i,this.toggle,"fullscreen")}),H.call(this,this.player.elements.container,"keydown",i=>this.trapFocus(i)),this.update()}static get native(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}get usingNative(){return Ve.native&&!this.forceFallback}static get prefix(){if(h.function(document.exitFullscreen))return"";let e="";return["webkit","moz","ms"].some(i=>!(!h.function(document[`${i}ExitFullscreen`])&&!h.function(document[`${i}CancelFullScreen`]))&&(e=i,!0)),e}static get property(){return this.prefix==="moz"?"FullScreen":"Fullscreen"}get enabled(){return(Ve.native||this.player.config.fullscreen.fallback)&&this.player.config.fullscreen.enabled&&this.player.supported.ui&&this.player.isVideo}get active(){if(!this.enabled)return!1;if(!Ve.native||this.forceFallback)return ki(this.target,this.player.config.classNames.fullscreen.fallback);const e=this.prefix?this.target.getRootNode()[`${this.prefix}${this.property}Element`]:this.target.getRootNode().fullscreenElement;return e&&e.shadowRoot?e===this.target.getRootNode().host:e===this.target}get target(){return re.isIos&&this.player.config.fullscreen.iosNative?this.player.media:this.player.elements.fullscreen||this.player.elements.container}}function vi(t,e=1){return new Promise((i,s)=>{const r=new Image,a=()=>{delete r.onload,delete r.onerror,(r.naturalWidth>=e?i:s)(r)};Object.assign(r,{onload:a,onerror:a,src:t})})}const Z={addStyleHook(){W(this.elements.container,this.config.selectors.container.replace(".",""),!0),W(this.elements.container,this.config.classNames.uiSupported,this.supported.ui)},toggleNativeControls(t=!1){t&&this.isHTML5?this.media.setAttribute("controls",""):this.media.removeAttribute("controls")},build(){if(this.listeners.media(),!this.supported.ui)return this.debug.warn(`Basic support only for ${this.provider} ${this.type}`),void Z.toggleNativeControls.call(this,!0);h.element(this.elements.controls)||(S.inject.call(this),this.listeners.controls()),Z.toggleNativeControls.call(this),this.isHTML5&&F.setup.call(this),this.volume=null,this.muted=null,this.loop=null,this.quality=null,this.speed=null,S.updateVolume.call(this),S.timeUpdate.call(this),S.durationUpdate.call(this),Z.checkPlaying.call(this),W(this.elements.container,this.config.classNames.pip.supported,q.pip&&this.isHTML5&&this.isVideo),W(this.elements.container,this.config.classNames.airplay.supported,q.airplay&&this.isHTML5),W(this.elements.container,this.config.classNames.isIos,re.isIos),W(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout(()=>{E.call(this,this.media,"ready")},0),Z.setTitle.call(this),this.poster&&Z.setPoster.call(this,this.poster,!1).catch(()=>{}),this.config.duration&&S.durationUpdate.call(this),this.config.mediaMetadata&&S.setMediaMetadata.call(this)},setTitle(){let t=K.get("play",this.config);if(h.string(this.config.title)&&!h.empty(this.config.title)&&(t+=`, ${this.config.title}`),Array.from(this.elements.buttons.play||[]).forEach(e=>{e.setAttribute("aria-label",t)}),this.isEmbed){const e=X.call(this,"iframe");if(!h.element(e))return;const i=h.empty(this.config.title)?"video":this.config.title,s=K.get("frameTitle",this.config);e.setAttribute("title",s.replace("{title}",i))}},togglePoster(t){W(this.elements.container,this.config.classNames.posterEnabled,t)},setPoster(t,e=!0){return e&&this.poster?Promise.reject(new Error("Poster already set")):(this.media.setAttribute("data-poster",t),this.elements.poster.removeAttribute("hidden"),Qu.call(this).then(()=>vi(t)).catch(i=>{throw t===this.poster&&Z.togglePoster.call(this,!1),i}).then(()=>{if(t!==this.poster)throw new Error("setPoster cancelled by later call to setPoster")}).then(()=>(Object.assign(this.elements.poster.style,{backgroundImage:`url('${t}')`,backgroundSize:""}),Z.togglePoster.call(this,!0),t)))},checkPlaying(t){W(this.elements.container,this.config.classNames.playing,this.playing),W(this.elements.container,this.config.classNames.paused,this.paused),W(this.elements.container,this.config.classNames.stopped,this.stopped),Array.from(this.elements.buttons.play||[]).forEach(e=>{Object.assign(e,{pressed:this.playing}),e.setAttribute("aria-label",K.get(this.playing?"pause":"play",this.config))}),h.event(t)&&t.type==="timeupdate"||Z.toggleControls.call(this)},checkLoading(t){this.loading=["stalled","waiting"].includes(t.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout(()=>{W(this.elements.container,this.config.classNames.loading,this.loading),Z.toggleControls.call(this)},this.loading?250:0)},toggleControls(t){const{controls:e}=this.elements;if(e&&this.config.hideControls){const i=this.touch&&this.lastSeekTime+2e3>Date.now();this.toggleControls(Boolean(t||this.loading||this.paused||e.pressed||e.hover||i))}},migrateStyles(){Object.values(j({},this.media.style)).filter(t=>!h.empty(t)&&h.string(t)&&t.startsWith("--plyr")).forEach(t=>{this.elements.container.style.setProperty(t,this.media.style.getPropertyValue(t)),this.media.style.removeProperty(t)}),h.empty(this.media.style)&&this.media.removeAttribute("style")}};class ap{constructor(e){_(this,"firstTouch",()=>{const{player:i}=this,{elements:s}=i;i.touch=!0,W(s.container,i.config.classNames.isTouch,!0)}),_(this,"setTabFocus",i=>{const{player:s}=this,{elements:r}=s,{key:a,type:n,timeStamp:o}=i;if(clearTimeout(this.focusTimer),n==="keydown"&&a!=="Tab")return;n==="keydown"&&(this.lastKeyDown=o);const c=o-this.lastKeyDown<=20;(n!=="focus"||c)&&((()=>{const l=s.config.classNames.tabFocus;W(xt.call(s,`.${l}`),l,!1)})(),n!=="focusout"&&(this.focusTimer=setTimeout(()=>{const l=document.activeElement;r.container.contains(l)&&W(document.activeElement,s.config.classNames.tabFocus,!0)},10)))}),_(this,"global",(i=!0)=>{const{player:s}=this;s.config.keyboard.global&&Mt.call(s,window,"keydown keyup",this.handleKey,i,!1),Mt.call(s,document.body,"click",this.toggleMenu,i),hr.call(s,document.body,"touchstart",this.firstTouch),Mt.call(s,document.body,"keydown focus blur focusout",this.setTabFocus,i,!1,!0)}),_(this,"container",()=>{const{player:i}=this,{config:s,elements:r,timers:a}=i;!s.keyboard.global&&s.keyboard.focused&&H.call(i,r.container,"keydown keyup",this.handleKey,!1),H.call(i,r.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen",c=>{const{controls:l}=r;l&&c.type==="enterfullscreen"&&(l.pressed=!1,l.hover=!1);let d=0;["touchstart","touchmove","mousemove"].includes(c.type)&&(Z.toggleControls.call(i,!0),d=i.touch?3e3:2e3),clearTimeout(a.controls),a.controls=setTimeout(()=>Z.toggleControls.call(i,!1),d)});const n=()=>{if(!i.isVimeo||i.config.vimeo.premium)return;const c=r.wrapper,{active:l}=i.fullscreen,[d,u]=dr.call(i),p=eo(`aspect-ratio: ${d} / ${u}`);if(!l)return void(p?(c.style.width=null,c.style.height=null):(c.style.maxWidth=null,c.style.margin=null));const[m,g]=Gu(),f=m/g>d/u;p?(c.style.width=f?"auto":"100%",c.style.height=f?"100%":"auto"):(c.style.maxWidth=f?g/u*d+"px":null,c.style.margin=f?"0 auto":null)},o=()=>{clearTimeout(a.resized),a.resized=setTimeout(n,50)};H.call(i,r.container,"enterfullscreen exitfullscreen",c=>{const{target:l}=i.fullscreen;l===r.container&&(!i.isEmbed&&h.empty(i.config.ratio)||(n(),(c.type==="enterfullscreen"?H:Ui).call(i,window,"resize",o)))})}),_(this,"media",()=>{const{player:i}=this,{elements:s}=i;if(H.call(i,i.media,"timeupdate seeking seeked",a=>S.timeUpdate.call(i,a)),H.call(i,i.media,"durationchange loadeddata loadedmetadata",a=>S.durationUpdate.call(i,a)),H.call(i,i.media,"ended",()=>{i.isHTML5&&i.isVideo&&i.config.resetOnEnd&&(i.restart(),i.pause())}),H.call(i,i.media,"progress playing seeking seeked",a=>S.updateProgress.call(i,a)),H.call(i,i.media,"volumechange",a=>S.updateVolume.call(i,a)),H.call(i,i.media,"playing play pause ended emptied timeupdate",a=>Z.checkPlaying.call(i,a)),H.call(i,i.media,"waiting canplay seeked playing",a=>Z.checkLoading.call(i,a)),i.supported.ui&&i.config.clickToPlay&&!i.isAudio){const a=X.call(i,`.${i.config.classNames.video}`);if(!h.element(a))return;H.call(i,s.container,"click",n=>{([s.container,a].includes(n.target)||a.contains(n.target))&&(i.touch&&i.config.hideControls||(i.ended?(this.proxy(n,i.restart,"restart"),this.proxy(n,()=>{Be(i.play())},"play")):this.proxy(n,()=>{Be(i.togglePlay())},"play")))})}i.supported.ui&&i.config.disableContextMenu&&H.call(i,s.wrapper,"contextmenu",a=>{a.preventDefault()},!1),H.call(i,i.media,"volumechange",()=>{i.storage.set({volume:i.volume,muted:i.muted})}),H.call(i,i.media,"ratechange",()=>{S.updateSetting.call(i,"speed"),i.storage.set({speed:i.speed})}),H.call(i,i.media,"qualitychange",a=>{S.updateSetting.call(i,"quality",null,a.detail.quality)}),H.call(i,i.media,"ready qualitychange",()=>{S.setDownloadUrl.call(i)});const r=i.config.events.concat(["keyup","keydown"]).join(" ");H.call(i,i.media,r,a=>{let{detail:n={}}=a;a.type==="error"&&(n=i.media.error),E.call(i,s.container,a.type,!0,n)})}),_(this,"proxy",(i,s,r)=>{const{player:a}=this,n=a.config.listeners[r];let o=!0;h.function(n)&&(o=n.call(a,i)),o!==!1&&h.function(s)&&s.call(a,i)}),_(this,"bind",(i,s,r,a,n=!0)=>{const{player:o}=this,c=o.config.listeners[a],l=h.function(c);H.call(o,i,s,d=>this.proxy(d,r,a),n&&!l)}),_(this,"controls",()=>{const{player:i}=this,{elements:s}=i,r=re.isIE?"change":"input";if(s.buttons.play&&Array.from(s.buttons.play).forEach(a=>{this.bind(a,"click",()=>{Be(i.togglePlay())},"play")}),this.bind(s.buttons.restart,"click",i.restart,"restart"),this.bind(s.buttons.rewind,"click",()=>{i.lastSeekTime=Date.now(),i.rewind()},"rewind"),this.bind(s.buttons.fastForward,"click",()=>{i.lastSeekTime=Date.now(),i.forward()},"fastForward"),this.bind(s.buttons.mute,"click",()=>{i.muted=!i.muted},"mute"),this.bind(s.buttons.captions,"click",()=>i.toggleCaptions()),this.bind(s.buttons.download,"click",()=>{E.call(i,i.media,"download")},"download"),this.bind(s.buttons.fullscreen,"click",()=>{i.fullscreen.toggle()},"fullscreen"),this.bind(s.buttons.pip,"click",()=>{i.pip="toggle"},"pip"),this.bind(s.buttons.airplay,"click",i.airplay,"airplay"),this.bind(s.buttons.settings,"click",a=>{a.stopPropagation(),a.preventDefault(),S.toggleMenu.call(i,a)},null,!1),this.bind(s.buttons.settings,"keyup",a=>{["Space","Enter"].includes(a.key)&&(a.key!=="Enter"?(a.preventDefault(),a.stopPropagation(),S.toggleMenu.call(i,a)):S.focusFirstMenuItem.call(i,null,!0))},null,!1),this.bind(s.settings.menu,"keydown",a=>{a.key==="Escape"&&S.toggleMenu.call(i,a)}),this.bind(s.inputs.seek,"mousedown mousemove",a=>{const n=s.progress.getBoundingClientRect(),o=100/n.width*(a.pageX-n.left);a.currentTarget.setAttribute("seek-value",o)}),this.bind(s.inputs.seek,"mousedown mouseup keydown keyup touchstart touchend",a=>{const n=a.currentTarget,o="play-on-seeked";if(h.keyboardEvent(a)&&!["ArrowLeft","ArrowRight"].includes(a.key))return;i.lastSeekTime=Date.now();const c=n.hasAttribute(o),l=["mouseup","touchend","keyup"].includes(a.type);c&&l?(n.removeAttribute(o),Be(i.play())):!l&&i.playing&&(n.setAttribute(o,""),i.pause())}),re.isIos){const a=xt.call(i,'input[type="range"]');Array.from(a).forEach(n=>this.bind(n,r,o=>qn(o.target)))}this.bind(s.inputs.seek,r,a=>{const n=a.currentTarget;let o=n.getAttribute("seek-value");h.empty(o)&&(o=n.value),n.removeAttribute("seek-value"),i.currentTime=o/n.max*i.duration},"seek"),this.bind(s.progress,"mouseenter mouseleave mousemove",a=>S.updateSeekTooltip.call(i,a)),this.bind(s.progress,"mousemove touchmove",a=>{const{previewThumbnails:n}=i;n&&n.loaded&&n.startMove(a)}),this.bind(s.progress,"mouseleave touchend click",()=>{const{previewThumbnails:a}=i;a&&a.loaded&&a.endMove(!1,!0)}),this.bind(s.progress,"mousedown touchstart",a=>{const{previewThumbnails:n}=i;n&&n.loaded&&n.startScrubbing(a)}),this.bind(s.progress,"mouseup touchend",a=>{const{previewThumbnails:n}=i;n&&n.loaded&&n.endScrubbing(a)}),re.isWebkit&&Array.from(xt.call(i,'input[type="range"]')).forEach(a=>{this.bind(a,"input",n=>S.updateRangeFill.call(i,n.target))}),i.config.toggleInvert&&!h.element(s.display.duration)&&this.bind(s.display.currentTime,"click",()=>{i.currentTime!==0&&(i.config.invertTime=!i.config.invertTime,S.timeUpdate.call(i))}),this.bind(s.inputs.volume,r,a=>{i.volume=a.target.value},"volume"),this.bind(s.controls,"mouseenter mouseleave",a=>{s.controls.hover=!i.touch&&a.type==="mouseenter"}),s.fullscreen&&Array.from(s.fullscreen.children).filter(a=>!a.contains(s.container)).forEach(a=>{this.bind(a,"mouseenter mouseleave",n=>{s.controls&&(s.controls.hover=!i.touch&&n.type==="mouseenter")})}),this.bind(s.controls,"mousedown mouseup touchstart touchend touchcancel",a=>{s.controls.pressed=["mousedown","touchstart"].includes(a.type)}),this.bind(s.controls,"focusin",()=>{const{config:a,timers:n}=i;W(s.controls,a.classNames.noTransition,!0),Z.toggleControls.call(i,!0),setTimeout(()=>{W(s.controls,a.classNames.noTransition,!1)},0);const o=this.touch?3e3:4e3;clearTimeout(n.controls),n.controls=setTimeout(()=>Z.toggleControls.call(i,!1),o)}),this.bind(s.inputs.volume,"wheel",a=>{const n=a.webkitDirectionInvertedFromDevice,[o,c]=[a.deltaX,-a.deltaY].map(u=>n?-u:u),l=Math.sign(Math.abs(o)>Math.abs(c)?o:c);i.increaseVolume(l/50);const{volume:d}=i.media;(l===1&&d<1||l===-1&&d>0)&&a.preventDefault()},"volume",!1)}),this.player=e,this.lastKey=null,this.focusTimer=null,this.lastKeyDown=null,this.handleKey=this.handleKey.bind(this),this.toggleMenu=this.toggleMenu.bind(this),this.setTabFocus=this.setTabFocus.bind(this),this.firstTouch=this.firstTouch.bind(this)}handleKey(e){const{player:i}=this,{elements:s}=i,{key:r,type:a,altKey:n,ctrlKey:o,metaKey:c,shiftKey:l}=e,d=a==="keydown",u=d&&r===this.lastKey;if(!(n||o||c||l)&&!!r){if(d){const m=document.activeElement;if(h.element(m)){const{editable:g}=i.config.selectors,{seek:f}=s.inputs;if(m!==f&&ht(m,g)||e.key==="Space"&&ht(m,'button, [role^="menuitem"]'))return}switch(["Space","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","0","1","2","3","4","5","6","7","8","9","c","f","k","l","m"].includes(r)&&(e.preventDefault(),e.stopPropagation()),r){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":u||(p=parseInt(r,10),i.currentTime=i.duration/10*p);break;case"Space":case"k":u||Be(i.togglePlay());break;case"ArrowUp":i.increaseVolume(.1);break;case"ArrowDown":i.decreaseVolume(.1);break;case"m":u||(i.muted=!i.muted);break;case"ArrowRight":i.forward();break;case"ArrowLeft":i.rewind();break;case"f":i.fullscreen.toggle();break;case"c":u||i.toggleCaptions();break;case"l":i.loop=!i.loop}r==="Escape"&&!i.fullscreen.usingNative&&i.fullscreen.active&&i.fullscreen.toggle(),this.lastKey=r}else this.lastKey=null;var p}}toggleMenu(e){S.toggleMenu.call(this.player,e)}}function np(t,e){return t(e={exports:{}},e.exports),e.exports}var op=np(function(t,e){t.exports=function(){var i=function(){},s={},r={},a={};function n(p,m){p=p.push?p:[p];var g,f,b,v=[],x=p.length,y=x;for(g=function(k,z){z.length&&v.push(k),--y||m(v)};x--;)f=p[x],(b=r[f])?g(f,b):(a[f]=a[f]||[]).push(g)}function o(p,m){if(p){var g=a[p];if(r[p]=m,g)for(;g.length;)g[0](p,m),g.splice(0,1)}}function c(p,m){p.call&&(p={success:p}),m.length?(p.error||i)(m):(p.success||i)(p)}function l(p,m,g,f){var b,v,x=document,y=g.async,k=(g.numRetries||0)+1,z=g.before||i,T=p.replace(/[\?|#].*$/,""),O=p.replace(/^(css|img)!/,"");f=f||0,/(^css!|\.css$)/.test(T)?((v=x.createElement("link")).rel="stylesheet",v.href=O,(b="hideFocus"in v)&&v.relList&&(b=0,v.rel="preload",v.as="style")):/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(T)?(v=x.createElement("img")).src=O:((v=x.createElement("script")).src=p,v.async=y===void 0||y),v.onload=v.onerror=v.onbeforeload=function(te){var G=te.type[0];if(b)try{v.sheet.cssText.length||(G="e")}catch(xe){xe.code!=18&&(G="e")}if(G=="e"){if((f+=1)<k)return l(p,m,g,f)}else if(v.rel=="preload"&&v.as=="style")return v.rel="stylesheet";m(p,G,te.defaultPrevented)},z(p,v)!==!1&&x.head.appendChild(v)}function d(p,m,g){var f,b,v=(p=p.push?p:[p]).length,x=v,y=[];for(f=function(k,z,T){if(z=="e"&&y.push(k),z=="b"){if(!T)return;y.push(k)}--v||m(y)},b=0;b<x;b++)l(p[b],f,g)}function u(p,m,g){var f,b;if(m&&m.trim&&(f=m),b=(f?g:m)||{},f){if(f in s)throw"LoadJS";s[f]=!0}function v(x,y){d(p,function(k){c(b,k),x&&c({success:x,error:y},k),o(f,k)},b)}if(b.returnPromise)return new Promise(v);v()}return u.ready=function(p,m){return n(p,function(g){c(m,g)}),u},u.done=function(p){o(p,[])},u.reset=function(){s={},r={},a={}},u.isDefined=function(p){return p in s},u}()});function ur(t){return new Promise((e,i)=>{op(t,{success:e,error:i})})}function lp(t){return h.empty(t)?null:h.number(Number(t))?t:t.match(/^.*(vimeo.com\/|video\/)(\d+).*/)?RegExp.$2:t}function cp(t){const e=t.match(/^.*(vimeo.com\/|video\/)(\d+)(\?.*&*h=|\/)+([\d,a-f]+)/);return e&&e.length===5?e[4]:null}function Et(t){t&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===t&&(this.media.paused=!t,E.call(this,this.media,t?"play":"pause"))}const Ps={setup(){const t=this;W(t.elements.wrapper,t.config.classNames.embed,!0),t.options.speed=t.config.speed.options,It.call(t),h.object(window.Vimeo)?Ps.ready.call(t):ur(t.config.urls.vimeo.sdk).then(()=>{Ps.ready.call(t)}).catch(e=>{t.debug.warn("Vimeo SDK (player.js) failed to load",e)})},ready(){const t=this,e=t.config.vimeo,x=e,{premium:i,referrerPolicy:s}=x,r=vr(x,["premium","referrerPolicy"]);let a=t.media.getAttribute("src"),n="";h.empty(a)?(a=t.media.getAttribute(t.config.attributes.embed.id),n=t.media.getAttribute(t.config.attributes.embed.hash)):n=cp(a);const o=n?{h:n}:{};i&&Object.assign(r,{controls:!1,sidedock:!1});const c=oo(j(j({loop:t.config.loop.active,autoplay:t.autoplay,muted:t.muted,gesture:"media",playsinline:!this.config.fullscreen.iosNative},o),r)),l=lp(a),d=N("iframe"),u=Es(t.config.urls.vimeo.iframe,l,c);if(d.setAttribute("src",u),d.setAttribute("allowfullscreen",""),d.setAttribute("allow",["autoplay","fullscreen","picture-in-picture","encrypted-media","accelerometer","gyroscope"].join("; ")),h.empty(s)||d.setAttribute("referrerPolicy",s),i||!e.customControls)d.setAttribute("data-poster",t.poster),t.media=Ai(d,t.media);else{const y=N("div",{class:t.config.classNames.embedContainer,"data-poster":t.poster});y.appendChild(d),t.media=Ai(y,t.media)}e.customControls||ri(Es(t.config.urls.vimeo.api,u)).then(y=>{!h.empty(y)&&y.thumbnail_url&&Z.setPoster.call(t,y.thumbnail_url).catch(()=>{})}),t.embed=new window.Vimeo.Player(d,{autopause:t.config.autopause,muted:t.muted}),t.media.paused=!0,t.media.currentTime=0,t.supported.ui&&t.embed.disableTextTrack(),t.media.play=()=>(Et.call(t,!0),t.embed.play()),t.media.pause=()=>(Et.call(t,!1),t.embed.pause()),t.media.stop=()=>{t.pause(),t.currentTime=0};let{currentTime:p}=t.media;Object.defineProperty(t.media,"currentTime",{get:()=>p,set(y){const{embed:k,media:z,paused:T,volume:O}=t,te=T&&!k.hasPlayed;z.seeking=!0,E.call(t,z,"seeking"),Promise.resolve(te&&k.setVolume(0)).then(()=>k.setCurrentTime(y)).then(()=>te&&k.pause()).then(()=>te&&k.setVolume(O)).catch(()=>{})}});let m=t.config.speed.selected;Object.defineProperty(t.media,"playbackRate",{get:()=>m,set(y){t.embed.setPlaybackRate(y).then(()=>{m=y,E.call(t,t.media,"ratechange")}).catch(()=>{t.options.speed=[1]})}});let{volume:g}=t.config;Object.defineProperty(t.media,"volume",{get:()=>g,set(y){t.embed.setVolume(y).then(()=>{g=y,E.call(t,t.media,"volumechange")})}});let{muted:f}=t.config;Object.defineProperty(t.media,"muted",{get:()=>f,set(y){const k=!!h.boolean(y)&&y;t.embed.setVolume(k?0:t.config.volume).then(()=>{f=k,E.call(t,t.media,"volumechange")})}});let b,{loop:v}=t.config;Object.defineProperty(t.media,"loop",{get:()=>v,set(y){const k=h.boolean(y)?y:t.config.loop.active;t.embed.setLoop(k).then(()=>{v=k})}}),t.embed.getVideoUrl().then(y=>{b=y,S.setDownloadUrl.call(t)}).catch(y=>{this.debug.warn(y)}),Object.defineProperty(t.media,"currentSrc",{get:()=>b}),Object.defineProperty(t.media,"ended",{get:()=>t.currentTime===t.duration}),Promise.all([t.embed.getVideoWidth(),t.embed.getVideoHeight()]).then(y=>{const[k,z]=y;t.embed.ratio=io(k,z),It.call(this)}),t.embed.setAutopause(t.config.autopause).then(y=>{t.config.autopause=y}),t.embed.getVideoTitle().then(y=>{t.config.title=y,Z.setTitle.call(this)}),t.embed.getCurrentTime().then(y=>{p=y,E.call(t,t.media,"timeupdate")}),t.embed.getDuration().then(y=>{t.media.duration=y,E.call(t,t.media,"durationchange")}),t.embed.getTextTracks().then(y=>{t.media.textTracks=y,F.setup.call(t)}),t.embed.on("cuechange",({cues:y=[]})=>{const k=y.map(z=>ep(z.text));F.updateCues.call(t,k)}),t.embed.on("loaded",()=>{t.embed.getPaused().then(y=>{Et.call(t,!y),y||E.call(t,t.media,"playing")}),h.element(t.embed.element)&&t.supported.ui&&t.embed.element.setAttribute("tabindex",-1)}),t.embed.on("bufferstart",()=>{E.call(t,t.media,"waiting")}),t.embed.on("bufferend",()=>{E.call(t,t.media,"playing")}),t.embed.on("play",()=>{Et.call(t,!0),E.call(t,t.media,"playing")}),t.embed.on("pause",()=>{Et.call(t,!1)}),t.embed.on("timeupdate",y=>{t.media.seeking=!1,p=y.seconds,E.call(t,t.media,"timeupdate")}),t.embed.on("progress",y=>{t.media.buffered=y.percent,E.call(t,t.media,"progress"),parseInt(y.percent,10)===1&&E.call(t,t.media,"canplaythrough"),t.embed.getDuration().then(k=>{k!==t.media.duration&&(t.media.duration=k,E.call(t,t.media,"durationchange"))})}),t.embed.on("seeked",()=>{t.media.seeking=!1,E.call(t,t.media,"seeked")}),t.embed.on("ended",()=>{t.media.paused=!0,E.call(t,t.media,"ended")}),t.embed.on("error",y=>{t.media.error=y,E.call(t,t.media,"error")}),e.customControls&&setTimeout(()=>Z.build.call(t),0)}};function hp(t){return h.empty(t)?null:t.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)?RegExp.$2:t}function Pt(t){t&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===t&&(this.media.paused=!t,E.call(this,this.media,t?"play":"pause"))}function dp(t){return t.noCookie?"https://www.youtube-nocookie.com":window.location.protocol==="http:"?"http://www.youtube.com":void 0}const xi={setup(){if(W(this.elements.wrapper,this.config.classNames.embed,!0),h.object(window.YT)&&h.function(window.YT.Player))xi.ready.call(this);else{const t=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=()=>{h.function(t)&&t(),xi.ready.call(this)},ur(this.config.urls.youtube.sdk).catch(e=>{this.debug.warn("YouTube API failed to load",e)})}},getTitle(t){ri(Es(this.config.urls.youtube.api,t)).then(e=>{if(h.object(e)){const{title:i,height:s,width:r}=e;this.config.title=i,Z.setTitle.call(this),this.embed.ratio=io(r,s)}It.call(this)}).catch(()=>{It.call(this)})},ready(){const t=this,e=t.config.youtube,i=t.media&&t.media.getAttribute("id");if(!h.empty(i)&&i.startsWith("youtube-"))return;let s=t.media.getAttribute("src");h.empty(s)&&(s=t.media.getAttribute(this.config.attributes.embed.id));const r=hp(s),a=N("div",{id:qu(t.provider),"data-poster":e.customControls?t.poster:void 0});if(t.media=Ai(a,t.media),e.customControls){const n=o=>`https://i.ytimg.com/vi/${r}/${o}default.jpg`;vi(n("maxres"),121).catch(()=>vi(n("sd"),121)).catch(()=>vi(n("hq"))).then(o=>Z.setPoster.call(t,o.src)).then(o=>{o.includes("maxres")||(t.elements.poster.style.backgroundSize="cover")}).catch(()=>{})}t.embed=new window.YT.Player(t.media,{videoId:r,host:dp(e),playerVars:J({},{autoplay:t.config.autoplay?1:0,hl:t.config.hl,controls:t.supported.ui&&e.customControls?0:1,disablekb:1,playsinline:t.config.fullscreen.iosNative?0:1,cc_load_policy:t.captions.active?1:0,cc_lang_pref:t.config.captions.language,widget_referrer:window?window.location.href:null},e),events:{onError(n){if(!t.media.error){const o=n.data,c={2:"The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.",5:"The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.",100:"The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.",101:"The owner of the requested video does not allow it to be played in embedded players.",150:"The owner of the requested video does not allow it to be played in embedded players."}[o]||"An unknown error occured";t.media.error={code:o,message:c},E.call(t,t.media,"error")}},onPlaybackRateChange(n){const o=n.target;t.media.playbackRate=o.getPlaybackRate(),E.call(t,t.media,"ratechange")},onReady(n){if(h.function(t.media.play))return;const o=n.target;xi.getTitle.call(t,r),t.media.play=()=>{Pt.call(t,!0),o.playVideo()},t.media.pause=()=>{Pt.call(t,!1),o.pauseVideo()},t.media.stop=()=>{o.stopVideo()},t.media.duration=o.getDuration(),t.media.paused=!0,t.media.currentTime=0,Object.defineProperty(t.media,"currentTime",{get:()=>Number(o.getCurrentTime()),set(u){t.paused&&!t.embed.hasPlayed&&t.embed.mute(),t.media.seeking=!0,E.call(t,t.media,"seeking"),o.seekTo(u)}}),Object.defineProperty(t.media,"playbackRate",{get:()=>o.getPlaybackRate(),set(u){o.setPlaybackRate(u)}});let{volume:c}=t.config;Object.defineProperty(t.media,"volume",{get:()=>c,set(u){c=u,o.setVolume(100*c),E.call(t,t.media,"volumechange")}});let{muted:l}=t.config;Object.defineProperty(t.media,"muted",{get:()=>l,set(u){const p=h.boolean(u)?u:l;l=p,o[p?"mute":"unMute"](),o.setVolume(100*c),E.call(t,t.media,"volumechange")}}),Object.defineProperty(t.media,"currentSrc",{get:()=>o.getVideoUrl()}),Object.defineProperty(t.media,"ended",{get:()=>t.currentTime===t.duration});const d=o.getAvailablePlaybackRates();t.options.speed=d.filter(u=>t.config.speed.options.includes(u)),t.supported.ui&&e.customControls&&t.media.setAttribute("tabindex",-1),E.call(t,t.media,"timeupdate"),E.call(t,t.media,"durationchange"),clearInterval(t.timers.buffering),t.timers.buffering=setInterval(()=>{t.media.buffered=o.getVideoLoadedFraction(),(t.media.lastBuffered===null||t.media.lastBuffered<t.media.buffered)&&E.call(t,t.media,"progress"),t.media.lastBuffered=t.media.buffered,t.media.buffered===1&&(clearInterval(t.timers.buffering),E.call(t,t.media,"canplaythrough"))},200),e.customControls&&setTimeout(()=>Z.build.call(t),50)},onStateChange(n){const o=n.target;switch(clearInterval(t.timers.playing),t.media.seeking&&[1,2].includes(n.data)&&(t.media.seeking=!1,E.call(t,t.media,"seeked")),n.data){case-1:E.call(t,t.media,"timeupdate"),t.media.buffered=o.getVideoLoadedFraction(),E.call(t,t.media,"progress");break;case 0:Pt.call(t,!1),t.media.loop?(o.stopVideo(),o.playVideo()):E.call(t,t.media,"ended");break;case 1:e.customControls&&!t.config.autoplay&&t.media.paused&&!t.embed.hasPlayed?t.media.pause():(Pt.call(t,!0),E.call(t,t.media,"playing"),t.timers.playing=setInterval(()=>{E.call(t,t.media,"timeupdate")},50),t.media.duration!==o.getDuration()&&(t.media.duration=o.getDuration(),E.call(t,t.media,"durationchange")));break;case 2:t.muted||t.embed.unMute(),Pt.call(t,!1);break;case 3:E.call(t,t.media,"waiting")}E.call(t,t.elements.container,"statechange",!1,{code:n.data})}}})}},co={setup(){this.media?(W(this.elements.container,this.config.classNames.type.replace("{0}",this.type),!0),W(this.elements.container,this.config.classNames.provider.replace("{0}",this.provider),!0),this.isEmbed&&W(this.elements.container,this.config.classNames.type.replace("{0}","video"),!0),this.isVideo&&(this.elements.wrapper=N("div",{class:this.config.classNames.video}),Xn(this.media,this.elements.wrapper),this.elements.poster=N("div",{class:this.config.classNames.poster}),this.elements.wrapper.appendChild(this.elements.poster)),this.isHTML5?Ke.setup.call(this):this.isYouTube?xi.setup.call(this):this.isVimeo&&Ps.setup.call(this)):this.debug.warn("No media element found!")}};class up{constructor(e){_(this,"load",()=>{this.enabled&&(h.object(window.google)&&h.object(window.google.ima)?this.ready():ur(this.player.config.urls.googleIMA.sdk).then(()=>{this.ready()}).catch(()=>{this.trigger("error",new Error("Google IMA SDK failed to load"))}))}),_(this,"ready",()=>{var i;this.enabled||((i=this).manager&&i.manager.destroy(),i.elements.displayContainer&&i.elements.displayContainer.destroy(),i.elements.container.remove()),this.startSafetyTimer(12e3,"ready()"),this.managerPromise.then(()=>{this.clearSafetyTimer("onAdsManagerLoaded()")}),this.listeners(),this.setupIMA()}),_(this,"setupIMA",()=>{this.elements.container=N("div",{class:this.player.config.classNames.ads}),this.player.elements.container.appendChild(this.elements.container),google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),google.ima.settings.setLocale(this.player.config.ads.language),google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.player.config.playsinline),this.elements.displayContainer=new google.ima.AdDisplayContainer(this.elements.container,this.player.media),this.loader=new google.ima.AdsLoader(this.elements.displayContainer),this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,i=>this.onAdsManagerLoaded(i),!1),this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,i=>this.onAdError(i),!1),this.requestAds()}),_(this,"requestAds",()=>{const{container:i}=this.player.elements;try{const s=new google.ima.AdsRequest;s.adTagUrl=this.tagUrl,s.linearAdSlotWidth=i.offsetWidth,s.linearAdSlotHeight=i.offsetHeight,s.nonLinearAdSlotWidth=i.offsetWidth,s.nonLinearAdSlotHeight=i.offsetHeight,s.forceNonLinearFullSlot=!1,s.setAdWillPlayMuted(!this.player.muted),this.loader.requestAds(s)}catch(s){this.onAdError(s)}}),_(this,"pollCountdown",(i=!1)=>{if(!i)return clearInterval(this.countdownTimer),void this.elements.container.removeAttribute("data-badge-text");this.countdownTimer=setInterval(()=>{const s=Wi(Math.max(this.manager.getRemainingTime(),0)),r=`${K.get("advertisement",this.player.config)} - ${s}`;this.elements.container.setAttribute("data-badge-text",r)},100)}),_(this,"onAdsManagerLoaded",i=>{if(!this.enabled)return;const s=new google.ima.AdsRenderingSettings;s.restoreCustomPlaybackStateOnAdBreakComplete=!0,s.enablePreloading=!0,this.manager=i.getAdsManager(this.player,s),this.cuePoints=this.manager.getCuePoints(),this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,r=>this.onAdError(r)),Object.keys(google.ima.AdEvent.Type).forEach(r=>{this.manager.addEventListener(google.ima.AdEvent.Type[r],a=>this.onAdEvent(a))}),this.trigger("loaded")}),_(this,"addCuePoints",()=>{h.empty(this.cuePoints)||this.cuePoints.forEach(i=>{if(i!==0&&i!==-1&&i<this.player.duration){const s=this.player.elements.progress;if(h.element(s)){const r=100/this.player.duration*i,a=N("span",{class:this.player.config.classNames.cues});a.style.left=`${r.toString()}%`,s.appendChild(a)}}})}),_(this,"onAdEvent",i=>{const{container:s}=this.player.elements,r=i.getAd(),a=i.getAdData();switch((n=>{E.call(this.player,this.player.media,`ads${n.replace(/_/g,"").toLowerCase()}`)})(i.type),i.type){case google.ima.AdEvent.Type.LOADED:this.trigger("loaded"),this.pollCountdown(!0),r.isLinear()||(r.width=s.offsetWidth,r.height=s.offsetHeight);break;case google.ima.AdEvent.Type.STARTED:this.manager.setVolume(this.player.volume);break;case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:this.player.ended?this.loadAds():this.loader.contentComplete();break;case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:this.pauseContent();break;case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:this.pollCountdown(),this.resumeContent();break;case google.ima.AdEvent.Type.LOG:a.adError&&this.player.debug.warn(`Non-fatal ad error: ${a.adError.getMessage()}`)}}),_(this,"onAdError",i=>{this.cancel(),this.player.debug.warn("Ads error",i)}),_(this,"listeners",()=>{const{container:i}=this.player.elements;let s;this.player.on("canplay",()=>{this.addCuePoints()}),this.player.on("ended",()=>{this.loader.contentComplete()}),this.player.on("timeupdate",()=>{s=this.player.currentTime}),this.player.on("seeked",()=>{const r=this.player.currentTime;h.empty(this.cuePoints)||this.cuePoints.forEach((a,n)=>{s<a&&a<r&&(this.manager.discardAdBreak(),this.cuePoints.splice(n,1))})}),window.addEventListener("resize",()=>{this.manager&&this.manager.resize(i.offsetWidth,i.offsetHeight,google.ima.ViewMode.NORMAL)})}),_(this,"play",()=>{const{container:i}=this.player.elements;this.managerPromise||this.resumeContent(),this.managerPromise.then(()=>{this.manager.setVolume(this.player.volume),this.elements.displayContainer.initialize();try{this.initialized||(this.manager.init(i.offsetWidth,i.offsetHeight,google.ima.ViewMode.NORMAL),this.manager.start()),this.initialized=!0}catch(s){this.onAdError(s)}}).catch(()=>{})}),_(this,"resumeContent",()=>{this.elements.container.style.zIndex="",this.playing=!1,Be(this.player.media.play())}),_(this,"pauseContent",()=>{this.elements.container.style.zIndex=3,this.playing=!0,this.player.media.pause()}),_(this,"cancel",()=>{this.initialized&&this.resumeContent(),this.trigger("error"),this.loadAds()}),_(this,"loadAds",()=>{this.managerPromise.then(()=>{this.manager&&this.manager.destroy(),this.managerPromise=new Promise(i=>{this.on("loaded",i),this.player.debug.log(this.manager)}),this.initialized=!1,this.requestAds()}).catch(()=>{})}),_(this,"trigger",(i,...s)=>{const r=this.events[i];h.array(r)&&r.forEach(a=>{h.function(a)&&a.apply(this,s)})}),_(this,"on",(i,s)=>(h.array(this.events[i])||(this.events[i]=[]),this.events[i].push(s),this)),_(this,"startSafetyTimer",(i,s)=>{this.player.debug.log(`Safety timer invoked from: ${s}`),this.safetyTimer=setTimeout(()=>{this.cancel(),this.clearSafetyTimer("startSafetyTimer()")},i)}),_(this,"clearSafetyTimer",i=>{h.nullOrUndefined(this.safetyTimer)||(this.player.debug.log(`Safety timer cleared from: ${i}`),clearTimeout(this.safetyTimer),this.safetyTimer=null)}),this.player=e,this.config=e.config.ads,this.playing=!1,this.initialized=!1,this.elements={container:null,displayContainer:null},this.manager=null,this.loader=null,this.cuePoints=null,this.events={},this.safetyTimer=null,this.countdownTimer=null,this.managerPromise=new Promise((i,s)=>{this.on("loaded",i),this.on("error",s)}),this.load()}get enabled(){const{config:e}=this;return this.player.isHTML5&&this.player.isVideo&&e.enabled&&(!h.empty(e.publisherId)||h.url(e.tagUrl))}get tagUrl(){const{config:e}=this;return h.url(e.tagUrl)?e.tagUrl:`https://go.aniview.com/api/adserver6/vast/?${oo({AV_PUBLISHERID:"58c25bb0073ef448b1087ad6",AV_CHANNELID:"5a0458dc28a06145e4519d21",AV_URL:window.location.hostname,cb:Date.now(),AV_WIDTH:640,AV_HEIGHT:480,AV_CDIM2:e.publisherId})}`}}function ho(t=0,e=0,i=255){return Math.min(Math.max(t,e),i)}const pp=t=>{const e=[];return t.split(/\r\n\r\n|\n\n|\r\r/).forEach(i=>{const s={};i.split(/\r\n|\n|\r/).forEach(r=>{if(h.number(s.startTime)){if(!h.empty(r.trim())&&h.empty(s.text)){const a=r.trim().split("#xywh=");[s.text]=a,a[1]&&([s.x,s.y,s.w,s.h]=a[1].split(","))}}else{const a=r.match(/([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})( ?--> ?)([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})/);a&&(s.startTime=60*Number(a[1]||0)*60+60*Number(a[2])+Number(a[3])+Number(`0.${a[4]}`),s.endTime=60*Number(a[6]||0)*60+60*Number(a[7])+Number(a[8])+Number(`0.${a[9]}`))}}),s.text&&e.push(s)}),e},ca=(t,e)=>{const i={};return t>e.width/e.height?(i.width=e.width,i.height=1/t*e.width):(i.height=e.height,i.width=t*e.height),i};class zs{constructor(e){_(this,"load",()=>{this.player.elements.display.seekTooltip&&(this.player.elements.display.seekTooltip.hidden=this.enabled),this.enabled&&this.getThumbnails().then(()=>{this.enabled&&(this.render(),this.determineContainerAutoSizing(),this.loaded=!0)})}),_(this,"getThumbnails",()=>new Promise(i=>{const{src:s}=this.player.config.previewThumbnails;if(h.empty(s))throw new Error("Missing previewThumbnails.src config attribute");const r=()=>{this.thumbnails.sort((a,n)=>a.height-n.height),this.player.debug.log("Preview thumbnails",this.thumbnails),i()};if(h.function(s))s(a=>{this.thumbnails=a,r()});else{const a=(h.string(s)?[s]:s).map(n=>this.getThumbnail(n));Promise.all(a).then(r)}})),_(this,"getThumbnail",i=>new Promise(s=>{ri(i).then(r=>{const a={frames:pp(r),height:null,urlPrefix:""};a.frames[0].text.startsWith("/")||a.frames[0].text.startsWith("http://")||a.frames[0].text.startsWith("https://")||(a.urlPrefix=i.substring(0,i.lastIndexOf("/")+1));const n=new Image;n.onload=()=>{a.height=n.naturalHeight,a.width=n.naturalWidth,this.thumbnails.push(a),s()},n.src=a.urlPrefix+a.frames[0].text})})),_(this,"startMove",i=>{if(this.loaded&&h.event(i)&&["touchmove","mousemove"].includes(i.type)&&this.player.media.duration){if(i.type==="touchmove")this.seekTime=this.player.media.duration*(this.player.elements.inputs.seek.value/100);else{var s,r;const a=this.player.elements.progress.getBoundingClientRect(),n=100/a.width*(i.pageX-a.left);this.seekTime=this.player.media.duration*(n/100),this.seekTime<0&&(this.seekTime=0),this.seekTime>this.player.media.duration-1&&(this.seekTime=this.player.media.duration-1),this.mousePosX=i.pageX,this.elements.thumb.time.innerText=Wi(this.seekTime);const o=(s=this.player.config.markers)===null||s===void 0||(r=s.points)===null||r===void 0?void 0:r.find(({time:c})=>c===Math.round(this.seekTime));o&&this.elements.thumb.time.insertAdjacentHTML("afterbegin",`${o.label}<br>`)}this.showImageAtCurrentTime()}}),_(this,"endMove",()=>{this.toggleThumbContainer(!1,!0)}),_(this,"startScrubbing",i=>{(h.nullOrUndefined(i.button)||i.button===!1||i.button===0)&&(this.mouseDown=!0,this.player.media.duration&&(this.toggleScrubbingContainer(!0),this.toggleThumbContainer(!1,!0),this.showImageAtCurrentTime()))}),_(this,"endScrubbing",()=>{this.mouseDown=!1,Math.ceil(this.lastTime)===Math.ceil(this.player.media.currentTime)?this.toggleScrubbingContainer(!1):hr.call(this.player,this.player.media,"timeupdate",()=>{this.mouseDown||this.toggleScrubbingContainer(!1)})}),_(this,"listeners",()=>{this.player.on("play",()=>{this.toggleThumbContainer(!1,!0)}),this.player.on("seeked",()=>{this.toggleThumbContainer(!1)}),this.player.on("timeupdate",()=>{this.lastTime=this.player.media.currentTime})}),_(this,"render",()=>{this.elements.thumb.container=N("div",{class:this.player.config.classNames.previewThumbnails.thumbContainer}),this.elements.thumb.imageContainer=N("div",{class:this.player.config.classNames.previewThumbnails.imageContainer}),this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);const i=N("div",{class:this.player.config.classNames.previewThumbnails.timeContainer});this.elements.thumb.time=N("span",{},"00:00"),i.appendChild(this.elements.thumb.time),this.elements.thumb.imageContainer.appendChild(i),h.element(this.player.elements.progress)&&this.player.elements.progress.appendChild(this.elements.thumb.container),this.elements.scrubbing.container=N("div",{class:this.player.config.classNames.previewThumbnails.scrubbingContainer}),this.player.elements.wrapper.appendChild(this.elements.scrubbing.container)}),_(this,"destroy",()=>{this.elements.thumb.container&&this.elements.thumb.container.remove(),this.elements.scrubbing.container&&this.elements.scrubbing.container.remove()}),_(this,"showImageAtCurrentTime",()=>{this.mouseDown?this.setScrubbingContainerSize():this.setThumbContainerSizeAndPos();const i=this.thumbnails[0].frames.findIndex(a=>this.seekTime>=a.startTime&&this.seekTime<=a.endTime),s=i>=0;let r=0;this.mouseDown||this.toggleThumbContainer(s),s&&(this.thumbnails.forEach((a,n)=>{this.loadedImages.includes(a.frames[i].text)&&(r=n)}),i!==this.showingThumb&&(this.showingThumb=i,this.loadImage(r)))}),_(this,"loadImage",(i=0)=>{const s=this.showingThumb,r=this.thumbnails[i],{urlPrefix:a}=r,n=r.frames[s],o=r.frames[s].text,c=a+o;if(this.currentImageElement&&this.currentImageElement.dataset.filename===o)this.showImage(this.currentImageElement,n,i,s,o,!1),this.currentImageElement.dataset.index=s,this.removeOldImages(this.currentImageElement);else{this.loadingImage&&this.usingSprites&&(this.loadingImage.onload=null);const l=new Image;l.src=c,l.dataset.index=s,l.dataset.filename=o,this.showingThumbFilename=o,this.player.debug.log(`Loading image: ${c}`),l.onload=()=>this.showImage(l,n,i,s,o,!0),this.loadingImage=l,this.removeOldImages(l)}}),_(this,"showImage",(i,s,r,a,n,o=!0)=>{this.player.debug.log(`Showing thumb: ${n}. num: ${a}. qual: ${r}. newimg: ${o}`),this.setImageSizeAndOffset(i,s),o&&(this.currentImageContainer.appendChild(i),this.currentImageElement=i,this.loadedImages.includes(n)||this.loadedImages.push(n)),this.preloadNearby(a,!0).then(this.preloadNearby(a,!1)).then(this.getHigherQuality(r,i,s,n))}),_(this,"removeOldImages",i=>{Array.from(this.currentImageContainer.children).forEach(s=>{if(s.tagName.toLowerCase()!=="img")return;const r=this.usingSprites?500:1e3;if(s.dataset.index!==i.dataset.index&&!s.dataset.deleting){s.dataset.deleting=!0;const{currentImageContainer:a}=this;setTimeout(()=>{a.removeChild(s),this.player.debug.log(`Removing thumb: ${s.dataset.filename}`)},r)}})}),_(this,"preloadNearby",(i,s=!0)=>new Promise(r=>{setTimeout(()=>{const a=this.thumbnails[0].frames[i].text;if(this.showingThumbFilename===a){let n;n=s?this.thumbnails[0].frames.slice(i):this.thumbnails[0].frames.slice(0,i).reverse();let o=!1;n.forEach(c=>{const l=c.text;if(l!==a&&!this.loadedImages.includes(l)){o=!0,this.player.debug.log(`Preloading thumb filename: ${l}`);const{urlPrefix:d}=this.thumbnails[0],u=d+l,p=new Image;p.src=u,p.onload=()=>{this.player.debug.log(`Preloaded thumb filename: ${l}`),this.loadedImages.includes(l)||this.loadedImages.push(l),r()}}}),o||r()}},300)})),_(this,"getHigherQuality",(i,s,r,a)=>{if(i<this.thumbnails.length-1){let n=s.naturalHeight;this.usingSprites&&(n=r.h),n<this.thumbContainerHeight&&setTimeout(()=>{this.showingThumbFilename===a&&(this.player.debug.log(`Showing higher quality thumb for: ${a}`),this.loadImage(i+1))},300)}}),_(this,"toggleThumbContainer",(i=!1,s=!1)=>{const r=this.player.config.classNames.previewThumbnails.thumbContainerShown;this.elements.thumb.container.classList.toggle(r,i),!i&&s&&(this.showingThumb=null,this.showingThumbFilename=null)}),_(this,"toggleScrubbingContainer",(i=!1)=>{const s=this.player.config.classNames.previewThumbnails.scrubbingContainerShown;this.elements.scrubbing.container.classList.toggle(s,i),i||(this.showingThumb=null,this.showingThumbFilename=null)}),_(this,"determineContainerAutoSizing",()=>{(this.elements.thumb.imageContainer.clientHeight>20||this.elements.thumb.imageContainer.clientWidth>20)&&(this.sizeSpecifiedInCSS=!0)}),_(this,"setThumbContainerSizeAndPos",()=>{const{imageContainer:i}=this.elements.thumb;if(this.sizeSpecifiedInCSS){if(i.clientHeight>20&&i.clientWidth<20){const s=Math.floor(i.clientHeight*this.thumbAspectRatio);i.style.width=`${s}px`}else if(i.clientHeight<20&&i.clientWidth>20){const s=Math.floor(i.clientWidth/this.thumbAspectRatio);i.style.height=`${s}px`}}else{const s=Math.floor(this.thumbContainerHeight*this.thumbAspectRatio);i.style.height=`${this.thumbContainerHeight}px`,i.style.width=`${s}px`}this.setThumbContainerPos()}),_(this,"setThumbContainerPos",()=>{const i=this.player.elements.progress.getBoundingClientRect(),s=this.player.elements.container.getBoundingClientRect(),{container:r}=this.elements.thumb,a=s.left-i.left+10,n=s.right-i.left-r.clientWidth-10,o=this.mousePosX-i.left-r.clientWidth/2,c=ho(o,a,n);r.style.left=`${c}px`,r.style.setProperty("--preview-arrow-offset",o-c+"px")}),_(this,"setScrubbingContainerSize",()=>{const{width:i,height:s}=ca(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});this.elements.scrubbing.container.style.width=`${i}px`,this.elements.scrubbing.container.style.height=`${s}px`}),_(this,"setImageSizeAndOffset",(i,s)=>{if(!this.usingSprites)return;const r=this.thumbContainerHeight/s.h;i.style.height=i.naturalHeight*r+"px",i.style.width=i.naturalWidth*r+"px",i.style.left=`-${s.x*r}px`,i.style.top=`-${s.y*r}px`}),this.player=e,this.thumbnails=[],this.loaded=!1,this.lastMouseMoveTime=Date.now(),this.mouseDown=!1,this.loadedImages=[],this.elements={thumb:{},scrubbing:{}},this.load()}get enabled(){return this.player.isHTML5&&this.player.isVideo&&this.player.config.previewThumbnails.enabled}get currentImageContainer(){return this.mouseDown?this.elements.scrubbing.container:this.elements.thumb.imageContainer}get usingSprites(){return Object.keys(this.thumbnails[0].frames[0]).includes("w")}get thumbAspectRatio(){return this.usingSprites?this.thumbnails[0].frames[0].w/this.thumbnails[0].frames[0].h:this.thumbnails[0].width/this.thumbnails[0].height}get thumbContainerHeight(){if(this.mouseDown){const{height:e}=ca(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});return e}return this.sizeSpecifiedInCSS?this.elements.thumb.imageContainer.clientHeight:Math.floor(this.player.media.clientWidth/this.thumbAspectRatio/4)}get currentImageElement(){return this.mouseDown?this.currentScrubbingImageElement:this.currentThumbnailImageElement}set currentImageElement(e){this.mouseDown?this.currentScrubbingImageElement=e:this.currentThumbnailImageElement=e}}const Ds={insertElements(t,e){h.string(e)?aa(t,this.media,{src:e}):h.array(e)&&e.forEach(i=>{aa(t,this.media,i)})},change(t){Jn(t,"sources.length")?(Ke.cancelRequests.call(this),this.destroy.call(this,()=>{this.options.quality=[],He(this.media),this.media=null,h.element(this.elements.container)&&this.elements.container.removeAttribute("class");const{sources:e,type:i}=t,[{provider:s=qe.html5,src:r}]=e,a=s==="html5"?i:"div",n=s==="html5"?{}:{src:r};Object.assign(this,{provider:s,type:i,supported:q.check(i,s,this.config.playsinline),media:N(a,n)}),this.elements.container.appendChild(this.media),h.boolean(t.autoplay)&&(this.config.autoplay=t.autoplay),this.isHTML5&&(this.config.crossorigin&&this.media.setAttribute("crossorigin",""),this.config.autoplay&&this.media.setAttribute("autoplay",""),h.empty(t.poster)||(this.poster=t.poster),this.config.loop.active&&this.media.setAttribute("loop",""),this.config.muted&&this.media.setAttribute("muted",""),this.config.playsinline&&this.media.setAttribute("playsinline","")),Z.addStyleHook.call(this),this.isHTML5&&Ds.insertElements.call(this,"source",e),this.config.title=t.title,co.setup.call(this),this.isHTML5&&Object.keys(t).includes("tracks")&&Ds.insertElements.call(this,"track",t.tracks),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&Z.build.call(this),this.isHTML5&&this.media.load(),h.empty(t.previewThumbnails)||(Object.assign(this.config.previewThumbnails,t.previewThumbnails),this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new zs(this))),this.fullscreen.update()},!0)):this.debug.warn("Invalid source format")}};class Xt{constructor(e,i){if(_(this,"play",()=>h.function(this.media.play)?(this.ads&&this.ads.enabled&&this.ads.managerPromise.then(()=>this.ads.play()).catch(()=>Be(this.media.play())),this.media.play()):null),_(this,"pause",()=>this.playing&&h.function(this.media.pause)?this.media.pause():null),_(this,"togglePlay",o=>(h.boolean(o)?o:!this.playing)?this.play():this.pause()),_(this,"stop",()=>{this.isHTML5?(this.pause(),this.restart()):h.function(this.media.stop)&&this.media.stop()}),_(this,"restart",()=>{this.currentTime=0}),_(this,"rewind",o=>{this.currentTime-=h.number(o)?o:this.config.seekTime}),_(this,"forward",o=>{this.currentTime+=h.number(o)?o:this.config.seekTime}),_(this,"increaseVolume",o=>{const c=this.media.muted?0:this.volume;this.volume=c+(h.number(o)?o:0)}),_(this,"decreaseVolume",o=>{this.increaseVolume(-o)}),_(this,"airplay",()=>{q.airplay&&this.media.webkitShowPlaybackTargetPicker()}),_(this,"toggleControls",o=>{if(this.supported.ui&&!this.isAudio){const c=ki(this.elements.container,this.config.classNames.hideControls),l=o===void 0?void 0:!o,d=W(this.elements.container,this.config.classNames.hideControls,l);if(d&&h.array(this.config.controls)&&this.config.controls.includes("settings")&&!h.empty(this.config.settings)&&S.toggleMenu.call(this,!1),d!==c){const u=d?"controlshidden":"controlsshown";E.call(this,this.media,u)}return!d}return!1}),_(this,"on",(o,c)=>{H.call(this,this.elements.container,o,c)}),_(this,"once",(o,c)=>{hr.call(this,this.elements.container,o,c)}),_(this,"off",(o,c)=>{Ui(this.elements.container,o,c)}),_(this,"destroy",(o,c=!1)=>{if(!this.ready)return;const l=()=>{document.body.style.overflow="",this.embed=null,c?(Object.keys(this.elements).length&&(He(this.elements.buttons.play),He(this.elements.captions),He(this.elements.controls),He(this.elements.wrapper),this.elements.buttons.play=null,this.elements.captions=null,this.elements.controls=null,this.elements.wrapper=null),h.function(o)&&o()):(Yu.call(this),Ke.cancelRequests.call(this),Ai(this.elements.original,this.elements.container),E.call(this,this.elements.original,"destroyed",!0),h.function(o)&&o.call(this.elements.original),this.ready=!1,setTimeout(()=>{this.elements=null,this.media=null},200))};this.stop(),clearTimeout(this.timers.loading),clearTimeout(this.timers.controls),clearTimeout(this.timers.resized),this.isHTML5?(Z.toggleNativeControls.call(this,!0),l()):this.isYouTube?(clearInterval(this.timers.buffering),clearInterval(this.timers.playing),this.embed!==null&&h.function(this.embed.destroy)&&this.embed.destroy(),l()):this.isVimeo&&(this.embed!==null&&this.embed.unload().then(l),setTimeout(l,200))}),_(this,"supports",o=>q.mime.call(this,o)),this.timers={},this.ready=!1,this.loading=!1,this.failed=!1,this.touch=q.touch,this.media=e,h.string(this.media)&&(this.media=document.querySelectorAll(this.media)),(window.jQuery&&this.media instanceof jQuery||h.nodeList(this.media)||h.array(this.media))&&(this.media=this.media[0]),this.config=J({},lo,Xt.defaults,i||{},(()=>{try{return JSON.parse(this.media.getAttribute("data-plyr-config"))}catch{return{}}})()),this.elements={container:null,fullscreen:null,captions:null,buttons:{},display:{},progress:{},inputs:{},settings:{popup:null,menu:null,panels:{},buttons:{}}},this.captions={active:null,currentTrack:-1,meta:new WeakMap},this.fullscreen={active:!1},this.options={speed:[],quality:[]},this.debug=new rp(this.config.debug),this.debug.log("Config",this.config),this.debug.log("Support",q),h.nullOrUndefined(this.media)||!h.element(this.media))return void this.debug.error("Setup failed: no suitable element passed");if(this.media.plyr)return void this.debug.warn("Target already setup");if(!this.config.enabled)return void this.debug.error("Setup failed: disabled by config");if(!q.check().api)return void this.debug.error("Setup failed: no support");const s=this.media.cloneNode(!0);s.autoplay=!1,this.elements.original=s;const r=this.media.tagName.toLowerCase();let a=null,n=null;switch(r){case"div":if(a=this.media.querySelector("iframe"),h.element(a)){if(n=no(a.getAttribute("src")),this.provider=sp(n.toString()),this.elements.container=this.media,this.media=a,this.elements.container.className="",n.search.length){const o=["1","true"];o.includes(n.searchParams.get("autoplay"))&&(this.config.autoplay=!0),o.includes(n.searchParams.get("loop"))&&(this.config.loop.active=!0),this.isYouTube?(this.config.playsinline=o.includes(n.searchParams.get("playsinline")),this.config.youtube.hl=n.searchParams.get("hl")):this.config.playsinline=!0}}else this.provider=this.media.getAttribute(this.config.attributes.embed.provider),this.media.removeAttribute(this.config.attributes.embed.provider);if(h.empty(this.provider)||!Object.values(qe).includes(this.provider))return void this.debug.error("Setup failed: Invalid provider");this.type=hs.video;break;case"video":case"audio":this.type=r,this.provider=qe.html5,this.media.hasAttribute("crossorigin")&&(this.config.crossorigin=!0),this.media.hasAttribute("autoplay")&&(this.config.autoplay=!0),(this.media.hasAttribute("playsinline")||this.media.hasAttribute("webkit-playsinline"))&&(this.config.playsinline=!0),this.media.hasAttribute("muted")&&(this.config.muted=!0),this.media.hasAttribute("loop")&&(this.config.loop.active=!0);break;default:return void this.debug.error("Setup failed: unsupported type")}this.supported=q.check(this.type,this.provider,this.config.playsinline),this.supported.api?(this.eventListeners=[],this.listeners=new ap(this),this.storage=new Jt(this),this.media.plyr=this,h.element(this.elements.container)||(this.elements.container=N("div",{tabindex:0}),Xn(this.media,this.elements.container)),Z.migrateStyles.call(this),Z.addStyleHook.call(this),co.setup.call(this),this.config.debug&&H.call(this,this.elements.container,this.config.events.join(" "),o=>{this.debug.log(`event: ${o.type}`)}),this.fullscreen=new Ve(this),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&Z.build.call(this),this.listeners.container(),this.listeners.global(),this.config.ads.enabled&&(this.ads=new up(this)),this.isHTML5&&this.config.autoplay&&this.once("canplay",()=>Be(this.play())),this.lastSeekTime=0,this.config.previewThumbnails.enabled&&(this.previewThumbnails=new zs(this))):this.debug.error("Setup failed: no support")}get isHTML5(){return this.provider===qe.html5}get isEmbed(){return this.isYouTube||this.isVimeo}get isYouTube(){return this.provider===qe.youtube}get isVimeo(){return this.provider===qe.vimeo}get isVideo(){return this.type===hs.video}get isAudio(){return this.type===hs.audio}get playing(){return Boolean(this.ready&&!this.paused&&!this.ended)}get paused(){return Boolean(this.media.paused)}get stopped(){return Boolean(this.paused&&this.currentTime===0)}get ended(){return Boolean(this.media.ended)}set currentTime(e){if(!this.duration)return;const i=h.number(e)&&e>0;this.media.currentTime=i?Math.min(e,this.duration):0,this.debug.log(`Seeking to ${this.currentTime} seconds`)}get currentTime(){return Number(this.media.currentTime)}get buffered(){const{buffered:e}=this.media;return h.number(e)?e:e&&e.length&&this.duration>0?e.end(0)/this.duration:0}get seeking(){return Boolean(this.media.seeking)}get duration(){const e=parseFloat(this.config.duration),i=(this.media||{}).duration,s=h.number(i)&&i!==1/0?i:0;return e||s}set volume(e){let i=e;h.string(i)&&(i=Number(i)),h.number(i)||(i=this.storage.get("volume")),h.number(i)||({volume:i}=this.config),i>1&&(i=1),i<0&&(i=0),this.config.volume=i,this.media.volume=i,!h.empty(e)&&this.muted&&i>0&&(this.muted=!1)}get volume(){return Number(this.media.volume)}set muted(e){let i=e;h.boolean(i)||(i=this.storage.get("muted")),h.boolean(i)||(i=this.config.muted),this.config.muted=i,this.media.muted=i}get muted(){return Boolean(this.media.muted)}get hasAudio(){return!this.isHTML5||!!this.isAudio||Boolean(this.media.mozHasAudio)||Boolean(this.media.webkitAudioDecodedByteCount)||Boolean(this.media.audioTracks&&this.media.audioTracks.length)}set speed(e){let i=null;h.number(e)&&(i=e),h.number(i)||(i=this.storage.get("speed")),h.number(i)||(i=this.config.speed.selected);const{minimumSpeed:s,maximumSpeed:r}=this;i=ho(i,s,r),this.config.speed.selected=i,setTimeout(()=>{this.media&&(this.media.playbackRate=i)},0)}get speed(){return Number(this.media.playbackRate)}get minimumSpeed(){return this.isYouTube?Math.min(...this.options.speed):this.isVimeo?.5:.0625}get maximumSpeed(){return this.isYouTube?Math.max(...this.options.speed):this.isVimeo?2:16}set quality(e){const i=this.config.quality,s=this.options.quality;if(!s.length)return;let r=[!h.empty(e)&&Number(e),this.storage.get("quality"),i.selected,i.default].find(h.number),a=!0;if(!s.includes(r)){const n=Kn(s,r);this.debug.warn(`Unsupported quality option: ${r}, using ${n} instead`),r=n,a=!1}i.selected=r,this.media.quality=r,a&&this.storage.set({quality:r})}get quality(){return this.media.quality}set loop(e){const i=h.boolean(e)?e:this.config.loop.active;this.config.loop.active=i,this.media.loop=i}get loop(){return Boolean(this.media.loop)}set source(e){Ds.change.call(this,e)}get source(){return this.media.currentSrc}get download(){const{download:e}=this.config.urls;return h.url(e)?e:this.source}set download(e){h.url(e)&&(this.config.urls.download=e,S.setDownloadUrl.call(this))}set poster(e){this.isVideo?Z.setPoster.call(this,e,!1).catch(()=>{}):this.debug.warn("Poster can only be set for video")}get poster(){return this.isVideo?this.media.getAttribute("poster")||this.media.getAttribute("data-poster"):null}get ratio(){if(!this.isVideo)return null;const e=Ti(dr.call(this));return h.array(e)?e.join(":"):e}set ratio(e){this.isVideo?h.string(e)&&to(e)?(this.config.ratio=Ti(e),It.call(this)):this.debug.error(`Invalid aspect ratio specified (${e})`):this.debug.warn("Aspect ratio can only be set for video")}set autoplay(e){this.config.autoplay=h.boolean(e)?e:this.config.autoplay}get autoplay(){return Boolean(this.config.autoplay)}toggleCaptions(e){F.toggle.call(this,e,!1)}set currentTrack(e){F.set.call(this,e,!1),F.setup.call(this)}get currentTrack(){const{toggled:e,currentTrack:i}=this.captions;return e?i:-1}set language(e){F.setLanguage.call(this,e,!1)}get language(){return(F.getCurrentTrack.call(this)||{}).language}set pip(e){if(!q.pip)return;const i=h.boolean(e)?e:!this.pip;h.function(this.media.webkitSetPresentationMode)&&this.media.webkitSetPresentationMode(i?cs.active:cs.inactive),h.function(this.media.requestPictureInPicture)&&(!this.pip&&i?this.media.requestPictureInPicture():this.pip&&!i&&document.exitPictureInPicture())}get pip(){return q.pip?h.empty(this.media.webkitPresentationMode)?this.media===document.pictureInPictureElement:this.media.webkitPresentationMode===cs.active:null}setPreviewThumbnails(e){this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),Object.assign(this.config.previewThumbnails,e),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new zs(this))}static supported(e,i,s){return q.check(e,i,s)}static loadSprite(e,i){return ro(e,i)}static setup(e,i={}){let s=null;return h.string(e)?s=Array.from(document.querySelectorAll(e)):h.nodeList(e)?s=Array.from(e):h.array(e)&&(s=e.filter(h.element)),h.empty(s)?null:s.map(r=>new Xt(r,i))}}Xt.defaults=Wu(lo);function gp(t){let e,i,s;return{c(){e=Ct("video"),i=Ct("source"),Pn(i.src,s=t[3])||I(i,"src",s),I(i,"type",t[2]),I(e,"data-app-kind","Plyr"),I(e,"crossorigin","anonymous"),e.playsInline=!0,I(e,"data-poster",t[4])},m(r,a){At(r,e,a),V(e,i),t[8](e)},p:st,d(r){r&&ft(e),t[8](null)}}}function mp(t){let e,i,s;return{c(){e=Ct("audio"),i=Ct("source"),Pn(i.src,s=t[3])||I(i,"src",s),I(i,"type",t[2]),I(e,"data-app-kind","Plyr"),I(e,"crossorigin","anonymous"),I(e,"data-poster",t[4])},m(r,a){At(r,e,a),V(e,i),t[7](e)},p:st,d(r){r&&ft(e),t[7](null)}}}function fp(t){let e,i,s=JSON.stringify({src:t[3],type:t[0].state.type})+"",r;return{c(){e=Ct("div"),i=Is(`Invalid "src" or "type".
|
126
|
+
`),r=Is(s),I(e,"data-app-kind","Plyr"),I(e,"class","plyr--audio")},m(a,n){At(a,e,n),V(e,i),V(e,r)},p(a,n){n&1&&s!==(s=JSON.stringify({src:a[3],type:a[0].state.type})+"")&&Jd(r,s)},d(a){a&&ft(e)}}}function bp(t){let e;return{c(){e=Ct("div"),I(e,"data-app-kind","Plyr"),I(e,"class","plyr__video-embed"),I(e,"data-plyr-provider","youtube"),I(e,"data-plyr-embed-id",t[3]),I(e,"data-poster",t[4])},m(i,s){At(i,e,s),t[6](e)},p:st,d(i){i&&ft(e),t[6](null)}}}function yp(t){let e,i,s,r;function a(c,l){return c[0].state.provider==="youtube"?bp:c[2]?(e==null&&(e=!!c[2].startsWith("audio/")),e?mp:gp):fp}let n=a(t),o=n(t);return s=new bu({}),{c(){o.c(),i=Gd(),au(s.$$.fragment)},m(c,l){o.m(c,l),At(c,i,l),Vn(s,c,l),r=!0},p(c,[l]){n===(n=a(c))&&o?o.p(c,l):(o.d(1),o=n(c),o&&(o.c(),o.m(i.parentNode,i)))},i(c){r||(Ln(s.$$.fragment,c),r=!0)},o(c){ru(s.$$.fragment,c),r=!1},d(c){o.d(c),c&&ft(i),$n(s,c)}}}function wp(t,e,i){let{storage:s}=e,{sync:r}=e;const a=s.state.provider?void 0:s.state.type||cu(s.state.src),{src:n,poster:o}=s.state,c=lu.includes(String(a).toLowerCase());let l,d;Xd(async()=>{if(l){if(c&&pu(l)){const g=await uu();g.loadSource(n),g.attachMedia(l)}d=new Xt(l,{fullscreen:{enabled:!1},controls:["play","progress","current-time","mute","volume"],clickToPlay:!1,youtube:{autoplay:!0},loadSprite:!1}),i(5,r.player=d,r)}}),Kd(()=>{try{r.dispose(),d==null||d.destroy()}catch(g){console.warn("[Plyr] destroy plyr error",g)}});function u(g){Ht[g?"unshift":"push"](()=>{l=g,i(1,l)})}function p(g){Ht[g?"unshift":"push"](()=>{l=g,i(1,l)})}function m(g){Ht[g?"unshift":"push"](()=>{l=g,i(1,l)})}return t.$$set=g=>{"storage"in g&&i(0,s=g.storage),"sync"in g&&i(5,r=g.sync)},[s,l,a,n,o,r,u,p,m]}class vp extends Bn{constructor(e){super();jn(this,e,wp,yp,En,{storage:0,sync:5})}}class xp{constructor(e){this.context=e,this.behavior="owner",this._skip_next_play_pause=0,this._sync_timer=0,this._interval=1e3,this._blink=0,this._player=null,this._buffering=!1,this._throttle=0,this._dispatch_time_again=!1,this._buffering_timer=0,this._disposer=null;const i=e.room,s=e.displayer;this.uid=i?i.uid:"",this.getTimestamp=i?()=>i.calibrationTimestamp:()=>s.beginTimestamp+s.progressTime,this._disposer=this.context.storage.addStateChangedListener(this.syncAll.bind(this))}dispose(){this._disposer&&this._disposer(),this._disposer=null,clearInterval(this._sync_timer),clearTimeout(this._buffering_timer)}get player(){return this._player}set player(e){this._player=e,e&&e.once("ready",this.setupPlayer.bind(this,e))}setupPlayer(e){this.registerListeners(e),this.watchUserInputs(e),this._sync_timer=setInterval(this.syncAll.bind(this),this._interval)}syncAll(){const{behavior:e,player:i,context:s}=this;if(!i)return;const{storage:r}=s,{currentTime:a,hostTime:n,muted:o,paused:c,volume:l,owner:d}=r.state;e==="owner"&&d===this.uid||(c!==i.paused&&!this._skip_next_play_pause&&(console.log("< sync paused",c),c?i.pause():hu(i)),o!==i.muted&&(console.log("< sync muted",o),i.muted=o),l!==i.volume&&(console.log("< sync volume",l),i.volume=l),!this._buffering&&(c?Math.abs(i.currentTime-a)>.5&&(console.log("< sync current time (paused)",a),i.currentTime=a):this.syncCurrentTime(n,a,i)))}watchUserInputs(e){const i=e.elements.controls,s=mu(e.elements.buttons.play),r=i==null?void 0:i.querySelector('input[data-plyr="seek"]'),a=i==null?void 0:i.querySelector('button[data-plyr="mute"]'),n=i==null?void 0:i.querySelector('input[data-plyr="volume"]');this.fixSeekBarOnInit(r,e),s==null||s.addEventListener("click",()=>{this.behavior==="owner"&&this.dispatchOwner(),this.dispatchPlayPause(e)}),r==null||r.addEventListener("change",()=>{this.behavior==="owner"&&this.dispatchOwner(),this.dispatchSeek(e,r)}),a==null||a.addEventListener("click",()=>{this.behavior==="owner"&&this.dispatchOwner(),this.dispatchVolume(e)}),n==null||n.addEventListener("change",()=>{this.behavior==="owner"&&this.dispatchOwner(),this.dispatchVolume(e)})}fixSeekBarOnInit(e,i){const{currentTime:s}=this.context.storage.state;if(i.duration&&s&&e){const r=100*s/i.duration;e.value=r.toFixed(2)}}registerListeners(e){e.on("ended",()=>{e.stop(),this.context.storage.setState({paused:!0,currentTime:0})}),e.on("waiting",()=>{this._buffering=!0,this._buffering_timer=setTimeout(this.clearBuffering.bind(this),this._interval/2)}),e.on("playing",()=>{this._buffering=!1}),e.on("timeupdate",()=>{this.isOwner()&&this.dispatchCurrentTime(e)}),e.on("volumechange",()=>{this.isOwner()&&this.dispatchVolume(e)}),e.on("play",()=>{this.isOwner()&&this.dispatchPlayPause(e)}),e.on("pause",()=>{this.isOwner()&&this.dispatchPlayPause(e)})}clearBuffering(){this._buffering=!1,this._buffering_timer=0}dispatchOwner(){this.context.storage.state.owner!==this.uid&&(console.log("> set owner",this.uid),this.context.storage.setState({owner:this.uid}))}dispatchPlayPause(e){console.log("> set paused",e.paused),this.context.storage.setState({hostTime:this.getTimestamp(),currentTime:e.currentTime,paused:e.paused}),clearTimeout(this._skip_next_play_pause),this._skip_next_play_pause=setTimeout(this.skipNextPlayPause.bind(this),500)}skipNextPlayPause(){this._skip_next_play_pause=0}dispatchVolume(e){console.log("> set volume",e.volume),this.context.storage.setState({muted:e.muted,volume:e.volume})}dispatchSeek(e,i){const s=i.valueAsNumber*e.duration/100;console.log("> set current time (seek)",s),this.context.storage.setState({hostTime:this.getTimestamp(),currentTime:s})}dispatchCurrentTime(e){if(this._throttle){this._dispatch_time_again=!0;return}console.log("> set current time",e.currentTime),this.context.storage.setState({hostTime:this.getTimestamp(),currentTime:e.currentTime}),this._throttle=setTimeout(this.clearThrottle.bind(this,e),1e3)}clearThrottle(e){this._throttle=0,this._dispatch_time_again&&(this._dispatch_time_again=!1,this.dispatchCurrentTime(e))}isOwner(){return this.behavior==="owner"&&this.context.storage.state.owner===this.uid}syncCurrentTime(e,i,s){const r=this.getTimestamp();if(r&&e){const a=i+(r-e)/1e3;Math.abs(a-s.currentTime)>1?(console.log("< sync current time (playing)",a),s.currentTime=a,this._blink++,this._blink>3&&this.updateSyncInterval(!0)):this.updateSyncInterval(!1)}}updateSyncInterval(e){this._blink=0,this._interval=gu(this._interval+(e?2e3:-2e3),1e3,15e3),clearTimeout(this._sync_timer),this._sync_timer=setInterval(this.syncAll.bind(this),this._interval)}}var Mp=(()=>`@charset "UTF-8";@keyframes plyr-progress{to{background-position:25px 0;background-position:var(--plyr-progress-loading-size,25px) 0}}@keyframes plyr-popup{0%{opacity:.5;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes plyr-fade-in{0%{opacity:0}to{opacity:1}}.plyr{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;align-items:center;direction:ltr;display:flex;flex-direction:column;font-family:inherit;font-family:var(--plyr-font-family,inherit);font-variant-numeric:tabular-nums;font-weight:400;font-weight:var(--plyr-font-weight-regular,400);line-height:1.7;line-height:var(--plyr-line-height,1.7);max-width:100%;min-width:200px;position:relative;text-shadow:none;transition:box-shadow .3s ease;z-index:0}.plyr audio,.plyr iframe,.plyr video{display:block;height:100%;width:100%}.plyr button{font:inherit;line-height:inherit;width:auto}.plyr:focus{outline:0}.plyr--full-ui{box-sizing:border-box}.plyr--full-ui *,.plyr--full-ui :after,.plyr--full-ui :before{box-sizing:inherit}.plyr--full-ui a,.plyr--full-ui button,.plyr--full-ui input,.plyr--full-ui label{touch-action:manipulation}.plyr__badge{background:#4a5464;background:var(--plyr-badge-background,#4a5464);border-radius:2px;border-radius:var(--plyr-badge-border-radius,2px);color:#fff;color:var(--plyr-badge-text-color,#fff);font-size:9px;font-size:var(--plyr-font-size-badge,9px);line-height:1;padding:3px 4px}.plyr--full-ui ::-webkit-media-text-track-container{display:none}.plyr__captions{animation:plyr-fade-in .3s ease;bottom:0;display:none;font-size:13px;font-size:var(--plyr-font-size-small,13px);left:0;padding:10px;padding:var(--plyr-control-spacing,10px);position:absolute;text-align:center;transition:transform .4s ease-in-out;width:100%}.plyr__captions span:empty{display:none}@media (min-width:480px){.plyr__captions{font-size:15px;font-size:var(--plyr-font-size-base,15px);padding:20px;padding:calc(var(--plyr-control-spacing, 10px)*2)}}@media (min-width:768px){.plyr__captions{font-size:18px;font-size:var(--plyr-font-size-large,18px)}}.plyr--captions-active .plyr__captions{display:block}.plyr:not(.plyr--hide-controls) .plyr__controls:not(:empty)~.plyr__captions{transform:translateY(-40px);transform:translateY(calc(var(--plyr-control-spacing, 10px)*-4))}.plyr__caption{background:rgba(0,0,0,.8);background:var(--plyr-captions-background,rgba(0,0,0,.8));border-radius:2px;-webkit-box-decoration-break:clone;box-decoration-break:clone;color:#fff;color:var(--plyr-captions-text-color,#fff);line-height:185%;padding:.2em .5em;white-space:pre-wrap}.plyr__caption div{display:inline}.plyr__control{background:transparent;border:0;border-radius:3px;border-radius:var(--plyr-control-radius,3px);color:inherit;cursor:pointer;flex-shrink:0;overflow:visible;padding:7px;padding:calc(var(--plyr-control-spacing, 10px)*.7);position:relative;transition:all .3s ease}.plyr__control svg{fill:currentColor;display:block;height:18px;height:var(--plyr-control-icon-size,18px);pointer-events:none;width:18px;width:var(--plyr-control-icon-size,18px)}.plyr__control:focus{outline:0}.plyr__control.plyr__tab-focus{outline:3px dotted #00b2ff;outline:var(--plyr-tab-focus-color,var(--plyr-color-main,var(--plyr-color-main,#00b2ff))) dotted 3px;outline-offset:2px}a.plyr__control{text-decoration:none}.plyr__control.plyr__control--pressed .icon--not-pressed,.plyr__control.plyr__control--pressed .label--not-pressed,.plyr__control:not(.plyr__control--pressed) .icon--pressed,.plyr__control:not(.plyr__control--pressed) .label--pressed,a.plyr__control:after,a.plyr__control:before{display:none}.plyr--full-ui ::-webkit-media-controls{display:none}.plyr__controls{align-items:center;display:flex;justify-content:flex-end;text-align:center}.plyr__controls .plyr__progress__container{flex:1;min-width:0}.plyr__controls .plyr__controls__item{margin-left:2.5px;margin-left:calc(var(--plyr-control-spacing, 10px)/4)}.plyr__controls .plyr__controls__item:first-child{margin-left:0;margin-right:auto}.plyr__controls .plyr__controls__item.plyr__progress__container{padding-left:2.5px;padding-left:calc(var(--plyr-control-spacing, 10px)/4)}.plyr__controls .plyr__controls__item.plyr__time{padding:0 5px;padding:0 calc(var(--plyr-control-spacing, 10px)/2)}.plyr__controls .plyr__controls__item.plyr__progress__container:first-child,.plyr__controls .plyr__controls__item.plyr__time+.plyr__time,.plyr__controls .plyr__controls__item.plyr__time:first-child{padding-left:0}.plyr [data-plyr=airplay],.plyr [data-plyr=captions],.plyr [data-plyr=fullscreen],.plyr [data-plyr=pip],.plyr__controls:empty{display:none}.plyr--airplay-supported [data-plyr=airplay],.plyr--captions-enabled [data-plyr=captions],.plyr--fullscreen-enabled [data-plyr=fullscreen],.plyr--pip-supported [data-plyr=pip]{display:inline-block}.plyr__menu{display:flex;position:relative}.plyr__menu .plyr__control svg{transition:transform .3s ease}.plyr__menu .plyr__control[aria-expanded=true] svg{transform:rotate(90deg)}.plyr__menu .plyr__control[aria-expanded=true] .plyr__tooltip{display:none}.plyr__menu__container{animation:plyr-popup .2s ease;background:hsla(0,0%,100%,.9);background:var(--plyr-menu-background,hsla(0,0%,100%,.9));border-radius:4px;bottom:100%;box-shadow:0 1px 2px #00000026;box-shadow:var(--plyr-menu-shadow,0 1px 2px rgba(0,0,0,.15));color:#4a5464;color:var(--plyr-menu-color,#4a5464);font-size:15px;font-size:var(--plyr-font-size-base,15px);margin-bottom:10px;position:absolute;right:-3px;text-align:left;white-space:nowrap;z-index:3}.plyr__menu__container>div{overflow:hidden;transition:height .35s cubic-bezier(.4,0,.2,1),width .35s cubic-bezier(.4,0,.2,1)}.plyr__menu__container:after{border:4px solid transparent;border-top-color:#ffffffe6;border:var(--plyr-menu-arrow-size,4px) solid transparent;border-top-color:var(--plyr-menu-background,hsla(0,0%,100%,.9));content:"";height:0;position:absolute;right:14px;right:calc(var(--plyr-control-icon-size, 18px)/2 + var(--plyr-control-spacing, 10px)*.7 - var(--plyr-menu-arrow-size, 4px)/2);top:100%;width:0}.plyr__menu__container [role=menu]{padding:7px;padding:calc(var(--plyr-control-spacing, 10px)*.7)}.plyr__menu__container [role=menuitem],.plyr__menu__container [role=menuitemradio]{margin-top:2px}.plyr__menu__container [role=menuitem]:first-child,.plyr__menu__container [role=menuitemradio]:first-child{margin-top:0}.plyr__menu__container .plyr__control{align-items:center;color:#4a5464;color:var(--plyr-menu-color,#4a5464);display:flex;font-size:13px;font-size:var(--plyr-font-size-menu,var(--plyr-font-size-small,13px));padding:4.66667px 10.5px;padding:calc(var(--plyr-control-spacing, 10px)*.7/1.5) calc(var(--plyr-control-spacing, 10px)*.7*1.5);-webkit-user-select:none;user-select:none;width:100%}.plyr__menu__container .plyr__control>span{align-items:inherit;display:flex;width:100%}.plyr__menu__container .plyr__control:after{border:4px solid transparent;border:var(--plyr-menu-item-arrow-size,4px) solid transparent;content:"";position:absolute;top:50%;transform:translateY(-50%)}.plyr__menu__container .plyr__control--forward{padding-right:28px;padding-right:calc(var(--plyr-control-spacing, 10px)*.7*4)}.plyr__menu__container .plyr__control--forward:after{border-left-color:#728197;border-left-color:var(--plyr-menu-arrow-color,#728197);right:6.5px;right:calc(var(--plyr-control-spacing, 10px)*.7*1.5 - var(--plyr-menu-item-arrow-size, 4px))}.plyr__menu__container .plyr__control--forward.plyr__tab-focus:after,.plyr__menu__container .plyr__control--forward:hover:after{border-left-color:currentColor}.plyr__menu__container .plyr__control--back{font-weight:400;font-weight:var(--plyr-font-weight-regular,400);margin:7px;margin:calc(var(--plyr-control-spacing, 10px)*.7);margin-bottom:3.5px;margin-bottom:calc(var(--plyr-control-spacing, 10px)*.7/2);padding-left:28px;padding-left:calc(var(--plyr-control-spacing, 10px)*.7*4);position:relative;width:calc(100% - 14px);width:calc(100% - var(--plyr-control-spacing, 10px)*.7*2)}.plyr__menu__container .plyr__control--back:after{border-right-color:#728197;border-right-color:var(--plyr-menu-arrow-color,#728197);left:6.5px;left:calc(var(--plyr-control-spacing, 10px)*.7*1.5 - var(--plyr-menu-item-arrow-size, 4px))}.plyr__menu__container .plyr__control--back:before{background:#dcdfe5;background:var(--plyr-menu-back-border-color,#dcdfe5);box-shadow:0 1px #fff;box-shadow:0 1px 0 var(--plyr-menu-back-border-shadow-color,#fff);content:"";height:1px;left:0;margin-top:3.5px;margin-top:calc(var(--plyr-control-spacing, 10px)*.7/2);overflow:hidden;position:absolute;right:0;top:100%}.plyr__menu__container .plyr__control--back.plyr__tab-focus:after,.plyr__menu__container .plyr__control--back:hover:after{border-right-color:currentColor}.plyr__menu__container .plyr__control[role=menuitemradio]{padding-left:7px;padding-left:calc(var(--plyr-control-spacing, 10px)*.7)}.plyr__menu__container .plyr__control[role=menuitemradio]:after,.plyr__menu__container .plyr__control[role=menuitemradio]:before{border-radius:100%}.plyr__menu__container .plyr__control[role=menuitemradio]:before{background:rgba(0,0,0,.1);content:"";display:block;flex-shrink:0;height:16px;margin-right:10px;margin-right:var(--plyr-control-spacing,10px);transition:all .3s ease;width:16px}.plyr__menu__container .plyr__control[role=menuitemradio]:after{background:#fff;border:0;height:6px;left:12px;opacity:0;top:50%;transform:translateY(-50%) scale(0);transition:transform .3s ease,opacity .3s ease;width:6px}.plyr__menu__container .plyr__control[role=menuitemradio][aria-checked=true]:before{background:#00b2ff;background:var(--plyr-control-toggle-checked-background,var(--plyr-color-main,var(--plyr-color-main,#00b2ff)))}.plyr__menu__container .plyr__control[role=menuitemradio][aria-checked=true]:after{opacity:1;transform:translateY(-50%) scale(1)}.plyr__menu__container .plyr__control[role=menuitemradio].plyr__tab-focus:before,.plyr__menu__container .plyr__control[role=menuitemradio]:hover:before{background:rgba(35,40,47,.1)}.plyr__menu__container .plyr__menu__value{align-items:center;display:flex;margin-left:auto;margin-right:calc(-7px + 2);margin-right:calc(var(--plyr-control-spacing, 10px)*.7*-1 - -2);overflow:hidden;padding-left:24.5px;padding-left:calc(var(--plyr-control-spacing, 10px)*.7*3.5);pointer-events:none}.plyr--full-ui input[type=range]{-webkit-appearance:none;appearance:none;background:transparent;border:0;border-radius:26px;border-radius:calc(var(--plyr-range-thumb-height, 13px)*2);color:#00b2ff;color:var(--plyr-range-fill-background,var(--plyr-color-main,var(--plyr-color-main,#00b2ff)));display:block;height:19px;height:calc(var(--plyr-range-thumb-active-shadow-width, 3px)*2 + var(--plyr-range-thumb-height, 13px));margin:0;min-width:0;padding:0;transition:box-shadow .3s ease;width:100%}.plyr--full-ui input[type=range]::-webkit-slider-runnable-track{background:transparent;background-image:linear-gradient(90deg,currentColor 0,transparent 0);background-image:linear-gradient(to right,currentColor var(--value,0),transparent var(--value,0));border:0;border-radius:2.5px;border-radius:calc(var(--plyr-range-track-height, 5px)/2);height:5px;height:var(--plyr-range-track-height,5px);-webkit-transition:box-shadow .3s ease;transition:box-shadow .3s ease;-webkit-user-select:none;user-select:none}.plyr--full-ui input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;background:#fff;background:var(--plyr-range-thumb-background,#fff);border:0;border-radius:100%;box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2));height:13px;height:var(--plyr-range-thumb-height,13px);margin-top:-4px;margin-top:calc((var(--plyr-range-thumb-height, 13px) - var(--plyr-range-track-height, 5px))/2*-1);position:relative;-webkit-transition:all .2s ease;transition:all .2s ease;width:13px;width:var(--plyr-range-thumb-height,13px)}.plyr--full-ui input[type=range]::-moz-range-track{background:transparent;border:0;border-radius:2.5px;border-radius:calc(var(--plyr-range-track-height, 5px)/2);height:5px;height:var(--plyr-range-track-height,5px);-moz-transition:box-shadow .3s ease;transition:box-shadow .3s ease;user-select:none}.plyr--full-ui input[type=range]::-moz-range-thumb{background:#fff;background:var(--plyr-range-thumb-background,#fff);border:0;border-radius:100%;box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2));height:13px;height:var(--plyr-range-thumb-height,13px);position:relative;-moz-transition:all .2s ease;transition:all .2s ease;width:13px;width:var(--plyr-range-thumb-height,13px)}.plyr--full-ui input[type=range]::-moz-range-progress{background:currentColor;border-radius:2.5px;border-radius:calc(var(--plyr-range-track-height, 5px)/2);height:5px;height:var(--plyr-range-track-height,5px)}.plyr--full-ui input[type=range]::-ms-track{color:transparent}.plyr--full-ui input[type=range]::-ms-fill-upper,.plyr--full-ui input[type=range]::-ms-track{background:transparent;border:0;border-radius:2.5px;border-radius:calc(var(--plyr-range-track-height, 5px)/2);height:5px;height:var(--plyr-range-track-height,5px);-ms-transition:box-shadow .3s ease;transition:box-shadow .3s ease;user-select:none}.plyr--full-ui input[type=range]::-ms-fill-lower{background:transparent;background:currentColor;border:0;border-radius:2.5px;border-radius:calc(var(--plyr-range-track-height, 5px)/2);height:5px;height:var(--plyr-range-track-height,5px);-ms-transition:box-shadow .3s ease;transition:box-shadow .3s ease;user-select:none}.plyr--full-ui input[type=range]::-ms-thumb{background:#fff;background:var(--plyr-range-thumb-background,#fff);border:0;border-radius:100%;box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2));height:13px;height:var(--plyr-range-thumb-height,13px);margin-top:0;position:relative;-ms-transition:all .2s ease;transition:all .2s ease;width:13px;width:var(--plyr-range-thumb-height,13px)}.plyr--full-ui input[type=range]::-ms-tooltip{display:none}.plyr--full-ui input[type=range]::-moz-focus-outer{border:0}.plyr--full-ui input[type=range]:focus{outline:0}.plyr--full-ui input[type=range].plyr__tab-focus::-webkit-slider-runnable-track{outline:3px dotted #00b2ff;outline:var(--plyr-tab-focus-color,var(--plyr-color-main,var(--plyr-color-main,#00b2ff))) dotted 3px;outline-offset:2px}.plyr--full-ui input[type=range].plyr__tab-focus::-moz-range-track{outline:3px dotted #00b2ff;outline:var(--plyr-tab-focus-color,var(--plyr-color-main,var(--plyr-color-main,#00b2ff))) dotted 3px;outline-offset:2px}.plyr--full-ui input[type=range].plyr__tab-focus::-ms-track{outline:3px dotted #00b2ff;outline:var(--plyr-tab-focus-color,var(--plyr-color-main,var(--plyr-color-main,#00b2ff))) dotted 3px;outline-offset:2px}.plyr__poster{background-color:#000;background-color:var(--plyr-video-background,var(--plyr-video-background,#000));background-position:50% 50%;background-repeat:no-repeat;background-size:contain;height:100%;left:0;opacity:0;position:absolute;top:0;transition:opacity .2s ease;width:100%;z-index:1}.plyr--stopped.plyr__poster-enabled .plyr__poster{opacity:1}.plyr--youtube.plyr--paused.plyr__poster-enabled:not(.plyr--stopped) .plyr__poster{display:none}.plyr__time{font-size:13px;font-size:var(--plyr-font-size-time,var(--plyr-font-size-small,13px))}.plyr__time+.plyr__time:before{content:"\\2044";margin-right:10px;margin-right:var(--plyr-control-spacing,10px)}@media (max-width:767px){.plyr__time+.plyr__time{display:none}}.plyr__tooltip{background:hsla(0,0%,100%,.9);background:var(--plyr-tooltip-background,hsla(0,0%,100%,.9));border-radius:5px;border-radius:var(--plyr-tooltip-radius,5px);bottom:100%;box-shadow:0 1px 2px #00000026;box-shadow:var(--plyr-tooltip-shadow,0 1px 2px rgba(0,0,0,.15));color:#4a5464;color:var(--plyr-tooltip-color,#4a5464);font-size:13px;font-size:var(--plyr-font-size-small,13px);font-weight:400;font-weight:var(--plyr-font-weight-regular,400);left:50%;line-height:1.3;margin-bottom:10px;margin-bottom:calc(var(--plyr-control-spacing, 10px)/2*2);opacity:0;padding:5px 7.5px;padding:calc(var(--plyr-control-spacing, 10px)/2) calc(var(--plyr-control-spacing, 10px)/2*1.5);pointer-events:none;position:absolute;transform:translate(-50%,10px) scale(.8);transform-origin:50% 100%;transition:transform .2s ease .1s,opacity .2s ease .1s;white-space:nowrap;z-index:2}.plyr__tooltip:before{border-left:4px solid transparent;border-left:var(--plyr-tooltip-arrow-size,4px) solid transparent;border-right:4px solid transparent;border-right:var(--plyr-tooltip-arrow-size,4px) solid transparent;border-top:4px solid hsla(0,0%,100%,.9);border-top:var(--plyr-tooltip-arrow-size,4px) solid var(--plyr-tooltip-background,hsla(0,0%,100%,.9));bottom:-4px;bottom:calc(var(--plyr-tooltip-arrow-size, 4px)*-1);content:"";height:0;left:50%;position:absolute;transform:translate(-50%);width:0;z-index:2}.plyr .plyr__control.plyr__tab-focus .plyr__tooltip,.plyr .plyr__control:hover .plyr__tooltip,.plyr__tooltip--visible{opacity:1;transform:translate(-50%) scale(1)}.plyr .plyr__control:hover .plyr__tooltip{z-index:3}.plyr__controls>.plyr__control:first-child .plyr__tooltip,.plyr__controls>.plyr__control:first-child+.plyr__control .plyr__tooltip{left:0;transform:translateY(10px) scale(.8);transform-origin:0 100%}.plyr__controls>.plyr__control:first-child .plyr__tooltip:before,.plyr__controls>.plyr__control:first-child+.plyr__control .plyr__tooltip:before{left:16px;left:calc(var(--plyr-control-icon-size, 18px)/2 + var(--plyr-control-spacing, 10px)*.7)}.plyr__controls>.plyr__control:last-child .plyr__tooltip{left:auto;right:0;transform:translateY(10px) scale(.8);transform-origin:100% 100%}.plyr__controls>.plyr__control:last-child .plyr__tooltip:before{left:auto;right:16px;right:calc(var(--plyr-control-icon-size, 18px)/2 + var(--plyr-control-spacing, 10px)*.7);transform:translate(50%)}.plyr__controls>.plyr__control:first-child .plyr__tooltip--visible,.plyr__controls>.plyr__control:first-child+.plyr__control .plyr__tooltip--visible,.plyr__controls>.plyr__control:first-child+.plyr__control.plyr__tab-focus .plyr__tooltip,.plyr__controls>.plyr__control:first-child+.plyr__control:hover .plyr__tooltip,.plyr__controls>.plyr__control:first-child.plyr__tab-focus .plyr__tooltip,.plyr__controls>.plyr__control:first-child:hover .plyr__tooltip,.plyr__controls>.plyr__control:last-child .plyr__tooltip--visible,.plyr__controls>.plyr__control:last-child.plyr__tab-focus .plyr__tooltip,.plyr__controls>.plyr__control:last-child:hover .plyr__tooltip{transform:translate(0) scale(1)}.plyr__progress{left:6.5px;left:calc(var(--plyr-range-thumb-height, 13px)*.5);margin-right:13px;margin-right:var(--plyr-range-thumb-height,13px);position:relative}.plyr__progress input[type=range],.plyr__progress__buffer{margin-left:-6.5px;margin-left:calc(var(--plyr-range-thumb-height, 13px)*-.5);margin-right:-6.5px;margin-right:calc(var(--plyr-range-thumb-height, 13px)*-.5);width:calc(100% + 13px);width:calc(100% + var(--plyr-range-thumb-height, 13px))}.plyr__progress input[type=range]{position:relative;z-index:2}.plyr__progress .plyr__tooltip{left:0;max-width:120px;overflow-wrap:break-word;white-space:normal}.plyr__progress__buffer{-webkit-appearance:none;background:transparent;border:0;border-radius:100px;height:5px;height:var(--plyr-range-track-height,5px);left:0;margin-top:-2.5px;margin-top:calc((var(--plyr-range-track-height, 5px)/2)*-1);padding:0;position:absolute;top:50%}.plyr__progress__buffer::-webkit-progress-bar{background:transparent}.plyr__progress__buffer::-webkit-progress-value{background:currentColor;border-radius:100px;min-width:5px;min-width:var(--plyr-range-track-height,5px);-webkit-transition:width .2s ease;transition:width .2s ease}.plyr__progress__buffer::-moz-progress-bar{background:currentColor;border-radius:100px;min-width:5px;min-width:var(--plyr-range-track-height,5px);-moz-transition:width .2s ease;transition:width .2s ease}.plyr__progress__buffer::-ms-fill{border-radius:100px;-ms-transition:width .2s ease;transition:width .2s ease}.plyr--loading .plyr__progress__buffer{animation:plyr-progress 1s linear infinite;background-image:linear-gradient(-45deg,rgba(35,40,47,.6) 25%,transparent 0,transparent 50%,rgba(35,40,47,.6) 0,rgba(35,40,47,.6) 75%,transparent 0,transparent);background-image:linear-gradient(-45deg,var(--plyr-progress-loading-background,rgba(35,40,47,.6)) 25%,transparent 25%,transparent 50%,var(--plyr-progress-loading-background,rgba(35,40,47,.6)) 50%,var(--plyr-progress-loading-background,rgba(35,40,47,.6)) 75%,transparent 75%,transparent);background-repeat:repeat-x;background-size:25px 25px;background-size:var(--plyr-progress-loading-size,25px) var(--plyr-progress-loading-size,25px);color:transparent}.plyr--video.plyr--loading .plyr__progress__buffer{background-color:#ffffff40;background-color:var(--plyr-video-progress-buffered-background,hsla(0,0%,100%,.25))}.plyr--audio.plyr--loading .plyr__progress__buffer{background-color:#c1c8d199;background-color:var(--plyr-audio-progress-buffered-background,rgba(193,200,209,.6))}.plyr__progress__marker{background-color:#fff;background-color:var(--plyr-progress-marker-background,#fff);border-radius:1px;height:5px;height:var(--plyr-range-track-height,5px);position:absolute;top:50%;transform:translate(-50%,-50%);width:3px;width:var(--plyr-progress-marker-width,3px);z-index:3}.plyr__volume{align-items:center;display:flex;max-width:110px;min-width:80px;position:relative;width:20%}.plyr__volume input[type=range]{margin-left:5px;margin-left:calc(var(--plyr-control-spacing, 10px)/2);margin-right:5px;margin-right:calc(var(--plyr-control-spacing, 10px)/2);position:relative;z-index:2}.plyr--is-ios .plyr__volume{min-width:0;width:auto}.plyr--audio{display:block}.plyr--audio .plyr__controls{background:#fff;background:var(--plyr-audio-controls-background,#fff);border-radius:inherit;color:#4a5464;color:var(--plyr-audio-control-color,#4a5464);padding:10px;padding:var(--plyr-control-spacing,10px)}.plyr--audio .plyr__control.plyr__tab-focus,.plyr--audio .plyr__control:hover,.plyr--audio .plyr__control[aria-expanded=true]{background:#00b2ff;background:var(--plyr-audio-control-background-hover,var(--plyr-color-main,var(--plyr-color-main,#00b2ff)));color:#fff;color:var(--plyr-audio-control-color-hover,#fff)}.plyr--full-ui.plyr--audio input[type=range]::-webkit-slider-runnable-track{background-color:#c1c8d199;background-color:var(--plyr-audio-range-track-background,var(--plyr-audio-progress-buffered-background,rgba(193,200,209,.6)))}.plyr--full-ui.plyr--audio input[type=range]::-moz-range-track{background-color:#c1c8d199;background-color:var(--plyr-audio-range-track-background,var(--plyr-audio-progress-buffered-background,rgba(193,200,209,.6)))}.plyr--full-ui.plyr--audio input[type=range]::-ms-track{background-color:#c1c8d199;background-color:var(--plyr-audio-range-track-background,var(--plyr-audio-progress-buffered-background,rgba(193,200,209,.6)))}.plyr--full-ui.plyr--audio input[type=range]:active::-webkit-slider-thumb{box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33,0 0 0 3px #23282f1a;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2)),0 0 0 var(--plyr-range-thumb-active-shadow-width,3px) var(--plyr-audio-range-thumb-active-shadow-color,rgba(35,40,47,.1))}.plyr--full-ui.plyr--audio input[type=range]:active::-moz-range-thumb{box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33,0 0 0 3px #23282f1a;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2)),0 0 0 var(--plyr-range-thumb-active-shadow-width,3px) var(--plyr-audio-range-thumb-active-shadow-color,rgba(35,40,47,.1))}.plyr--full-ui.plyr--audio input[type=range]:active::-ms-thumb{box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33,0 0 0 3px #23282f1a;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2)),0 0 0 var(--plyr-range-thumb-active-shadow-width,3px) var(--plyr-audio-range-thumb-active-shadow-color,rgba(35,40,47,.1))}.plyr--audio .plyr__progress__buffer{color:#c1c8d199;color:var(--plyr-audio-progress-buffered-background,rgba(193,200,209,.6))}.plyr--video{background:#000;background:var(--plyr-video-background,var(--plyr-video-background,#000));overflow:hidden}.plyr--video.plyr--menu-open{overflow:visible}.plyr__video-wrapper{background:#000;background:var(--plyr-video-background,var(--plyr-video-background,#000));height:100%;margin:auto;overflow:hidden;position:relative;width:100%}.plyr__video-embed,.plyr__video-wrapper--fixed-ratio{aspect-ratio:16/9}@supports not (aspect-ratio:16/9){.plyr__video-embed,.plyr__video-wrapper--fixed-ratio{height:0;padding-bottom:56.25%;position:relative}}.plyr__video-embed iframe,.plyr__video-wrapper--fixed-ratio video{border:0;height:100%;left:0;position:absolute;top:0;width:100%}.plyr--full-ui .plyr__video-embed>.plyr__video-embed__container{padding-bottom:240%;position:relative;transform:translateY(-38.28125%)}.plyr--video .plyr__controls{background:linear-gradient(transparent,rgba(0,0,0,.75));background:var(--plyr-video-controls-background,linear-gradient(transparent,rgba(0,0,0,.75)));border-bottom-left-radius:inherit;border-bottom-right-radius:inherit;bottom:0;color:#fff;color:var(--plyr-video-control-color,#fff);left:0;padding:5px;padding:calc(var(--plyr-control-spacing, 10px)/2);padding-top:20px;padding-top:calc(var(--plyr-control-spacing, 10px)*2);position:absolute;right:0;transition:opacity .4s ease-in-out,transform .4s ease-in-out;z-index:3}@media (min-width:480px){.plyr--video .plyr__controls{padding:10px;padding:var(--plyr-control-spacing,10px);padding-top:35px;padding-top:calc(var(--plyr-control-spacing, 10px)*3.5)}}.plyr--video.plyr--hide-controls .plyr__controls{opacity:0;pointer-events:none;transform:translateY(100%)}.plyr--video .plyr__control.plyr__tab-focus,.plyr--video .plyr__control:hover,.plyr--video .plyr__control[aria-expanded=true]{background:#00b2ff;background:var(--plyr-video-control-background-hover,var(--plyr-color-main,var(--plyr-color-main,#00b2ff)));color:#fff;color:var(--plyr-video-control-color-hover,#fff)}.plyr__control--overlaid{background:#00b2ff;background:var(--plyr-video-control-background-hover,var(--plyr-color-main,var(--plyr-color-main,#00b2ff)));border:0;border-radius:100%;color:#fff;color:var(--plyr-video-control-color,#fff);display:none;left:50%;opacity:.9;padding:15px;padding:calc(var(--plyr-control-spacing, 10px)*1.5);position:absolute;top:50%;transform:translate(-50%,-50%);transition:.3s;z-index:2}.plyr__control--overlaid svg{left:2px;position:relative}.plyr__control--overlaid:focus,.plyr__control--overlaid:hover{opacity:1}.plyr--playing .plyr__control--overlaid{opacity:0;visibility:hidden}.plyr--full-ui.plyr--video .plyr__control--overlaid{display:block}.plyr--full-ui.plyr--video input[type=range]::-webkit-slider-runnable-track{background-color:#ffffff40;background-color:var(--plyr-video-range-track-background,var(--plyr-video-progress-buffered-background,hsla(0,0%,100%,.25)))}.plyr--full-ui.plyr--video input[type=range]::-moz-range-track{background-color:#ffffff40;background-color:var(--plyr-video-range-track-background,var(--plyr-video-progress-buffered-background,hsla(0,0%,100%,.25)))}.plyr--full-ui.plyr--video input[type=range]::-ms-track{background-color:#ffffff40;background-color:var(--plyr-video-range-track-background,var(--plyr-video-progress-buffered-background,hsla(0,0%,100%,.25)))}.plyr--full-ui.plyr--video input[type=range]:active::-webkit-slider-thumb{box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33,0 0 0 3px #ffffff80;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2)),0 0 0 var(--plyr-range-thumb-active-shadow-width,3px) var(--plyr-audio-range-thumb-active-shadow-color,hsla(0,0%,100%,.5))}.plyr--full-ui.plyr--video input[type=range]:active::-moz-range-thumb{box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33,0 0 0 3px #ffffff80;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2)),0 0 0 var(--plyr-range-thumb-active-shadow-width,3px) var(--plyr-audio-range-thumb-active-shadow-color,hsla(0,0%,100%,.5))}.plyr--full-ui.plyr--video input[type=range]:active::-ms-thumb{box-shadow:0 1px 1px #23282f26,0 0 0 1px #23282f33,0 0 0 3px #ffffff80;box-shadow:var(--plyr-range-thumb-shadow,0 1px 1px rgba(35,40,47,.15),0 0 0 1px rgba(35,40,47,.2)),0 0 0 var(--plyr-range-thumb-active-shadow-width,3px) var(--plyr-audio-range-thumb-active-shadow-color,hsla(0,0%,100%,.5))}.plyr--video .plyr__progress__buffer{color:#ffffff40;color:var(--plyr-video-progress-buffered-background,hsla(0,0%,100%,.25))}.plyr:fullscreen{background:#000;border-radius:0!important;height:100%;margin:0;width:100%}.plyr:fullscreen video{height:100%}.plyr:fullscreen .plyr__control .icon--exit-fullscreen{display:block}.plyr:fullscreen .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr:fullscreen.plyr--hide-controls{cursor:none}@media (min-width:1024px){.plyr:fullscreen .plyr__captions{font-size:21px;font-size:var(--plyr-font-size-xlarge,21px)}}.plyr--fullscreen-fallback{background:#000;border-radius:0!important;bottom:0;display:block;height:100%;left:0;margin:0;position:fixed;right:0;top:0;width:100%;z-index:10000000}.plyr--fullscreen-fallback video{height:100%}.plyr--fullscreen-fallback .plyr__control .icon--exit-fullscreen{display:block}.plyr--fullscreen-fallback .plyr__control .icon--exit-fullscreen+svg{display:none}.plyr--fullscreen-fallback.plyr--hide-controls{cursor:none}@media (min-width:1024px){.plyr--fullscreen-fallback .plyr__captions{font-size:21px;font-size:var(--plyr-font-size-xlarge,21px)}}.plyr__ads{border-radius:inherit;bottom:0;cursor:pointer;left:0;overflow:hidden;position:absolute;right:0;top:0;z-index:-1}.plyr__ads>div,.plyr__ads>div iframe{height:100%;position:absolute;width:100%}.plyr__ads:after{background:#23282f;border-radius:2px;bottom:10px;bottom:var(--plyr-control-spacing,10px);color:#fff;content:attr(data-badge-text);font-size:11px;padding:2px 6px;pointer-events:none;position:absolute;right:10px;right:var(--plyr-control-spacing,10px);z-index:3}.plyr__ads:empty:after{display:none}.plyr__cues{background:currentColor;display:block;height:5px;height:var(--plyr-range-track-height,5px);left:0;opacity:.8;position:absolute;top:50%;transform:translateY(-50%);width:3px;z-index:3}.plyr__preview-thumb{background-color:#ffffffe6;background-color:var(--plyr-tooltip-background,hsla(0,0%,100%,.9));border-radius:5px;border-radius:var(--plyr-tooltip-radius,5px);bottom:100%;box-shadow:0 1px 2px #00000026;box-shadow:var(--plyr-tooltip-shadow,0 1px 2px rgba(0,0,0,.15));margin-bottom:10px;margin-bottom:calc(var(--plyr-control-spacing, 10px)/2*2);opacity:0;padding:3px;pointer-events:none;position:absolute;transform:translateY(10px) scale(.8);transform-origin:50% 100%;transition:transform .2s ease .1s,opacity .2s ease .1s;z-index:2}.plyr__preview-thumb--is-shown{opacity:1;transform:translate(0) scale(1)}.plyr__preview-thumb:before{border-left:4px solid transparent;border-left:var(--plyr-tooltip-arrow-size,4px) solid transparent;border-right:4px solid transparent;border-right:var(--plyr-tooltip-arrow-size,4px) solid transparent;border-top:4px solid hsla(0,0%,100%,.9);border-top:var(--plyr-tooltip-arrow-size,4px) solid var(--plyr-tooltip-background,hsla(0,0%,100%,.9));bottom:-4px;bottom:calc(var(--plyr-tooltip-arrow-size, 4px)*-1);content:"";height:0;left:calc(50% + var(--preview-arrow-offset));position:absolute;transform:translate(-50%);width:0;z-index:2}.plyr__preview-thumb__image-container{background:#c1c8d1;border-radius:4px;border-radius:calc(var(--plyr-tooltip-radius, 5px) - 1px);overflow:hidden;position:relative;z-index:0}.plyr__preview-thumb__image-container img,.plyr__preview-thumb__image-container:after{height:100%;left:0;position:absolute;top:0;width:100%}.plyr__preview-thumb__image-container:after{border-radius:inherit;box-shadow:inset 0 0 0 1px #00000026;content:"";pointer-events:none}.plyr__preview-thumb__image-container img{max-height:none;max-width:none}.plyr__preview-thumb__time-container{background:linear-gradient(transparent,rgba(0,0,0,.75));background:var(--plyr-video-controls-background,linear-gradient(transparent,rgba(0,0,0,.75)));border-bottom-left-radius:4px;border-bottom-left-radius:calc(var(--plyr-tooltip-radius, 5px) - 1px);border-bottom-right-radius:4px;border-bottom-right-radius:calc(var(--plyr-tooltip-radius, 5px) - 1px);bottom:0;left:0;line-height:1.1;padding:20px 6px 6px;position:absolute;right:0;z-index:3}.plyr__preview-thumb__time-container span{color:#fff;font-size:13px;font-size:var(--plyr-font-size-time,var(--plyr-font-size-small,13px))}.plyr__preview-scrubbing{bottom:0;filter:blur(1px);height:100%;left:0;margin:auto;opacity:0;overflow:hidden;pointer-events:none;position:absolute;right:0;top:0;transition:opacity .3s ease;width:100%;z-index:1}.plyr__preview-scrubbing--is-shown{opacity:1}.plyr__preview-scrubbing img{height:100%;left:0;max-height:none;max-width:none;-o-object-fit:contain;object-fit:contain;position:absolute;top:0;width:100%}.plyr--no-transition{transition:none!important}.plyr__sr-only{clip:rect(1px,1px,1px,1px);border:0!important;height:1px!important;overflow:hidden;padding:0!important;position:absolute!important;width:1px!important}.plyr [hidden]{display:none!important}.plyr--video{width:100%;height:100%}.plyr--audio{width:100%;height:100%;display:flex;align-items:stretch;justify-content:center;background-color:#fff}.telebox-color-scheme-dark .plyr--audio{color-scheme:dark;background-color:#121212;--plyr-audio-controls-background: #121212;--plyr-audio-control-color: #eee}
|
127
|
+
`)();const Sp={volume:1,paused:!0,muted:!1,currentTime:0},Ni={kind:"Plyr",config:{minwidth:300,minheight:80},setup(t){const e=t.storage;if(e.ensureState(Sp),!e.state.src){t.emitter.emit("destroy",{error:new Error('[Plyr]: missing "src"')});return}!e.state.type&&!e.state.provider&&console.warn('[Plyr]: missing "type", will guess from file extension');const i=t.box;i.mountStyles(Mp);const s=new xp(t),r=new vp({target:i.$content,props:{storage:t.storage,sync:s}});t.emitter.on("destroy",()=>{try{s.dispose(),r.$destroy()}catch{}})}},Cp=()=>{ce.register({kind:_i.kind,src:_i}),ce.register({kind:Ni.kind,src:Ni})},Ls={DocsViewer:_i.kind,MediaPlayer:Ni.kind},Ip={[Ls.DocsViewer]:_i,[Ls.MediaPlayer]:Ni};const uo=new Jc({emitter:P}),$=class extends M.InvisiblePlugin{constructor(t){super(t);this.version="1.0.0-canary.40",this.dependencies={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"1.0.0-alpha.34",emittery:"^0.11.0",lodash:"^4.17.21","p-retry":"^4.6.2","side-effect-manager":"^1.1.1",uuid:"^7.0.3","value-enhancer":"^1.3.2"},peerDependencies:{"white-web-sdk":"^2.16.0"},devDependencies:{"@netless/app-docs-viewer":"^0.3.0","@netless/app-plyr":"0.2.0","@playwright/test":"^1.23.2","@rollup/plugin-commonjs":"^20.0.0","@rollup/plugin-node-resolve":"^13.0.4","@rollup/plugin-url":"^6.1.0","@sveltejs/vite-plugin-svelte":"^1.0.0-next.49","@tsconfig/svelte":"^2.0.1","@types/debug":"^4.1.7","@types/lodash":"^4.14.182","@types/lodash-es":"^4.17.6","@types/node":"^18.0.3","@types/uuid":"^8.3.4","@typescript-eslint/eslint-plugin":"^4.30.0","@typescript-eslint/parser":"^4.30.0","@vitest/ui":"^0.14.2",cypress:"^8.7.0",dotenv:"^10.0.0",eslint:"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-svelte3":"^3.2.0",jsdom:"^19.0.0",less:"^4.1.3",prettier:"^2.3.2","prettier-plugin-svelte":"^2.4.0","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-styles":"^3.14.1",svelte:"^3.42.4",typescript:"^4.5.5",vite:"^2.5.3","vite-plugin-dts":"^1.2.1",vitest:"^0.18.0","white-web-sdk":"2.16.26"}},this.emitter=Q,this.viewMode=M.ViewMode.Broadcaster,this.viewMode$=new w.Val(M.ViewMode.Broadcaster),this.isReplay=M.isPlayer(this.displayer),this.containerSizeRatio=$.containerSizeRatio,this.moveCamera=C.debounce(e=>{var r;const i=j({},this.mainView.camera),s=j(j({},i),e);if(!C.isEqual(s,i)&&!!this.appManager)if(e.animationMode===M.AnimationMode.Immediately)this.appManager.mainViewProxy.storeCamera(j({id:this.appManager.uid},s));else{const a=this.appManager.mainViewProxy.size$.value,n=(r=this.boxManager)==null?void 0:r.stageRect;let o;e.scale&&a&&n&&(o=e.scale*Ei(a,n)),o?this.mainView.moveCamera(oe(j({},e),{scale:o})):this.mainView.moveCamera(e),this.appManager.dispatchInternalEvent(Y.MoveCamera,e),setTimeout(()=>{!this.appManager||this.appManager.mainViewProxy.storeCamera(j({id:this.appManager.uid},s))},200)}},200),$.displayer=t.displayer,window.NETLESS_DEPS={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"1.0.0-alpha.34",emittery:"^0.11.0",lodash:"^4.17.21","p-retry":"^4.6.2","side-effect-manager":"^1.1.1",uuid:"^7.0.3","value-enhancer":"^1.3.2"},peerDependencies:{"white-web-sdk":"^2.16.0"},devDependencies:{"@netless/app-docs-viewer":"^0.3.0","@netless/app-plyr":"0.2.0","@playwright/test":"^1.23.2","@rollup/plugin-commonjs":"^20.0.0","@rollup/plugin-node-resolve":"^13.0.4","@rollup/plugin-url":"^6.1.0","@sveltejs/vite-plugin-svelte":"^1.0.0-next.49","@tsconfig/svelte":"^2.0.1","@types/debug":"^4.1.7","@types/lodash":"^4.14.182","@types/lodash-es":"^4.17.6","@types/node":"^18.0.3","@types/uuid":"^8.3.4","@typescript-eslint/eslint-plugin":"^4.30.0","@typescript-eslint/parser":"^4.30.0","@vitest/ui":"^0.14.2",cypress:"^8.7.0",dotenv:"^10.0.0",eslint:"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-svelte3":"^3.2.0",jsdom:"^19.0.0",less:"^4.1.3",prettier:"^2.3.2","prettier-plugin-svelte":"^2.4.0","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-styles":"^3.14.1",svelte:"^3.42.4",typescript:"^4.5.5",vite:"^2.5.3","vite-plugin-dts":"^1.2.1",vitest:"^0.18.0","white-web-sdk":"2.16.26"}}}static async mount(t){var a;const e=t.room;$.container=t.container;const i=t.debug,s=t.cursor;$.params=t,$.displayer=t.room,cl();let r;if(M.isRoom(e)){if(e.phase!==M.RoomPhase.Connected)throw new Error("[WindowManager]: Room only Connected can be mount");e.phase===M.RoomPhase.Connected&&e.isWritable&&(e.disableSerialization=!1),r=await this.initManager(e)}if($.isCreated)throw new Error("[WindowManager]: Already created cannot be created again");if(this.debug=Boolean(i),Je("Already insert room",r),M.isRoom(this.displayer)){if(!r)throw new Error("[WindowManager]: init InvisiblePlugin failed")}else await No.default(async n=>{if(r=await e.getInvisiblePlugin($.kind),!r)throw Je(`manager is empty. retrying ${n}`),new Error},{retries:10});if(!r)throw new Error("[WindowManager]: create manager failed");t.containerSizeRatio&&($.containerSizeRatio=t.containerSizeRatio),r.containerSizeRatio=$.containerSizeRatio,await r.ensureAttributes(),r.appManager=new yl(r),r._pageState=new qc(r.appManager),r.cursorManager=new Gc(r.appManager,Boolean(s),t.applianceIcons),r.boxManager=Sc(r,Q,P,Ue,{collectorContainer:t.collectorContainer,collectorStyles:t.collectorStyles,prefersColorScheme:t.prefersColorScheme,stageRatio:$.containerSizeRatio,containerStyle:t.containerStyle,stageStyle:t.stageStyle,fullscreen:t.fullscreen}),(a=r.appManager)==null||a.setBoxManager(r.boxManager),t.container&&r.bindContainer(t.container),Xc(e,r),P.emit("onCreated"),$.isCreated=!0;try{await Vo()}catch(n){console.warn("[WindowManager]: indexedDB open failed"),console.log(n)}return r}static async initManager(t){let e=t.getInvisiblePlugin($.kind);if(!e&&M.isRoom(t))if(t.isWritable===!1){try{await t.setWritable(!0)}catch{throw new Error("[WindowManger]: room must be switched to be writable")}e=await Nr(t),e==null||e.ensureAttributes(),await Mi(500),await t.setWritable(!1)}else e=await Nr(t);return e}static initContainer(t,e,i){$.container||($.container=t);const{playground:s,mainViewElement:r}=ll(t,e);if($.playground=s,i){const a=document.createElement("style");a.textContent=i,s.appendChild(a)}return r}static get registered(){return pe.registered}bindContainer(t){var e,i,s,r,a,n;if(M.isRoom(this.displayer)&&this.room.phase!==M.RoomPhase.Connected)throw new xa;if($.isCreated&&$.container)$.container.firstChild&&t.appendChild($.container.firstChild);else{const o=(e=this.boxManager)==null?void 0:e.teleBoxManager.$stage;if($.params&&o){const c=$.params,l=$.initContainer(t,o,c.overwriteStyles);this.boxManager&&$.playground&&this.boxManager.setRoot($.playground),this.bindMainView(l,c.disableCameraTransform),$.playground&&((i=this.cursorManager)==null||i.setupWrapper($.playground))}}P.emit("updateManagerRect"),(s=this.appManager)==null||s.refresh(),(r=this.appManager)==null||r.resetMaximized(),(a=this.appManager)==null||a.resetMinimized(),(n=this.appManager)==null||n.displayerWritableListener(!this.room.isWritable),$.container=t}bindCollectorContainer(t){$.isCreated&&this.boxManager?this.boxManager.setCollector(t):$.params&&($.params.collectorContainer=t)}static register(t){return pe.register(t)}static unregister(t){return pe.unregister(t)}async addApp(t){if(this.appManager)return this.appManager.rootDirRemoving?new Promise((e,i)=>{P.once("rootDirRemoved").then(async()=>{try{const s=await this._addApp(t);e(s)}catch(s){i(s.message)}})}):this._addApp(t);throw new de}async _addApp(t){var e,i,s;if(this.appManager){if(!t.kind||typeof t.kind!="string")throw new ya;const r=await((e=pe.appClasses.get(t.kind))==null?void 0:e());if(r&&((i=r.config)==null?void 0:i.singleton)&&this.appManager.appProxies.has(t.kind))throw new fa;const a=this.setupScenePath(t,this.appManager);return a===void 0?void 0:((s=t==null?void 0:t.options)!=null&&s.scenePath&&(t.options.scenePath=Ko(t.options.scenePath)),await this.appManager.addApp(t,Boolean(a)))}else throw new de}setupScenePath(t,e){let i=!1;if(t.options){const{scenePath:s,scenes:r}=t.options;if(s){if(!Xo(s))throw new va;const a=Object.keys(this.apps||{});for(const n of a){const o=e.store.getAppScenePath(n);if(o&&o===s){if(console.warn(`[WindowManager]: ScenePath ${s} Already opened`),this.boxManager){const c=this.boxManager.getTopBox();c&&this.boxManager.setZIndex(n,c.zIndex+1,!1)}return}}}s&&r&&r.length>0&&(this.isDynamicPPT(r)?(i=!0,ut(this.displayer)[s]||vt(this.room,s,r)):ut(this.displayer)[s]||vt(this.room,s,[{name:r[0].name}])),s&&r===void 0&&vt(this.room,s,[{}])}return i}async setMainViewScenePath(t){this.appManager&&await this.appManager.setMainViewScenePath(t)}async setMainViewSceneIndex(t){this.appManager&&await this.appManager.setMainViewSceneIndex(t)}async nextPage(){if(this.appManager){const t=this.mainViewSceneIndex+1;return t>=this.mainViewScenesLength?(console.warn("[WindowManager]: current page is the last page"),!1):(await this.appManager.setMainViewSceneIndex(t),!0)}else return!1}async prevPage(){if(this.appManager){const t=this.mainViewSceneIndex-1;return t<0?(console.warn("[WindowManager]: current page is the first page"),!1):(await this.appManager.setMainViewSceneIndex(t),!0)}else return!1}async jumpPage(t){return this.appManager?t<0||t>=this.pageState.length?(console.warn(`[WindowManager]: index ${t} out of range`),!1):(await this.appManager.setMainViewSceneIndex(t),!0):!1}async addPage(t){if(this.appManager){const e=t==null?void 0:t.after,i=t==null?void 0:t.scene;if(e){const s=this.mainViewSceneIndex+1;this.room.putScenes(we,[i||{}],s)}else this.room.putScenes(we,[i||{}])}}async removePage(t){if(this.appManager){const e=t===void 0?this.pageState.index:t;return this.pageState.length===1?(console.warn("[WindowManager]: can not remove the last page"),!1):e<0||e>=this.pageState.length?(console.warn(`[WindowManager]: index ${t} out of range`),!1):this.appManager.removeSceneByIndex(e)}else return!1}getMainViewScenePath(){var t;return(t=this.appManager)==null?void 0:t.store.getMainViewScenePath()}getMainViewSceneIndex(){var t;return(t=this.appManager)==null?void 0:t.store.getMainViewSceneIndex()}setReadonly(t){var e;this.readonly=t,(e=this.boxManager)==null||e.setReadonly(t),P.emit("setReadonly",t)}switchMainViewToWriter(){var t;return(t=this.appManager)==null?void 0:t.mainViewProxy.mainViewClickHandler()}onAppDestroy(t,e){qo(`destroy-${t}`,e)}setViewMode(t){var i;Je("setViewMode",t);const e=(i=this.appManager)==null?void 0:i.mainViewProxy;t===M.ViewMode.Broadcaster&&(this.canOperate&&(e==null||e.storeCurrentCamera()),e==null||e.start()),t===M.ViewMode.Freedom&&(e==null||e.stop()),this.viewMode=t,this.viewMode$.setValue(t)}setBoxState(t){if(!!this.canOperate)switch(t){case"normal":this.setMaximized(!1),this.setMinimized(!1);break;case"maximized":this.setMaximized(!0),this.setMinimized(!1);break;case"minimized":this.setMinimized(!0);break}}setMaximized(t){var e;!this.canOperate||(e=this.boxManager)==null||e.setMaximized(t,!1)}setMinimized(t){var e;!this.canOperate||(e=this.boxManager)==null||e.setMinimized(t,!1)}get mainView(){if(this.appManager)return this.appManager.mainViewProxy.view;throw new de}get camera(){if(this.appManager)return this.appManager.mainViewProxy.view.camera;throw new de}get baseCamera(){if(this.appManager)return this.appManager.mainViewProxy.camera$.value;throw new de}get baseSize(){if(this.appManager)return this.appManager.mainViewProxy.size$.value;throw new de}get cameraState(){if(this.appManager)return this.appManager.mainViewProxy.cameraState;throw new de}get apps(){var t;return(t=this.appManager)==null?void 0:t.store.apps()}get boxState(){var t;if(this.appManager)return(t=this.appManager.boxManager)==null?void 0:t.boxState;throw new de}get darkMode(){var t,e;return Boolean((e=(t=this.appManager)==null?void 0:t.boxManager)==null?void 0:e.darkMode)}get prefersColorScheme(){var t;if(this.appManager)return(t=this.appManager.boxManager)==null?void 0:t.prefersColorScheme;throw new de}get fullscreen(){var t;if(this.appManager)return(t=this.appManager.boxManager)==null?void 0:t.teleBoxManager.fullscreen;throw new de}get focused(){return this.attributes.focus}get focusedView(){var t,e;return((e=(t=this.appManager)==null?void 0:t.focusApp)==null?void 0:e.view)||this.mainView}get mainViewSceneIndex(){var t;return((t=this._pageState)==null?void 0:t.index)||0}get mainViewSceneDir(){var t;if(this.appManager)return(t=this.appManager)==null?void 0:t.getMainViewSceneDir();throw new de}get topApp(){var t,e;return(e=(t=this.boxManager)==null?void 0:t.getTopBox())==null?void 0:e.id}get mainViewScenesLength(){var t;return((t=this._pageState)==null?void 0:t.length)||0}get canRedoSteps(){var t;return((t=this.focusedView)==null?void 0:t.canRedoSteps)||0}get canUndoSteps(){var t;return((t=this.focusedView)==null?void 0:t.canUndoSteps)||0}get sceneState(){if(this.appManager)return this.appManager.sceneState;throw new de}get pageState(){if(this._pageState)return this._pageState.toObject();throw new de}get teleboxManager(){if(!this.boxManager)throw new Vs;return this.boxManager.teleBoxManager}queryAll(){var t;return Array.from(((t=this.appManager)==null?void 0:t.appProxies.values())||[])}queryOne(t){var e;return(e=this.appManager)==null?void 0:e.appProxies.get(t)}async closeApp(t){var e;return(e=this.appManager)==null?void 0:e.closeApp(t)}convertToPointInWorld(t){return this.mainView.convertToPointInWorld(t)}setCameraBound(t){this.mainView.setCameraBound(t)}onDestroy(){this._destroy()}destroy(){this._destroy()}_destroy(){var t,e,i;(t=this.appManager)==null||t.destroy(),(e=this.cursorManager)==null||e.destroy(),$.container=void 0,$.isCreated=!1,$.playground&&((i=$.playground.parentNode)==null||i.removeChild($.playground)),$.params=void 0,Je("Destroyed")}bindMainView(t,e){var i;this.appManager&&(this.appManager.bindMainView(t,Boolean(e)),(i=this.cursorManager)==null||i.setMainViewDivElement(t))}get canOperate(){return M.isRoom(this.displayer)?this.displayer.isWritable&&this.displayer.phase===M.RoomPhase.Connected:!1}get room(){return this.displayer}safeSetAttributes(t){this.canOperate&&this.setAttributes(t)}safeUpdateAttributes(t,e){this.canOperate&&this.updateAttributes(t,e)}setPrefersColorScheme(t){var e,i;(i=(e=this.appManager)==null?void 0:e.boxManager)==null||i.setPrefersColorScheme(t)}setFullscreen(t){var e,i;(i=(e=this.appManager)==null?void 0:e.boxManager)==null||i.teleBoxManager.setFullscreen(t)}cleanCurrentScene(){var t;(t=this.focusedView)==null||t.cleanCurrentScene()}redo(){var t;return((t=this.focusedView)==null?void 0:t.redo())||0}undo(){var t;return((t=this.focusedView)==null?void 0:t.undo())||0}delete(){var t;(t=this.focusedView)==null||t.delete()}copy(){var t;(t=this.focusedView)==null||t.copy()}paste(){var t;(t=this.focusedView)==null||t.paste()}duplicate(){var t;(t=this.focusedView)==null||t.duplicate()}insertText(t,e,i){var s;return((s=this.focusedView)==null?void 0:s.insertText(t,e,i))||""}insertImage(t){var e;return(e=this.focusedView)==null?void 0:e.insertImage(t)}completeImageUpload(t,e){var i;return(i=this.focusedView)==null?void 0:i.completeImageUpload(t,e)}lockImage(t,e){var i;return(i=this.focusedView)==null?void 0:i.lockImage(t,e)}lockImages(t){var e;return(e=this.focusedView)==null?void 0:e.lockImages(t)}refresh(){var t;this._refresh(),(t=this.appManager)==null||t.dispatchInternalEvent(Y.Refresh)}_refresh(){var t,e;(t=this.appManager)==null||t.mainViewProxy.rebind(),$.container&&this.bindContainer($.container),(e=this.appManager)==null||e.refresher.refresh()}setContainerSizeRatio(t){if(!C.isNumber(t))throw new Error(`[WindowManager]: updateContainerSizeRatio error, ratio must be a number. but got ${t}`);$.containerSizeRatio=t,this.containerSizeRatio=t,P.emit("containerSizeRatioUpdate",t)}setContainerStyle(t){var e;(e=this.boxManager)==null||e.teleBoxManager.setContainerStyle(t)}setStageStyle(t){var e;(e=this.boxManager)==null||e.teleBoxManager.setStageStyle(t)}setBaseSize(t){var e;(e=this.appManager)==null||e.mainViewProxy.setMainViewSize(t),setTimeout(()=>{!this.appManager||!this.appManager.mainViewProxy.camera$.value||this.appManager.mainViewProxy.storeCamera(oe(j({},this.appManager.mainViewProxy.camera$.value),{id:this.appManager.uid,scale:1}))},500)}createPPTHandler(){return{onPageJumpTo:(t,e)=>{var i,s,r,a;(a=(r=(s=(i=this.appManager)==null?void 0:i.focusApp)==null?void 0:s.appContext)==null?void 0:r.whiteBoardView)==null||a.jumpPage(e)},onPageToNext:()=>{var t,e,i,s;this.focused&&((s=(i=(e=(t=this.appManager)==null?void 0:t.focusApp)==null?void 0:e.appContext)==null?void 0:i.whiteBoardView)==null||s.nextPage())},onPageToPrev:()=>{var t,e,i,s;this.focused&&((s=(i=(e=(t=this.appManager)==null?void 0:t.focusApp)==null?void 0:e.appContext)==null?void 0:i.whiteBoardView)==null||s.prevPage())}}}isDynamicPPT(t){var i,s;const e=(s=(i=t[0])==null?void 0:i.ppt)==null?void 0:s.src;return e==null?void 0:e.startsWith("pptx://")}async ensureAttributes(){C.isNull(this.attributes)&&await Mi(50),C.isObject(this.attributes)&&(this.attributes[ee.Apps]||this.safeSetAttributes({[ee.Apps]:{}}),this.attributes[ee.Cursors]||this.safeSetAttributes({[ee.Cursors]:{}}),this.attributes._mainScenePath||this.safeSetAttributes({_mainScenePath:ga}),this.attributes._mainSceneIndex||this.safeSetAttributes({_mainSceneIndex:0}),this.attributes[ee.Registered]||this.safeSetAttributes({[ee.Registered]:{}}))}};let ce=$;ce.kind="WindowManager";ce.debug=!1;ce.containerSizeRatio=zo;ce.isCreated=!1;Cp();exports.AppCreateError=fa;exports.AppManagerNotInitError=de;exports.AppNotRegisterError=sl;exports.BindContainerRoomPhaseInvalidError=xa;exports.BoxManagerNotInitializeError=Vs;exports.BoxNotCreatedError=wa;exports.BuiltinApps=Ls;exports.BuiltinAppsMap=Ip;exports.InvalidScenePath=va;exports.ParamsInvalidError=ya;exports.WhiteWebSDKInvalidError=ba;exports.WindowManager=ce;exports.calculateNextIndex=$s;exports.reconnectRefresher=uo;
|