@netless/window-manager 1.0.0-canary.33 → 1.0.0-canary.36

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.umd.js CHANGED
@@ -1,5 +1,5 @@
1
- var gS=Object.defineProperty,mS=Object.defineProperties;var vS=Object.getOwnPropertyDescriptors;var Wf=Object.getOwnPropertySymbols;var wS=Object.prototype.hasOwnProperty,yS=Object.prototype.propertyIsEnumerable;var Ff=(O,se,$e)=>se in O?gS(O,se,{enumerable:!0,configurable:!0,writable:!0,value:$e}):O[se]=$e,F=(O,se)=>{for(var $e in se||(se={}))wS.call(se,$e)&&Ff(O,$e,se[$e]);if(Wf)for(var $e of Wf(se))yS.call(se,$e)&&Ff(O,$e,se[$e]);return O},Nt=(O,se)=>mS(O,vS(se));(function(O,se){typeof exports=="object"&&typeof module!="undefined"?se(exports,require("p-retry"),require("emittery"),require("lodash"),require("white-web-sdk"),require("uuid"),require("side-effect-manager"),require("value-enhancer"),require("@juggle/resize-observer"),require("video.js")):typeof define=="function"&&define.amd?define(["exports","p-retry","emittery","lodash","white-web-sdk","uuid","side-effect-manager","value-enhancer","@juggle/resize-observer","video.js"],se):(O=typeof globalThis!="undefined"?globalThis:O||self,se(O.WindowManager={},O.pRetry,O.Emittery,O.lodash,O.whiteWebSdk,O.uuid,O.sideEffectManager,O.valueEnhancer,O.resizeObserver,O.p$1))})(this,function(O,se,$e,A,b,Qf,Pe,I,ru,Zf){"use strict";function Js(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var Yf=Js(se),kt=Js($e),su=Js(Zf),Z=(e=>(e.AppMove="AppMove",e.AppFocus="AppFocus",e.AppResize="AppResize",e.AppBoxStateChange="AppBoxStateChange",e.GetAttributes="GetAttributes",e.UpdateWindowManagerWrapper="UpdateWindowManagerWrapper",e.WindowCreated="WindowCreated",e.SetMainViewScenePath="SetMainViewScenePath",e.SetMainViewSceneIndex="SetMainViewSceneIndex",e.SetAppFocusIndex="SetAppFocusIndex",e.SwitchViewsToFreedom="SwitchViewsToFreedom",e.CursorMove="CursorMove",e.RootDirRemoved="RootDirRemoved",e.Refresh="Refresh",e.InitMainViewCamera="InitMainViewCamera",e.InvokeAttributesUpdateCallback="InvokeAttributesUpdateCallback",e))(Z||{});const Ks="__WindowManger",qs="__WindowMangerEnsureReconnected__";var Ye=(e=>(e.Size="size",e.Position="position",e.SceneIndex="SceneIndex",e.ZIndex="zIndex",e.Visible="visible",e.Ratio="ratio",e.StageRatio="stageRatio",e.Draggable="draggable",e.Resizable="resizable",e))(Ye||{}),ou=(e=>(e.setBoxSize="setBoxSize",e.setBoxMinSize="setBoxMinSize",e.destroy="destroy",e))(ou||{}),eo=(e=>(e.StartCreate="StartCreate",e))(eo||{}),au=(e=>(e.Leave="leave",e.Normal="normal",e))(au||{});const lu="2.16.1",Gf=340/720,Xf=340/720,Jf=9/16,ze="/",uu="/init",cu=50,du=500,ee=new kt.default;class Kf{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(t){this.list.push(t),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 t=this.list.shift();t&&(this.currentInvoker=t,t().then(()=>{this.invoked()}).catch(i=>{console.error(`[WindowManager]: create app error: ${i.message}`),this.invoked()}))}emitReady(){this.isEmit||setTimeout(()=>{ee.emit("ready")},cu),this.isEmit=!0}empty(){this.list=[],this.clear()}destroy(){this.timer&&this.clear()}}const j=new kt.default,qf="__WindowManagerAppCache";let sn,hu;const eg=async()=>{sn=await ng()},tg=(e,t)=>{if(!!sn)return sg(sn,{kind:e,sourceCode:t})},ig=async e=>sn?await rg(sn,e):null;function ng(){return new Promise((e,t)=>{const i=indexedDB.open(qf,2);i.onerror=n=>{t(n)},i.onupgradeneeded=n=>{const r=n.target.result;r.objectStoreNames.contains("apps")||(hu=r.createObjectStore("apps",{keyPath:"kind"}),hu.createIndex("kind","kind",{unique:!0}))},i.onsuccess=()=>{const n=i.result;e(n)}})}function rg(e,t){return new Promise((i,n)=>{const s=e.transaction(["apps"]).objectStore("apps").index("kind").get(t);s.onerror=o=>n(o),s.onsuccess=()=>{s.result?i(s.result):i(null)}})}function sg(e,t){return new Promise((i,n)=>{const r=e.transaction(["apps"],"readwrite").objectStore("apps").add(t);r.onsuccess=()=>i(),r.onerror=()=>n()})}const og="NetlessApp",ag=1e4,lg=async e=>{const t=await ig(e);if(t)return t.sourceCode;{const n=await(await cg(e,{timeout:ag})).text();return await tg(e,n),n}},pu=(e,t)=>{let i=Function(e+`
2
- ;return ${t}`)();return typeof i=="undefined"&&(i=window[t]),i},ug=async(e,t,i)=>{const n=i||og+t;ee.emit("loadApp",{kind:t,status:"start"});try{const r=await lg(e);if(!r||r.length===0){ee.emit("loadApp",{kind:t,status:"failed",reason:"script is empty."});return}try{const s=pu(r,n);return ee.emit("loadApp",{kind:t,status:"success"}),s}catch(s){if(s.message.includes("Can only have one anonymous define call per script file")){const o=window.define;typeof o=="function"&&o.amd&&delete o.amd;const a=pu(r,n);return ee.emit("loadApp",{kind:t,status:"success"}),a}ee.emit("loadApp",{kind:t,status:"failed",reason:s.message})}}catch(r){ee.emit("loadApp",{kind:t,status:"failed",reason:r.message})}};async function cg(e,t){const{timeout:i=1e4}=t,n=new AbortController,r=setTimeout(()=>n.abort(),i),s=await fetch(e,Nt(F({},t),{signal:n.signal,headers:{"content-type":"text/plain"}}));return clearTimeout(r),s}class dg{constructor(){this.kindEmitters=new Map,this.registered=new Map,this.appClassesCache=new Map,this.appClasses=new Map,this.syncRegisterApp=null,this.onSyncRegisterAppChange=t=>{this.register({kind:t.kind,src:t.src})}}setSyncRegisterApp(t){this.syncRegisterApp=t}async register(t){this.appClassesCache.delete(t.kind),this.registered.set(t.kind,t);const i=t.src;let n;if(typeof i=="string"?(n=async()=>{let r=await ug(i,t.kind,t.name);if(r)return r.__esModule&&(r=r.default),r;throw new Error(`[WindowManager]: load remote script failed, ${i}`)},this.syncRegisterApp&&this.syncRegisterApp({kind:t.kind,src:i,name:t.name})):typeof i=="function"?n=i:n=async()=>i,this.appClasses.set(t.kind,async()=>{let r=this.appClassesCache.get(t.kind);return r||(r=n(),this.appClassesCache.set(t.kind,r)),r}),t.addHooks){const r=this.createKindEmitter(t.kind);r&&t.addHooks(r)}}unregister(t){this.appClasses.delete(t),this.appClassesCache.delete(t),this.registered.delete(t);const i=this.kindEmitters.get(t);i&&(i.clearListeners(),this.kindEmitters.delete(t))}async notifyApp(t,i,n){const r=this.kindEmitters.get(t);await(r==null?void 0:r.emit(i,n))}createKindEmitter(t){if(!this.kindEmitters.has(t)){const i=new kt.default;this.kindEmitters.set(t,i)}return this.kindEmitters.get(t)}}const Ie=new dg,hg=async e=>{var i,n;const t=await((i=Ie.appClasses.get(e))==null?void 0:i());return t&&((n=t.config)==null?void 0:n.singleton)?e:`${e}-${Qf.v4().replace("-","").slice(0,8)}`},ii=(e,t)=>{if(!e.didRelease&&e.focusScenePath!==t)return e.focusScenePath=t,e},fu=e=>{e.didRelease||e.release()},on=(e,t)=>{if(e&&e.isWritable&&e.state.sceneState.scenePath!==t){const i=t==="/"?"":t;e.setScenePath(i)}},pg=(e,t,i)=>{var n;if(e&&t){const s=(n=ni(e)[t])==null?void 0:n[i];if(s)return`${t}/${s.name}`}},to=(e,t,i)=>{e&&e.scenePathType(t)!==b.ScenePathType.None&&e.removeScenes(t,i)},fg=(e,t)=>{j.once(e).then(t)};A.debounce((e,t)=>{e.emit("mainViewModeChange",t)},200);const gg=(e,t,i=0)=>{const n=ni(e)[t];if(!n)return;const r=n[i];if(!r)return;const s=r.name;return t===ze?`/${s}`:`${t}/${s}`},ni=e=>e.entireScenes(),Ti=(e,t,i,n)=>e==null?void 0:e.putScenes(t,i,n),mg=e=>e.startsWith("/"),io=e=>{const t=e.split("/");t.pop();let i=t.join("/");return i===""&&(i="/"),i},vg=e=>e.endsWith("/")?e.slice(0,-1):e,gu=e=>{const t=e.split(".").map(i=>i.padStart(2,"0")).join("");return parseInt(t)},cr=e=>new Promise(t=>setTimeout(t,e)),wg=e=>e.split("").reduce((i,n)=>(n===ze&&(i+=1),i),0)===1;class yg{constructor(t){this.manager=t,this.displayer=this.manager.displayer,this.mainMagixEventListener=i=>{if(i.authorId!==this.displayer.observerId){const n=i.payload;switch(n.eventName){case Z.AppMove:{this.appMoveHandler(n.payload);break}case Z.AppResize:{this.appResizeHandler(n.payload);break}case Z.AppBoxStateChange:{this.boxStateChangeHandler(n.payload);break}case Z.SetMainViewScenePath:{this.setMainViewScenePathHandler(n.payload);break}case Z.CursorMove:{this.cursorMoveHandler(n.payload);break}case Z.RootDirRemoved:{this.rootDirRemovedHandler();break}case Z.Refresh:{this.refreshHandler();break}case Z.InitMainViewCamera:{this.initMainViewCameraHandler();break}case Z.SetAppFocusIndex:{this.setAppFocusViewIndexHandler(n.payload);break}case Z.InvokeAttributesUpdateCallback:{this.manager.attributesUpdateCallback(this.manager.attributes.apps);break}}}},this.appMoveHandler=i=>{var n;(n=this.boxManager)==null||n.moveBox(i)},this.appResizeHandler=i=>{var n,r;(n=this.boxManager)==null||n.resizeBox(Object.assign(i,{skipUpdate:!0})),(r=this.manager.room)==null||r.refreshViewSize()},this.boxStateChangeHandler=i=>{ee.emit("boxStateChange",i)},this.setMainViewScenePathHandler=({nextScenePath:i})=>{ii(this.manager.mainView,i),ee.emit("mainViewScenePathChange",i)},this.cursorMoveHandler=i=>{j.emit("cursorMove",i)},this.rootDirRemovedHandler=()=>{this.manager.createRootDirScenesCallback(),this.manager.mainViewProxy.rebind(),j.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 n=this.manager.appProxies.get(i.appID);n&&n.setSceneIndexWithoutSync(i.index)}}}get boxManager(){return this.manager.boxManager}addListeners(){this.displayer.addMagixEventListener(Ks,this.mainMagixEventListener)}removeListeners(){this.displayer.removeMagixEventListener(Ks,this.mainMagixEventListener)}}class mu extends Error{constructor(){super(...arguments);this.message="[WindowManager]: app duplicate exists and cannot be created again"}}class xg extends Error{constructor(t){super(`[WindowManager]: app ${t} need register or provide src`)}}class be extends Error{constructor(){super(...arguments);this.message="[WindowManager]: AppManager must be initialized"}}class vu extends Error{constructor(t){super(`[WindowManager]: white-web-sdk version must large than ${t}`)}}class wu extends Error{constructor(){super(...arguments);this.message="[WindowManager]: kind must be a valid string"}}class yu extends Error{constructor(){super(...arguments);this.message="[WindowManager]: box need created"}}class xu extends Error{constructor(){super(...arguments);this.message='[WindowManager]: ScenePath should start with "/"'}}class Su extends Error{constructor(){super(...arguments);this.message="[WindowManager]: boxManager not found"}}class Cu extends Error{constructor(){super(...arguments);this.message="[WindowManager]: room phase only Connected can be bindContainer"}}const Mu=e=>(t,i)=>{if(t!==void 0)if(b.listenUpdated){const n=r=>{r.map(o=>o.kind).includes(e)&&i()};return b.listenUpdated(t,n),i(),()=>b.unlistenUpdated(t,n)}else return b.reaction(()=>t,()=>{i()},{fireImmediately:!0})},Iu=(e,t,i)=>{let n=null;const r=b.reaction(e,()=>{n&&(n(),n=null);const s=e();A.isObject(s)?(n=()=>b.unlistenUpdated(s,t),b.listenUpdated(s,t)):i==null||i(s)},{fireImmediately:!0});return()=>{n==null||n(),r()}},Sg=Mu(b.UpdateEventKind.Removed);Mu(b.UpdateEventKind.Inserted);const no=Object.keys;function bu(e){return Boolean(A.has(e,"__isRef"))}function Cg(e){return{k:Pe.genUID(),v:e,__isRef:!0}}class Mg{constructor(){this.listeners=new Set}get length(){return this.listeners.size}dispatch(t){this.listeners.forEach(i=>i(t))}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}}const Ge="_WM-STORAGE_";class Au{constructor(t,i,n){if(this._sideEffect=new Pe.SideEffectManager,this._destroyed=!1,this._refMap=new WeakMap,this._lastValue=new Map,this.onStateChanged=new Mg,n&&!A.isObject(n))throw new Error(`Default state for Storage ${i} is not an object.`);this._context=t,this.id=i||null,this._state={};const r=this._getRawState(this._state);this._context.isWritable&&(this.id===null?t.isAddApp&&n&&this.setState(n):(r===this._state||!A.isObject(r))&&(A.get(this._context.getAttributes(),[Ge])||this._context.updateAttributes([Ge],{}),this._context.updateAttributes([Ge,this.id],this._state),n&&this.setState(n))),no(r).forEach(s=>{if(!(this.id===null&&s===Ge))try{const o=A.isObject(r[s])?JSON.parse(JSON.stringify(r[s])):r[s];bu(o)?(this._state[s]=o.v,A.isObject(o.v)&&this._refMap.set(o.v,o)):this._state[s]=o}catch(o){console.error(o)}}),this._sideEffect.addDisposer(Iu(()=>this.id===null?t.getAttributes():A.get(t.getAttributes(),[Ge,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(t){return this.onStateChanged.addListener(t),()=>this.onStateChanged.removeListener(t)}ensureState(t){return this.setState(no(t).reduce((i,n)=>(A.has(this._state,n)||(i[n]=t[n]),i),{}))}setState(t){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`),t);return}const i=no(t);i.length>0&&i.forEach(n=>{const r=t[n];if(r!==this._state[n])if(r===void 0)this._lastValue.set(n,this._state[n]),delete this._state[n],this._setRawState(n,r);else{this._lastValue.set(n,this._state[n]),this._state[n]=r;let s=r;if(A.isObject(r)){let o=this._refMap.get(r);o||(o=Cg(r),this._refMap.set(r,o)),s=o}this._setRawState(n,s)}})}emptyStorage(){if(!(A.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(A.mapValues(this._state,A.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([Ge,this.id],void 0)}get destroyed(){return this._destroyed}destroy(){this._destroyed=!0,this._sideEffect.flushAll()}_getRawState(t){var i;return this.id===null?(i=this._context.getAttributes())!=null?i:t:A.get(this._context.getAttributes(),[Ge,this.id],t)}_setRawState(t,i){if(this.id===null){if(t===Ge)throw new Error(`Cannot set attribute internal filed "${Ge}"`);return this._context.updateAttributes([t],i)}else return this._context.updateAttributes([Ge,this.id,t],i)}_updateProperties(t){var i;if(this._destroyed){console.error(new Error(`Cannot call _updateProperties on destroyed Storage "${this.id}".`));return}if(t.length>0){const n={};for(let r=0;r<t.length;r++)try{const s=t[r],o=s.key;if(this.id===null&&o===Ge)continue;const a=A.isObject(s.value)?JSON.parse(JSON.stringify(s.value)):s.value;let l;switch(this._lastValue.has(o)&&(l=this._lastValue.get(o),this._lastValue.delete(o)),s.kind){case 2:{A.has(this._state,o)&&(l=this._state[o],delete this._state[o]),n[o]={oldValue:l};break}default:{let u=a;if(bu(a)){const{k:h,v:p}=a,w=this._state[o];A.isObject(w)&&((i=this._refMap.get(w))==null?void 0:i.k)===h?u=w:(u=p,A.isObject(p)&&this._refMap.set(p,a))}u!==this._state[o]&&(l=this._state[o],this._state[o]=u),n[o]={newValue:u,oldValue:l};break}}}catch(s){console.error(s)}this.onStateChanged.dispatch(n)}}}class Ig{constructor(t,i,n,r){this.view=t,this.appContext=i,this.appProxy=n,this.ensureSize=r,this.nextPage=async()=>{const u=this.pageState.index+1;return this.jumpPage(u)},this.prevPage=async()=>{const u=this.pageState.index-1;return this.jumpPage(u)},this.jumpPage=async u=>u<0||u>=this.pageState.length?(console.warn(`[WindowManager]: index ${u} out of range`),!1):(this.appProxy.setSceneIndex(u),!0),this.addPage=async u=>{const h=u==null?void 0:u.after,p=u==null?void 0:u.scene,w=this.appProxy.scenePath;if(!!w)if(h){const C=this.pageState.index+1;Ti(this.appContext.room,w,[p||{}],C)}else Ti(this.appContext.room,w,[p||{}])},this.removePage=async u=>{const h=u===void 0?this.pageState.index:u;return this.pageState.length===1?(console.warn("[WindowManager]: can not remove the last page"),!1):h<0||h>=this.pageState.length?(console.warn(`[WindowManager]: page index ${u} out of range`),!1):this.appProxy.removeSceneByIndex(h)};const s=new I.Val(n.pageState),o=new I.Val(n.size$.value),a=u=>A.pick(u,["centerX","centerY","scale"]),l=new I.Val(a(this.view.camera));this.baseRect$=o,this.pageState$=s,this.baseCamera$=l,this.appProxy.sideEffectManager.add(()=>[n.appEmitter.on("pageStateChange",u=>s.setValue(u)),n.camera$.subscribe(u=>{u&&l.setValue(a(u))}),n.size$.subscribe(u=>{u&&o.setValue(A.pick(u,["width","height"]))})]),t.disableCameraTransform=!0}get pageState(){return this.pageState$.value}moveCamera(t){this.appProxy.moveCamera(t)}setBaseRect(t){this.appProxy.updateSize(t.width,t.height)}}const Pt=(...e)=>{we.debug&&console.log("[WindowManager]:",...e)},bg=(e,t)=>{const i=document.createElement("div");i.className="netless-window-manager-playground";const n=document.createElement("div");return n.className="netless-window-manager-main-view",t.appendChild(n),e.appendChild(i),{playground:i,mainViewElement:n}},Ag=()=>{if(gu(b.WhiteVersion)<gu(lu))throw new vu(lu)},Eu=(e,t)=>{const i=e==null?void 0:e.state.roomMembers;return i==null?void 0:i.find(n=>{var r;return((r=n.payload)==null?void 0:r.uid)===t})},Tu=e=>e.map(t=>{var i;return F({uid:((i=t.payload)==null?void 0:i.uid)||""},b.toJS(t))}),Nu=async e=>{try{return await e.createInvisiblePlugin(we,{})}catch(t){if(t.message==='invisible plugin "WindowManager" exits')return await cr(200),e.getInvisiblePlugin(we.kind);Pt("createInvisiblePlugin failed",t)}};class Eg{constructor(t,i,n,r){this.manager=t,this.appId=i,this.appProxy=n,this.appOptions=r,this.mobxUtils={autorun:b.autorun,reaction:b.reaction,toJS:b.toJS},this.objectUtils={listenUpdated:b.listenUpdated,unlistenUpdated:b.unlistenUpdated,listenDisposed:b.listenDisposed,unlistenDisposed:b.unlistenDisposed},this.store=this.manager.store,this.isReplay=this.manager.isReplay,this.getAttributes=()=>this.appProxy.attributes,this.getScenes=()=>{const s=this.store.getAppAttributes(this.appId);return s!=null&&s.isDynamicPPT?this.appProxy.scenes:s==null?void 0:s.options.scenes},this.createWhiteBoardView=s=>{if(this.whiteBoardView)return this.whiteBoardView;let o=this.view;o||(o=this.appProxy.createAppDir()),s&&A.isBoolean(s.syncCamera)&&this.appProxy.syncCamera$.setValue(s.syncCamera);const a=document.createElement("div");return this._viewWrapper=a,a.className="window-manager-view-wrapper",this.box.$main.appendChild(a),o.divElement=a,this.appProxy.fireMemberStateChange(),this.isAddApp&&this.ensurePageSize(s==null?void 0:s.size),this.whiteBoardView=new Ig(o,this,this.appProxy,this.ensurePageSize),this.appProxy.sideEffectManager.add(()=>[this.box._stageRect$.subscribe(l=>{a.style.left=`${l.x}px`,a.style.top=`${l.y}px`,a.style.width=`${l.width}px`,a.style.height=`${l.height}px`}),()=>()=>{this.whiteBoardView=void 0}]),this.appProxy.whiteBoardViewCreated$.setValue(!0),this.whiteBoardView},this.ensurePageSize=s=>{var l;if(!A.isNumber(s)||!this.appProxy.scenePath||this.appProxy.pageState.length>=s)return;if(s<=0||s>=du)throw Error(`[WindowManager]: size ${s} muse be in range [1, ${du}]`);const o=s-this.appProxy.pageState.length,a=new Array(o).fill({});(l=this.room)==null||l.putScenes(this.appProxy.scenePath,a)},this.getInitScenePath=()=>this.appProxy.scenePath,this.setAttributes=s=>{this.manager.safeSetAttributes({[this.appId]:s})},this.updateAttributes=(s,o)=>{this.manager.attributes[this.appId]&&this.manager.safeUpdateAttributes([this.appId,...s],o)},this.setScenePath=async s=>{var o;!this.appProxy.box||(this.appProxy.setFullPath(s),(o=this.room)==null||o.setScenePath(s))},this.getAppOptions=()=>typeof this.appOptions=="function"?this.appOptions():this.appOptions,this.createStorage=(s,o)=>{const a=new Au(this,s,o);return this.emitter.on("destroy",()=>{a.destroy()}),a},this.dispatchMagixEvent=(...s)=>{var a;const o=`${this.appId}:${s[0]}`;return(a=this.manager.room)==null?void 0:a.dispatchMagixEvent(o,s[1])},this.addMagixEventListener=(s,o,a)=>{const l=`${this.appId}:${s}`;return this.manager.displayer.addMagixEventListener(l,o,a),()=>this.manager.displayer.removeMagixEventListener(l,o)},this.removeMagixEventListener=this.manager.displayer.removeMagixEventListener.bind(this.manager.displayer),this.emitter=n.appEmitter,this.isAddApp=n.isAddApp}get displayer(){return this.manager.displayer}get destroyed(){return this.appProxy.status==="destroyed"}get view(){return this.appProxy.view}get isWritable(){return this.manager.canOperate&&!this.destroyed}get box(){const t=this.appProxy.box$.value;if(t)return t;throw new yu}get room(){return this.manager.room}get members(){return this.manager.members$.value}get currentMember(){const t=Eu(this.room,this.manager.uid);if(!t)throw new Error(`Member ${this.manager.uid} not found.`);return F({uid:this.manager.uid},t)}get storage(){return this._storage||(this._storage=new Au(this)),this._storage}}class Tg{constructor(t){this.params=t,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:n}=this.params;this.view=this.params.view,n&&(this.scenePath=n,this.sceneNode=i.createScenesCallback(n,{onAddScene:this.onSceneChange,onRemoveScene:this.onSceneChange}))}setView(t){this.view=t}getFullPath(t){var n;const i=(n=this.sceneNode)==null?void 0:n.scenes;if(this.scenePath&&i){const r=i[t];if(r)return`${this.scenePath}/${r}`}}toObject(){var t,i;return{index:((t=this.view)==null?void 0:t.focusSceneIndex)||0,length:((i=this.sceneNode)==null?void 0:i.scenes.length)||0}}destroy(){var t;(t=this.sceneNode)==null||t.dispose()}}class Ng{constructor(t){this.saveCamera=t,this.setRect=i=>{this.rect=i,this.remoteCamera&&this.remoteSize&&this.onRemoteUpdate(this.remoteCamera,this.remoteSize)},this.onRemoteUpdate=A.throttle((i,n)=>{if(this.remoteCamera=i,this.remoteSize=n,this.remoteSize&&this.rect){const r=this.rect.width/n.width,s=this.rect.height/n.height,a={scale:i.scale*Math.min(r,s),animationMode:b.AnimationMode.Continuous};i.centerX!==null&&(a.centerX=i.centerX),i.centerY!==null&&(a.centerY=i.centerY),this.moveCamera(a)}},10)}setView(t){this.view=t}onRemoteSizeUpdate(t){this.remoteSize=t;const i=!A.isEqual(A.pick(this.rect,["width","height"]),A.pick(t,["width","height"]));if(this.rect&&this.remoteCamera&&i){const n=this.rect.width/t.width,r=this.remoteCamera.scale*n;this.moveCamera({scale:r})}}onLocalCameraUpdate(t){this.saveCamera(t),this.remoteCamera=t}moveCamera(t){var i;(i=this.view)==null||i.moveCamera(Nt(F({},t),{animationMode:b.AnimationMode.Continuous}))}}class ku{constructor(t){this.context=t,this.sem=new Pe.SideEffectManager,this.bindView=n=>{!n||(this.synchronizer.setView(n),this.sem.flush("view"),this.sem.add(()=>(n.callbacks.on("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice),()=>n.callbacks.off("onCameraUpdatedByDevice",this.onCameraUpdatedByDevice)),"view"))},this.onCameraUpdatedByDevice=n=>{if(!n)return;this.synchronizer.onLocalCameraUpdate(Nt(F({},n),{id:this.context.uid}));const r=this.context.stageRect$.value;if(r){const s={width:r.width,height:r.height,id:this.context.uid};A.isEqual(s,this.context.size$.value)||this.context.storeSize(s)}},this.synchronizer=new Ng(n=>{this.context.camera$.setValue(n,!0),!(this.context.viewMode$&&this.context.viewMode$.value===b.ViewMode.Freedom)&&this.context.storeCamera(n)}),this.bindView(this.context.view$.value),this.sem.add(()=>[this.context.view$.subscribe(n=>{const r=this.context.camera$.value;r&&this.context.size$.value&&(n==null||n.moveCamera({scale:1,animationMode:b.AnimationMode.Immediately}),this.synchronizer.onRemoteUpdate(r,this.context.size$.value)),this.bindView(n)}),this.context.camera$.subscribe((n,r)=>{const s=this.context.size$.value;n&&s&&!r&&this.synchronizer.onRemoteUpdate(n,s)}),this.context.size$.subscribe(n=>{n&&this.synchronizer.onRemoteSizeUpdate(n)}),this.context.stageRect$.subscribe(n=>{n&&this.synchronizer.setRect(n)})]);const i=I.combine([this.context.camera$,this.context.size$]);i.reaction(([n,r])=>{n&&r&&(this.synchronizer.onRemoteUpdate(n,r),i.destroy())})}destroy(){this.sem.flushAll()}}const gt=new kt.default,ro=(e,t)=>{let i=0;const n=t.length-1;return e===t.index?e===n?i=e-1:i=t.index+1:i=t.index,i};var oe=(e=>(e.Apps="apps",e.Focus="focus",e.State="state",e.BoxState="boxState",e.MainViewCamera="mainViewCamera",e.MainViewSize="mainViewSize",e.Broadcaster="broadcaster",e.Cursors="cursors",e.Position="position",e.CursorState="cursorState",e.FullPath="fullPath",e.Registered="registered",e.Camera="camera",e.Size="size",e))(oe||{});class kg{constructor(t){this.context=t,this.setAppFocus=(i,n)=>{n?this.context.safeSetAttributes({focus:i}):this.context.safeSetAttributes({focus:void 0})}}setContext(t){this.context=t}get attributes(){return this.context.getAttributes()}apps(){return A.get(this.attributes,["apps"])}get focus(){return A.get(this.attributes,["focus"])}getAppAttributes(t){return A.get(this.apps(),[t])}getAppState(t){return A.get(this.apps(),[t,"state"])}getMaximized(){return A.get(this.attributes,["maximized"])}getMinimized(){return A.get(this.attributes,["minimized"])}setupAppAttributes(t,i,n){this.attributes.apps||this.context.safeSetAttributes({apps:{}});const s=["scenePath","title"];n||s.push("scenes");const o=A.pick(t.options,s),a={kind:t.kind,options:o,isDynamicPPT:n,setup:!1};typeof t.src=="string"&&(a.src=t.src),a.createdAt=Date.now(),this.context.safeUpdateAttributes(["apps",i],a),this.context.safeUpdateAttributes(["apps",i,"state"],{[Ye.Size]:{},[Ye.Position]:{},[Ye.SceneIndex]:0})}updateAppState(t,i,n){A.get(this.attributes,["apps",t,"state"])&&this.context.safeUpdateAttributes(["apps",t,"state",i],n)}updateAppAttributes(t,i,n){this.context.safeUpdateAttributes(["apps",t,i],n)}cleanAppAttributes(t){this.context.safeUpdateAttributes(["apps",t],void 0),this.context.safeSetAttributes({[t]:void 0}),this.attributes.focus===t&&this.cleanFocus()}cleanFocus(){this.context.safeSetAttributes({focus:void 0})}getAppSceneIndex(t){var i;return(i=this.getAppState(t))==null?void 0:i[Ye.SceneIndex]}getAppScenePath(t){var i,n;return(n=(i=this.getAppAttributes(t))==null?void 0:i.options)==null?void 0:n.scenePath}getMainViewScenePath(){return this.attributes._mainScenePath}getMainViewSceneIndex(){return this.attributes._mainSceneIndex}getBoxState(){return this.attributes.boxState}setMainViewScenePath(t){this.context.safeSetAttributes({_mainScenePath:t})}setMainViewSceneIndex(t){this.context.safeSetAttributes({_mainSceneIndex:t})}getMainViewCamera(){return A.get(this.attributes,["mainViewCamera"])}getMainViewSize(){return A.get(this.attributes,["mainViewSize"])}setMainViewCamera(t){this.context.safeSetAttributes({mainViewCamera:F({},t)})}setMainViewSize(t){this.context.safeSetAttributes({mainViewSize:F({},t)})}setMainViewCameraAndSize(t,i){this.context.safeSetAttributes({mainViewCamera:F({},t),mainViewSize:F({},i)})}updateCursor(t,i){A.get(this.attributes,["cursors"])||this.context.safeUpdateAttributes(["cursors"],{}),A.get(this.attributes,["cursors",t])||this.context.safeUpdateAttributes(["cursors",t],{}),this.context.safeUpdateAttributes(["cursors",t,"position"],i)}updateCursorState(t,i){A.get(this.attributes,["cursors",t])||this.context.safeUpdateAttributes(["cursors",t],{}),this.context.safeUpdateAttributes(["cursors",t,"cursorState"],i)}getCursorState(t){return A.get(this.attributes,["cursors",t,"cursorState"])}cleanCursor(t){this.context.safeUpdateAttributes(["cursors",t],void 0)}setMainViewFocusPath(t){const i=this.getMainViewScenePath();i&&ii(t,i)}}const Pg=new kg({getAttributes:()=>{throw new Error("getAttributes not implemented")},safeSetAttributes:()=>{throw new Error("safeSetAttributes not implemented")},safeUpdateAttributes:()=>{throw new Error("safeUpdateAttributes not implemented")}});class so{constructor(t,i,n,r){var s;this.params=t,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 Pe.SideEffectManager,this.valManager=new I.ValManager,this.fullPath$=this.valManager.attach(new I.Val(void 0)),this.camera$=this.valManager.attach(new I.Val(void 0)),this.size$=this.valManager.attach(new I.Val(void 0)),this.box$=this.valManager.attach(new I.Val(void 0)),this.view$=this.valManager.attach(new I.Val(void 0)),this.syncCamera$=this.valManager.attach(new I.Val(!0)),this.whiteBoardViewCreated$=this.valManager.attach(new I.Val(!1)),this.fireMemberStateChange=()=>{this.manager.room&&this.onMemberStateChange(this.manager.room.state.memberState)},this.onMemberStateChange=o=>{var l,u;o.currentApplianceName==="clicker"?(l=this.appContext)!=null&&l._viewWrapper&&(this.appContext._viewWrapper.style.pointerEvents="none"):(u=this.appContext)!=null&&u._viewWrapper&&(this.appContext._viewWrapper.style.pointerEvents="auto")},this.computedInitialRect=o=>{var l;const a=(l=this.manager.boxManager)==null?void 0:l.stageRect;if(a){const{width:u,height:h}=a,p=o.height/o.width;return h<480?{width:480/p,height:480}:{width:u*.65,height:h*.65}}},this.getAppInitState=o=>{var C,E;const a=this.store.getAppState(o);if(!a)return;const l=this.store.focus,u=(C=this.attributes)==null?void 0:C.maximized,h=(E=this.attributes)==null?void 0:E.minimized;let p={maximized:u,minimized:h,id:o};const w=A.omitBy(a,A.isUndefined);return l===o&&(p=Nt(F({},p),{focus:!0})),Object.assign(p,w)},this.appAttributesUpdateListener=o=>{this.sideEffectManager.add(()=>[this.manager.refresher.add(o,()=>b.autorun(()=>{const a=this.manager.attributes[o];a&&this.appEmitter.emit("attributesUpdate",a)})),this.manager.refresher.add(this.stateKey,()=>b.autorun(()=>{var l,u,h;const a=(l=this.appAttributes)==null?void 0:l.state;(a==null?void 0:a.zIndex)>0&&a.zIndex!==((u=this.box)==null?void 0:u.zIndex)&&((h=this.boxManager)==null||h.setZIndex(o,a.zIndex))})),this.manager.refresher.add(`${o}-fullPath`,()=>b.autorun(()=>{var l;const a=(l=this.appAttributes)==null?void 0:l.fullPath;this.setFocusScenePathHandler(a),this.fullPath$.value!==a&&(this.notifyPageStateChange(),this.fullPath$.setValue(a))}))])},this.setFocusScenePathHandler=A.debounce(o=>{var a;this.view&&o&&o!==((a=this.view)==null?void 0:a.focusScenePath)&&ii(this.view,o)},50),this.notifyPageStateChange=A.debounce(()=>{this.pageState&&this.appEmitter.emit("pageStateChange",this.pageState)},50),this.storeCamera=o=>{this.store.updateAppAttributes(this.id,oe.Camera,o)},this.storeSize=o=>{this.store.updateAppAttributes(this.id,oe.Size,o)},this.updateSize=(o,a)=>{const l={id:this.manager.uid,width:o,height:a};this.store.updateAppAttributes(this.id,oe.Size,l),this.size$.setValue(l)},this.moveCamera=o=>{if(!this.camera$.value)return;const a=Nt(F(F({},this.camera$.value),o),{id:this.uid});this.storeCamera(a),this.camera$.setValue(a)},this.addCameraReaction=()=>{this.sideEffectManager.add(()=>this.manager.refresher.add(`${this.id}-camera`,()=>b.reaction(()=>{var o;return(o=this.appAttributes)==null?void 0:o.camera},o=>{if(o){const a=b.toJS(o);A.isEqual(a,this.camera$.value)||this.camera$.setValue(a)}})),"camera")},this.addSizeReaction=()=>{this.sideEffectManager.add(()=>this.manager.refresher.add(`${this.id}-size`,()=>b.reaction(()=>{var o;return(o=this.appAttributes)==null?void 0:o.size},o=>{if(o){const a=b.toJS(o);A.isEqual(a,this.size$.value)||this.size$.setValue(a)}})),"size")},this.onFocus=()=>{this.setScenePath()},this.setupDone=()=>{this.store.updateAppAttributes(this.id,"setup",!0),this.manager.dispatchInternalEvent(Z.InvokeAttributesUpdateCallback)},this.kind=t.kind,this.id=n,this.appScenePath=`/${this.id}-app-dir`,this.stateKey=`${this.id}_state`,this.appProxies.set(this.id,this),this.appEmitter=new kt.default,this.appListener=this.makeAppEventListener(this.id),this.isAddApp=r,this.initScenes(),(s=this.params.options)!=null&&s.scenePath&&this.createView(),this.scenePath||(this.scenePath=this.appScenePath),this._pageState=new Tg({displayer:this.manager.displayer,scenePath:this.scenePath,view:this.view,notifyPageStateChange:this.notifyPageStateChange}),this.sideEffectManager.add(()=>()=>this._pageState.destroy()),this.camera$.setValue(b.toJS(this.appAttributes.camera)),this.size$.setValue(b.toJS(this.appAttributes.size)),this.addCameraReaction(),this.addSizeReaction(),this.sideEffectManager.add(()=>j.on("memberStateChange",this.onMemberStateChange)),this.sideEffectManager.add(()=>[this.syncCamera$.reaction(o=>{o||this.viewSync&&(this.viewSync.destroy(),this.viewSync=void 0,this.sideEffectManager.flush("camera"),this.sideEffectManager.flush("size"))}),this.whiteBoardViewCreated$.reaction(o=>{if(o&&this.box){if(!this.syncCamera$.value)return;I.combine([this.box$,this.view$]).subscribe(([a,l])=>{if(a&&l){if(this.camera$.value||(this.storeCamera({centerX:null,centerY:null,scale:1,id:this.uid}),this.camera$.setValue(b.toJS(this.appAttributes.camera))),!this.size$.value&&a.stageRect){const u=this.computedInitialRect(a.stageRect),h=(u==null?void 0:u.width)||a.stageRect.width,p=(u==null?void 0:u.height)||a.stageRect.height;this.storeSize({id:this.uid,width:h,height:p}),this.size$.setValue(b.toJS(this.appAttributes.size))}this.viewSync=new ku({uid:this.uid,view$:this.view$,camera$:this.camera$,size$:this.size$,stageRect$:a._stageRect$,storeCamera:this.storeCamera,storeSize:this.storeSize}),this.sideEffectManager.add(()=>()=>{var u;return(u=this.viewSync)==null?void 0:u.destroy()}),this.whiteBoardViewCreated$.destroy()}})}}),this.manager.members$.reaction(o=>{this.appEmitter.emit("roomMembersChange",o)})])}createAppDir(){const t=this.scenePath||this.appScenePath;this._pageState.createSceneNode(t)||(Ti(this.manager.room,t,[{name:"1"}]),this._pageState.createSceneNode(t),this.setSceneIndex(0)),this.scenes=ni(this.manager.displayer)[t];const n=this.createView();return this._pageState.setView(n),n}initScenes(){var i;const t=this.params.options;t&&(this.scenePath=t.scenePath,((i=this.appAttributes)==null?void 0:i.isDynamicPPT)&&this.scenePath?this.scenes=ni(this.manager.displayer)[this.scenePath]:this.scenes=t.scenes)}get view(){return this.view$.value}get viewIndex(){var t;return(t=this.view)==null?void 0:t.focusSceneIndex}get isWritable(){var t;return this.manager.canOperate&&!((t=this.box)!=null&&t.readonly)}get attributes(){return this.manager.attributes[this.id]}get appAttributes(){return this.store.getAppAttributes(this.id)}getFullScenePath(){if(this.scenePath)return A.get(this.appAttributes,[oe.FullPath])||this.getFullScenePathFromScenes()}getFullScenePathFromScenes(){const t=A.get(this.appAttributes,["state","SceneIndex"],0),i=pg(this.manager.room,this.scenePath,t);return i&&this.setFullPath(i),i}setFullPath(t){this.store.updateAppAttributes(this.id,oe.FullPath,t)}async baseInsertApp(t=!1){var s;const i=this.params;if(!i.kind)throw new Error("[WindowManager]: kind require");const n=await((s=Ie.appClasses.get(i.kind))==null?void 0:s()),r=Ie.registered.get(i.kind);if(n)await this.setupApp(this.id,t,n,i.options,r==null?void 0:r.appOptions);else throw new Error(`[WindowManager]: app load failed ${i.kind} ${i.src}`);return j.emit("updateManagerRect"),{appId:this.id,app:n}}get box(){return this.box$.value}async setupApp(t,i,n,r,s){var a;if(Pt("setupApp",t,n,r),!this.boxManager)throw new Su;const o=new Eg(this.manager,t,this,s);this.appContext=o;try{j.once(`${t}${Z.WindowCreated}`).then(async()=>{var p;let h;i||(h=this.getAppInitState(t),(p=this.boxManager)==null||p.updateBoxState(h)),this.appEmitter.onAny(this.appListener),this.appAttributesUpdateListener(t),this.setViewFocusScenePath(),setTimeout(async()=>{const w=await n.setup(o);this.appResult=w,Ie.notifyApp(this.kind,"created",{appId:t,result:w}),this.fixMobileSize(),this.isAddApp&&this.setupDone()},cu)});const l=(a=this.boxManager)==null?void 0:a.createBox({appId:t,app:n,options:r,canOperate:this.manager.canOperate,smartPosition:this.isAddApp}),u=Ie.registered.get(this.kind);u!=null&&u.contentStyles&&(l==null||l.mountUserStyles(u.contentStyles)),this.box$.setValue(l),this.isAddApp&&this.box&&(this.store.updateAppState(t,Ye.ZIndex,this.box.zIndex),this.store.updateAppState(t,Ye.Size,{width:this.box.intrinsicWidth,height:this.box.intrinsicHeight}),this.boxManager.focusBox({appId:t},!1))}catch(l){throw console.error(l),new Error(`[WindowManager]: app setup error: ${l.message}`)}}fixMobileSize(){var i,n;const t=(i=this.boxManager)==null?void 0:i.getBox(this.id);t&&(t.minimized||(n=this.boxManager)==null||n.resizeBox({appId:this.id,width:t.intrinsicWidth+.001,height:t.intrinsicHeight+.001,skipUpdate:!0}))}async onSeek(t){var n;this.appEmitter.emit("seek",t).catch(r=>{console.log(`[WindowManager]: emit seek error: ${r.message}`)});const i=this.getAppInitState(this.id);(n=this.boxManager)==null||n.updateBoxState(i)}async onReconnected(){var s;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 n=this.params;await new so(n,this.manager,this.id,this.isAddApp).baseInsertApp(!0),(s=this.boxManager)==null||s.updateBoxState(i)}async onRemoveScene(t){if(this.scenePath&&t.startsWith(this.scenePath+"/")){let i=this.pageState.index,n=this._pageState.getFullPath(i);n||(i=0,n=this._pageState.getFullPath(i)),n&&this.setFullPath(n),this.setViewFocusScenePath(),this.view&&(this.view.focusSceneIndex=i)}}emitAppSceneStateChange(t){this.appEmitter.emit("sceneStateChange",t)}emitAppIsWritableChange(){this.appEmitter.emit("writableChange",this.isWritable)}makeAppEventListener(t){return(i,n)=>{var r,s,o,a;if(!!this.manager.canOperate)switch(i){case"setBoxSize":{(r=this.boxManager)==null||r.resizeBox({appId:t,width:n.width,height:n.height,skipUpdate:!1});break}case"setBoxMinSize":{(s=this.boxManager)==null||s.setBoxMinSize({appId:t,minWidth:n.minwidth,minHeight:n.minheight});break}case"setBoxTitle":{(o=this.boxManager)==null||o.setBoxTitle({appId:t,title:n.title});break}case ou.destroy:{if(this.status==="destroyed")return;this.destroy(!0,!1,!0,n==null?void 0:n.error),n!=null&&n.error&&console.error(n==null?void 0:n.error);break}case"focus":{(a=this.boxManager)==null||a.focusBox({appId:this.id}),gt.emit("focus",{appId:this.id});break}}}}setScenePath(){if(!this.manager.canOperate)return;const t=this.getFullScenePath();this.manager.room&&t&&this.view&&on(this.manager.room,t)}setViewFocusScenePath(){if(this.status==="destroyed")return;const t=this.getFullScenePath();return t&&this.view&&ii(this.view,t),t}createView(){const t=this.viewManager.createView(this.id);return this.view$.setValue(t),this.setViewFocusScenePath(),t}get pageState(){return this._pageState.toObject()}async removeSceneByIndex(t){const i=this._pageState.getFullPath(t);if(i&&this.pageState){const n=ro(t,this.pageState);return this.setSceneIndexWithoutSync(n),this.manager.dispatchInternalEvent(Z.SetAppFocusIndex,{type:"app",appID:this.id,index:n}),setTimeout(()=>{to(this.manager.room,i,t)},100),!0}else return!1}setSceneIndexWithoutSync(t){this.view&&(this.view.focusSceneIndex=t)}setSceneIndex(t){if(this.view){this.view.focusSceneIndex=t;const i=this._pageState.getFullPath(t);i&&(this.setFullPath(i),on(this.manager.room,i))}}async destroy(t,i,n,r){var s;if(this.status!=="destroyed"){this.status="destroyed";try{await Ie.notifyApp(this.kind,"destroy",{appId:this.id}),ee.emit("appClose",{appId:this.id,kind:this.kind,error:r}),await this.appEmitter.emit("destroy",{error:r})}catch(o){console.error("[WindowManager]: notifyApp error",o.message,o.stack)}this.appEmitter.clearListeners(),this.sideEffectManager.flushAll(),j.emit(`destroy-${this.id}`,{error:r}),t&&((s=this.boxManager)==null||s.closeBox(this.id,n)),i&&(this.store.cleanAppAttributes(this.id),this.scenePath&&to(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 zg{constructor(t){this.displayer=t,this.views=new Map}createView(t){const i=Pu(this.displayer);return this.views.set(t,i),i}getView(t){return this.views.get(t)}destroyView(t){const i=this.views.get(t);if(i){try{i.release()}catch{}this.views.delete(t)}}setViewScenePath(t,i){const n=this.views.get(t);n&&(n.focusScenePath=i)}destroy(){this.views.forEach(t=>{try{t.release()}catch{}}),this.views.clear()}}const Pu=e=>{const t=e.views.createView();return Dg(t),t},Dg=e=>{e.setCameraBound({maxContentMode:()=>10,minContentMode:()=>.1})};class jg{constructor(t){this.manager=t,this.started=!1,this.mainViewIsAddListener=!1,this.store=this.manager.store,this.sideEffectManager=new Pe.SideEffectManager,this.camera$=new I.Val(void 0),this.size$=new I.Val(void 0),this.view$=new I.Val(void 0),this.createViewSync=()=>{var i;this.manager.boxManager&&!this.viewSync&&(this.viewSync=new ku({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(()=>j.on("writableChange",i=>{i&&this.ensureCameraAndSize()}))},this.addCameraReaction=()=>{this.manager.refresher.add(oe.MainViewCamera,this.cameraReaction),this.manager.refresher.add(oe.MainViewSize,this.sizeReaction)},this.storeCurrentCamera=()=>{const i=this.view.camera;this.storeCamera(F({id:this.manager.uid},i))},this.storeCurrentSize=()=>{var n;const i=(n=this.manager.boxManager)==null?void 0:n.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=()=>b.reaction(()=>this.mainViewCamera,i=>{if(i){const n=b.toJS(i);A.isEqual(n,this.camera$.value)||this.camera$.setValue(n)}},{fireImmediately:!0}),this.sizeReaction=()=>b.reaction(()=>this.mainViewSize,i=>{if(i){const n=b.toJS(i);A.isEqual(n,this.size$.value)||this.size$.setValue(n)}},{fireImmediately:!0}),this.mainViewClickListener=()=>{this.mainViewClickHandler()},this.setMainViewSize=A.debounce(i=>{this.store.setMainViewSize(Nt(F({},i),{id:this.manager.uid}))},50),this.onCameraOrSizeUpdated=()=>{ee.emit("cameraStateChange",this.cameraState)},this.mainView=this.createMainView(),j.once("mainViewMounted").then(()=>{this.addMainViewListener(),this.start(),this.ensureCameraAndSize(),this.startListenWritableChange()}),this.sideEffectManager.add(()=>[j.on("startReconnect",()=>{fu(this.mainView)})]),this.createViewSync(),this.sideEffectManager.add(()=>j.on("focusedChange",({focused:i})=>{if(i===void 0){const n=this.store.getMainViewScenePath();n&&on(this.manager.room,n)}}))}ensureCameraAndSize(){var t;if(!this.mainViewCamera||!this.mainViewSize){this.manager.dispatchInternalEvent(Z.InitMainViewCamera),this.storeCamera(F({id:this.manager.uid},this.view.camera));const i=(t=this.manager.boxManager)==null?void 0:t.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 A.get(this.view,["didRelease"])}start(){this.started||(this.addCameraListener(),this.addCameraReaction(),this.started=!0)}get view(){return this.mainView}get cameraState(){return F(F({},this.view.camera),this.view.size)}createMainView(){const t=Pu(this.manager.displayer),i=this.store.getMainViewScenePath();return i&&ii(t,i),this.view$.setValue(t),t}onReconnect(){if(this.didRelease)this.rebind();else{const t=this.store.getMainViewScenePath();this.setFocusScenePath(t)}}setFocusScenePath(t){if(t)return ii(this.view,t)}rebind(){const t=this.mainView.divElement,i=this.mainView.disableCameraTransform,n=F({},this.mainView.camera);this.stop(),fu(this.mainView),this.removeMainViewListener(),this.mainView=this.createMainView(),this.mainView.disableCameraTransform=i,this.mainView.divElement=t,this.mainView.moveCamera(Nt(F({},n),{animationMode:b.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 t;!this.manager.canOperate||(this.store.cleanFocus(),(t=this.manager.boxManager)==null||t.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(oe.MainViewCamera),this.manager.refresher.remove(oe.MainViewSize),this.started=!1}destroy(){this.camera$.destroy(),this.size$.destroy(),this.view$.destroy(),this.removeMainViewListener(),this.stop(),this.sideEffectManager.flushAll()}}class Lg{constructor(t){this.context=t,this.addRedoUndoListeners=i=>{if(i===void 0)this.addViewCallbacks(this.context.mainView(),this.onCanRedoStepsUpdate,this.onCanUndoStepsUpdate);else{const n=this.context.getAppProxy(i);n&&n.view&&this.addViewCallbacks(n.view,this.onCanRedoStepsUpdate,this.onCanUndoStepsUpdate)}},this.addViewCallbacks=(i,n,r)=>{n(i.canRedoSteps),r(i.canUndoSteps),i.callbacks.on("onCanRedoStepsUpdate",n),i.callbacks.on("onCanUndoStepsUpdate",r)},this.disposeViewCallbacks=i=>{i.callbacks.off("onCanRedoStepsUpdate",this.onCanRedoStepsUpdate),i.callbacks.off("onCanUndoStepsUpdate",this.onCanUndoStepsUpdate)},this.onCanRedoStepsUpdate=i=>{ee.emit("canRedoStepsChange",i)},this.onCanUndoStepsUpdate=i=>{ee.emit("canUndoStepsChange",i)},this.disposePrevFocusViewRedoUndoListeners=i=>{let n;if(i===void 0)n=this.context.mainView();else{const r=this.context.getAppProxy(i);r&&r.view&&(n=r.view)}n&&this.disposeViewCallbacks(n)},j.on("focusedChange",i=>{this.disposePrevFocusViewRedoUndoListeners(i.prev),setTimeout(()=>{this.addRedoUndoListeners(i.focused)},0)}),j.on("rootDirRemoved",()=>{this.disposePrevFocusViewRedoUndoListeners(t.focus()),this.addRedoUndoListeners(t.focus())}),this.addRedoUndoListeners(t.focus())}destroy(){this.disposePrevFocusViewRedoUndoListeners(this.context.focus())}}class Vg{constructor(t){this.windowManger=t,this.appProxies=new Map,this.appStatus=new Map,this.store=Pg,this.isReplay=this.windowManger.isReplay,this.mainViewScenesLength=0,this.callbacksNode=null,this.appCreateQueue=new Kf,this.sceneIndex$=new I.Val(void 0),this.focused$=new I.Val(void 0),this.members$=new I.Val([]),this.sideEffectManager=new Pe.SideEffectManager,this.sceneState=null,this.rootDirRemoving=!1,this.onRemoveScenes=async i=>{var r,s;const{scenePath:n}=i;if(n===ze){await this.onRootDirRemoved(),this.dispatchInternalEvent(Z.RootDirRemoved);return}if(wg(n)){let o=this.mainView.focusSceneIndex||0,a=(r=this.callbacksNode)==null?void 0:r.scenes[o];a||(o=0,a=(s=this.callbacksNode)==null?void 0:s.scenes[o]),a&&await this.setMainViewScenePath(`${ze}${a}`),await this.setMainViewSceneIndex(o)}else this.appProxies.forEach(o=>{o.onRemoveScene(n)})},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(n=>{n.onSeek(i)})},this.createRootDirScenesCallback=()=>{let i=!1;this.callbacksNode&&(this.callbacksNode.dispose(),i=!0),this.callbacksNode=this.displayer.createScenesCallback(ze,{onAddScene:this.onSceneChange,onRemoveScene:async(n,r)=>{await this.onSceneChange(n),j.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 s;const n=ro(i,this.windowManger.pageState);this.setSceneIndexWithoutSync(n),this.dispatchInternalEvent(Z.SetAppFocusIndex,{type:"main",index:n});const r=(s=this.callbacksNode)==null?void 0:s.scenes[i];return setTimeout(()=>{r&&to(this.room,`${ze}${r}`,i)},100),new Promise((o,a)=>{j.once("rootDirSceneRemoved").then(l=>{l===r&&o(!0)}).catch(l=>{console.log(`[WindowManager]: removePage error: ${l}`),a(!1)})})},this.setSceneIndexWithoutSync=i=>{var r;const n=(r=this.callbacksNode)==null?void 0:r.scenes[i];n&&this.mainViewProxy.setFocusScenePath(`${ze}${n}`)},this.onSceneChange=i=>(this.mainViewScenesLength=i.scenes.length,this.updateSceneState(i),this.emitMainViewScenesChange(this.mainViewScenesLength)),this.emitMainViewScenesChange=i=>Promise.all([ee.emit("mainViewScenesLengthChange",i),j.emit("changePageState")]),this.updateSceneState=i=>{const n=this.store.getMainViewSceneIndex()||0;let r=i.scenes[n];r||(r=i.scenes[this.mainView.focusSceneIndex||0]),this.sceneState={scenePath:`${ze}${r}`,contextPath:i.path,index:n,scenes:i.scenes.map(s=>({name:s})),sceneName:r},ee.emit("sceneStateChange",this.sceneState)},this.onBoxMove=i=>{this.dispatchInternalEvent(Z.AppMove,i),this.store.updateAppState(i.appId,Ye.Position,{x:i.x,y:i.y})},this.onBoxResize=i=>{i.width&&i.height&&(this.dispatchInternalEvent(Z.AppResize,i),this.store.updateAppState(i.appId,Ye.Size,{width:i.width,height:i.height}))},this.onBoxFocus=i=>{this.windowManger.safeSetAttributes({focus:i.appId})},this.onBoxClose=i=>{const n=this.appProxies.get(i.appId);n&&n.destroy(!1,!0,!0,i.error)},this.onBoxStateChange=i=>{this.dispatchInternalEvent(Z.AppBoxStateChange,i)},this.addAppsChangeListener=()=>{this.refresher.add("apps",()=>Iu(()=>this.attributes.apps,()=>{this.attributesUpdateCallback(this.attributes.apps)}))},this.addAppCloseListener=()=>{var i;(i=this.refresher)==null||i.add("appsClose",()=>Sg(this.attributes.apps,()=>{this.onAppDelete(this.attributes.apps)}))},this.onMainViewIndexChange=i=>{i!==void 0&&this.sceneIndex$.value!==i&&(ee.emit("mainViewSceneIndexChange",i),j.emit("changePageState"),this.callbacksNode&&this.updateSceneState(this.callbacksNode),this.sceneIndex$.setValue(i))},this.onFocusChange=i=>{var n;this.focused$.value!==i&&(ee.emit("focusedChange",i),j.emit("focusedChange",{focused:i,prev:this.focused$.value}),this.focused$.setValue(i),i!==void 0&&((n=this.boxManager)==null||n.focusBox({appId:i}),setTimeout(()=>{const r=this.appProxies.get(i);r&&(r.onFocus(),Ie.notifyApp(r.kind,"focus",{appId:i}))},0)))},this.attributesUpdateCallback=A.debounce(i=>this._attributesUpdateCallback(i),100),this.onRegisteredChange=i=>{!i||Object.entries(i).forEach(([n,r])=>{Ie.appClasses.has(n)||Ie.register({kind:n,src:r.src,name:r.name})})},this.onMinimized=i=>{var n,r;((n=this.boxManager)==null?void 0:n.minimized)!==i&&(i===!0&&((r=this.boxManager)==null||r.blurAllBox()),setTimeout(()=>{var s;(s=this.boxManager)==null||s.setMinimized(Boolean(i))},0))},this.onAppDelete=async i=>{const n=Object.keys(i);for(const[r,s]of this.appProxies.entries())n.includes(r)||await s.destroy(!0,!1,!0)},this.closeAll=async()=>{for(const[i,n]of this.appProxies.entries())await n.destroy(!0,!1,!0)},this.displayerStateListener=i=>{const n=i.sceneState;if(n){const r=n.scenePath;this.appProxies.forEach(s=>{s.scenePath&&r.startsWith(s.scenePath)&&(s.emitAppSceneStateChange(n),s.setFullPath(r))})}this.appProxies.forEach(r=>{r.appEmitter.emit("roomStateChange",i)}),i.roomMembers&&this.members$.setValue(Tu(i.roomMembers)),j.emit("observerIdChange",this.displayer.observerId),i.memberState&&j.emit("memberStateChange",b.toJS(i.memberState))},this.displayerWritableListener=i=>{var s,o;const n=!i,r=this.windowManger.readonly===void 0||!this.windowManger.readonly;this.windowManger.readonly===void 0?(s=this.boxManager)==null||s.setReadonly(i):(o=this.boxManager)==null||o.setReadonly(!(n&&r)),this.appProxies.forEach(a=>{a.emitAppIsWritableChange()}),n&&this.room&&this.room.disableSerialization===!0&&(this.room.disableSerialization=!1),j.emit("writableChange",n)},this.updateSceneIndex=()=>{const i=this.store.getMainViewScenePath(),n=io(i),r=ni(this.displayer)[n];if(r.length){const s=i.replace(n,"").replace("/",""),o=r.findIndex(a=>a.name===s);A.isInteger(o)&&o>=0&&this.safeSetAttributes({_mainSceneIndex:o})}},this.updateRootDirRemoving=i=>{this.rootDirRemoving=i},this.displayer=t.displayer,this.store.setContext({getAttributes:()=>this.attributes,safeSetAttributes:i=>this.safeSetAttributes(i),safeUpdateAttributes:(i,n)=>this.safeUpdateAttributes(i,n)}),this.mainViewProxy=new jg(this),this.viewManager=new zg(this.displayer),this.appListeners=new yg(this),this.displayer.callbacks.on(this.eventName,this.displayerStateListener),this.appListeners.addListeners(),this.refresher=$f,this.refresher.setRoom(this.room),this.refresher.setContext({emitter:j}),this.sideEffectManager.add(()=>()=>{var i,n,r;this.appCreateQueue.destroy(),this.mainViewProxy.destroy(),(i=this.refresher)==null||i.destroy(),this.viewManager.destroy(),(n=this.boxManager)==null||n.destroy(),(r=this.callbacksNode)==null||r.dispose()}),j.once("onCreated").then(()=>this.onCreated()),j.on("onReconnected",()=>this.onReconnected()),b.isPlayer(this.displayer)&&(j.on("seekStart",this.onPlayerSeekStart),j.on("seek",this.onPlayerSeekDone)),j.on("removeScenes",this.onRemoveScenes),j.on("setReadonly",this.onReadonlyChanged),this.createRootDirScenesCallback(),Ie.setSyncRegisterApp(i=>{this.safeUpdateAttributes([oe.Registered,i.kind],i)}),this.members$.setValue(Tu(this.displayer.state.roomMembers))}async onRootDirRemoved(t=!0){await this.setMainViewScenePath(uu),this.createRootDirScenesCallback();for(const[i,n]of this.appProxies.entries())n.view&&await this.closeApp(i,t);this.mainViewProxy.rebind(),await j.emit("rootDirRemoved"),this.updateRootDirRemoving(!1)}get eventName(){return b.isRoom(this.displayer)?"onRoomStateChanged":"onPlayerStateChanged"}get attributes(){return this.windowManger.attributes}get canOperate(){return this.windowManger.canOperate}get room(){return b.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 t;return((t=this.room)==null?void 0:t.uid)||""}getMainViewSceneDir(){const t=this.store.getMainViewScenePath();if(t)return io(t);throw new Error("[WindowManager]: mainViewSceneDir not found")}async onCreated(){var t;if(await this.attributesUpdateCallback(this.attributes.apps),j.emit("updateManagerRect"),gt.on("move",this.onBoxMove),gt.on("resize",this.onBoxResize),gt.on("focus",this.onBoxFocus),gt.on("close",this.onBoxClose),gt.on("boxStateChange",this.onBoxStateChange),this.addAppsChangeListener(),this.addAppCloseListener(),this.refresher.add("maximized",()=>b.autorun(()=>{var n;const i=this.attributes.maximized;(n=this.boxManager)==null||n.setMaximized(Boolean(i))})),this.refresher.add("minimized",()=>b.autorun(()=>{const i=this.attributes.minimized;this.onMinimized(i)})),this.refresher.add("mainViewIndex",()=>b.autorun(()=>{const i=A.get(this.attributes,"_mainSceneIndex");this.onMainViewIndexChange(i)})),this.refresher.add("focusedChange",()=>b.autorun(()=>{const i=A.get(this.attributes,"focus");this.onFocusChange(i)})),this.refresher.add("registeredChange",()=>b.autorun(()=>{const i=A.get(this.attributes,oe.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(!((t=this.room)!=null&&t.isWritable)),this.displayer.callbacks.on("onEnableWriteNowChanged",this.displayerWritableListener),this.focused$.setValue(this.attributes.focus),this.sideEffectManager.add(()=>{const i=new Lg({mainView:()=>this.mainViewProxy.view,focus:()=>this.attributes.focus,getAppProxy:n=>this.appProxies.get(n)});return()=>i.destroy()})}async _attributesUpdateCallback(t){if(t&&we.container){const i=Object.keys(t);i.length===0&&this.appCreateQueue.emitReady();const n=i.map(r=>t[r].setup?{id:r,createdAt:t[r].createdAt}:{});for(const{id:r}of A.orderBy(n,"createdAt","asc"))if(r&&!this.appProxies.has(r)&&!this.appStatus.has(r)){const s=t[r];try{if(!this.attributes[r])throw new Error("appAttributes is undefined");this.appCreateQueue.push(()=>(this.appStatus.set(r,eo.StartCreate),this.baseInsertApp({kind:s.kind,options:s.options,isDynamicPPT:s.isDynamicPPT},r,!1))),this.focusByAttributes(t)}catch(o){console.warn("[WindowManager]: Insert App Error",o)}}}}refresh(){this.attributesUpdateCallback(this.attributes.apps)}setBoxManager(t){this.boxManager=t,this.mainViewProxy.createViewSync()}resetMaximized(){var t;(t=this.boxManager)==null||t.setMaximized(Boolean(this.store.getMaximized()))}resetMinimized(){var t;(t=this.boxManager)==null||t.setMinimized(Boolean(this.store.getMinimized()))}bindMainView(t,i){const n=this.mainViewProxy.view;n.disableCameraTransform=i,cr(30).then(()=>{n.divElement=t,j.emit("mainViewMounted")}),n.focusScenePath||this.setMainViewFocusPath()}setMainViewFocusPath(t){var n;const i=t||this.store.getMainViewScenePath();if(i)return ii(this.mainView,i),((n=this.mainView)==null?void 0:n.focusScenePath)===i}resetScenePath(t){this.displayer.state.sceneState.scenePath!==t&&on(this.room,t)}async addApp(t,i){Pt("addApp",t);const{appId:n,needFocus:r}=await this.beforeAddApp(t,i),s=await this.baseInsertApp(t,n,!0,r);return this.afterAddApp(s),s==null?void 0:s.id}async beforeAddApp(t,i){var o,a;const n=await hg(t.kind);this.appStatus.set(n,eo.StartCreate);const r=(o=t.attributes)!=null?o:{};this.safeUpdateAttributes([n],r),this.store.setupAppAttributes(t,n,i);const s=!((a=this.boxManager)!=null&&a.minimized);return s&&this.store.setAppFocus(n,!0),{appId:n,needFocus:s}}afterAddApp(t){var i,n;if(t&&t.box){const r=t.box;gt.emit("move",{appId:t.id,x:r==null?void 0:r.intrinsicX,y:r==null?void 0:r.intrinsicY}),this.store.updateAppState(t.id,Ye.ZIndex,r.zIndex)}(i=this.boxManager)!=null&&i.minimized&&((n=this.boxManager)==null||n.setMinimized(!1,!1))}async closeApp(t,i=!0){const n=this.appProxies.get(t);n&&n.destroy(!0,i,!1)}async baseInsertApp(t,i,n,r){if(this.appProxies.has(i)){console.warn("[WindowManager]: app duplicate exists and cannot be created again");return}const s=new so(t,this,i,n);if(s)return await s.baseInsertApp(r),this.appStatus.delete(i),s;throw this.appStatus.delete(i),new Error("[WindowManger]: initialize AppProxy failed")}safeSetAttributes(t){this.windowManger.safeSetAttributes(t)}safeUpdateAttributes(t,i){this.windowManger.safeUpdateAttributes(t,i)}async setMainViewScenePath(t){if(this.room){const i=this.displayer.scenePathType(t);if(io(t)!==ze)throw new Error('[WindowManager]: main view scenePath must in root dir "/"');if(i===b.ScenePathType.None)throw new Error(`[WindowManager]: ${t} not valid scene`);if(i===b.ScenePathType.Page)await this._setMainViewScenePath(t);else if(i===b.ScenePathType.Dir){const r=gg(this.displayer,t);r&&await this._setMainViewScenePath(r)}}}async _setMainViewScenePath(t){this.setMainViewFocusPath(t)&&(this.safeSetAttributes({_mainScenePath:t}),this.store.setMainViewFocusPath(this.mainView),this.updateSceneIndex(),this.dispatchSetMainViewScenePath(t))}async setMainViewSceneIndex(t){var i;if(this.room){if(this.store.getMainViewSceneIndex()===t)return;const n=(i=this.callbacksNode)==null?void 0:i.scenes[t],r=`${ze}${n}`;if(n)this.setMainViewFocusPath(r)&&(this.store.setMainViewScenePath(r),this.safeSetAttributes({_mainSceneIndex:t}),this.dispatchSetMainViewScenePath(r));else throw new Error(`[WindowManager]: ${t} not valid index`)}}dispatchSetMainViewScenePath(t){this.dispatchInternalEvent(Z.SetMainViewScenePath,{nextScenePath:t}),on(this.room,t)}getAppInitPath(t){var n;const i=this.store.getAppAttributes(t);if(i)return(n=i==null?void 0:i.options)==null?void 0:n.scenePath}safeDispatchMagixEvent(t,i){this.canOperate&&this.displayer.dispatchMagixEvent(t,i)}focusByAttributes(t){var i;if(t&&Object.keys(t).length===((i=this.boxManager)==null?void 0:i.boxSize)){const n=this.store.focus;n&&this.boxManager.focusBox({appId:n})}}async onReconnected(){this.attributesUpdateCallback(this.attributes.apps);const i=Array.from(this.appProxies.values()).map(n=>n.onReconnected());this.mainViewProxy.onReconnect(),await Promise.all(i)}notifyContainerRectUpdate(t){this.appProxies.forEach(i=>{i.appEmitter.emit("containerRectUpdate",t)})}dispatchInternalEvent(t,i){this.safeDispatchMagixEvent(Ks,{eventName:t,payload:i})}destroy(){this.displayer.callbacks.off(this.eventName,this.displayerStateListener),this.displayer.callbacks.off("onEnableWriteNowChanged",this.displayerWritableListener),this.appListeners.removeListeners(),gt.clearListeners(),j.clearListeners(),this.appProxies.size&&this.appProxies.forEach(t=>{t.destroy(!0,!1,!0)}),ee.clearListeners(),this.sideEffectManager.flushAll(),this.sceneIndex$.destroy(),this.focused$.destroy(),this.members$.destroy()}}/*! *****************************************************************************
1
+ var wp=Object.defineProperty,vp=Object.defineProperties;var xp=Object.getOwnPropertyDescriptors;var Zi=Object.getOwnPropertySymbols;var po=Object.prototype.hasOwnProperty,go=Object.prototype.propertyIsEnumerable;var uo=(E,X,oe)=>X in E?wp(E,X,{enumerable:!0,configurable:!0,writable:!0,value:oe}):E[X]=oe,B=(E,X)=>{for(var oe in X||(X={}))po.call(X,oe)&&uo(E,oe,X[oe]);if(Zi)for(var oe of Zi(X))go.call(X,oe)&&uo(E,oe,X[oe]);return E},he=(E,X)=>vp(E,xp(X));var mo=(E,X)=>{var oe={};for(var w in E)po.call(E,w)&&X.indexOf(w)<0&&(oe[w]=E[w]);if(E!=null&&Zi)for(var w of Zi(E))X.indexOf(w)<0&&go.call(E,w)&&(oe[w]=E[w]);return oe};(function(E,X){typeof exports=="object"&&typeof module!="undefined"?X(exports,require("p-retry"),require("emittery"),require("lodash"),require("white-web-sdk"),require("uuid"),require("side-effect-manager"),require("value-enhancer"),require("@juggle/resize-observer")):typeof define=="function"&&define.amd?define(["exports","p-retry","emittery","lodash","white-web-sdk","uuid","side-effect-manager","value-enhancer","@juggle/resize-observer"],X):(E=typeof globalThis!="undefined"?globalThis:E||self,X(E.WindowManager={},E.pRetry,E.Emittery,E.lodash,E.whiteWebSdk,E.uuid,E.sideEffectManager,E.valueEnhancer,E.resizeObserver))})(this,function(E,X,oe,w,S,fo,ye,v,mr){"use strict";function fr(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var bo=fr(X),Je=fr(oe),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 Yi="__WindowManger",Qi="__WindowMangerEnsureReconnected__";var ke=(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))(ke||{}),br=(t=>(t.setBoxSize="setBoxSize",t.setBoxMinSize="setBoxMinSize",t.destroy="destroy",t))(br||{}),Gi=(t=>(t.StartCreate="StartCreate",t))(Gi||{}),yr=(t=>(t.Leave="leave",t.Normal="normal",t))(yr||{});const wr="2.16.1",yo=340/720,wo=340/720,vo=9/16,we="/",vr="/init",xr=50,Mr=500,G=new Je.default;class xo{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(()=>{G.emit("ready")},xr),this.isEmit=!0}empty(){this.list=[],this.clear()}destroy(){this.timer&&this.clear()}}const z=new Je.default,Mo="__WindowManagerAppCache";let Et,Sr;const So=async()=>{Et=await _o()},Co=(t,e)=>{if(!!Et)return ko(Et,{kind:t,sourceCode:e})},Io=async t=>Et?await Ao(Et,t):null;function _o(){return new Promise((t,e)=>{const i=indexedDB.open(Mo,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 Ao(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 ko(t,e){return new Promise((i,s)=>{const r=t.transaction(["apps"],"readwrite").objectStore("apps").add(e);r.onsuccess=()=>i(),r.onerror=()=>s()})}const To="NetlessApp",No=1e4,Po=async t=>{const e=await Io(t);if(e)return e.sourceCode;{const s=await(await zo(t,{timeout:No})).text();return await Co(t,s),s}},Cr=(t,e)=>{let i=Function(t+`
2
+ ;return ${e}`)();return typeof i=="undefined"&&(i=window[e]),i},Eo=async(t,e,i)=>{const s=i||To+e;G.emit("loadApp",{kind:e,status:"start"});try{const r=await Po(t);if(!r||r.length===0){G.emit("loadApp",{kind:e,status:"failed",reason:"script is empty."});return}try{const a=Cr(r,s);return G.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 G.emit("loadApp",{kind:e,status:"success"}),o}G.emit("loadApp",{kind:e,status:"failed",reason:a.message})}}catch(r){G.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(B({},e),{signal:s.signal,headers:{"content-type":"text/plain"}}));return clearTimeout(r),a}class Do{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 Eo(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 Je.default;this.kindEmitters.set(e,i)}return this.kindEmitters.get(e)}}const ge=new Do,Vo=async t=>{var i,s;const e=await((i=ge.appClasses.get(t))==null?void 0:i());return e&&((s=e.config)==null?void 0:s.singleton)?t:`${t}-${fo.v4().replace("-","").slice(0,8)}`},ht=(t,e)=>{if(!t.didRelease&&t.focusScenePath!==e)return t.focusScenePath=e,t},Ir=t=>{t.didRelease||t.release()},zt=(t,e)=>{if(t&&t.isWritable&&t.state.sceneState.scenePath!==e){const i=e==="/"?"":e;t.setScenePath(i)}},Lo=(t,e,i)=>{var s;if(t&&e){const a=(s=dt(t)[e])==null?void 0:s[i];if(a)return`${e}/${a.name}`}},qi=(t,e,i)=>{t&&t.scenePathType(e)!==S.ScenePathType.None&&t.removeScenes(e,i)},$o=(t,e)=>{z.once(t).then(e)};w.debounce((t,e)=>{t.emit("mainViewModeChange",e)},200);const jo=(t,e,i=0)=>{const s=dt(t)[e];if(!s)return;const r=s[i];if(!r)return;const a=r.name;return e===we?`/${a}`:`${e}/${a}`},dt=t=>t.entireScenes(),vt=(t,e,i,s)=>t==null?void 0:t.putScenes(e,i,s),Bo=t=>t.startsWith("/"),Ji=t=>{const e=t.split("/");e.pop();let i=e.join("/");return i===""&&(i="/"),i},Ro=t=>t.endsWith("/")?t.slice(0,-1):t,_r=t=>{const e=t.split(".").map(i=>i.padStart(2,"0")).join("");return parseInt(e)},li=t=>new Promise(e=>setTimeout(e,t)),Oo=t=>t.split("").reduce((i,s)=>(s===we&&(i+=1),i),0)===1;class Uo{constructor(e){this.saveCamera=e,this.setRect=i=>{this.rect=i,this.remoteCamera&&this.remoteSize&&this.onRemoteUpdate(this.remoteCamera,this.remoteSize)},this.onRemoteUpdate=w.throttle((i,s)=>{if(this.remoteCamera=i,this.remoteSize=s,this.remoteSize&&this.rect){const a={scale:i.scale*ci(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){this.remoteSize=e;const i=!w.isEqual(w.pick(this.rect,["width","height"]),w.pick(e,["width","height"]));if(this.rect&&this.remoteCamera&&i){const s=this.rect.width/e.width,r=this.remoteCamera.scale*s;this.moveCamera({scale:r})}}onLocalCameraUpdate(e){this.saveCamera(e),this.remoteCamera=e}moveCamera(e){var i;(i=this.view)==null||i.moveCamera(he(B({},e),{animationMode:S.AnimationMode.Immediately}))}}const ci=(t,e)=>{const i=e.width/t.width,s=e.height/t.height;return Math.min(i,s)};class Ho{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=>{G.emit("boxStateChange",i)},this.setMainViewScenePathHandler=({nextScenePath:i})=>{ht(this.manager.mainView,i),G.emit("mainViewScenePathChange",i)},this.cursorMoveHandler=i=>{z.emit("cursorMove",i)},this.rootDirRemovedHandler=()=>{this.manager.createRootDirScenesCallback(),this.manager.mainViewProxy.rebind(),z.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*ci(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(Yi,this.mainMagixEventListener)}removeListeners(){this.displayer.removeMagixEventListener(Yi,this.mainMagixEventListener)}}class Ar extends Error{constructor(){super(...arguments);this.message="[WindowManager]: app duplicate exists and cannot be created again"}}class Fo extends Error{constructor(e){super(`[WindowManager]: app ${e} need register or provide src`)}}class me extends Error{constructor(){super(...arguments);this.message="[WindowManager]: AppManager must be initialized"}}class kr extends Error{constructor(e){super(`[WindowManager]: white-web-sdk version must large than ${e}`)}}class Tr extends Error{constructor(){super(...arguments);this.message="[WindowManager]: kind must be a valid string"}}class Nr extends Error{constructor(){super(...arguments);this.message="[WindowManager]: box need created"}}class Pr extends Error{constructor(){super(...arguments);this.message='[WindowManager]: ScenePath should start with "/"'}}class Er extends Error{constructor(){super(...arguments);this.message="[WindowManager]: boxManager not found"}}class zr extends Error{constructor(){super(...arguments);this.message="[WindowManager]: room phase only Connected can be bindContainer"}}const Dr=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})},Vr=(t,e,i)=>{let s=null;const r=S.reaction(t,()=>{s&&(s(),s=null);const a=t();w.isObject(a)?(s=()=>S.unlistenUpdated(a,e),S.listenUpdated(a,e)):i==null||i(a)},{fireImmediately:!0});return()=>{s==null||s(),r()}},Wo=Dr(S.UpdateEventKind.Removed);Dr(S.UpdateEventKind.Inserted);const Xi=Object.keys;function Lr(t){return Boolean(w.has(t,"__isRef"))}function Zo(t){return{k:ye.genUID(),v:t,__isRef:!0}}class Yo{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 $r{constructor(e,i,s){if(this._sideEffect=new ye.SideEffectManager,this._destroyed=!1,this._refMap=new WeakMap,this._lastValue=new Map,this.onStateChanged=new Yo,s&&!w.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||!w.isObject(r))&&(w.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=w.isObject(r[a])?JSON.parse(JSON.stringify(r[a])):r[a];Lr(n)?(this._state[a]=n.v,w.isObject(n.v)&&this._refMap.set(n.v,n)):this._state[a]=n}catch(n){console.error(n)}}),this._sideEffect.addDisposer(Vr(()=>this.id===null?e.getAttributes():w.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)=>(w.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(w.isObject(r)){let n=this._refMap.get(r);n||(n=Zo(r),this._refMap.set(r,n)),a=n}this._setRawState(s,a)}})}emptyStorage(){if(!(w.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(w.mapValues(this._state,w.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:w.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=w.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:{w.has(this._state,n)&&(c=this._state[n],delete this._state[n]),s[n]={oldValue:c};break}default:{let l=o;if(Lr(o)){const{k:d,v:u}=o,p=this._state[n];w.isObject(p)&&((i=this._refMap.get(p))==null?void 0:i.k)===d?l=p:(l=u,w.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 Qo{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 v.Val(s.pageState),n=new v.Val(s.size$.value),o=l=>w.pick(l,["centerX","centerY","scale"]),c=new v.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(w.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 Xe=(...t)=>{pe.debug&&console.log("[WindowManager]:",...t)},Go=(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}},qo=()=>{if(_r(S.WhiteVersion)<_r(wr))throw new kr(wr)},jr=(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})},Br=t=>t.map(e=>{var i;return B({uid:((i=e.payload)==null?void 0:i.uid)||""},S.toJS(e))}),Rr=async t=>{try{return await t.createInvisiblePlugin(pe,{})}catch(e){if(e.message==='invisible plugin "WindowManager" exits')return await li(200),t.getInvisiblePlugin(pe.kind);Xe("createInvisiblePlugin failed",e)}};class Jo{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&&w.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 Qo(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(!w.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 $r(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 Nr}get room(){return this.manager.room}get members(){return this.manager.members$.value}get currentMember(){const e=jr(this.room,this.manager.uid);if(!e)throw new Error(`Member ${this.manager.uid} not found.`);return B({uid:this.manager.uid},e)}get storage(){return this._storage||(this._storage=new $r(this)),this._storage}}class Xo{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 Or{constructor(e){this.context=e,this.sem=new ye.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=ci(this.context.size$.value,this.context.stageRect$.value),a=s.scale/r;this.synchronizer.onLocalCameraUpdate(he(B({},s),{scale:a,id:this.context.uid}))}},this.synchronizer=new Uo(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=v.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 He=new Je.default,Ki=(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 te=(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))(te||{});class Ko{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 w.get(this.attributes,["apps"])}get focus(){return w.get(this.attributes,["focus"])}getAppAttributes(e){return w.get(this.apps(),[e])}getAppState(e){return w.get(this.apps(),[e,"state"])}getMaximized(){return w.get(this.attributes,["maximized"])}getMinimized(){return w.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=w.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"],{[ke.Size]:{},[ke.Position]:{},[ke.SceneIndex]:0})}updateAppState(e,i,s){w.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[ke.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 w.get(this.attributes,["mainViewCamera"])}getMainViewSize(){return w.get(this.attributes,["mainViewSize"])}setMainViewCamera(e){this.context.safeSetAttributes({mainViewCamera:B({},e)})}setMainViewSize(e){this.context.safeSetAttributes({mainViewSize:B({},e)})}setMainViewCameraAndSize(e,i){this.context.safeSetAttributes({mainViewCamera:B({},e),mainViewSize:B({},i)})}updateCursor(e,i){w.get(this.attributes,["cursors"])||this.context.safeUpdateAttributes(["cursors"],{}),w.get(this.attributes,["cursors",e])||this.context.safeUpdateAttributes(["cursors",e],{}),this.context.safeUpdateAttributes(["cursors",e,"position"],i)}updateCursorState(e,i){w.get(this.attributes,["cursors",e])||this.context.safeUpdateAttributes(["cursors",e],{}),this.context.safeUpdateAttributes(["cursors",e,"cursorState"],i)}getCursorState(e){return w.get(this.attributes,["cursors",e,"cursorState"])}cleanCursor(e){this.context.safeUpdateAttributes(["cursors",e],void 0)}setMainViewFocusPath(e){const i=this.getMainViewScenePath();i&&ht(e,i)}}const el=new Ko({getAttributes:()=>{throw new Error("getAttributes not implemented")},safeSetAttributes:()=>{throw new Error("safeSetAttributes not implemented")},safeUpdateAttributes:()=>{throw new Error("safeUpdateAttributes not implemented")}});class es{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 ye.SideEffectManager,this.valManager=new v.ValManager,this.fullPath$=this.valManager.attach(new v.Val(void 0)),this.camera$=this.valManager.attach(new v.Val(void 0)),this.size$=this.valManager.attach(new v.Val(void 0)),this.box$=this.valManager.attach(new v.Val(void 0)),this.view$=this.valManager.attach(new v.Val(void 0)),this.syncCamera$=this.valManager.attach(new v.Val(!0)),this.whiteBoardViewCreated$=this.valManager.attach(new v.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=w.omitBy(o,w.isUndefined);return c===n&&(u=he(B({},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=w.debounce(n=>{var o;this.view&&n&&n!==((o=this.view)==null?void 0:o.focusScenePath)&&ht(this.view,n)},50),this.notifyPageStateChange=w.debounce(()=>{this.pageState&&this.appEmitter.emit("pageStateChange",this.pageState)},50),this.storeCamera=n=>{this.store.updateAppAttributes(this.id,te.Camera,n)},this.storeSize=n=>{this.store.updateAppAttributes(this.id,te.Size,n)},this.updateSize=(n,o)=>{const c={id:this.manager.uid,width:n,height:o};this.store.updateAppAttributes(this.id,te.Size,c),this.size$.setValue(c)},this.moveCamera=n=>{if(!this.camera$.value)return;const o=he(B(B({},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);w.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);w.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 Je.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 Xo({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(()=>z.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;v.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 Or({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=dt(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=dt(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 w.get(this.appAttributes,[te.FullPath])||this.getFullScenePathFromScenes()}getFullScenePathFromScenes(){const e=w.get(this.appAttributes,["state","SceneIndex"],0),i=Lo(this.manager.room,this.scenePath,e);return i&&this.setFullPath(i),i}setFullPath(e){this.store.updateAppAttributes(this.id,te.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=ge.appClasses.get(i.kind))==null?void 0:a()),r=ge.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 z.emit("updateManagerRect"),{appId:this.id,app:s}}get box(){return this.box$.value}async setupApp(e,i,s,r,a){var o;if(Xe("setupApp",e,s,r),!this.boxManager)throw new Er;const n=new Jo(this.manager,e,this,a);this.appContext=n;try{z.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,ge.notifyApp(this.kind,"created",{appId:e,result:p}),this.fixMobileSize(),this.isAddApp&&this.setupDone()},xr)});const c=(o=this.boxManager)==null?void 0:o.createBox({appId:e,app:s,options:r,canOperate:this.manager.canOperate,smartPosition:this.isAddApp}),l=ge.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,ke.ZIndex,this.box.zIndex),this.store.updateAppState(e,ke.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 es(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 br.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}),He.emit("focus",{appId:this.id});break}}}}setScenePath(){if(!this.manager.canOperate)return;const e=this.getFullScenePath();this.manager.room&&e&&this.view&&zt(this.manager.room,e)}setViewFocusScenePath(){if(this.status==="destroyed")return;const e=this.getFullScenePath();return e&&this.view&&ht(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=Ki(e,this.pageState);return this.setSceneIndexWithoutSync(s),this.manager.dispatchInternalEvent(Y.SetAppFocusIndex,{type:"app",appID:this.id,index:s}),setTimeout(()=>{qi(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),zt(this.manager.room,i))}}async destroy(e,i,s,r){var a;if(this.status!=="destroyed"){this.status="destroyed";try{await ge.notifyApp(this.kind,"destroy",{appId:this.id}),G.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(),z.emit(`destroy-${this.id}`,{error:r}),e&&((a=this.boxManager)==null||a.closeBox(this.id,s)),i&&(this.store.cleanAppAttributes(this.id),this.scenePath&&qi(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 tl{constructor(e){this.displayer=e,this.views=new Map}createView(e){const i=Ur(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 Ur=t=>{const e=t.views.createView();return il(e),e},il=t=>{t.setCameraBound({maxContentMode:()=>10,minContentMode:()=>.1})};class sl{constructor(e){this.manager=e,this.started=!1,this.mainViewIsAddListener=!1,this.store=this.manager.store,this.sideEffectManager=new ye.SideEffectManager,this.camera$=new v.Val(void 0),this.size$=new v.Val(void 0),this.view$=new v.Val(void 0),this.createViewSync=()=>{var i;this.manager.boxManager&&!this.viewSync&&(this.viewSync=new Or({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(()=>z.on("writableChange",i=>{i&&this.ensureCameraAndSize()}))},this.addCameraReaction=()=>{this.manager.refresher.add(te.MainViewCamera,this.cameraReaction),this.manager.refresher.add(te.MainViewSize,this.sizeReaction)},this.storeCurrentCamera=()=>{const i=this.view.camera;this.storeCamera(B({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);w.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);w.isEqual(s,this.size$.value)||this.size$.setValue(s)}},{fireImmediately:!0}),this.mainViewClickListener=()=>{this.mainViewClickHandler()},this.setMainViewSize=w.debounce(i=>{this.store.setMainViewSize(he(B({},i),{id:this.manager.uid}))},50),this.onCameraOrSizeUpdated=()=>{G.emit("cameraStateChange",this.cameraState)},this.mainView=this.createMainView(),z.once("mainViewMounted").then(()=>{this.addMainViewListener(),this.start(),this.ensureCameraAndSize(),this.startListenWritableChange()}),this.sideEffectManager.add(()=>[z.on("startReconnect",()=>{Ir(this.mainView)})]),this.createViewSync(),this.sideEffectManager.add(()=>z.on("focusedChange",({focused:i})=>{if(i===void 0){const s=this.store.getMainViewScenePath();s&&zt(this.manager.room,s)}})),this.camera$.reaction(i=>{i&&G.emit("baseCameraChange",i)}),this.size$.reaction(i=>{i&&G.emit("baseSizeChange",i)})}ensureCameraAndSize(){var e;if(!this.mainViewCamera||!this.mainViewSize){this.manager.dispatchInternalEvent(Y.InitMainViewCamera),this.storeCamera(B({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 w.get(this.view,["didRelease"])}start(){this.started||(this.addCameraListener(),this.addCameraReaction(),this.started=!0)}get view(){return this.mainView}get cameraState(){return B(B({},this.view.camera),this.view.size)}createMainView(){const e=Ur(this.manager.displayer),i=this.store.getMainViewScenePath();return i&&ht(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 ht(this.view,e)}rebind(){const e=this.mainView.divElement,i=this.mainView.disableCameraTransform,s=B({},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(he(B({},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(te.MainViewCamera),this.manager.refresher.remove(te.MainViewSize),this.started=!1}destroy(){this.camera$.destroy(),this.size$.destroy(),this.view$.destroy(),this.removeMainViewListener(),this.stop(),this.sideEffectManager.flushAll()}}class rl{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=>{G.emit("canRedoStepsChange",i)},this.onCanUndoStepsUpdate=i=>{G.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)},z.on("focusedChange",i=>{this.disposePrevFocusViewRedoUndoListeners(i.prev),setTimeout(()=>{this.addRedoUndoListeners(i.focused)},0)}),z.on("rootDirRemoved",()=>{this.disposePrevFocusViewRedoUndoListeners(e.focus()),this.addRedoUndoListeners(e.focus())}),this.addRedoUndoListeners(e.focus())}destroy(){this.disposePrevFocusViewRedoUndoListeners(this.context.focus())}}class al{constructor(e){this.windowManger=e,this.appProxies=new Map,this.appStatus=new Map,this.store=el,this.isReplay=this.windowManger.isReplay,this.mainViewScenesLength=0,this.callbacksNode=null,this.appCreateQueue=new xo,this.sceneIndex$=new v.Val(void 0),this.focused$=new v.Val(void 0),this.members$=new v.Val([]),this.sideEffectManager=new ye.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(Oo(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),z.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=Ki(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&&qi(this.room,`${we}${r}`,i)},100),new Promise((n,o)=>{z.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([G.emit("mainViewScenesLengthChange",i),z.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},G.emit("sceneStateChange",this.sceneState)},this.onBoxMove=i=>{this.dispatchInternalEvent(Y.AppMove,i),this.store.updateAppState(i.appId,ke.Position,{x:i.x,y:i.y})},this.onBoxResize=i=>{i.width&&i.height&&(this.dispatchInternalEvent(Y.AppResize,i),this.store.updateAppState(i.appId,ke.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",()=>Vr(()=>this.attributes.apps,()=>{this.attributesUpdateCallback(this.attributes.apps)}))},this.addAppCloseListener=()=>{var i;(i=this.refresher)==null||i.add("appsClose",()=>Wo(this.attributes.apps,()=>{this.onAppDelete(this.attributes.apps)}))},this.onMainViewIndexChange=i=>{i!==void 0&&this.sceneIndex$.value!==i&&(G.emit("mainViewSceneIndexChange",i),z.emit("changePageState"),this.callbacksNode&&this.updateSceneState(this.callbacksNode),this.sceneIndex$.setValue(i))},this.onFocusChange=i=>{var s;this.focused$.value!==i&&(G.emit("focusedChange",i),z.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(),ge.notifyApp(r.kind,"focus",{appId:i}))},0)))},this.attributesUpdateCallback=w.debounce(i=>this._attributesUpdateCallback(i),100),this.onRegisteredChange=i=>{!i||Object.entries(i).forEach(([s,r])=>{ge.appClasses.has(s)||ge.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(Br(i.roomMembers)),z.emit("observerIdChange",this.displayer.observerId),i.memberState&&z.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),z.emit("writableChange",s)},this.updateSceneIndex=()=>{const i=this.store.getMainViewScenePath(),s=Ji(i),r=dt(this.displayer)[s];if(r.length){const a=i.replace(s,"").replace("/",""),n=r.findIndex(o=>o.name===a);w.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 sl(this),this.viewManager=new tl(this.displayer),this.appListeners=new Ho(this),this.displayer.callbacks.on(this.eventName,this.displayerStateListener),this.appListeners.addListeners(),this.refresher=no,this.refresher.setRoom(this.room),this.refresher.setContext({emitter:z}),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()}),z.once("onCreated").then(()=>this.onCreated()),z.on("onReconnected",()=>this.onReconnected()),S.isPlayer(this.displayer)&&(z.on("seekStart",this.onPlayerSeekStart),z.on("seek",this.onPlayerSeekDone)),z.on("removeScenes",this.onRemoveScenes),z.on("setReadonly",this.onReadonlyChanged),this.createRootDirScenesCallback(),ge.setSyncRegisterApp(i=>{this.safeUpdateAttributes([te.Registered,i.kind],i)}),this.members$.setValue(Br(this.displayer.state.roomMembers))}async onRootDirRemoved(e=!0){await this.setMainViewScenePath(vr),this.createRootDirScenesCallback();for(const[i,s]of this.appProxies.entries())s.view&&await this.closeApp(i,e);this.mainViewProxy.rebind(),await z.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),z.emit("updateManagerRect"),He.on("move",this.onBoxMove),He.on("resize",this.onBoxResize),He.on("focus",this.onBoxFocus),He.on("close",this.onBoxClose),He.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=w.get(this.attributes,"_mainSceneIndex");this.onMainViewIndexChange(i)})),this.refresher.add("focusedChange",()=>S.autorun(()=>{const i=w.get(this.attributes,"focus");this.onFocusChange(i)})),this.refresher.add("registeredChange",()=>S.autorun(()=>{const i=w.get(this.attributes,te.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 rl({mainView:()=>this.mainViewProxy.view,focus:()=>this.attributes.focus,getAppProxy:s=>this.appProxies.get(s)});return()=>i.destroy()})}async _attributesUpdateCallback(e){if(e&&pe.container){const i=Object.keys(e);i.length===0&&this.appCreateQueue.emitReady();const s=i.map(r=>e[r].setup?{id:r,createdAt:e[r].createdAt}:{});for(const{id:r}of w.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,Gi.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,li(30).then(()=>{s.divElement=e,z.emit("mainViewMounted")}),s.focusScenePath||this.setMainViewFocusPath()}setMainViewFocusPath(e){var s;const i=e||this.store.getMainViewScenePath();if(i)return ht(this.mainView,i),((s=this.mainView)==null?void 0:s.focusScenePath)===i}resetScenePath(e){this.displayer.state.sceneState.scenePath!==e&&zt(this.room,e)}async addApp(e,i){Xe("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 Vo(e.kind);this.appStatus.set(s,Gi.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;He.emit("move",{appId:e.id,x:r==null?void 0:r.intrinsicX,y:r==null?void 0:r.intrinsicY}),this.store.updateAppState(e.id,ke.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 es(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}),zt(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(Yi,{eventName:e,payload:i})}destroy(){this.displayer.callbacks.off(this.eventName,this.displayerStateListener),this.displayer.callbacks.off("onEnableWriteNowChanged",this.displayerWritableListener),this.appListeners.removeListeners(),He.clearListeners(),z.clearListeners(),this.appProxies.size&&this.appProxies.forEach(e=>{e.destroy(!0,!1,!0)}),G.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 @@ var gS=Object.defineProperty,mS=Object.defineProperties;var vS=Object.getOwnProp
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 ye=function(){return ye=Object.assign||function(t){for(var i,n=1,r=arguments.length;n<r;n++){i=arguments[n];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s])}return t},ye.apply(this,arguments)};function oo(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(i[n[r]]=e[n[r]]);return i}var ao=0,zu=typeof window!="undefined"&&window.requestAnimationFrame!==void 0?function(e){return window.requestAnimationFrame(e)}:function(e){var t=Date.now(),i=Math.max(0,16.7-(t-ao));ao=t+i,setTimeout(function(){return e(ao)},i)},Rg=function(e){var t=[],i=[],n=0,r=!1,s=0,o=new WeakSet,a=new WeakSet,l={cancel:function(u){var h=i.indexOf(u);o.add(u),h!==-1&&i.splice(h,1)},process:function(u){var h;if(r=!0,h=[i,t],t=h[0],i=h[1],i.length=0,n=t.length,n){var p;for(s=0;s<n;s++)p=t[s],p(u),a.has(p)===!0&&!o.has(p)&&(l.schedule(p),e(!0))}r=!1},schedule:function(u,h,p){h===void 0&&(h=!1),p===void 0&&(p=!1);var w=p&&r,C=w?t:i;o.delete(u),h&&a.add(u),C.indexOf(u)===-1&&(C.push(u),w&&(n=t.length))}};return l},Bg=40,Du=1/60*1e3,dr=!0,an=!1,lo=!1,ln={delta:0,timestamp:0},uo=["read","update","preRender","render","postRender"],Og=function(e){return an=e},ju=uo.reduce(function(e,t){return e[t]=Rg(Og),e},{}),_g=uo.reduce(function(e,t){var i=ju[t];return e[t]=function(n,r,s){return r===void 0&&(r=!1),s===void 0&&(s=!1),an||Ug(),i.schedule(n,r,s),n},e},{}),$g=function(e){return ju[e].process(ln)},Lu=function(e){an=!1,ln.delta=dr?Du:Math.max(Math.min(e-ln.timestamp,Bg),1),dr||(Du=ln.delta),ln.timestamp=e,lo=!0,uo.forEach($g),lo=!1,an&&(dr=!1,zu(Lu))},Ug=function(){an=!0,dr=!0,lo||zu(Lu)},Vu=function(e,t){return function(i){return Math.max(Math.min(i,t),e)}},hr=function(e){return e%1?Number(e.toFixed(5)):e},Ru=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i,pr={test:function(e){return typeof e=="number"},parse:parseFloat,transform:function(e){return e}},un=ye(ye({},pr),{transform:Vu(0,1)}),fr=ye(ye({},pr),{default:1}),co=function(e){return{test:function(t){return typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1},parse:parseFloat,transform:function(t){return""+t+e}}},ri=co("deg"),cn=co("%"),V=co("px"),Bu=ye(ye({},cn),{parse:function(e){return cn.parse(e)/100},transform:function(e){return cn.transform(e*100)}}),Hg=function(e){return e.substring(e.indexOf("(")+1,e.lastIndexOf(")"))},Wg=Vu(0,255),ho=function(e){return e.red!==void 0},po=function(e){return e.hue!==void 0};function Fg(e){return Hg(e).replace(/(,|\/)/g," ").split(/ \s*/)}var Ou=function(e){return function(t){if(typeof t!="string")return t;for(var i={},n=Fg(t),r=0;r<4;r++)i[e[r]]=n[r]!==void 0?parseFloat(n[r]):1;return i}},Qg=function(e){var t=e.red,i=e.green,n=e.blue,r=e.alpha,s=r===void 0?1:r;return"rgba("+t+", "+i+", "+n+", "+s+")"},Zg=function(e){var t=e.hue,i=e.saturation,n=e.lightness,r=e.alpha,s=r===void 0?1:r;return"hsla("+t+", "+i+", "+n+", "+s+")"},fo=ye(ye({},pr),{transform:function(e){return Math.round(Wg(e))}});function go(e,t){return e.startsWith(t)&&Ru.test(e)}var gr={test:function(e){return typeof e=="string"?go(e,"rgb"):ho(e)},parse:Ou(["red","green","blue","alpha"]),transform:function(e){var t=e.red,i=e.green,n=e.blue,r=e.alpha,s=r===void 0?1:r;return Qg({red:fo.transform(t),green:fo.transform(i),blue:fo.transform(n),alpha:hr(un.transform(s))})}},mo={test:function(e){return typeof e=="string"?go(e,"hsl"):po(e)},parse:Ou(["hue","saturation","lightness","alpha"]),transform:function(e){var t=e.hue,i=e.saturation,n=e.lightness,r=e.alpha,s=r===void 0?1:r;return Zg({hue:Math.round(t),saturation:cn.transform(hr(i)),lightness:cn.transform(hr(n)),alpha:hr(un.transform(s))})}},_u=ye(ye({},gr),{test:function(e){return typeof e=="string"&&go(e,"#")},parse:function(e){var t="",i="",n="";return e.length>4?(t=e.substr(1,2),i=e.substr(3,2),n=e.substr(5,2)):(t=e.substr(1,1),i=e.substr(2,1),n=e.substr(3,1),t+=t,i+=i,n+=n),{red:parseInt(t,16),green:parseInt(i,16),blue:parseInt(n,16),alpha:1}}}),nt={test:function(e){return typeof e=="string"&&Ru.test(e)||ho(e)||po(e)},parse:function(e){return gr.test(e)?gr.parse(e):mo.test(e)?mo.parse(e):_u.test(e)?_u.parse(e):e},transform:function(e){return ho(e)?gr.transform(e):po(e)?mo.transform(e):e}},vo=function(e){var t=e.onRead,i=e.onRender,n=e.uncachedValues,r=n===void 0?new Set:n,s=e.useCache,o=s===void 0?!0:s;return function(a){a===void 0&&(a={});var l=oo(a,[]),u={},h=[],p=!1;function w(E,T){E.startsWith("--")&&(l.hasCSSVariable=!0);var c=u[E];u[E]=T,u[E]!==c&&(h.indexOf(E)===-1&&h.push(E),p||(p=!0,_g.render(C.render)))}var C={get:function(E,T){T===void 0&&(T=!1);var c=!T&&o&&!r.has(E)&&u[E]!==void 0;return c?u[E]:t(E,l)},set:function(E,T){if(typeof E=="string")w(E,T);else for(var c in E)w(c,E[c]);return this},render:function(E){return E===void 0&&(E=!1),(p||E===!0)&&(i(u,l,h),p=!1,h.length=0),this}};return C}},Yg=/([a-z])([A-Z])/g,Gg="$1-$2",mr=function(e){return e.replace(Yg,Gg).toLowerCase()},$u=new Map,wo=new Map,Uu=["Webkit","Moz","O","ms",""],Xg=Uu.length,Jg=typeof document!="undefined",yo,Hu=function(e,t){return wo.set(e,mr(t))},Kg=function(e){yo=yo||document.createElement("div");for(var t=0;t<Xg;t++){var i=Uu[t],n=i==="",r=n?e:i+e.charAt(0).toUpperCase()+e.slice(1);if(r in yo.style||n){if(n&&e==="clipPath"&&wo.has(e))return;$u.set(e,r),Hu(e,(n?"":"-")+mr(r))}}},qg=function(e){return Hu(e,e)},Wu=function(e,t){t===void 0&&(t=!1);var i=t?wo:$u;return i.has(e)||(Jg?Kg(e):qg(e)),i.get(e)||e},em=["","X","Y","Z"],tm=["translate","scale","rotate","skew","transformPerspective"],xo=tm.reduce(function(e,t){return em.reduce(function(i,n){return i.push(t+n),i},e)},["x","y","z"]),im=xo.reduce(function(e,t){return e[t]=!0,e},{});function So(e){return im[e]===!0}function nm(e,t){return xo.indexOf(e)-xo.indexOf(t)}var rm=new Set(["originX","originY","originZ"]);function sm(e){return rm.has(e)}var Fu=ye(ye({},pr),{transform:Math.round}),om={color:nt,backgroundColor:nt,outlineColor:nt,fill:nt,stroke:nt,borderColor:nt,borderTopColor:nt,borderRightColor:nt,borderBottomColor:nt,borderLeftColor:nt,borderWidth:V,borderTopWidth:V,borderRightWidth:V,borderBottomWidth:V,borderLeftWidth:V,borderRadius:V,radius:V,borderTopLeftRadius:V,borderTopRightRadius:V,borderBottomRightRadius:V,borderBottomLeftRadius:V,width:V,maxWidth:V,height:V,maxHeight:V,size:V,top:V,right:V,bottom:V,left:V,padding:V,paddingTop:V,paddingRight:V,paddingBottom:V,paddingLeft:V,margin:V,marginTop:V,marginRight:V,marginBottom:V,marginLeft:V,rotate:ri,rotateX:ri,rotateY:ri,rotateZ:ri,scale:fr,scaleX:fr,scaleY:fr,scaleZ:fr,skew:ri,skewX:ri,skewY:ri,distance:V,translateX:V,translateY:V,translateZ:V,x:V,y:V,z:V,perspective:V,opacity:un,originX:Bu,originY:Bu,originZ:V,zIndex:Fu,fillOpacity:un,strokeOpacity:un,numOctaves:Fu},Co=function(e){return om[e]},am=function(e,t){return t&&typeof e=="number"?t.transform(e):e},dn="scrollLeft",hn="scrollTop",Qu=new Set([dn,hn]),lm=new Set([dn,hn,"transform"]),um={x:"translateX",y:"translateY",z:"translateZ"};function Zu(e){return typeof e=="function"}function cm(e,t,i,n,r,s){s===void 0&&(s=!0);var o="",a=!1;i.sort(nm);for(var l=i.length,u=0;u<l;u++){var h=i[u];o+=(um[h]||h)+"("+t[h]+") ",a=h==="z"?!0:a}return!a&&r?o+="translateZ(0)":o=o.trim(),Zu(e.transform)?o=e.transform(t,n?"":o):s&&n&&(o="none"),o}function dm(e,t,i,n,r,s,o,a){t===void 0&&(t=!0),i===void 0&&(i={}),n===void 0&&(n={}),r===void 0&&(r={}),s===void 0&&(s=[]),o===void 0&&(o=!1),a===void 0&&(a=!0);var l=!0,u=!1,h=!1;for(var p in e){var w=e[p],C=Co(p),E=am(w,C);So(p)?(u=!0,n[p]=E,s.push(p),l&&(C.default&&w!==C.default||!C.default&&w!==0)&&(l=!1)):sm(p)?(r[p]=E,h=!0):(!lm.has(p)||!Zu(E))&&(i[Wu(p,o)]=E)}return(u||typeof e.transform=="function")&&(i.transform=cm(e,n,s,l,t,a)),h&&(i.transformOrigin=(r.originX||"50%")+" "+(r.originY||"50%")+" "+(r.originZ||0)),i}function Mo(e){var t=e===void 0?{}:e,i=t.enableHardwareAcceleration,n=i===void 0?!0:i,r=t.isDashCase,s=r===void 0?!0:r,o=t.allowTransformNone,a=o===void 0?!0:o,l={},u={},h={},p=[];return function(w){return p.length=0,dm(w,n,l,u,h,p,s,a),l}}function hm(e,t){var i=t.element,n=t.preparseOutput,r=Co(e);if(So(e))return r&&r.default||0;if(Qu.has(e))return i[e];var s=window.getComputedStyle(i,null).getPropertyValue(Wu(e,!0))||0;return n&&r&&r.test(s)&&r.parse?r.parse(s):s}function pm(e,t,i){var n=t.element,r=t.buildStyles,s=t.hasCSSVariable;if(Object.assign(n.style,r(e)),s)for(var o=i.length,a=0;a<o;a++){var l=i[a];l.startsWith("--")&&n.style.setProperty(l,e[l])}i.indexOf(dn)!==-1&&(n[dn]=e[dn]),i.indexOf(hn)!==-1&&(n[hn]=e[hn])}var fm=vo({onRead:hm,onRender:pm,uncachedValues:Qu});function gm(e,t){t===void 0&&(t={});var i=t.enableHardwareAcceleration,n=t.allowTransformNone,r=oo(t,["enableHardwareAcceleration","allowTransformNone"]);return fm(ye({element:e,buildStyles:Mo({enableHardwareAcceleration:i,allowTransformNone:n}),preparseOutput:!0},r))}var Yu=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues"]),Gu=.5,Xu=function(){return{style:{}}},Io=function(e,t){return V.transform(e*t)},mm={x:0,y:0,width:0,height:0};function Ju(e,t,i){return typeof e=="string"?e:V.transform(t+i*e)}function vm(e,t,i){return Ju(t,e.x,e.width)+" "+Ju(i,e.y,e.height)}var Ku={enableHardwareAcceleration:!1,isDashCase:!1};function wm(e,t,i,n,r,s){t===void 0&&(t=mm),n===void 0&&(n=Mo(Ku)),r===void 0&&(r=Xu()),s===void 0&&(s=!0);var o=e.attrX,a=e.attrY,l=e.originX,u=e.originY,h=e.pathLength,p=e.pathSpacing,w=p===void 0?1:p,C=e.pathOffset,E=C===void 0?0:C,T=oo(e,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]),c=n(T);for(var d in c)if(d==="transform")r.style.transform=c[d];else{var f=s&&!Yu.has(d)?mr(d):d;r[f]=c[d]}return(l!==void 0||u!==void 0||c.transform)&&(r.style.transformOrigin=vm(t,l!==void 0?l:Gu,u!==void 0?u:Gu)),o!==void 0&&(r.x=o),a!==void 0&&(r.y=a),i!==void 0&&h!==void 0&&(r[s?"stroke-dashoffset":"strokeDashoffset"]=Io(-E,i),r[s?"stroke-dasharray":"strokeDasharray"]=Io(h,i)+" "+Io(w,i)),r}function ym(e,t,i){i===void 0&&(i=!0);var n=Xu(),r=Mo(Ku);return function(s){return wm(s,e,t,r,n,i)}}var xm=function(e){return typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()},Sm=function(e){try{return xm(e)}catch{return{x:0,y:0,width:0,height:0}}},Cm=function(e){return e.tagName==="path"},Mm=vo({onRead:function(e,t){var i=t.element;if(e=Yu.has(e)?e:mr(e),So(e)){var n=Co(e);return n&&n.default||0}else return i.getAttribute(e)},onRender:function(e,t){var i=t.element,n=t.buildAttrs,r=n(e);for(var s in r)s==="style"?Object.assign(i.style,r.style):i.setAttribute(s,r[s])}}),Im=function(e){var t=Sm(e),i=Cm(e)&&e.getTotalLength?e.getTotalLength():void 0;return Mm({element:e,buildAttrs:ym(t,i)})},bm=vo({useCache:!1,onRead:function(e){return e==="scrollTop"?window.pageYOffset:window.pageXOffset},onRender:function(e){var t=e.scrollTop,i=t===void 0?0:t,n=e.scrollLeft,r=n===void 0?0:n;return window.scrollTo(r,i)}}),bo=new WeakMap,Am=function(e){return e instanceof HTMLElement||typeof e.click=="function"},Em=function(e){return e instanceof SVGElement||"ownerSVGElement"in e},Tm=function(e,t){var i;return e===window?i=bm(e):Am(e)?i=gm(e,t):Em(e)&&(i=Im(e)),bo.set(e,i),i},Nm=function(e,t){return bo.has(e)?bo.get(e):Tm(e,t)};function km(e,t){var i=typeof e=="string"?document.querySelector(e):e;return Nm(i,t)}var Xe=function(t,i,n,r){var s=n?n.call(r,t,i):void 0;if(s!==void 0)return!!s;if(t===i)return!0;if(typeof t!="object"||!t||typeof i!="object"||!i)return!1;var o=Object.keys(t),a=Object.keys(i);if(o.length!==a.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(i),u=0;u<o.length;u++){var h=o[u];if(!l(h))return!1;var p=t[h],w=i[h];if(s=n?n.call(r,p,w,h):void 0,s===!1||s===void 0&&p!==w)return!1}return!0},Pm=(()=>`.tele-fancy-scrollbar {
15
+ ***************************************************************************** */var de=function(){return de=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},de.apply(this,arguments)};function ts(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 is=0,Hr=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-is));is=e+i,setTimeout(function(){return t(is)},i)},nl=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},ol=40,Fr=1/60*1e3,hi=!0,Dt=!1,ss=!1,Vt={delta:0,timestamp:0},rs=["read","update","preRender","render","postRender"],ll=function(t){return Dt=t},Wr=rs.reduce(function(t,e){return t[e]=nl(ll),t},{}),cl=rs.reduce(function(t,e){var i=Wr[e];return t[e]=function(s,r,a){return r===void 0&&(r=!1),a===void 0&&(a=!1),Dt||dl(),i.schedule(s,r,a),s},t},{}),hl=function(t){return Wr[t].process(Vt)},Zr=function(t){Dt=!1,Vt.delta=hi?Fr:Math.max(Math.min(t-Vt.timestamp,ol),1),hi||(Fr=Vt.delta),Vt.timestamp=t,ss=!0,rs.forEach(hl),ss=!1,Dt&&(hi=!1,Hr(Zr))},dl=function(){Dt=!0,hi=!0,ss||Hr(Zr)},Yr=function(t,e){return function(i){return Math.max(Math.min(i,e),t)}},di=function(t){return t%1?Number(t.toFixed(5)):t},Qr=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i,ui={test:function(t){return typeof t=="number"},parse:parseFloat,transform:function(t){return t}},Lt=de(de({},ui),{transform:Yr(0,1)}),pi=de(de({},ui),{default:1}),as=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}}},ut=as("deg"),$t=as("%"),V=as("px"),Gr=de(de({},$t),{parse:function(t){return $t.parse(t)/100},transform:function(t){return $t.transform(t*100)}}),ul=function(t){return t.substring(t.indexOf("(")+1,t.lastIndexOf(")"))},pl=Yr(0,255),ns=function(t){return t.red!==void 0},os=function(t){return t.hue!==void 0};function gl(t){return ul(t).replace(/(,|\/)/g," ").split(/ \s*/)}var qr=function(t){return function(e){if(typeof e!="string")return e;for(var i={},s=gl(e),r=0;r<4;r++)i[t[r]]=s[r]!==void 0?parseFloat(s[r]):1;return i}},ml=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+")"},fl=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+")"},ls=de(de({},ui),{transform:function(t){return Math.round(pl(t))}});function cs(t,e){return t.startsWith(e)&&Qr.test(t)}var gi={test:function(t){return typeof t=="string"?cs(t,"rgb"):ns(t)},parse:qr(["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 ml({red:ls.transform(e),green:ls.transform(i),blue:ls.transform(s),alpha:di(Lt.transform(a))})}},hs={test:function(t){return typeof t=="string"?cs(t,"hsl"):os(t)},parse:qr(["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 fl({hue:Math.round(e),saturation:$t.transform(di(i)),lightness:$t.transform(di(s)),alpha:di(Lt.transform(a))})}},Jr=de(de({},gi),{test:function(t){return typeof t=="string"&&cs(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}}}),Le={test:function(t){return typeof t=="string"&&Qr.test(t)||ns(t)||os(t)},parse:function(t){return gi.test(t)?gi.parse(t):hs.test(t)?hs.parse(t):Jr.test(t)?Jr.parse(t):t},transform:function(t){return ns(t)?gi.transform(t):os(t)?hs.transform(t):t}},ds=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=ts(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,cl.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}},bl=/([a-z])([A-Z])/g,yl="$1-$2",mi=function(t){return t.replace(bl,yl).toLowerCase()},Xr=new Map,us=new Map,Kr=["Webkit","Moz","O","ms",""],wl=Kr.length,vl=typeof document!="undefined",ps,ea=function(t,e){return us.set(t,mi(e))},xl=function(t){ps=ps||document.createElement("div");for(var e=0;e<wl;e++){var i=Kr[e],s=i==="",r=s?t:i+t.charAt(0).toUpperCase()+t.slice(1);if(r in ps.style||s){if(s&&t==="clipPath"&&us.has(t))return;Xr.set(t,r),ea(t,(s?"":"-")+mi(r))}}},Ml=function(t){return ea(t,t)},ta=function(t,e){e===void 0&&(e=!1);var i=e?us:Xr;return i.has(t)||(vl?xl(t):Ml(t)),i.get(t)||t},Sl=["","X","Y","Z"],Cl=["translate","scale","rotate","skew","transformPerspective"],gs=Cl.reduce(function(t,e){return Sl.reduce(function(i,s){return i.push(e+s),i},t)},["x","y","z"]),Il=gs.reduce(function(t,e){return t[e]=!0,t},{});function ms(t){return Il[t]===!0}function _l(t,e){return gs.indexOf(t)-gs.indexOf(e)}var Al=new Set(["originX","originY","originZ"]);function kl(t){return Al.has(t)}var ia=de(de({},ui),{transform:Math.round}),Tl={color:Le,backgroundColor:Le,outlineColor:Le,fill:Le,stroke:Le,borderColor:Le,borderTopColor:Le,borderRightColor:Le,borderBottomColor:Le,borderLeftColor:Le,borderWidth:V,borderTopWidth:V,borderRightWidth:V,borderBottomWidth:V,borderLeftWidth:V,borderRadius:V,radius:V,borderTopLeftRadius:V,borderTopRightRadius:V,borderBottomRightRadius:V,borderBottomLeftRadius:V,width:V,maxWidth:V,height:V,maxHeight:V,size:V,top:V,right:V,bottom:V,left:V,padding:V,paddingTop:V,paddingRight:V,paddingBottom:V,paddingLeft:V,margin:V,marginTop:V,marginRight:V,marginBottom:V,marginLeft:V,rotate:ut,rotateX:ut,rotateY:ut,rotateZ:ut,scale:pi,scaleX:pi,scaleY:pi,scaleZ:pi,skew:ut,skewX:ut,skewY:ut,distance:V,translateX:V,translateY:V,translateZ:V,x:V,y:V,z:V,perspective:V,opacity:Lt,originX:Gr,originY:Gr,originZ:V,zIndex:ia,fillOpacity:Lt,strokeOpacity:Lt,numOctaves:ia},fs=function(t){return Tl[t]},Nl=function(t,e){return e&&typeof t=="number"?e.transform(t):t},jt="scrollLeft",Bt="scrollTop",sa=new Set([jt,Bt]),Pl=new Set([jt,Bt,"transform"]),El={x:"translateX",y:"translateY",z:"translateZ"};function ra(t){return typeof t=="function"}function zl(t,e,i,s,r,a){a===void 0&&(a=!0);var n="",o=!1;i.sort(_l);for(var c=i.length,l=0;l<c;l++){var d=i[l];n+=(El[d]||d)+"("+e[d]+") ",o=d==="z"?!0:o}return!o&&r?n+="translateZ(0)":n=n.trim(),ra(t.transform)?n=t.transform(e,s?"":n):a&&s&&(n="none"),n}function Dl(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=Nl(p,m);ms(u)?(l=!0,s[u]=g,a.push(u),c&&(m.default&&p!==m.default||!m.default&&p!==0)&&(c=!1)):kl(u)?(r[u]=g,d=!0):(!Pl.has(u)||!ra(g))&&(i[ta(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 bs(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,Dl(p,s,c,l,d,u,a,o),c}}function Vl(t,e){var i=e.element,s=e.preparseOutput,r=fs(t);if(ms(t))return r&&r.default||0;if(sa.has(t))return i[t];var a=window.getComputedStyle(i,null).getPropertyValue(ta(t,!0))||0;return s&&r&&r.test(a)&&r.parse?r.parse(a):a}function Ll(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 $l=ds({onRead:Vl,onRender:Ll,uncachedValues:sa});function jl(t,e){e===void 0&&(e={});var i=e.enableHardwareAcceleration,s=e.allowTransformNone,r=ts(e,["enableHardwareAcceleration","allowTransformNone"]);return $l(de({element:t,buildStyles:bs({enableHardwareAcceleration:i,allowTransformNone:s}),preparseOutput:!0},r))}var aa=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues"]),na=.5,oa=function(){return{style:{}}},ys=function(t,e){return V.transform(t*e)},Bl={x:0,y:0,width:0,height:0};function la(t,e,i){return typeof t=="string"?t:V.transform(e+i*t)}function Rl(t,e,i){return la(e,t.x,t.width)+" "+la(i,t.y,t.height)}var ca={enableHardwareAcceleration:!1,isDashCase:!1};function Ol(t,e,i,s,r,a){e===void 0&&(e=Bl),s===void 0&&(s=bs(ca)),r===void 0&&(r=oa()),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=ts(t,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]),b=s(f);for(var x in b)if(x==="transform")r.style.transform=b[x];else{var M=a&&!aa.has(x)?mi(x):x;r[M]=b[x]}return(c!==void 0||l!==void 0||b.transform)&&(r.style.transformOrigin=Rl(e,c!==void 0?c:na,l!==void 0?l:na)),n!==void 0&&(r.x=n),o!==void 0&&(r.y=o),i!==void 0&&d!==void 0&&(r[a?"stroke-dashoffset":"strokeDashoffset"]=ys(-g,i),r[a?"stroke-dasharray":"strokeDasharray"]=ys(d,i)+" "+ys(p,i)),r}function Ul(t,e,i){i===void 0&&(i=!0);var s=oa(),r=bs(ca);return function(a){return Ol(a,t,e,r,s,i)}}var Hl=function(t){return typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()},Fl=function(t){try{return Hl(t)}catch{return{x:0,y:0,width:0,height:0}}},Wl=function(t){return t.tagName==="path"},Zl=ds({onRead:function(t,e){var i=e.element;if(t=aa.has(t)?t:mi(t),ms(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])}}),Yl=function(t){var e=Fl(t),i=Wl(t)&&t.getTotalLength?t.getTotalLength():void 0;return Zl({element:t,buildAttrs:Ul(e,i)})},Ql=ds({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,Gl=function(t){return t instanceof HTMLElement||typeof t.click=="function"},ql=function(t){return t instanceof SVGElement||"ownerSVGElement"in t},Jl=function(t,e){var i;return t===window?i=Ql(t):Gl(t)?i=jl(t,e):ql(t)&&(i=Yl(t)),ws.set(t,i),i},Xl=function(t,e){return ws.has(t)?ws.get(t):Jl(t,e)};function Kl(t,e){var i=typeof t=="string"?document.querySelector(t):t;return Xl(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},ec=(()=>`.tele-fancy-scrollbar {
16
16
  overscroll-behavior: contain;
17
17
  overflow: auto;
18
18
  overflow-y: scroll;
@@ -120,35 +120,8 @@ var gS=Object.defineProperty,mS=Object.defineProperties;var vS=Object.getOwnProp
120
120
  color: var(--tele-boxFooterColor, #e9e9e9);
121
121
  background-color: #383b42;
122
122
  background-color: var(--tele-boxFooterBackground, #383b42);
123
- }`)(),qu=(e=>(e.Light="light",e.Dark="dark",e.Auto="auto",e))(qu||{}),ue=(e=>(e.Normal="normal",e.Minimized="minimized",e.Maximized="maximized",e))(ue||{}),Ae=(e=>(e.DarkMode="dark_mode",e.PrefersColorScheme="prefers_color_scheme",e.Close="close",e.Focus="focus",e.Blur="blur",e.IntrinsicMove="intrinsic_move",e.IntrinsicResize="intrinsic_resize",e.ZIndex="z_index",e.State="state",e.Minimized="minimized",e.Maximized="maximized",e.Readonly="readonly",e.Destroyed="destroyed",e))(Ae||{}),rt=(e=>(e.Close="close",e.Maximize="maximize",e.Minimize="minimize",e))(rt||{}),st=(e=>(e.North="n",e.South="s",e.West="w",e.East="e",e.NorthWest="nw",e.NorthEast="ne",e.SouthEast="se",e.SouthWest="sw",e))(st||{});const Ao="dh";function Ni(e,t,i){return Math.min(Math.max(e,t),i)}function pn(e){e.stopPropagation(),e.cancelable&&e.preventDefault()}let zm=1;function Dm(){return`New Box ${zm++}`}class ec{constructor({readonly$:t,state$:i,title$:n,buttons:r,onEvent:s,onDragStart:o,namespace:a="telebox"}){this.sideEffect=new Pe.SideEffectManager,this.lastTitleBarClick={timestamp:0,clientX:-100,clientY:-100},this.handleTitleBarClick=l=>{var u;if(!l.isPrimary||this.readonly$.value||l.button!==0||(u=l.target.dataset)!=null&&u.teleTitleBarNoDblClick)return;pn(l);const h=Date.now();h-this.lastTitleBarClick.timestamp<=500?Math.abs(l.clientX-this.lastTitleBarClick.clientX)<=5&&Math.abs(l.clientY-this.lastTitleBarClick.clientY)<=5&&this.onEvent&&this.onEvent({type:rt.Maximize}):this.onDragStart&&this.onDragStart(l),this.lastTitleBarClick.timestamp=h,this.lastTitleBarClick.clientX=l.clientX,this.lastTitleBarClick.clientY=l.clientY},this.readonly$=t,this.state$=i,this.title$=n,this.onEvent=s,this.onDragStart=o,this.namespace=a,this.buttons=r||[{type:rt.Minimize,iconClassName:this.wrapClassName("titlebar-icon-minimize")},{type:rt.Maximize,iconClassName:this.wrapClassName("titlebar-icon-maximize"),isActive:l=>l===ue.Maximized},{type:rt.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 t=document.createElement("div");t.className=this.wrapClassName("title-area"),t.dataset.teleBoxHandle=Ao;const i=document.createElement("h1");i.className=this.wrapClassName("title"),i.dataset.teleBoxHandle=Ao,t.appendChild(i),t.appendChild(this.$dragArea);const n=document.createElement("div");n.className=this.wrapClassName("titlebar-btns"),this.buttons.forEach(({iconClassName:r},s)=>{const o=String(s),a=document.createElement("button");a.className=`${this.wrapClassName("titlebar-btn")} ${r}`,a.dataset.teleTitleBarBtnIndex=o,a.dataset.teleTitleBarNoDblClick="true",n.appendChild(a)}),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((s,o)=>{var a;s.isActive&&((a=n.children[o])==null||a.classList.toggle("is-active",s.isActive(r)))})}),"render-state-btns"),this.sideEffect.addEventListener(n,"click",r=>{var s;if(this.readonly$.value)return;const o=r.target,a=Number((s=o.dataset)==null?void 0:s.teleTitleBarBtnIndex);if(!Number.isNaN(a)&&a<this.buttons.length){pn(r);const l=this.buttons[a];this.onEvent&&this.onEvent({type:l.type,value:l.value})}},{},"render-btns-container-click"),this.$titleBar.appendChild(t),this.$titleBar.appendChild(n)}return this.$titleBar}renderDragArea(){const t=document.createElement("div");return t.className=this.wrapClassName("drag-area"),t.dataset.teleBoxHandle=Ao,this.sideEffect.addEventListener(t,"pointerdown",this.handleTitleBarClick),t}dragHandle(){return this.$titleBar}wrapClassName(t){return`${this.namespace}-${t}`}destroy(){this.sideEffect.flushAll(),this.$titleBar&&(this.$titleBar=void 0,this.onDragStart=void 0,this.onEvent=void 0)}}function tc([e,t]){if(t<=0||e.width<=0||e.height<=0)return e;const i=e.width*t;if(i===e.height)return e;if(i<e.height)return{x:0,y:(e.height-i)/2,width:e.width,height:i};const n=e.height/t;return{x:(e.width-n)/2,y:0,width:n,height:e.height}}const jm=window.ResizeObserver||ru.ResizeObserver;class Lm{constructor({id:t=Pe.genUID(),title:i=Dm(),namespace:n="telebox",visible:r=!0,width:s=.5,height:o=.5,minWidth:a=0,minHeight:l=0,x:u=.1,y:h=.1,resizable:p=!0,draggable:w=!0,boxRatio:C=-1,focus:E=!1,zIndex:T=100,stageRatio:c=null,enableShadowDOM:d=!0,titleBar:f,content:g,stage:m,footer:x,styles:y,userStyles:k,bodyStyle:D=null,stageStyle:P=null,darkMode$:q,fence$:ie,minimized$:ne,maximized$:tt,readonly$:G,root:J,rootRect$:it,managerStageRect$:pe,managerStageRatio$:Qe,defaultBoxBodyStyle$:Ze,defaultBoxStageStyle$:Et,collectorRect$:Ei}){this.events=new kt.default,this._delegateEvents=new kt.default,this.handleTrackStart=H=>{var Q;return(Q=this._handleTrackStart)==null?void 0:Q.call(this,H)},this._sideEffect=new Pe.SideEffectManager,this.id=t,this.namespace=n,this.enableShadowDOM=d;const qt=new I.ValManager;this._sideEffect.addDisposer(()=>qt.destroy());const rn=new I.Val(i),M=new I.Val(r),v=new I.Val(p),N=new I.Val(w),$=new I.Val(C),U=new I.Val(T),_e=new I.Val(E),Me=I.combine([ne,tt],([H,Q])=>H?ue.Minimized:Q?ue.Maximized:ue.Normal),Tt=new I.Val({width:Ni(a,0,1),height:Ni(l,0,1)},{compare:Xe}),ei=I.combine([Tt,pe],([H,Q])=>({width:H.width*Q.width,height:H.height*Q.height}),{compare:Xe}),Xs=new I.Val({width:s,height:o},{compare:Xe});this._sideEffect.addDisposer(Tt.reaction((H,Q)=>{Xs.setValue({width:Math.max(s,H.width),height:Math.max(o,H.height)},Q)}));const iu=new I.Val({x:u,y:h},{compare:Xe}),nu=I.combine([Xs,pe],([H,Q])=>({width:Q.width*H.width,height:Q.height*H.height}),{compare:Xe}),ur=I.combine([iu,pe],([H,Q])=>({x:H.x*Q.width,y:H.y*Q.height}),{compare:Xe}),sS=new I.Val(D),oS=new I.Val(P),aS=new I.Val(null),Uf=new I.Val(pe.value,{compare:Xe}),Hf=new I.Val(c),lS=I.combine([Hf,Qe],([H,Q])=>H!=null?H:Q),uS=I.combine([Uf,lS],tc,{compare:Xe}),cS={darkMode:q,fence:ie,minimized:ne,maximized:tt,readonly:G,rootRect:it,managerStageRect:pe,managerStageRatio:Qe,defaultBoxBodyStyle:Ze,defaultBoxStageStyle:Et,collectorRect:Ei};I.withReadonlyValueEnhancer(this,cS);const dS={zIndex:U,focus:_e,state:Me,minSize:Tt,pxMinSize:ei,intrinsicSize:Xs,intrinsicCoord:iu,pxIntrinsicSize:nu,pxIntrinsicCoord:ur,bodyRect:Uf,stageRect:uS};I.withReadonlyValueEnhancer(this,dS,qt);const hS={title:rn,visible:M,resizable:v,draggable:N,boxRatio:$,stageRatio:Hf,bodyStyle:sS,stageStyle:oS};I.withValueEnhancer(this,hS,qt),this.titleBar=f||new ec({readonly$:G,state$:Me,title$:rn,namespace:this.namespace,onDragStart:H=>{var Q;return(Q=this._handleTrackStart)==null?void 0:Q.call(this,H)},onEvent:H=>this._delegateEvents.emit(H.type)}),this._sideEffect.addDisposer($.subscribe(H=>{H>0&&this.transform(ur.value.x,ur.value.y,nu.value.width,nu.value.height)})),this._sideEffect.addDisposer(ie.subscribe(H=>{H&&this.move(ur.value.x,ur.value.y)})),this.$box=this._render(),aS.setValue(this.$content.parentElement),g&&this.mountContent(g),m&&this.mountStage(m),x&&this.mountFooter(x),y&&this.mountStyles(y),k&&this.mountUserStyles(k),J.appendChild(this.$box);const ti=(H,Q)=>{this._sideEffect.addDisposer(H.reaction((pS,fS)=>{fS||this.events.emit(Q,pS)}))};ti(q,Ae.DarkMode),ti(G,Ae.Readonly),ti(U,Ae.ZIndex),ti(ne,Ae.Minimized),ti(tt,Ae.Maximized),ti(Me,Ae.State),ti(Xs,Ae.IntrinsicResize),ti(iu,Ae.IntrinsicMove),this._sideEffect.addDisposer([M.reaction((H,Q)=>{!Q&&!H&&this.events.emit(Ae.Close)}),_e.reaction((H,Q)=>{Q||this.events.emit(H?Ae.Focus:Ae.Blur)})])}get minWidth(){return this._minSize$.value.width}get minHeight(){return this._minSize$.value.height}setMinWidth(t,i=!1){this._minSize$.setValue({width:t,height:this.minHeight},i)}setMinHeight(t,i=!1){this._minSize$.setValue({width:this.minWidth,height:t},i)}resize(t,i,n=!1){this._intrinsicSize$.setValue({width:Math.max(t,this.minWidth),height:Math.max(i,this.minHeight)},n)}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(t,i,n=!1){let r,s;const o=this.managerStageRect,a=this.pxIntrinsicSize;this.fence?(r=Ni(t,0,o.width-a.width),s=Ni(i,0,o.height-a.height)):(r=Ni(t,-(a.width-120),0+o.width-20),s=Ni(i,0,0+o.height-20)),this._intrinsicCoord$.setValue({x:r/o.width,y:s/o.height},n)}transform(t,i,n,r,s=!1){const o=this.managerStageRect;if(n=Math.max(n,this.pxMinSize.width),r=Math.max(r,this.pxMinSize.height),this.boxRatio>0){const a=this.boxRatio*n;i!==this.pxIntrinsicCoord.y&&(i-=a-r),r=a}i<0&&(i=0,r=this.pxIntrinsicSize.height),this.move(t,i,s),this._intrinsicSize$.setValue({width:n/o.width,height:r/o.height},s)}mountContent(t){var i;(i=this.$authorContent)==null||i.remove(),this.$authorContent=t,this.$content.appendChild(t)}unmountContent(){this.$authorContent&&(this.$authorContent.remove(),this.$authorContent=void 0)}mountStage(t){var i;(i=this.$authorStage)==null||i.remove(),this.$authorStage=t,this.$stage||(this.$stage=this._renderStage()),this.$stage.appendChild(t),this.$stage.parentElement||this.$body.appendChild(this.$stage)}unmountStage(){var t;this.$authorStage&&(this.$authorStage.remove(),this.$authorStage=void 0),(t=this.$stage)==null||t.remove()}mountFooter(t){var i;(i=this.$authorFooter)==null||i.remove(),this.$authorFooter=t,this.$footer.appendChild(t)}unmountFooter(){this.$authorFooter&&(this.$authorFooter.remove(),this.$authorFooter=void 0)}mountStyles(t){this.$styles.textContent=t}unmountStyles(){this.$styles.textContent=""}mountUserStyles(t){this.$userStyles.textContent=t}unmountUserStyles(){this.$userStyles.textContent=""}_render(){if(this.$box)return this.$box;const t=(c,d)=>this._sideEffect.addDisposer([this._readonly$.subscribe(f=>c.classList.toggle(this.wrapClassName("readonly"),f)),this._draggable$.subscribe(f=>c.classList.toggle(this.wrapClassName("no-drag"),!f)),this._resizable$.subscribe(f=>c.classList.toggle(this.wrapClassName("no-resize"),!f)),this._focus$.subscribe(f=>c.classList.toggle(this.wrapClassName("blur"),!f)),this._darkMode$.subscribe(f=>{c.classList.toggle(this.wrapClassName("color-scheme-dark"),f),c.classList.toggle(this.wrapClassName("color-scheme-light"),!f)})],d);this.$box=document.createElement("div"),this.$box.classList.add(this.wrapClassName("box")),t(this.$box,"bind-box-state"),this._sideEffect.add(()=>{const c=this.wrapClassName("minimized"),d=this.wrapClassName("maximized"),f="box-maximized-timer";return this._state$.subscribe(g=>{this.$box.classList.toggle(c,g===ue.Minimized),g===ue.Maximized?(this._sideEffect.flush(f),this.$box.classList.toggle(d,!0)):this._sideEffect.setTimeout(()=>{this.$box.classList.toggle(d,!1)},0,f)})}),this._sideEffect.addDisposer(this._visible$.subscribe(c=>{this.$box.style.display=c?"block":"none"})),this._sideEffect.addDisposer(this._zIndex$.subscribe(c=>{this.$box.style.zIndex=String(c)})),this.$box.dataset.teleBoxID=this.id;const i=km(this.$box),n=I.combine([this._maximized$,this._minimized$,this._pxIntrinsicSize$,this._pxIntrinsicCoord$,this._collectorRect$,this._rootRect$,this._managerStageRect$],([c,d,f,g,m,x,y])=>{const k=c?{x:-y.x,y:-y.y,width:x.width,height:x.height,scaleX:1,scaleY:1}:{x:g.x,y:g.y,width:f.width,height:f.height,scaleX:1,scaleY:1};if(d&&m){const{width:D,height:P}=c?this.rootRect:f;k.x=m.x-D/2+m.width/2-y.x,k.y=m.y-P/2+m.height/2-y.y,k.scaleX=m.width/D,k.scaleY=m.height/P}return k},{compare:Xe}),r=n.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(n.subscribe(c=>{i.set(c)}));const s=document.createElement("div");s.className=this.wrapClassName("box-main"),this.$box.appendChild(s);const o=document.createElement("div");o.className=this.wrapClassName("titlebar-wrap"),o.appendChild(this.titleBar.render()),this.$titleBar=o;const a=document.createElement("div");a.className=this.wrapClassName("body-wrap"),this.$body=a;const l=document.createElement("style");this.$styles=l,a.appendChild(l);const u=document.createElement("style");this.$userStyles=u,a.appendChild(u);const h=document.createElement("div");h.className=this.wrapClassName("content")+" tele-fancy-scrollbar",this.$content=h,this._sideEffect.addDisposer(I.combine([this._bodyStyle$,this._defaultBoxBodyStyle$],([c,d])=>c!=null?c:d).subscribe(c=>h.style.cssText=c||"")),a.appendChild(h);const p=document.createElement("div");p.className=this.wrapClassName("footer-wrap"),this.$footer=p,s.appendChild(o);const w=document.createElement("div");w.className=this.wrapClassName("main"),this.$main=w,s.appendChild(w);const C=document.createElement("div");C.className=this.wrapClassName("quarantine-outer"),w.appendChild(C);const E=document.createElement("div");if(E.className=this.wrapClassName("quarantine"),E.appendChild(a),E.appendChild(p),this.enableShadowDOM){t(E,"bind-quarantine-state");const c=document.createElement("style");c.textContent=Pm,E.insertBefore(c,E.firstChild),C.attachShadow({mode:"open"}).appendChild(E)}else C.appendChild(E);this._renderResizeHandlers();const T=()=>{const c=a.getBoundingClientRect();this._bodyRect$.setValue({x:0,y:0,width:c.width,height:c.height})};return this._sideEffect.add(()=>{const c=new jm(()=>{this.minimized||T()});return c.observe(a),()=>c.disconnect()}),this._sideEffect.addDisposer(this._minimized$.reaction(c=>{c||this._sideEffect.setTimeout(T,400,"minimized-content-rect-fix")})),this.$box}_renderStage(){const t=document.createElement("div");t.className=this.wrapClassName("box-stage");const i=n=>{t.style.top=n.y+"px",t.style.left=n.x+"px",t.style.width=n.width+"px",t.style.height=n.height+"px"};return this._sideEffect.addDisposer([I.combine([this._stageStyle$,this._defaultBoxStageStyle$],([n,r])=>n!=null?n:r).subscribe(n=>{t.style.cssText=n||"",i(this._stageRect$.value)}),this._stageRect$.subscribe(i)],"box-stage-styles"),t}_renderResizeHandlers(){const t=document.createElement("div");t.className=this.wrapClassName("resize-handles"),Object.values(st).forEach(T=>{const c=document.createElement("div");c.className=this.wrapClassName(T)+" "+this.wrapClassName("resize-handle"),c.dataset.teleBoxHandle=T,t.appendChild(c)}),this.$box.appendChild(t);const i="handle-tracking-listener",n=this.wrapClassName("transforming");let r,s=0,o=0,a=0,l=0,u=0,h=0,p;const w=T=>{if(!T.isPrimary||this.state!==ue.Normal)return;pn(T);let{pageX:c,pageY:d}=T;d<0&&(d=0);const f=c-u,g=d-h;let{x:m,y:x}=this.pxIntrinsicCoord,{width:y,height:k}=this.pxIntrinsicSize;switch(p){case st.North:{x=o+g,k=l-g;break}case st.South:{k=l+g;break}case st.West:{m=s+f,y=a-f;break}case st.East:{y=a+f;break}case st.NorthWest:{m=s+f,x=o+g,y=a-f,k=l-g;break}case st.NorthEast:{x=o+g,y=a+f,k=l-g;break}case st.SouthEast:{y=a+f,k=l+g;break}case st.SouthWest:{m=s+f,y=a-f,k=l+g;break}default:{this.move(s+f,o+g);return}}this.transform(m,x,y,k)},C=T=>{!T.isPrimary||(p=void 0,r&&(pn(T),this.$box.classList.toggle(n,!1),this._sideEffect.flush(i),r.remove()))},E=T=>{var c;if(!T.isPrimary||this.readonly||T.button!=null&&T.button!==0||!this.draggable||p||this.state!==ue.Normal)return;const d=T.target;if((c=d.dataset)!=null&&c.teleBoxHandle){pn(T),{x:s,y:o}=this.pxIntrinsicCoord,{width:a,height:l}=this.pxIntrinsicSize,{pageX:u,pageY:h}=T,p=d.dataset.teleBoxHandle,r||(r=document.createElement("div"));const f=p?this.wrapClassName(`cursor-${p}`):"";r.className=this.wrapClassName(`track-mask${f?` ${f}`:""}`),this.$box.appendChild(r),this.$box.classList.add(n),this._sideEffect.add(()=>(window.addEventListener("pointermove",w,{passive:!1}),window.addEventListener("pointerup",C,{passive:!1}),window.addEventListener("pointercancel",C,{passive:!1}),()=>{window.removeEventListener("pointermove",w),window.removeEventListener("pointerup",C),window.removeEventListener("pointercancel",C)}),i)}};this._handleTrackStart=E,this._sideEffect.addEventListener(t,"pointerdown",E,{},"box-resizeHandles-pointerdown")}async destroy(){this.$box.remove(),this._sideEffect.flushAll(),this._sideEffect.flushAll(),await this.events.emit(Ae.Destroyed),this.events.clearListeners(),this._delegateEvents.clearListeners()}wrapClassName(t){return`${this.namespace}-${t}`}}var Vm="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K";class Rm{constructor({minimized$:t,readonly$:i,darkMode$:n,namespace:r="telebox",styles:s={},root:o,onClick:a}){this._sideEffect=new Pe.SideEffectManager,this.namespace=r;const l=new I.ValManager;this._sideEffect.addDisposer(()=>l.destroy());const u=new I.Val(void 0),h=I.derive(t),p=new I.Val(s),w=new I.Val(document.createElement("button")),C={styles:p,$collector:w};I.withValueEnhancer(this,C,l);const E={rect:u,visible:h};I.withReadonlyValueEnhancer(this,E,l),w.value.className=this.wrapClassName("collector"),w.value.style.backgroundImage=`url('${Vm}')`,this._sideEffect.addDisposer(w.subscribe(T=>{this._sideEffect.add(()=>(o.appendChild(T),()=>T.remove()),"telebox-collector-mount"),this._sideEffect.addEventListener(T,"click",()=>{i.value||a==null||a()},{},"telebox-collector-click"),this._sideEffect.addDisposer([h.subscribe(c=>{T.classList.toggle(this.wrapClassName("collector-visible"),c)}),i.subscribe(c=>{T.classList.toggle(this.wrapClassName("collector-readonly"),c)}),n.subscribe(c=>{T.classList.toggle(this.wrapClassName("color-scheme-dark"),c),T.classList.toggle(this.wrapClassName("color-scheme-light"),!c)}),p.subscribe(c=>{Object.keys(c).forEach(d=>{const f=c[d];f!=null&&(T.style[d]=f)})}),t.subscribe(c=>{if(c){const{x:d,y:f,width:g,height:m}=T.getBoundingClientRect(),x=o.getBoundingClientRect();u.setValue({x:d-x.x,y:f-x.y,width:g,height:m})}})],"telebox-collector-el")}))}destroy(){this._sideEffect.flushAll()}wrapClassName(t){return`${this.namespace}-${t}`}}var xe=(e=>(e.Focused="focused",e.Blurred="blurred",e.Created="created",e.Removed="removed",e.State="state",e.Maximized="maximized",e.Minimized="minimized",e.IntrinsicMove="intrinsic_move",e.IntrinsicResize="intrinsic_resize",e.ZIndex="z_index",e.PrefersColorScheme="prefers_color_scheme",e.DarkMode="dark_mode",e))(xe||{});class Bm extends ec{constructor(t){super(t);this.boxes$=t.boxes$,this.rootRect$=t.rootRect$,this.darkMode$=t.darkMode$,t.root.appendChild(this.render())}focusBox(t){var i;if(!(this.focusedBox&&this.focusedBox===t)){if(this.$titles&&this.state$.value===ue.Maximized){const{children:n}=this.$titles.firstElementChild;for(let r=n.length-1;r>=0;r-=1){const s=n[r],o=(i=s.dataset)==null?void 0:i.teleBoxID;o&&(t&&o===t.id?s.classList.toggle(this.wrapClassName("titles-tab-focus"),!0):this.focusedBox&&o===this.focusedBox.id&&s.classList.toggle(this.wrapClassName("titles-tab-focus"),!1))}}this.focusedBox=t}}render(){if(this.$titleBar)return this.$titleBar;const t=super.render();t.classList.add(this.wrapClassName("max-titlebar")),this.sideEffect.addDisposer([this.state$.subscribe(n=>{t.classList.toggle(this.wrapClassName("max-titlebar-maximized"),n===ue.Maximized)}),this.readonly$.subscribe(n=>{t.classList.toggle(this.wrapClassName("readonly"),n)}),I.combine([this.state$,this.boxes$]).subscribe(([n,r])=>{n===ue.Maximized&&(t.classList.toggle(this.wrapClassName("max-titlebar-single-title"),r.length===1),r.length!==1&&t.replaceChild(this.renderTitles(),t.firstElementChild))})],"max-render");const i=document.createElement("div");return i.classList.add(this.wrapClassName("titles-area")),t.insertBefore(i,t.firstElementChild),t}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",n=>{n.currentTarget.scrollBy({left:n.deltaY>0?250:-250,behavior:"smooth"})},{passive:!1},"max-render-wheel-titles");const t=document.createElement("div");t.className=this.wrapClassName("titles-content"),this.$titles.appendChild(t);const i=this.boxes$.value.map(n=>{const r=document.createElement("button");return r.className=this.wrapClassName("titles-tab"),r.textContent=n.title,r.dataset.teleBoxID=n.id,r.dataset.teleTitleBarNoDblClick="true",this.focusedBox&&n.id===this.focusedBox.id&&r.classList.add(this.wrapClassName("titles-tab-focus")),t.appendChild(r),n._title$.reaction(s=>r.textContent=s)});return this.sideEffect.addDisposer(()=>i.forEach(n=>n()),"max-render-tab-titles"),this.$titles}}const Om=window.ResizeObserver||ru.ResizeObserver;class _m{constructor({root:t=null,fullscreen:i=!1,prefersColorScheme:n=qu.Light,minimized:r=!1,maximized:s=!1,fence:o=!0,collector:a,namespace:l="telebox",readonly:u=!1,stageRatio:h=-1,containerStyle:p="",stageStyle:w="",defaultBoxBodyStyle:C=null,defaultBoxStageStyle:E=null,theme:T={}}={}){this.events=new kt.default,this._sideEffect=new Pe.SideEffectManager,this.namespace=l;const c=new I.ValManager;this._sideEffect.addDisposer(()=>c.destroy());const d=new I.Val(t),f=new I.Val(u),g=new I.Val(o),m=new I.Val(p),x=new I.Val(w),y=new I.Val(h),k=new I.Val(C),D=new I.Val(E),P=new I.Val(i),q=new I.Val(r),ie=new I.Val(s),ne=I.combine([ie,P],([v,N])=>N?!0:v),tt=I.combine([q,P],([v,N])=>N?!1:v);this.setMaximized=(v,N)=>ie.setValue(v,N),this.setMinimized=(v,N)=>q.setValue(v,N);const G=new I.Val({x:0,y:0,width:window.innerWidth,height:window.innerHeight},{compare:Xe});this._sideEffect.addDisposer(d.subscribe(v=>{this._sideEffect.add(()=>{if(!v)return()=>{};const N=new Om(()=>{const $=v.getBoundingClientRect();G.setValue({x:0,y:0,width:$.width,height:$.height})});return N.observe(v),()=>N.disconnect()},"calc-root-rect")}));const J=I.combine([G,y],tc,{compare:Xe});this.boxes$=new I.Val([]),this.topBox$=new I.Val(void 0),this._sideEffect.addDisposer(this.boxes$.subscribe(v=>{if(v.length>0){const N=v.reduce(($,U)=>$.zIndex>U.zIndex?$:U);this.topBox$.setValue(N)}else this.topBox$.setValue(void 0)}));const it=window.matchMedia("(prefers-color-scheme: dark)"),pe=new I.Val(!1);it&&(pe.setValue(it.matches),this._sideEffect.add(()=>{const v=N=>{pe.setValue(N.matches)};return it.addEventListener("change",v),()=>it.removeEventListener("change",v)}));const Qe=new I.Val(n);this._sideEffect.addDisposer(Qe.reaction((v,N)=>{N||this.events.emit(xe.PrefersColorScheme,v)}));const Ze=I.combine([pe,Qe],([v,N])=>N==="auto"?v:N==="dark"),Et=I.combine([tt,ne],([v,N])=>v?ue.Minimized:N?ue.Maximized:ue.Normal),Ei={darkMode:Ze,state:Et,root:d,rootRect:G,stageRect:J,minimized:tt,maximized:ne};I.withReadonlyValueEnhancer(this,Ei,c);const qt={fullscreen:P,prefersColorScheme:Qe,readonly:f,fence:g,stageRatio:y,containerStyle:m,stageStyle:x,defaultBoxBodyStyle:k,defaultBoxStageStyle:D};I.withValueEnhancer(this,qt,c);const rn=this.wrapClassName("titlebar-icon-close"),M=v=>{var N;if(!v.isPrimary||f.value)return;const $=v.target;if(!!$.tagName)for(let U=$;U;U=U.parentElement){if(U.classList&&U.classList.contains(rn))return;const _e=(N=U.dataset)==null?void 0:N.teleBoxID;if(_e){const Me=this.getBox(_e);if(Me){this.focusBox(Me),this.makeBoxTop(Me);return}}}};this._sideEffect.addEventListener(window,"pointerdown",M,!0),this.$container=document.createElement("div"),this.$container.className=this.wrapClassName("manager-container"),this.setTheme(T),this.$stage=document.createElement("div"),this.$stage.className=this.wrapClassName("manager-stage"),this.$container.appendChild(this.$stage),this._sideEffect.addDisposer([Ze.subscribe(v=>{this.$container.classList.toggle(this.wrapClassName("color-scheme-dark"),v),this.$container.classList.toggle(this.wrapClassName("color-scheme-light"),!v)}),P.subscribe(v=>{this.$container.classList.toggle(this.wrapClassName("is-fullscreen"),Boolean(v))}),I.combine([this.boxes$,P],([v,N])=>N==="no-titlebar"||N===!0&&v.length<=1).subscribe(v=>{this.$container.classList.toggle(this.wrapClassName("hide-fullscreen-titlebar"),v)}),ne.subscribe(v=>{this.$container.classList.toggle(this.wrapClassName("is-maximized"),v)}),tt.subscribe(v=>{this.$container.classList.toggle(this.wrapClassName("is-minimized"),v)}),m.subscribe(v=>{this.$container.style.cssText=v}),x.subscribe(v=>{this.$stage.style.cssText=v,this.$stage.style.width=J.value.width+"px",this.$stage.style.height=J.value.height+"px"}),J.subscribe(v=>{this.$stage.style.width=v.width+"px",this.$stage.style.height=v.height+"px"}),d.subscribe(v=>{v?v.appendChild(this.$container):this.$container.parentElement&&this.$container.remove()})]),this.collector=a!=null?a:new Rm({minimized$:tt,readonly$:f,darkMode$:Ze,namespace:l,root:this.$container,onClick:()=>q.setValue(!1)}),this.titleBar=new Bm({namespace:this.namespace,title$:I.derive(this.topBox$,v=>(v==null?void 0:v.title)||""),boxes$:this.boxes$,darkMode$:Ze,readonly$:f,state$:Et,rootRect$:G,root:this.$container,onEvent:v=>{switch(v.type){case rt.Maximize:{this.setMaximized(!ne.value);break}case rt.Minimize:{this.setMinimized(!0);break}case Ae.Close:{this.removeTopBox(),this.focusTopBox();break}}}}),this._sideEffect.addDisposer([Et.reaction((v,N)=>{N||this.events.emit(xe.State,v)}),ne.reaction((v,N)=>{N||this.events.emit(xe.Maximized,v)}),tt.reaction((v,N)=>{N||this.events.emit(xe.Minimized,v)}),Ze.reaction((v,N)=>{N||this.events.emit(xe.DarkMode,v)})])}get boxes(){return this.boxes$.value}get topBox(){return this.topBox$.value}setState(t,i=!1){switch(t){case ue.Maximized:{this.setMinimized(!1,i),this.setMaximized(!0,i);break}case ue.Minimized:{this.setMinimized(!0,i),this.setMaximized(!1,i);break}default:{this.setMinimized(!1,i),this.setMaximized(!1,i);break}}return this}create(t={},i=!0){const n=new Lm(Nt(F(F({zIndex:this.topBox?this.topBox.zIndex+1:100},t),i?this.smartPosition(t):{}),{namespace:this.namespace,root:this.$stage,darkMode$:this._darkMode$,maximized$:this._maximized$,minimized$:this._minimized$,fence$:this._fence$,rootRect$:this._rootRect$,managerStageRect$:this._stageRect$,managerStageRatio$:this._stageRatio$,readonly$:this._readonly$,collectorRect$:this.collector._rect$,defaultBoxBodyStyle$:this._defaultBoxBodyStyle$,defaultBoxStageStyle$:this._defaultBoxStageStyle$}));return n.focus&&(this.focusBox(n),i&&this.makeBoxTop(n)),this.boxes$.setValue([...this.boxes,n]),this._sideEffect.addDisposer([n._delegateEvents.on(rt.Maximize,()=>{this.setMaximized(!this.maximized)}),n._delegateEvents.on(rt.Minimize,()=>{this.setMinimized(!0)}),n._delegateEvents.on(rt.Close,()=>{this.remove(n),this.focusTopBox()}),n._intrinsicCoord$.reaction((r,s)=>{s||this.events.emit(xe.IntrinsicMove,n)}),n._intrinsicSize$.reaction((r,s)=>{s||this.events.emit(xe.IntrinsicResize,n)}),n._zIndex$.reaction((r,s)=>{if(this.boxes.length>0){const o=this.boxes.reduce((a,l)=>a.zIndex>l.zIndex?a:l);this.topBox$.setValue(o)}s||this.events.emit(xe.ZIndex,n)})]),this.events.emit(xe.Created,n),n}query(t){return t?this.boxes.filter(this.teleBoxMatcher(t)):[...this.boxes]}queryOne(t){return t?this.boxes.find(this.teleBoxMatcher(t)):this.boxes[0]}update(t,i,n=!1){const r=this.boxes.find(s=>s.id===t);if(r)return this.updateBox(r,i,n)}updateAll(t,i=!1){this.boxes.forEach(n=>{this.updateBox(n,t,i)})}remove(t,i=!1){const n=this.getBoxIndex(t);if(n>=0){const r=this.boxes.slice(),s=r.splice(n,1);return this.boxes$.setValue(r),s.forEach(o=>o.destroy()),i||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(xe.Removed,s)),s[0]}}removeTopBox(){if(this.topBox)return this.remove(this.topBox)}removeAll(t=!1){const i=this.boxes$.value;return this.boxes$.setValue([]),i.forEach(n=>n.destroy()),t||(this.boxes.length<=0&&(this.setMaximized(!1),this.setMinimized(!1)),this.events.emit(xe.Removed,i)),i}setTheme(t){Object.keys(t).forEach(i=>{var n;this.$container.style.setProperty(`--tele-${i}`,(n=t[i])!=null?n:null)})}mount(t){this._root$.setValue(t)}unmount(){this._root$.setValue(null)}destroy(t=!1){this.events.clearListeners(),this._sideEffect.flushAll(),this.removeAll(t),this.collector.destroy(),this.titleBar.destroy()}wrapClassName(t){return`${this.namespace}-${t}`}focusBox(t,i=!1){const n=this.getBox(t);n&&(this.boxes.forEach(r=>{if(n===r){let s=!1;n.focus||(s=!0,n._focus$.setValue(!0,i)),s&&!i&&this.events.emit(xe.Focused,n)}else r.focus&&this.blurBox(r,i)}),this.titleBar.focusBox(n))}focusTopBox(){if(this.topBox&&!this.topBox.focus)return this.focusBox(this.topBox)}blurBox(t,i=!1){const n=this.getBox(t);n&&(n.focus&&(n._focus$.setValue(!1,i),i||this.events.emit(xe.Blurred,n)),this.titleBar.focusedBox===n&&this.titleBar.focusBox())}blurAll(t=!1){this.boxes.forEach(i=>{i.focus&&(i._focus$.setValue(!1,t),t||this.events.emit(xe.Blurred,i))}),this.titleBar.focusedBox&&this.titleBar.focusBox()}teleBoxMatcher(t){const i=Object.keys(t);return n=>i.every(r=>t[r]===n[r])}updateBox(t,i,n=!1){var r,s,o,a,l,u;(i.x!=null||i.y!=null)&&t._intrinsicCoord$.setValue({x:(r=i.x)!=null?r:t.intrinsicX,y:(s=i.y)!=null?s:t.intrinsicY},n),(i.width!=null||i.height!=null)&&t._intrinsicSize$.setValue({width:(o=i.width)!=null?o:t.intrinsicWidth,height:(a=i.height)!=null?a:t.intrinsicHeight},n),i.title!=null&&t._title$.setValue(i.title),i.visible!=null&&t._visible$.setValue(i.visible,n),i.resizable!=null&&t._resizable$.setValue(i.resizable,n),i.draggable!=null&&t._draggable$.setValue(i.draggable,n),i.boxRatio!=null&&t._boxRatio$.setValue(i.boxRatio,n),i.zIndex!=null&&t._zIndex$.setValue(i.zIndex,n),i.stageRatio!==void 0&&t.setStageRatio(i.stageRatio,n),i.content!=null&&t.mountContent(i.content),i.footer!=null&&t.mountFooter(i.footer),(i.minHeight!=null||i.minWidth!=null)&&t._minSize$.setValue({width:(l=i.minWidth)!=null?l:t.minWidth,height:(u=i.minHeight)!=null?u:t.minHeight},n)}smartPosition(t){let{x:i,y:n}=t;const{width:r=.5,height:s=.5}=t,o=this.stageRect,a=this.topBox;if(i==null){let l=20;if(a){const u=a.pxIntrinsicCoord.x+20,h=r*o.width;u+h<=o.width&&(l=u)}i=l/o.width}if(n==null){let l=20;if(a){const u=a.pxIntrinsicCoord.y+20,h=s*o.height;u+h<=o.height&&(l=u)}n=l/o.height}return{x:i,y:n,width:r,height:s}}makeBoxTop(t,i=!1){this.topBox&&t!==this.topBox&&t._zIndex$.setValue(this.topBox.zIndex+1,i)}getBoxIndex(t){return typeof t=="string"?this.boxes.findIndex(i=>i.id===t):this.boxes.findIndex(i=>i===t)}getBox(t){return typeof t=="string"?this.boxes.find(i=>i.id===t):t}}const $m=(e,t,i,n,r)=>new Um({safeSetAttributes:s=>e.safeSetAttributes(s),updateAppState:(...s)=>{var o;return(o=e.appManager)==null?void 0:o.store.updateAppState(...s)},canOperate:()=>e.canOperate,notifyContainerRectUpdate:s=>{var o;return(o=e.appManager)==null?void 0:o.notifyContainerRectUpdate(s)},cleanFocus:()=>{var s;return(s=e.appManager)==null?void 0:s.store.cleanFocus()},setAppFocus:s=>{var o;return(o=e.appManager)==null?void 0:o.store.setAppFocus(s,!0)},callbacks:t,emitter:i,boxEmitter:n},r);class Um{constructor(t,i){this.context=t,this.sideEffectManager=new Pe.SideEffectManager;const{emitter:n,callbacks:r,boxEmitter:s}=t;this.teleBoxManager=this.setupBoxManager(i),this.sideEffectManager.add(()=>[this.teleBoxManager.onValChanged("state",o=>{r.emit("boxStateChange",o),n.emit("boxStateChange",o)}),this.teleBoxManager.onValChanged("darkMode",o=>{r.emit("darkModeChange",o)}),this.teleBoxManager.onValChanged("prefersColorScheme",o=>{r.emit("prefersColorSchemeChange",o)}),this.teleBoxManager.onValChanged("minimized",(o,a)=>{if(!a)if(this.context.safeSetAttributes({minimized:o}),o)this.context.cleanFocus(),this.blurAllBox();else{const l=this.getTopBox();l&&(this.context.setAppFocus(l.id),this.focusBox({appId:l.id},!1))}}),this.teleBoxManager.onValChanged("maximized",(o,a)=>{a||this.context.safeSetAttributes({maximized:o})}),this.teleBoxManager.events.on("removed",o=>{o.forEach(a=>{s.emit("close",{appId:a.id})})}),this.teleBoxManager.events.on("intrinsic_move",A.debounce(o=>{s.emit("move",{appId:o.id,x:o.intrinsicX,y:o.intrinsicY})},50)),this.teleBoxManager.events.on("intrinsic_resize",A.debounce(o=>{s.emit("resize",{appId:o.id,width:o.intrinsicWidth,height:o.intrinsicHeight})},200)),this.teleBoxManager.events.on("focused",o=>{o&&(this.canOperate?s.emit("focus",{appId:o.id}):this.teleBoxManager.blurBox(o.id))}),this.teleBoxManager.events.on("z_index",o=>{this.context.updateAppState(o.id,Ye.ZIndex,o.zIndex)}),n.on("containerSizeRatioUpdate",o=>{this.teleBoxManager._stageRatio$.setValue(o)})])}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(t){var p,w,C;if(!this.teleBoxManager)return;let{minwidth:i=Gf,minheight:n=Xf,enableShadowDOM:r=!0}=(p=t.app.config)!=null?p:{};const{width:s,height:o}=(w=t.app.config)!=null?w:{},a=((C=t.options)==null?void 0:C.title)||t.appId,l=this.teleBoxManager.rootRect;i>1&&(i=i/l.width),n>1&&(n=n/l.height);const u={title:a,minWidth:i,minHeight:n,width:s,height:o,id:t.appId,enableShadowDOM:r},h=this.teleBoxManager.create(u,t.smartPosition);return this.context.emitter.emit(`${t.appId}${Z.WindowCreated}`),h}setupBoxManager(t){const i=we.playground,n={stageRatio:t==null?void 0:t.stageRatio,root:i,fence:!1,prefersColorScheme:t==null?void 0:t.prefersColorScheme};t!=null&&t.containerStyle&&(n.containerStyle=t.containerStyle),t!=null&&t.stageStyle&&(n.stageStyle=t.stageStyle),t!=null&&t.fullscreen&&(n.fullscreen=t.fullscreen);const r=new _m(n);this.teleBoxManager&&this.teleBoxManager.destroy(),this.teleBoxManager=r;const s=t==null?void 0:t.collectorContainer;return s&&this.teleBoxManager.collector.set$collector(s),t!=null&&t.collectorStyles&&this.teleBoxManager.collector.setStyles(t.collectorStyles),r}getBox(t){return this.teleBoxManager.queryOne({id:t})}closeBox(t,i=!1){return this.teleBoxManager.remove(t,i)}boxIsFocus(t){const i=this.getBox(t);return i==null?void 0:i.focus}getFocusBox(){return this.teleBoxManager.query({focus:!0})[0]}getTopBox(){return this.teleBoxManager.topBox}updateBoxState(t){if(!t)return;const i=this.getBox(t.id);i&&(t.size&&i._intrinsicSize$.setValue(t.size,!0),t.position&&i._intrinsicCoord$.setValue(t.position,!0),t.zIndex&&i._zIndex$.setValue(t.zIndex,!0),setTimeout(()=>{t.focus&&this.teleBoxManager.focusBox(i.id,!0),t.maximized!=null&&this.teleBoxManager.setMaximized(Boolean(t.maximized),!0),t.minimized!=null&&this.teleBoxManager.setMinimized(Boolean(t.minimized),!0)},50),this.context.callbacks.emit("boxStateChange",this.teleBoxManager.state))}moveBox({appId:t,x:i,y:n}){const r=this.getBox(t);r&&r._intrinsicCoord$.setValue({x:i,y:n},!0)}focusBox({appId:t},i=!0){this.teleBoxManager.focusBox(t,i)}resizeBox({appId:t,width:i,height:n,skipUpdate:r}){const s=this.getBox(t);s&&s._intrinsicSize$.setValue({width:i,height:n},r)}setBoxMinSize(t){this.teleBoxManager.update(t.appId,{minWidth:t.minWidth,minHeight:t.minHeight},!0)}setBoxTitle(t){this.teleBoxManager.update(t.appId,{title:t.title},!0)}blurAllBox(){this.teleBoxManager.blurAll()}updateAll(t){this.teleBoxManager.updateAll(t)}setMaximized(t,i=!0){t!==this.maximized&&this.teleBoxManager.setMaximized(t,i)}setMinimized(t,i=!0){this.teleBoxManager.setMinimized(t,i)}focusTopBox(){if(this.teleBoxManager.query().length>=1){const i=this.getTopBox();i&&this.focusBox({appId:i.id},!1)}}updateBox(t,i,n=!0){this.teleBoxManager.update(t,i,n)}setReadonly(t){this.teleBoxManager.setReadonly(t)}setPrefersColorScheme(t){this.teleBoxManager.setPrefersColorScheme(t)}setZIndex(t,i,n=!0){this.teleBoxManager.update(t,{zIndex:i},n)}setRoot(t){this.teleBoxManager._root$.setValue(t)}setCollector(t){this.teleBoxManager.collector.set$collector(t)}destroy(){this.sideEffectManager.flushAll(),this.teleBoxManager.destroy()}}function vr(){}function ic(e){return e()}function nc(){return Object.create(null)}function wr(e){e.forEach(ic)}function Hm(e){return typeof e=="function"}function Wm(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let yr;function xr(e,t){return yr||(yr=document.createElement("a")),yr.href=t,e===yr.href}function Fm(e){return Object.keys(e).length===0}function mt(e,t){e.appendChild(t)}function Sr(e,t,i){e.insertBefore(t,i||null)}function fn(e){e.parentNode.removeChild(e)}function zt(e){return document.createElement(e)}function Eo(e){return document.createTextNode(e)}function To(){return Eo(" ")}function ce(e,t,i){i==null?e.removeAttribute(t):e.getAttribute(t)!==i&&e.setAttribute(t,i)}function Qm(e){return Array.from(e.childNodes)}function rc(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function fe(e,t,i,n){i===null?e.style.removeProperty(t):e.style.setProperty(t,i,n?"important":"")}let No;function gn(e){No=e}const mn=[],sc=[],Cr=[],oc=[],Zm=Promise.resolve();let ko=!1;function Ym(){ko||(ko=!0,Zm.then(ac))}function Po(e){Cr.push(e)}const zo=new Set;let Mr=0;function ac(){const e=No;do{for(;Mr<mn.length;){const t=mn[Mr];Mr++,gn(t),Gm(t.$$)}for(gn(null),mn.length=0,Mr=0;sc.length;)sc.pop()();for(let t=0;t<Cr.length;t+=1){const i=Cr[t];zo.has(i)||(zo.add(i),i())}Cr.length=0}while(mn.length);for(;oc.length;)oc.pop()();ko=!1,zo.clear(),gn(e)}function Gm(e){if(e.fragment!==null){e.update(),wr(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(Po)}}const Xm=new Set;function Jm(e,t){e&&e.i&&(Xm.delete(e),e.i(t))}function Km(e,t,i,n){const{fragment:r,on_mount:s,on_destroy:o,after_update:a}=e.$$;r&&r.m(t,i),n||Po(()=>{const l=s.map(ic).filter(Hm);o?o.push(...l):wr(l),e.$$.on_mount=[]}),a.forEach(Po)}function qm(e,t){const i=e.$$;i.fragment!==null&&(wr(i.on_destroy),i.fragment&&i.fragment.d(t),i.on_destroy=i.fragment=null,i.ctx=[])}function ev(e,t){e.$$.dirty[0]===-1&&(mn.push(e),Ym(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function tv(e,t,i,n,r,s,o,a=[-1]){const l=No;gn(e);const u=e.$$={fragment:null,ctx:null,props:s,update:vr,not_equal:r,bound:nc(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:nc(),dirty:a,skip_bound:!1,root:t.target||l.$$.root};o&&o(u.root);let h=!1;if(u.ctx=i?i(e,t.props||{},(p,w,...C)=>{const E=C.length?C[0]:w;return u.ctx&&r(u.ctx[p],u.ctx[p]=E)&&(!u.skip_bound&&u.bound[p]&&u.bound[p](E),h&&ev(e,p)),w}):[],u.update(),h=!0,wr(u.before_update),u.fragment=n?n(u.ctx):!1,t.target){if(t.hydrate){const p=Qm(t.target);u.fragment&&u.fragment.l(p),p.forEach(fn)}else u.fragment&&u.fragment.c();t.intro&&Jm(e.$$.fragment),Km(e,t.target,t.anchor,t.customElement),ac()}gn(l)}class iv{$destroy(){qm(this,1),this.$destroy=vr}$on(t,i){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(i),()=>{const r=n.indexOf(i);r!==-1&&n.splice(r,1)}}$set(t){this.$$set&&!Fm(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function lc(e){let t,i,n,r,s,o,a=e[14]&&uc(e),l=e[15]&&cc(e);return{c(){t=zt("div"),i=zt("div"),a&&a.c(),n=To(),r=zt("span"),s=Eo(e[0]),o=To(),l&&l.c(),fe(r,"overflow","hidden"),fe(r,"white-space","nowrap"),fe(r,"text-overflow","ellipsis"),fe(r,"max-width","80px"),ce(i,"class",e[8]),fe(i,"background-color",e[2]),fe(i,"color",e[9]),fe(i,"opacity",e[11]),ce(t,"class","netless-window-manager-cursor-name")},m(u,h){Sr(u,t,h),mt(t,i),a&&a.m(i,null),mt(i,n),mt(i,r),mt(r,s),mt(i,o),l&&l.m(i,null)},p(u,h){u[14]?a?a.p(u,h):(a=uc(u),a.c(),a.m(i,n)):a&&(a.d(1),a=null),h&1&&rc(s,u[0]),u[15]?l?l.p(u,h):(l=cc(u),l.c(),l.m(i,null)):l&&(l.d(1),l=null),h&256&&ce(i,"class",u[8]),h&4&&fe(i,"background-color",u[2]),h&512&&fe(i,"color",u[9]),h&2048&&fe(i,"opacity",u[11])},d(u){u&&fn(t),a&&a.d(),l&&l.d()}}}function uc(e){let t,i;return{c(){t=zt("img"),ce(t,"class","netless-window-manager-cursor-selector-avatar"),ce(t,"style",e[16]()),xr(t.src,i=e[7])||ce(t,"src",i),ce(t,"alt","avatar")},m(n,r){Sr(n,t,r)},p(n,r){r&128&&!xr(t.src,i=n[7])&&ce(t,"src",i)},d(n){n&&fn(t)}}}function cc(e){let t,i;return{c(){t=zt("span"),i=Eo(e[1]),ce(t,"class","netless-window-manager-cursor-tag-name"),fe(t,"background-color",e[10])},m(n,r){Sr(n,t,r),mt(t,i)},p(n,r){r&2&&rc(i,n[1]),r&1024&&fe(t,"background-color",n[10])},d(n){n&&fn(t)}}}function nv(e){let t,i,n,r,s,o,a=!e[12]&&lc(e);return{c(){t=zt("div"),a&&a.c(),i=To(),n=zt("div"),r=zt("img"),ce(r,"class",s="netless-window-manager-cursor-"+e[3]+"-image"),xr(r.src,o=e[6])||ce(r,"src",o),ce(r,"alt",e[3]),ce(n,"class","cursor-image-wrapper"),ce(t,"class","netless-window-manager-cursor-mid"),fe(t,"transform","translateX("+e[4]+"px) translateY("+e[5]+"px)"),fe(t,"display",e[13])},m(l,u){Sr(l,t,u),a&&a.m(t,null),mt(t,i),mt(t,n),mt(n,r)},p(l,[u]){l[12]?a&&(a.d(1),a=null):a?a.p(l,u):(a=lc(l),a.c(),a.m(t,i)),u&8&&s!==(s="netless-window-manager-cursor-"+l[3]+"-image")&&ce(r,"class",s),u&64&&!xr(r.src,o=l[6])&&ce(r,"src",o),u&8&&ce(r,"alt",l[3]),u&48&&fe(t,"transform","translateX("+l[4]+"px) translateY("+l[5]+"px)"),u&8192&&fe(t,"display",l[13])},i:vr,o:vr,d(l){l&&fn(t),a&&a.d()}}}function rv(e,t,i){let n,r,s,o,a,{cursorName:l}=t,{tagName:u}=t,{backgroundColor:h}=t,{appliance:p}=t,{x:w}=t,{y:C}=t,{src:E}=t,{visible:T}=t,{avatar:c}=t,{theme:d}=t,{color:f}=t,{cursorTagBackgroundColor:g}=t,{opacity:m}=t;const x=()=>Object.entries({width:(n?19:28)+"px",height:(n?19:28)+"px",position:n?"initial":"absolute","border-color":n?"white":h,"margin-right":(n?4:0)+"px"}).map(([y,k])=>`${y}: ${k}`).join(";");return e.$$set=y=>{"cursorName"in y&&i(0,l=y.cursorName),"tagName"in y&&i(1,u=y.tagName),"backgroundColor"in y&&i(2,h=y.backgroundColor),"appliance"in y&&i(3,p=y.appliance),"x"in y&&i(4,w=y.x),"y"in y&&i(5,C=y.y),"src"in y&&i(6,E=y.src),"visible"in y&&i(17,T=y.visible),"avatar"in y&&i(7,c=y.avatar),"theme"in y&&i(8,d=y.theme),"color"in y&&i(9,f=y.color),"cursorTagBackgroundColor"in y&&i(10,g=y.cursorTagBackgroundColor),"opacity"in y&&i(11,m=y.opacity)},e.$$.update=()=>{e.$$.dirty&1&&(n=!A.isEmpty(l)),e.$$.dirty&2&&i(15,r=!A.isEmpty(u)),e.$$.dirty&128&&i(14,s=!A.isEmpty(c)),e.$$.dirty&131072&&i(13,o=T?"initial":"none"),e.$$.dirty&8&&i(12,a=p===b.ApplianceNames.laserPointer)},[l,u,h,p,w,C,E,c,d,f,g,m,a,o,s,r,x,T]}class sv extends iv{constructor(t){super();tv(this,t,rv,nv,Wm,{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 ov{constructor(t,i,n,r){this.manager=t,this.memberId=i,this.cursorManager=n,this.wrapper=r,this.move=s=>{var o,a;if(s.type==="main"){const l=(o=this.manager.boxManager)==null?void 0:o.stageRect;this.component&&l&&(this.autoHidden(),this.moveCursor(s,l,this.manager.mainView))}else{const l=this.cursorManager.focusView,u=(a=l==null?void 0:l.divElement)==null?void 0:a.getBoundingClientRect(),h=l==null?void 0:l.camera;l&&u&&h&&this.component&&(this.autoHidden(),this.moveCursor(s,u,l))}},this.leave=()=>{this.hide()},this.updateMember(),this.createCursor(),this.autoHidden()}moveCursor(t,i,n){var l,u;const{x:r,y:s,type:o}=t,a=n==null?void 0:n.screen.convertPointToScreen(r,s);if(a){let h=a.x-2,p=a.y-18;if(o==="app"){const w=this.cursorManager.playgroundRect;w&&(h=h+i.x-w.x,p=p+i.y-w.y)}else h=h+i.x,p=p+i.y;a.x<0||a.x>i.width||a.y<0||a.y>i.height?(l=this.component)==null||l.$set({visible:!1,x:h,y:p}):(u=this.component)==null||u.$set({visible:!0,x:h,y:p})}}get memberApplianceName(){var t,i;return(i=(t=this.member)==null?void 0:t.memberState)==null?void 0:i.currentApplianceName}get memberColor(){var i,n;return`rgb(${(n=(i=this.member)==null?void 0:i.memberState)==null?void 0:n.strokeColor.join(",")})`}get payload(){var t;return(t=this.member)==null?void 0:t.payload}get memberCursorName(){var t,i;return((t=this.payload)==null?void 0:t.nickName)||((i=this.payload)==null?void 0:i.cursorName)||this.memberId}get memberTheme(){var t;return(t=this.payload)!=null&&t.theme?"netless-window-manager-cursor-inner-mellow":"netless-window-manager-cursor-inner"}get memberCursorTextColor(){var t;return((t=this.payload)==null?void 0:t.cursorTextColor)||"#FFFFFF"}get memberCursorTagBackgroundColor(){var t;return((t=this.payload)==null?void 0:t.cursorTagBackgroundColor)||this.memberColor}get memberAvatar(){var t;return(t=this.payload)==null?void 0:t.avatar}get memberOpacity(){return!this.memberCursorName&&!this.memberAvatar?0:1}get memberTagName(){var t;return(t=this.payload)==null?void 0:t.cursorTagName}autoHidden(){this.timer&&clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.hide()},1e3*10)}async createCursor(){this.member&&this.wrapper&&(this.component=new sv({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 t=this.cursorManager.applianceIcons;return t[this.memberApplianceName||b.ApplianceNames.shape]||t[b.ApplianceNames.shape]}}updateMember(){return this.member=Eu(this.manager.room,this.memberId),this.updateComponent(),this.member}updateComponent(){var t;(t=this.component)==null||t.$set(A.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 av="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==",lv="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==",uv="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=",cv="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDBweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDAgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT5zaGFwZS1jdXJzb3I8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz4KICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0icGF0aC0xIj48L3BhdGg+CiAgICAgICAgPGZpbHRlciB4PSItNjQuNiUiIHk9Ii01OS41JSIgd2lkdGg9IjIyOS4zJSIgaGVpZ2h0PSIyNDYuMSUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0yIj4KICAgICAgICAgICAgPGZlTW9ycGhvbG9neSByYWRpdXM9IjEiIG9wZXJhdG9yPSJkaWxhdGUiIGluPSJTb3VyY2VBbHBoYSIgcmVzdWx0PSJzaGFkb3dTcHJlYWRPdXRlcjEiPjwvZmVNb3JwaG9sb2d5PgogICAgICAgICAgICA8ZmVPZmZzZXQgZHg9IjAiIGR5PSIyIiBpbj0ic2hhZG93U3ByZWFkT3V0ZXIxIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSI+PC9mZU9mZnNldD4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMyIgaW49InNoYWRvd09mZnNldE91dGVyMSIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlR2F1c3NpYW5CbHVyPgogICAgICAgICAgICA8ZmVDb21wb3NpdGUgaW49InNoYWRvd0JsdXJPdXRlcjEiIGluMj0iU291cmNlQWxwaGEiIG9wZXJhdG9yPSJvdXQiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbXBvc2l0ZT4KICAgICAgICAgICAgPGZlQ29sb3JNYXRyaXggdmFsdWVzPSIwIDAgMCAwIDAgICAwIDAgMCAwIDAgICAwIDAgMCAwIDAgIDAgMCAwIDAuMTYgMCIgdHlwZT0ibWF0cml4IiBpbj0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbG9yTWF0cml4PgogICAgICAgIDwvZmlsdGVyPgogICAgPC9kZWZzPgogICAgPGcgaWQ9Iumhtemdoi00IiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0iV2hpdGVib2FyZC1HdWlkZWxpbmVzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMzQ0LjAwMDAwMCwgLTc1MS4wMDAwMDApIj4KICAgICAgICAgICAgPGcgaWQ9InNoYXBlLWN1cnNvciIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMzQ0LjAwMDAwMCwgNzUxLjAwMDAwMCkiPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9ouWkh+S7vS00NCIgZmlsbD0iI0ZGRkZGRiIgb3BhY2l0eT0iMC4wMSIgeD0iMCIgeT0iMCIgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIiByeD0iMiI+PC9yZWN0PgogICAgICAgICAgICAgICAgPGcgaWQ9IuW9oueKtue7k+WQiCIgZmlsbC1ydWxlPSJub256ZXJvIj4KICAgICAgICAgICAgICAgICAgICA8dXNlIGZpbGw9ImJsYWNrIiBmaWxsLW9wYWNpdHk9IjEiIGZpbHRlcj0idXJsKCNmaWx0ZXItMikiIHhsaW5rOmhyZWY9IiNwYXRoLTEiPjwvdXNlPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIxIiBkPSJNMjAsMjEgQzIwLjQ4NTQxMDMsMjEgMjAuODk4MDg1LDIxLjM0Nzk5OTMgMjAuOTg5OTQ3OSwyMS44NjU0ODc3IEwyMSwyMiBMMjEsMjcgQzIxLDI3LjU1MjI4NDcgMjAuNTUyMjg0NywyOCAyMCwyOCBDMTkuNTE0NTg5NywyOCAxOS4xMDE5MTUsMjcuNjUyMDAwNyAxOS4wMTAwNTIxLDI3LjEzNDUxMjMgTDE5LDI3IEwxOSwyMiBDMTksMjEuNDQ3NzE1MyAxOS40NDc3MTUzLDIxIDIwLDIxIFogTTI3LDE5IEMyNy41NTIyODQ3LDE5IDI4LDE5LjQ0NzcxNTMgMjgsMjAgQzI4LDIwLjQ4NTQxMDMgMjcuNjUyMDAwNywyMC44OTgwODUgMjcuMTM0NTEyMywyMC45ODk5NDc5IEwyNywyMSBMMjIsMjEgQzIxLjQ0NzcxNTMsMjEgMjEsMjAuNTUyMjg0NyAyMSwyMCBDMjEsMTkuNTE0NTg5NyAyMS4zNDc5OTkzLDE5LjEwMTkxNSAyMS44NjU0ODc3LDE5LjAxMDA1MjEgTDIyLDE5IEwyNywxOSBaIE0xOCwxOSBDMTguNTUyMjg0NywxOSAxOSwxOS40NDc3MTUzIDE5LDIwIEMxOSwyMC40ODU0MTAzIDE4LjY1MjAwMDcsMjAuODk4MDg1IDE4LjEzNDUxMjMsMjAuOTg5OTQ3OSBMMTgsMjEgTDEzLDIxIEMxMi40NDc3MTUzLDIxIDEyLDIwLjU1MjI4NDcgMTIsMjAgQzEyLDE5LjUxNDU4OTcgMTIuMzQ3OTk5MywxOS4xMDE5MTUgMTIuODY1NDg3NywxOS4wMTAwNTIxIEwxMywxOSBMMTgsMTkgWiBNMjAsMTIgQzIwLjQ4NTQxMDMsMTIgMjAuODk4MDg1LDEyLjM0Nzk5OTMgMjAuOTg5OTQ3OSwxMi44NjU0ODc3IEwyMSwxMyBMMjEsMTggQzIxLDE4LjU1MjI4NDcgMjAuNTUyMjg0NywxOSAyMCwxOSBDMTkuNTE0NTg5NywxOSAxOS4xMDE5MTUsMTguNjUyMDAwNyAxOS4wMTAwNTIxLDE4LjEzNDUxMjMgTDE5LDE4IEwxOSwxMyBDMTksMTIuNDQ3NzE1MyAxOS40NDc3MTUzLDEyIDIwLDEyIFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9oiIgZmlsbD0iI0ZGRkZGRiIgeD0iMTguNSIgeT0iMTciIHdpZHRoPSIzIiBoZWlnaHQ9IjYiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaIiIGZpbGw9IiNGRkZGRkYiIHg9IjE3IiB5PSIxOC41IiB3aWR0aD0iNiIgaGVpZ2h0PSIzIj48L3JlY3Q+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0i5b2i54q257uT5ZCIIiBmaWxsPSIjMjEyMzI0IiBmaWxsLXJ1bGU9Im5vbnplcm8iPjwvcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",dv="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDdweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDcgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT50ZXh0LWN1cnNvcjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxwYXRoIGQ9Ik0xNiwyNi41IEMxNS43MjM4NTc2LDI2LjUgMTUuNSwyNi4yNzYxNDI0IDE1LjUsMjYgQzE1LjUsMjUuNzU0NTQwMSAxNS42NzY4NzUyLDI1LjU1MDM5MTYgMTUuOTEwMTI0NCwyNS41MDgwNTU3IEwxNiwyNS41IEwxOS41LDI1LjUgTDE5LjUsMTQuNSBMMTYsMTQuNSBDMTUuNzIzODU3NiwxNC41IDE1LjUsMTQuMjc2MTQyNCAxNS41LDE0IEMxNS41LDEzLjc1NDU0MDEgMTUuNjc2ODc1MiwxMy41NTAzOTE2IDE1LjkxMDEyNDQsMTMuNTA4MDU1NyBMMTYsMTMuNSBMMjQsMTMuNSBDMjQuMjc2MTQyNCwxMy41IDI0LjUsMTMuNzIzODU3NiAyNC41LDE0IEMyNC41LDE0LjI0NTQ1OTkgMjQuMzIzMTI0OCwxNC40NDk2MDg0IDI0LjA4OTg3NTYsMTQuNDkxOTQ0MyBMMjQsMTQuNSBMMjAuNSwxNC41IEwyMC41LDI1LjUgTDI0LDI1LjUgQzI0LjI3NjE0MjQsMjUuNSAyNC41LDI1LjcyMzg1NzYgMjQuNSwyNiBDMjQuNSwyNi4yNDU0NTk5IDI0LjMyMzEyNDgsMjYuNDQ5NjA4NCAyNC4wODk4NzU2LDI2LjQ5MTk0NDMgTDI0LDI2LjUgTDE2LDI2LjUgWiIgaWQ9InBhdGgtMSI+PC9wYXRoPgogICAgICAgIDxmaWx0ZXIgeD0iLTI4NC4wJSIgeT0iLTgxLjUlIiB3aWR0aD0iNjY4LjElIiBoZWlnaHQ9IjI5My45JSIgZmlsdGVyVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiBpZD0iZmlsdGVyLTIiPgogICAgICAgICAgICA8ZmVNb3JwaG9sb2d5IHJhZGl1cz0iMSIgb3BlcmF0b3I9ImRpbGF0ZSIgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd1NwcmVhZE91dGVyMSI+PC9mZU1vcnBob2xvZ3k+CiAgICAgICAgICAgIDxmZU9mZnNldCBkeD0iMCIgZHk9IjIiIGluPSJzaGFkb3dTcHJlYWRPdXRlcjEiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIj48L2ZlT2Zmc2V0PgogICAgICAgICAgICA8ZmVHYXVzc2lhbkJsdXIgc3RkRGV2aWF0aW9uPSIzIiBpbj0ic2hhZG93T2Zmc2V0T3V0ZXIxIiByZXN1bHQ9InNoYWRvd0JsdXJPdXRlcjEiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgICAgIDxmZUNvbXBvc2l0ZSBpbj0ic2hhZG93Qmx1ck91dGVyMSIgaW4yPSJTb3VyY2VBbHBoYSIgb3BlcmF0b3I9Im91dCIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29tcG9zaXRlPgogICAgICAgICAgICA8ZmVDb2xvck1hdHJpeCB2YWx1ZXM9IjAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgMCAwIDAgMC4xNiAwIiB0eXBlPSJtYXRyaXgiIGluPSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29sb3JNYXRyaXg+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iLTQiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJXaGl0ZWJvYXJkLUd1aWRlbGluZXMiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zODguMDAwMDAwLCAtNjcyLjAwMDAwMCkiPgogICAgICAgICAgICA8ZyBpZD0idGV4dC1jdXJzb3IiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDM5Mi4wMDAwMDAsIDY3Mi4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaLlpIfku70tNDAiIGZpbGw9IiNGRkZGRkYiIG9wYWNpdHk9IjAuMDEiIHg9IjAiIHk9IjAiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcng9IjIiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgiIGZpbGwtcnVsZT0ibm9uemVybyI+CiAgICAgICAgICAgICAgICAgICAgPHVzZSBmaWxsPSJibGFjayIgZmlsbC1vcGFjaXR5PSIxIiBmaWx0ZXI9InVybCgjZmlsdGVyLTIpIiB4bGluazpocmVmPSIjcGF0aC0xIj48L3VzZT4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMSIgZD0iTTE5LDI1IEwxOSwxNSBMMTYsMTUgQzE1LjQ0NzcxNTMsMTUgMTUsMTQuNTUyMjg0NyAxNSwxNCBDMTUsMTMuNTE0NTg5NyAxNS4zNDc5OTkzLDEzLjEwMTkxNSAxNS44NjU0ODc3LDEzLjAxMDA1MjEgTDE2LDEzIEwyNCwxMyBDMjQuNTUyMjg0NywxMyAyNSwxMy40NDc3MTUzIDI1LDE0IEMyNSwxNC40ODU0MTAzIDI0LjY1MjAwMDcsMTQuODk4MDg1IDI0LjEzNDUxMjMsMTQuOTg5OTQ3OSBMMjQsMTUgTDIxLDE1IEwyMSwyNSBMMjQsMjUgQzI0LjU1MjI4NDcsMjUgMjUsMjUuNDQ3NzE1MyAyNSwyNiBDMjUsMjYuNDg1NDEwMyAyNC42NTIwMDA3LDI2Ljg5ODA4NSAyNC4xMzQ1MTIzLDI2Ljk4OTk0NzkgTDI0LDI3IEwxNiwyNyBDMTUuNDQ3NzE1MywyNyAxNSwyNi41NTIyODQ3IDE1LDI2IEMxNSwyNS41MTQ1ODk3IDE1LjM0Nzk5OTMsMjUuMTAxOTE1IDE1Ljg2NTQ4NzcsMjUuMDEwMDUyMSBMMTYsMjUgTDE5LDI1IFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=",hv="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjhweCIgaGVpZ2h0PSIyOHB4IiB2aWV3Qm94PSIwIDAgMjggMjgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDU1LjEgKDc4MTM2KSAtIGh0dHBzOi8vc2tldGNoYXBwLmNvbSAtLT4KICAgIDx0aXRsZT7nvJbnu4QgMjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxmaWx0ZXIgeD0iLTEyMC4wJSIgeT0iLTEyMC4wJSIgd2lkdGg9IjM0MC4wJSIgaGVpZ2h0PSIzNDAuMCUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0xIj4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iNCIgaW49IlNvdXJjZUdyYXBoaWMiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9Iue8lue7hC0yIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg5LjAwMDAwMCwgOS4wMDAwMDApIiBmaWxsPSIjRkYwMTAwIj4KICAgICAgICAgICAgPGNpcmNsZSBpZD0i5qSt5ZyG5b2iIiBmaWx0ZXI9InVybCgjZmlsdGVyLTEpIiBjeD0iNSIgY3k9IjUiIHI9IjUiPjwvY2lyY2xlPgogICAgICAgICAgICA8cGF0aCBkPSJNNSw4IEM2LjY1Njg1NDI1LDggOCw2LjY1Njg1NDI1IDgsNSBDOCwzLjM0MzE0NTc1IDYuNjU2ODU0MjUsMiA1LDIgQzMuMzQzMTQ1NzUsMiAyLDMuMzQzMTQ1NzUgMiw1IEMyLDYuNjU2ODU0MjUgMy4zNDMxNDU3NSw4IDUsOCBaIE01LDYuMjg1NzE0MjkgQzQuMjg5OTE5NjEsNi4yODU3MTQyOSAzLjcxNDI4NTcxLDUuNzEwMDgwMzkgMy43MTQyODU3MSw1IEMzLjcxNDI4NTcxLDQuMjg5OTE5NjEgNC4yODk5MTk2MSwzLjcxNDI4NTcxIDUsMy43MTQyODU3MSBDNS43MTAwODAzOSwzLjcxNDI4NTcxIDYuMjg1NzE0MjksNC4yODk5MTk2MSA2LjI4NTcxNDI5LDUgQzYuMjg1NzE0MjksNS43MTAwODAzOSA1LjcxMDA4MDM5LDYuMjg1NzE0MjkgNSw2LjI4NTcxNDI5IFoiIGlkPSLmpK3lnIblvaIiIGZpbGwtcnVsZT0ibm9uemVybyI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+";const dc={[b.ApplianceNames.pencil]:av,[b.ApplianceNames.selector]:lv,[b.ApplianceNames.eraser]:uv,[b.ApplianceNames.shape]:cv,[b.ApplianceNames.text]:dv,[b.ApplianceNames.laserPointer]:hv};class pv{constructor(t,i,n){var s;this.manager=t,this.enableCursor=i,this.cursorInstances=new Map,this.sideEffectManager=new Pe.SideEffectManager,this.store=this.manager.store,this.applianceIcons=dc,this.onCursorMove=o=>{const a=this.initCursorInstance(o.uid);if(o.state===au.Leave)a.leave();else{const l=a.updateMember();this.canMoveCursor(l)&&a.move(o.position)}},this.initCursorInstance=o=>{let a=this.cursorInstances.get(o);return a||(a=new ov(this.manager,o,this,we.playground),this.cursorInstances.set(o,a)),a},this.mouseMoveListener=A.throttle(o=>{o.pointerType==="touch"&&!o.isPrimary||this.updateCursor(this.getType(o),o.clientX,o.clientY)},48),this.getPoint=(o,a,l)=>{var h;const u=(h=o==null?void 0:o.divElement)==null?void 0:h.getBoundingClientRect();if(u)return o==null?void 0:o.convertToPointInWorld({x:a-u.x,y:l-u.y})},this.getType=o=>{var u;const a=o.target,l=this.manager.focusApp;switch(a.parentElement){case this.mainViewElement:return{type:"main"};case((u=l==null?void 0:l.view)==null?void 0:u.divElement):return{type:"app"};default:return{type:"main"}}},this.mouseLeaveListener=()=>{this.hideCursor(this.manager.uid)},this.roomMembers=(s=this.manager.room)==null?void 0:s.state.roomMembers;const r=we.playground;r&&this.setupWrapper(r),this.sideEffectManager.add(()=>j.on("cursorMove",this.onCursorMove)),this.sideEffectManager.add(()=>j.on("playgroundSizeChange",()=>this.updateContainerRect())),n&&(this.applianceIcons=F(F({},dc),n))}canMoveCursor(t){const i=(t==null?void 0:t.memberState.currentApplianceName)===b.ApplianceNames.laserPointer;return this.enableCursor||i}setupWrapper(t){this.sideEffectManager.add(()=>(t.addEventListener("pointerenter",this.mouseMoveListener),t.addEventListener("pointermove",this.mouseMoveListener),t.addEventListener("pointerleave",this.mouseLeaveListener),()=>{t.removeEventListener("pointerenter",this.mouseMoveListener),t.removeEventListener("pointermove",this.mouseMoveListener),t.removeEventListener("pointerleave",this.mouseLeaveListener)})),this.updateContainerRect()}setMainViewDivElement(t){this.mainViewElement=t}get boxState(){return this.store.getBoxState()}get focusView(){var t;return(t=this.manager.focusApp)==null?void 0:t.view}updateCursor(t,i,n){if(this.wrapperRect&&this.manager.canOperate){const r=t.type==="main"?this.manager.mainView:this.focusView,s=this.getPoint(r,i,n);s&&this.manager.dispatchInternalEvent(Z.CursorMove,{uid:this.manager.uid,position:{x:s.x,y:s.y,type:t.type}})}}updateContainerRect(){var t,i;this.wrapperRect=(t=this.manager.boxManager)==null?void 0:t.stageRect,this.playgroundRect=(i=we.playground)==null?void 0:i.getBoundingClientRect()}deleteCursor(t){this.store.cleanCursor(t);const i=this.cursorInstances.get(t);i&&i.destroy()}hideCursor(t){const i=this.cursorInstances.get(t);i&&i.hide()}destroy(){this.sideEffectManager.flushAll(),this.cursorInstances.size&&(this.cursorInstances.forEach(t=>{t.destroy()}),this.cursorInstances.clear())}}class fv{constructor(t){this.manager=t,j.on("changePageState",()=>{ee.emit("pageStateChange",this.toObject())})}get index(){var t;return((t=this.manager)==null?void 0:t.store.getMainViewSceneIndex())||0}get length(){var t;return((t=this.manager)==null?void 0:t.mainViewScenesLength)||0}toObject(){return{index:this.index>=this.length?this.length-1:this.index,length:this.length}}}class gv{constructor(t){this.ctx=t,this.reactors=new Map,this.disposers=new Map,this.onPhaseChanged=i=>{var n,r;i===b.RoomPhase.Reconnecting&&this.ctx.emitter.emit("startReconnect"),i===b.RoomPhase.Connected&&this.phase===b.RoomPhase.Reconnecting&&((n=this.room)!=null&&n.isWritable?(r=this.room)==null||r.dispatchMagixEvent(qs,{}):this.onReconnected()),this.phase=i},this.onReconnected=A.debounce(()=>{this._onReconnected()},1e3),this._onReconnected=()=>{Pt("onReconnected refresh reactors"),this.releaseDisposers(),this.reactors.forEach((i,n)=>{A.isFunction(i)&&this.disposers.set(n,i())}),this.ctx.emitter.emit("onReconnected")}}setRoom(t){this.room=t,this.phase=t==null?void 0:t.phase,t&&(t.callbacks.off("onPhaseChanged",this.onPhaseChanged),t.callbacks.on("onPhaseChanged",this.onPhaseChanged),t.addMagixEventListener(qs,i=>{i.authorId===t.observerId&&this.onReconnected()},{fireSelfEventAfterCommit:!0}))}setContext(t){this.ctx=t}releaseDisposers(){this.disposers.forEach(t=>{A.isFunction(t)&&t()}),this.disposers.clear()}refresh(){this._onReconnected()}add(t,i){const n=this.disposers.get(t);return n&&A.isFunction(n)&&n(),A.isFunction(i)&&(this.reactors.set(t,i),this.disposers.set(t,i())),()=>this.remove(t)}remove(t){this.reactors.has(t)&&this.reactors.delete(t);const i=this.disposers.get(t);i&&(A.isFunction(i)&&i(),this.disposers.delete(t))}hasReactor(t){return this.reactors.has(t)}destroy(){var t,i;(t=this.room)==null||t.callbacks.off("onPhaseChanged",this.onPhaseChanged),(i=this.room)==null||i.removeMagixEventListener(qs,this.onReconnected),this.releaseDisposers()}}const mv=(e,t)=>{if(b.isPlayer(e))wv(e);else{if(e=e,Object.getOwnPropertyDescriptor(e,"disableCameraTransform"))return;Object.defineProperty(e,"disableCameraTransform",{get(){return t.mainView.disableCameraTransform},set(n){t.mainView.disableCameraTransform=n}}),Object.defineProperty(e,"canUndoSteps",{get(){return t.canUndoSteps}}),Object.defineProperty(e,"canRedoSteps",{get(){return t.canRedoSteps}}),e.moveCamera=n=>t.moveCamera(n),e.moveCameraToContain=(...n)=>t.moveCameraToContain(...n),e.convertToPointInWorld=(...n)=>t.mainView.convertToPointInWorld(...n),e.setCameraBound=(...n)=>t.mainView.setCameraBound(...n),e.scenePreview=(...n)=>t.mainView.scenePreview(...n),e.fillSceneSnapshot=(...n)=>t.mainView.fillSceneSnapshot(...n),e.generateScreenshot=(...n)=>t.mainView.generateScreenshot(...n),e.setMemberState=(...n)=>t.mainView.setMemberState(...n),e.redo=()=>t.redo(),e.undo=()=>t.undo(),e.cleanCurrentScene=()=>t.cleanCurrentScene(),e.delete=()=>t.delete(),e.copy=()=>t.copy(),e.paste=()=>t.paste(),e.duplicate=()=>t.duplicate(),e.insertImage=(...n)=>t.insertImage(...n),e.completeImageUpload=(...n)=>t.completeImageUpload(...n),e.insertText=(...n)=>t.insertText(...n),e.lockImage=(...n)=>t.lockImage(...n),e.lockImages=(...n)=>t.lockImages(...n),vv(e,t),e.dynamicPpt.slideStateAdapter.pptHandler||(e.dynamicPpt.slideStateAdapter.pptHandler=t.createPPTHandler())}},vv=(e,t)=>{const i=e.removeScenes;e.removeScenes=(n,r)=>{var o;n===ze&&((o=t.appManager)==null||o.updateRootDirRemoving(!0));const s=i.call(e,n);return j.emit("removeScenes",{scenePath:n,index:r}),s}},wv=e=>{const t=e.seekToProgressTime;async function i(n){await j.emit("seekStart");const r=await t.call(e,n);return j.emit("seek",n),r}e.seekToProgressTime=i};var yv=Object.defineProperty,xv=Object.defineProperties,Sv=Object.getOwnPropertyDescriptors,hc=Object.getOwnPropertySymbols,Cv=Object.prototype.hasOwnProperty,Mv=Object.prototype.propertyIsEnumerable,pc=(e,t,i)=>t in e?yv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,fc=(e,t)=>{for(var i in t||(t={}))Cv.call(t,i)&&pc(e,i,t[i]);if(hc)for(var i of hc(t))Mv.call(t,i)&&pc(e,i,t[i]);return e},gc=(e,t)=>xv(e,Sv(t)),Iv=`.netless-app-docs-viewer-content{position:relative;height:100%;overflow:hidden}.netless-app-docs-viewer-preview-mask{display:none;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%}.netless-app-docs-viewer-preview{display:flex;flex-direction:column;align-items:center;position:absolute;z-index:300;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;color:#5f5f5f;user-select:none}.netless-app-docs-viewer-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;color:#191919}.netless-app-docs-viewer-float-footer{width:100%;min-height:26px;position:absolute;left:0;bottom:0;z-index:2000;background:rgba(249,249,252,.9);transition:opacity .4s}.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{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 2px;text-align:right;font-size:13px;line-height:1;font-weight:400;font-family:inherit;border-radius:2px;color:currentColor;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}.netless-app-docs-viewer-readonly.netless-app-docs-viewer-float-footer{display:none}.telebox-color-scheme-dark .netless-app-docs-viewer-page-number-input{color:#a6a6a8}.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:#222}.telebox-color-scheme-dark .netless-app-docs-viewer-footer{color:#a6a6a8;background:#2d2d33;border-top:none}.telebox-color-scheme-dark .netless-app-docs-viewer-footer-btn:hover{background:#212126}.telebox-color-scheme-dark .netless-app-docs-viewer-preview{background:rgba(50,50,50,.9)}.netless-app-docs-viewer-static-scrollbar{position:absolute;top:0;right:0;z-index:2147483647;width:8px;min-height:30px;margin:0;padding:0;border:none;outline:none;border-radius:4px;background:rgba(68,78,96,.4);box-shadow:1px 1px 8px #ffffffb3;opacity:0;transition:background .4s,opacity .4s 3s,transform .2s;user-select:none}.netless-app-docs-viewer-static-scrollbar.netless-app-docs-viewer-static-scrollbar-dragging{background:rgba(68,78,96,.6);opacity:1;transition:background .4s,opacity .4s 3s!important}.netless-app-docs-viewer-static-scrollbar:hover,.netless-app-docs-viewer-static-scrollbar:focus{background:rgba(68,78,96,.5)}.netless-app-docs-viewer-static-scrollbar:active{background:rgba(68,78,96,.6)}.netless-app-docs-viewer-content:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:background .4s,opacity .4s,transform .2s}.netless-app-docs-viewer-readonly .netless-app-docs-viewer-static-scrollbar{display:none}.netless-app-docs-viewer-static-pages:hover .netless-app-docs-viewer-static-scrollbar{opacity:1;transition:background .4s,opacity .4s,transform .2s}.page-renderer-pages-container{position:relative;overflow:hidden}.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-static-wb-view,.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 bv=(e,t,i,n)=>{if(i==="length"||i==="prototype"||i==="arguments"||i==="caller")return;const r=Object.getOwnPropertyDescriptor(e,i),s=Object.getOwnPropertyDescriptor(t,i);!Av(r,s)&&n||Object.defineProperty(e,i,s)},Av=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},Ev=(e,t)=>{const i=Object.getPrototypeOf(t);i!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,i)},Tv=(e,t)=>`/* Wrapped ${e}*/
125
- ${t}`,Nv=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),kv=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Pv=(e,t,i)=>{const n=i===""?"":`with ${i.trim()}() `,r=Tv.bind(null,n,t.toString());Object.defineProperty(r,"name",kv),Object.defineProperty(e,"toString",gc(fc({},Nv),{value:r}))};function zv(e,t,{ignoreNonConfigurable:i=!1}={}){const{name:n}=e;for(const r of Reflect.ownKeys(t))bv(e,t,r,i);return Ev(e,t),Pv(e,t,n),e}const Dv=(e,t={})=>{if(typeof e!="function")throw new TypeError(`Expected the first argument to be a function, got \`${typeof e}\``);const{wait:i=0,maxWait:n=Number.Infinity,before:r=!1,after:s=!0}=t;if(!r&&!s)throw new Error("Both `before` and `after` are false, function wouldn't be called.");let o,a,l;const u=function(...h){const p=this,w=()=>{o=void 0,a&&(clearTimeout(a),a=void 0),s&&(l=e.apply(p,h))},C=()=>{a=void 0,o&&(clearTimeout(o),o=void 0),s&&(l=e.apply(p,h))},E=r&&!o;return clearTimeout(o),o=setTimeout(w,i),n>0&&n!==Number.Infinity&&!a&&(a=setTimeout(C,n)),E&&(l=e.apply(p,h)),l};return zv(u,e),u.cancel=()=>{o&&(clearTimeout(o),o=void 0),a&&(clearTimeout(a),a=void 0)},u},mc="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",jv=mc.length,vc=Array(20),vn=()=>{for(let e=0;e<20;e++)vc[e]=mc.charAt(Math.random()*jv);return vc.join("")};class Ir{constructor(){this.disposers=new Map}add(t,i=vn()){return this.flush(i),this.disposers.set(i,t()),i}addDisposer(t,i=vn()){return this.flush(i),this.disposers.set(i,t),i}addEventListener(t,i,n,r,s=vn()){return this.add(()=>(t.addEventListener(i,n,r),()=>t.removeEventListener(i,n,r)),s),s}setTimeout(t,i,n=vn()){return this.add(()=>{const r=window.setTimeout(()=>{this.remove(n),t()},i);return()=>window.clearTimeout(r)},n)}setInterval(t,i,n=vn()){return this.add(()=>{const r=window.setInterval(t,i);return()=>window.clearInterval(r)},n)}remove(t){const i=this.disposers.get(t);return this.disposers.delete(t),i}flush(t){const i=this.remove(t);if(i)try{i()}catch(n){console.error(n)}}flushAll(){this.disposers.forEach(t=>{try{t()}catch(i){console.error(i)}}),this.disposers.clear()}}var si=[],Lv=function(){return si.some(function(e){return e.activeTargets.length>0})},Vv=function(){return si.some(function(e){return e.skippedTargets.length>0})},wc="ResizeObserver loop completed with undelivered notifications.",Rv=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:wc}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=wc),window.dispatchEvent(e)},wn;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(wn||(wn={}));var oi=function(e){return Object.freeze(e)},Bv=function(){function e(t,i){this.inlineSize=t,this.blockSize=i,oi(this)}return e}(),yc=function(){function e(t,i,n,r){return this.x=t,this.y=i,this.width=n,this.height=r,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,oi(this)}return e.prototype.toJSON=function(){var t=this,i=t.x,n=t.y,r=t.top,s=t.right,o=t.bottom,a=t.left,l=t.width,u=t.height;return{x:i,y:n,top:r,right:s,bottom:o,left:a,width:l,height:u}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),Do=function(e){return e instanceof SVGElement&&"getBBox"in e},xc=function(e){if(Do(e)){var t=e.getBBox(),i=t.width,n=t.height;return!i&&!n}var r=e,s=r.offsetWidth,o=r.offsetHeight;return!(s||o||e.getClientRects().length)},Sc=function(e){var t,i;if(e instanceof Element)return!0;var n=(i=(t=e)===null||t===void 0?void 0:t.ownerDocument)===null||i===void 0?void 0:i.defaultView;return!!(n&&e instanceof n.Element)},Ov=function(e){switch(e.tagName){case"INPUT":if(e.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},yn=typeof window!="undefined"?window:{},br=new WeakMap,Cc=/auto|scroll/,_v=/^tb|vertical/,$v=/msie|trident/i.test(yn.navigator&&yn.navigator.userAgent),ot=function(e){return parseFloat(e||"0")},ki=function(e,t,i){return e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=!1),new Bv((i?t:e)||0,(i?e:t)||0)},Mc=oi({devicePixelContentBoxSize:ki(),borderBoxSize:ki(),contentBoxSize:ki(),contentRect:new yc(0,0,0,0)}),Ic=function(e,t){if(t===void 0&&(t=!1),br.has(e)&&!t)return br.get(e);if(xc(e))return br.set(e,Mc),Mc;var i=getComputedStyle(e),n=Do(e)&&e.ownerSVGElement&&e.getBBox(),r=!$v&&i.boxSizing==="border-box",s=_v.test(i.writingMode||""),o=!n&&Cc.test(i.overflowY||""),a=!n&&Cc.test(i.overflowX||""),l=n?0:ot(i.paddingTop),u=n?0:ot(i.paddingRight),h=n?0:ot(i.paddingBottom),p=n?0:ot(i.paddingLeft),w=n?0:ot(i.borderTopWidth),C=n?0:ot(i.borderRightWidth),E=n?0:ot(i.borderBottomWidth),T=n?0:ot(i.borderLeftWidth),c=p+u,d=l+h,f=T+C,g=w+E,m=a?e.offsetHeight-g-e.clientHeight:0,x=o?e.offsetWidth-f-e.clientWidth:0,y=r?c+f:0,k=r?d+g:0,D=n?n.width:ot(i.width)-y-x,P=n?n.height:ot(i.height)-k-m,q=D+c+x+f,ie=P+d+m+g,ne=oi({devicePixelContentBoxSize:ki(Math.round(D*devicePixelRatio),Math.round(P*devicePixelRatio),s),borderBoxSize:ki(q,ie,s),contentBoxSize:ki(D,P,s),contentRect:new yc(p,l,D,P)});return br.set(e,ne),ne},bc=function(e,t,i){var n=Ic(e,i),r=n.borderBoxSize,s=n.contentBoxSize,o=n.devicePixelContentBoxSize;switch(t){case wn.DEVICE_PIXEL_CONTENT_BOX:return o;case wn.BORDER_BOX:return r;default:return s}},Uv=function(){function e(t){var i=Ic(t);this.target=t,this.contentRect=i.contentRect,this.borderBoxSize=oi([i.borderBoxSize]),this.contentBoxSize=oi([i.contentBoxSize]),this.devicePixelContentBoxSize=oi([i.devicePixelContentBoxSize])}return e}(),Ac=function(e){if(xc(e))return 1/0;for(var t=0,i=e.parentNode;i;)t+=1,i=i.parentNode;return t},Hv=function(){var e=1/0,t=[];si.forEach(function(o){if(o.activeTargets.length!==0){var a=[];o.activeTargets.forEach(function(u){var h=new Uv(u.target),p=Ac(u.target);a.push(h),u.lastReportedSize=bc(u.target,u.observedBox),p<e&&(e=p)}),t.push(function(){o.callback.call(o.observer,a,o.observer)}),o.activeTargets.splice(0,o.activeTargets.length)}});for(var i=0,n=t;i<n.length;i++){var r=n[i];r()}return e},Ec=function(e){si.forEach(function(i){i.activeTargets.splice(0,i.activeTargets.length),i.skippedTargets.splice(0,i.skippedTargets.length),i.observationTargets.forEach(function(r){r.isActive()&&(Ac(r.target)>e?i.activeTargets.push(r):i.skippedTargets.push(r))})})},Wv=function(){var e=0;for(Ec(e);Lv();)e=Hv(),Ec(e);return Vv()&&Rv(),e>0},jo,Tc=[],Fv=function(){return Tc.splice(0).forEach(function(e){return e()})},Qv=function(e){if(!jo){var t=0,i=document.createTextNode(""),n={characterData:!0};new MutationObserver(function(){return Fv()}).observe(i,n),jo=function(){i.textContent=""+(t?t--:t++)}}Tc.push(e),jo()},Zv=function(e){Qv(function(){requestAnimationFrame(e)})},Ar=0,Yv=function(){return!!Ar},Gv=250,Xv={attributes:!0,characterData:!0,childList:!0,subtree:!0},Nc=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],kc=function(e){return e===void 0&&(e=0),Date.now()+e},Lo=!1,Jv=function(){function e(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return e.prototype.run=function(t){var i=this;if(t===void 0&&(t=Gv),!Lo){Lo=!0;var n=kc(t);Zv(function(){var r=!1;try{r=Wv()}finally{if(Lo=!1,t=n-kc(),!Yv())return;r?i.run(1e3):t>0?i.run(t):i.start()}})}},e.prototype.schedule=function(){this.stop(),this.run()},e.prototype.observe=function(){var t=this,i=function(){return t.observer&&t.observer.observe(document.body,Xv)};document.body?i():yn.addEventListener("DOMContentLoaded",i)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Nc.forEach(function(i){return yn.addEventListener(i,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Nc.forEach(function(i){return yn.removeEventListener(i,t.listener,!0)}),this.stopped=!0)},e}(),Vo=new Jv,Pc=function(e){!Ar&&e>0&&Vo.start(),Ar+=e,!Ar&&Vo.stop()},Kv=function(e){return!Do(e)&&!Ov(e)&&getComputedStyle(e).display==="inline"},qv=function(){function e(t,i){this.target=t,this.observedBox=i||wn.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=bc(this.target,this.observedBox,!0);return Kv(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),ew=function(){function e(t,i){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=i}return e}(),Er=new WeakMap,zc=function(e,t){for(var i=0;i<e.length;i+=1)if(e[i].target===t)return i;return-1},Tr=function(){function e(){}return e.connect=function(t,i){var n=new ew(t,i);Er.set(t,n)},e.observe=function(t,i,n){var r=Er.get(t),s=r.observationTargets.length===0;zc(r.observationTargets,i)<0&&(s&&si.push(r),r.observationTargets.push(new qv(i,n&&n.box)),Pc(1),Vo.schedule())},e.unobserve=function(t,i){var n=Er.get(t),r=zc(n.observationTargets,i),s=n.observationTargets.length===1;r>=0&&(s&&si.splice(si.indexOf(n),1),n.observationTargets.splice(r,1),Pc(-1))},e.disconnect=function(t){var i=this,n=Er.get(t);n.observationTargets.slice().forEach(function(r){return i.unobserve(t,r.target)}),n.activeTargets.splice(0,n.activeTargets.length)},e}(),tw=function(){function e(t){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof t!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");Tr.connect(this,t)}return e.prototype.observe=function(t,i){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Sc(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Tr.observe(this,t,i)},e.prototype.unobserve=function(t){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Sc(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Tr.unobserve(this,t)},e.prototype.disconnect=function(){Tr.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}();function iw(e){const t="http://www.w3.org/2000/svg",i=document.createElementNS(t,"svg");i.setAttribute("class",`${e}-footer-icon-sidebar`),i.setAttribute("viewBox","0 0 64 64");const n=document.createElementNS(t,"path");return n.setAttribute("fill","currentColor"),n.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(n),i}function nw(e){const t="http://www.w3.org/2000/svg",i=document.createElementNS(t,"svg");i.setAttribute("class",`${e}-footer-icon-arrow-left`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(t,"path");return n.setAttribute("fill","currentColor"),n.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(n),i}function rw(e){const t="http://www.w3.org/2000/svg",i=document.createElementNS(t,"svg");i.setAttribute("class",`${e}-footer-icon-arrow-right`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(t,"path");return n.setAttribute("fill","currentColor"),n.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(n),i}function sw(e){const t="http://www.w3.org/2000/svg",i=document.createElementNS(t,"svg");i.setAttribute("class",`${e}-footer-icon-play`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(t,"path");return n.setAttribute("fill","currentColor"),n.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(n),i}function ow(e){const t="http://www.w3.org/2000/svg",i=document.createElementNS(t,"svg");i.setAttribute("class",`${e}-footer-icon-pause`),i.setAttribute("viewBox","0 0 500 500");const n=document.createElementNS(t,"path");return n.setAttribute("fill","currentColor"),n.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(n),i}const ai=typeof window!="undefined",Dc=ai&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),jc=ai&&"IntersectionObserver"in window,Lc=ai&&"classList"in document.createElement("p"),Vc=ai&&window.devicePixelRatio>1,aw={elements_selector:".lazy",container:Dc||ai?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_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},Rc=e=>Object.assign({},aw,e),Bc=function(e,t){let i;const n="LazyLoad::Initialized",r=new e(t);try{i=new CustomEvent(n,{detail:{instance:r}})}catch{i=document.createEvent("CustomEvent"),i.initCustomEvent(n,!1,!1,{instance:r})}window.dispatchEvent(i)},lw=(e,t)=>{if(!!t)if(!t.length)Bc(e,t);else for(let i=0,n;n=t[i];i+=1)Bc(e,n)},vt="src",Ro="srcset",Bo="sizes",Oc="poster",xn="llOriginalAttrs",_c="data",Oo="loading",$c="loaded",Uc="applied",uw="entered",_o="error",Hc="native",Wc="data-",Fc="ll-status",De=(e,t)=>e.getAttribute(Wc+t),cw=(e,t,i)=>{var n=Wc+t;if(i===null){e.removeAttribute(n);return}e.setAttribute(n,i)},Sn=e=>De(e,Fc),li=(e,t)=>cw(e,Fc,t),Nr=e=>li(e,null),$o=e=>Sn(e)===null,dw=e=>Sn(e)===Oo,hw=e=>Sn(e)===_o,Uo=e=>Sn(e)===Hc,pw=[Oo,$c,Uc,_o],fw=e=>pw.indexOf(Sn(e))>=0,Dt=(e,t,i,n)=>{if(!!e){if(n!==void 0){e(t,i,n);return}if(i!==void 0){e(t,i);return}e(t)}},Pi=(e,t)=>{if(Lc){e.classList.add(t);return}e.className+=(e.className?" ":"")+t},at=(e,t)=>{if(Lc){e.classList.remove(t);return}e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},gw=e=>{e.llTempImage=document.createElement("IMG")},mw=e=>{delete e.llTempImage},Qc=e=>e.llTempImage,kr=(e,t)=>{if(!t)return;const i=t._observer;!i||i.unobserve(e)},vw=e=>{e.disconnect()},ww=(e,t,i)=>{t.unobserve_entered&&kr(e,i)},Ho=(e,t)=>{!e||(e.loadingCount+=t)},yw=e=>{!e||(e.toLoadCount-=1)},Zc=(e,t)=>{!e||(e.toLoadCount=t)},xw=e=>e.loadingCount>0,Sw=e=>e.toLoadCount>0,Yc=e=>{let t=[];for(let i=0,n;n=e.children[i];i+=1)n.tagName==="SOURCE"&&t.push(n);return t},Wo=(e,t)=>{const i=e.parentNode;if(!i||i.tagName!=="PICTURE")return;Yc(i).forEach(t)},Gc=(e,t)=>{Yc(e).forEach(t)},Pr=[vt],Xc=[vt,Oc],zr=[vt,Ro,Bo],Jc=[_c],Dr=e=>!!e[xn],Kc=e=>e[xn],qc=e=>delete e[xn],zi=(e,t)=>{if(Dr(e))return;const i={};t.forEach(n=>{i[n]=e.getAttribute(n)}),e[xn]=i},Cw=e=>{Dr(e)||(e[xn]={backgroundImage:e.style.backgroundImage})},Mw=(e,t,i)=>{if(!i){e.removeAttribute(t);return}e.setAttribute(t,i)},Di=(e,t)=>{if(!Dr(e))return;const i=Kc(e);t.forEach(n=>{Mw(e,n,i[n])})},Iw=e=>{if(!Dr(e))return;const t=Kc(e);e.style.backgroundImage=t.backgroundImage},bw=(e,t,i)=>{Pi(e,t.class_applied),li(e,Uc),i&&(t.unobserve_completed&&kr(e,t),Dt(t.callback_applied,e,i))},ed=(e,t,i)=>{Pi(e,t.class_loading),li(e,Oo),i&&(Ho(i,1),Dt(t.callback_loading,e,i))},jt=(e,t,i)=>{!i||e.setAttribute(t,i)},td=(e,t)=>{jt(e,Bo,De(e,t.data_sizes)),jt(e,Ro,De(e,t.data_srcset)),jt(e,vt,De(e,t.data_src))},Aw=(e,t)=>{Wo(e,i=>{zi(i,zr),td(i,t)}),zi(e,zr),td(e,t)},Ew=(e,t)=>{zi(e,Pr),jt(e,vt,De(e,t.data_src))},Tw=(e,t)=>{Gc(e,i=>{zi(i,Pr),jt(i,vt,De(i,t.data_src))}),zi(e,Xc),jt(e,Oc,De(e,t.data_poster)),jt(e,vt,De(e,t.data_src)),e.load()},Nw=(e,t)=>{zi(e,Jc),jt(e,_c,De(e,t.data_src))},kw=(e,t,i)=>{const n=De(e,t.data_bg),r=De(e,t.data_bg_hidpi),s=Vc&&r?r:n;!s||(e.style.backgroundImage=`url("${s}")`,Qc(e).setAttribute(vt,s),ed(e,t,i))},Pw=(e,t,i)=>{const n=De(e,t.data_bg_multi),r=De(e,t.data_bg_multi_hidpi),s=Vc&&r?r:n;!s||(e.style.backgroundImage=s,bw(e,t,i))},id={IMG:Aw,IFRAME:Ew,VIDEO:Tw,OBJECT:Nw},zw=(e,t)=>{const i=id[e.tagName];!i||i(e,t)},Dw=(e,t,i)=>{const n=id[e.tagName];!n||(n(e,t),ed(e,t,i))},jw=["IMG","IFRAME","VIDEO","OBJECT"],Lw=e=>jw.indexOf(e.tagName)>-1,nd=(e,t)=>{t&&!xw(t)&&!Sw(t)&&Dt(e.callback_finish,t)},rd=(e,t,i)=>{e.addEventListener(t,i),e.llEvLisnrs[t]=i},Vw=(e,t,i)=>{e.removeEventListener(t,i)},Fo=e=>!!e.llEvLisnrs,Rw=(e,t,i)=>{Fo(e)||(e.llEvLisnrs={});const n=e.tagName==="VIDEO"?"loadeddata":"load";rd(e,n,t),rd(e,"error",i)},Qo=e=>{if(!Fo(e))return;const t=e.llEvLisnrs;for(let i in t){const n=t[i];Vw(e,i,n)}delete e.llEvLisnrs},sd=(e,t,i)=>{mw(e),Ho(i,-1),yw(i),at(e,t.class_loading),t.unobserve_completed&&kr(e,i)},Bw=(e,t,i,n)=>{const r=Uo(t);sd(t,i,n),Pi(t,i.class_loaded),li(t,$c),Dt(i.callback_loaded,t,n),r||nd(i,n)},Ow=(e,t,i,n)=>{const r=Uo(t);sd(t,i,n),Pi(t,i.class_error),li(t,_o),Dt(i.callback_error,t,n),r||nd(i,n)},Zo=(e,t,i)=>{const n=Qc(e)||e;if(Fo(n))return;Rw(n,o=>{Bw(o,e,t,i),Qo(n)},o=>{Ow(o,e,t,i),Qo(n)})},_w=(e,t,i)=>{gw(e),Zo(e,t,i),Cw(e),kw(e,t,i),Pw(e,t,i)},$w=(e,t,i)=>{Zo(e,t,i),Dw(e,t,i)},Yo=(e,t,i)=>{Lw(e)?$w(e,t,i):_w(e,t,i)},Uw=(e,t,i)=>{e.setAttribute("loading","lazy"),Zo(e,t,i),zw(e,t),li(e,Hc)},od=e=>{e.removeAttribute(vt),e.removeAttribute(Ro),e.removeAttribute(Bo)},Hw=e=>{Wo(e,t=>{od(t)}),od(e)},ad=e=>{Wo(e,t=>{Di(t,zr)}),Di(e,zr)},Ww={IMG:ad,IFRAME:e=>{Di(e,Pr)},VIDEO:e=>{Gc(e,t=>{Di(t,Pr)}),Di(e,Xc),e.load()},OBJECT:e=>{Di(e,Jc)}},Fw=e=>{const t=Ww[e.tagName];if(!t){Iw(e);return}t(e)},Qw=(e,t)=>{$o(e)||Uo(e)||(at(e,t.class_entered),at(e,t.class_exited),at(e,t.class_applied),at(e,t.class_loading),at(e,t.class_loaded),at(e,t.class_error))},Zw=(e,t)=>{Fw(e),Qw(e,t),Nr(e),qc(e)},Yw=(e,t,i,n)=>{!i.cancel_on_exit||!dw(e)||e.tagName==="IMG"&&(Qo(e),Hw(e),ad(e),at(e,i.class_loading),Ho(n,-1),Nr(e),Dt(i.callback_cancel,e,t,n))},Gw=(e,t,i,n)=>{const r=fw(e);li(e,uw),Pi(e,i.class_entered),at(e,i.class_exited),ww(e,i,n),Dt(i.callback_enter,e,t,n),!r&&Yo(e,i,n)},Xw=(e,t,i,n)=>{$o(e)||(Pi(e,i.class_exited),Yw(e,t,i,n),Dt(i.callback_exit,e,t,n))},Jw=["IMG","IFRAME","VIDEO"],ld=e=>e.use_native&&"loading"in HTMLImageElement.prototype,Kw=(e,t,i)=>{e.forEach(n=>{Jw.indexOf(n.tagName)!==-1&&Uw(n,t,i)}),Zc(i,0)},qw=e=>e.isIntersecting||e.intersectionRatio>0,ey=e=>({root:e.container===document?null:e.container,rootMargin:e.thresholds||e.threshold+"px"}),ty=(e,t,i)=>{e.forEach(n=>qw(n)?Gw(n.target,n,t,i):Xw(n.target,n,t,i))},iy=(e,t)=>{t.forEach(i=>{e.observe(i)})},ny=(e,t)=>{vw(e),iy(e,t)},ry=(e,t)=>{!jc||ld(e)||(t._observer=new IntersectionObserver(i=>{ty(i,e,t)},ey(e)))},ud=e=>Array.prototype.slice.call(e),jr=e=>e.container.querySelectorAll(e.elements_selector),sy=e=>ud(e).filter($o),oy=e=>hw(e),ay=e=>ud(e).filter(oy),cd=(e,t)=>sy(e||jr(t)),ly=(e,t)=>{ay(jr(e)).forEach(n=>{at(n,e.class_error),Nr(n)}),t.update()},uy=(e,t)=>{!ai||window.addEventListener("online",()=>{ly(e,t)})},Cn=function(e,t){const i=Rc(e);this._settings=i,this.loadingCount=0,ry(i,this),uy(i,this),this.update(t)};Cn.prototype={update:function(e){const t=this._settings,i=cd(e,t);if(Zc(this,i.length),Dc||!jc){this.loadAll(i);return}if(ld(t)){Kw(i,t,this);return}ny(this._observer,i)},destroy:function(){this._observer&&this._observer.disconnect(),jr(this._settings).forEach(e=>{qc(e)}),delete this._observer,delete this._settings,delete this.loadingCount,delete this.toLoadCount},loadAll:function(e){const t=this._settings;cd(e,t).forEach(n=>{kr(n,this),Yo(n,t,this)})},restoreAll:function(){const e=this._settings;jr(e).forEach(t=>{Zw(t,e)})}},Cn.load=(e,t)=>{const i=Rc(t);Yo(e,i)},Cn.resetStatus=e=>{Nr(e)},ai&&lw(Cn,window.lazyLoadOptions);class dd{constructor({readonly:t,box:i,pages:n,onNewPageIndex:r,onPlay:s}){if(this.pageIndex=0,this.namespace="netless-app-docs-viewer",this.isShowPreview=!1,this.isSmallBox=!1,this.sideEffect=new Ir,n.length<=0)throw new Error("[DocsViewer] Empty pages.");this.readonly=t,this.box=i,this.pages=n,this.onNewPageIndex=r,this.onPlay=s,this.render()}mount(){this.box.mountContent(this.$content),this.box.mountFooter(this.$footer),this.sideEffect.add(()=>{const t=new Cn({container:this.$preview,elements_selector:`.${this.wrapClassName("preview-page>img")}`});return()=>t.destroy()},"preview-lazyload")}unmount(){this.$content.remove(),this.$footer.remove()}setReadonly(t){this.readonly!==t&&(this.readonly=t,this.$content.classList.toggle(this.wrapClassName("readonly"),t),this.$footer.classList.toggle(this.wrapClassName("readonly"),t),this.$pageNumberInput.disabled=t)}destroy(){this.sideEffect.flushAll(),this.unmount()}setPageIndex(t){Number.isNaN(t)||(this.pageIndex=t,this.$pageNumberInput.value=String(t+1))}setSmallBox(t){this.isSmallBox!==t&&(this.isSmallBox=t,this.$footer.classList.toggle(this.wrapClassName("float-footer"),t))}render(){return this.renderContent(),this.renderFooter(),this.$content}renderContent(){if(!this.$content){const t=document.createElement("div");t.className=this.wrapClassName("content"),this.$content=t,this.readonly&&t.classList.add(this.wrapClassName("readonly")),t.appendChild(this.renderPreviewMask()),t.appendChild(this.renderPreview())}return this.$content}renderPreview(){if(!this.$preview){const t=document.createElement("div");t.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=t;const i=this.wrapClassName("preview-page"),n=this.wrapClassName("preview-page-name");this.pages.forEach((r,s)=>{var o;const a=(o=r.thumbnail)!=null?o:r.src.startsWith("ppt")?void 0:r.src;if(!a)return;const l=String(s),u=document.createElement("a");u.className=i+" "+this.wrapClassName(`preview-page-${s}`),u.setAttribute("href","#"),u.dataset.pageIndex=l;const h=document.createElement("span");h.className=n,h.textContent=String(s+1),h.dataset.pageIndex=l;const p=document.createElement("img");p.width=r.width,p.height=r.height,p.dataset.src=a,p.dataset.pageIndex=l,u.appendChild(p),u.appendChild(h),t.appendChild(u)}),this.sideEffect.addEventListener(t,"click",r=>{var s;if(this.readonly)return;const o=(s=r.target.dataset)==null?void 0:s.pageIndex;o&&(r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),this.onNewPageIndex(Number(o)),this.togglePreview(!1))})}return this.$preview}renderPreviewMask(){return this.$previewMask||(this.$previewMask=document.createElement("div"),this.$previewMask.className=this.wrapClassName("preview-mask"),this.sideEffect.addEventListener(this.$previewMask,"click",t=>{this.readonly||t.target===this.$previewMask&&this.togglePreview(!1)})),this.$previewMask}renderFooter(){if(!this.$footer){const t=document.createElement("div");if(t.className=this.wrapClassName("footer"),this.$footer=t,this.readonly&&t.classList.add(this.wrapClassName("readonly")),this.isSmallBox&&t.classList.add(this.wrapClassName("float-footer")),this.pages.some(l=>l.thumbnail||!l.src.startsWith("ppt"))){const l=this.renderFooterBtn("btn-sidebar",iw(this.namespace));this.sideEffect.addEventListener(l,"click",()=>{this.readonly||this.togglePreview()}),this.$footer.appendChild(l)}const i=document.createElement("div");i.className=this.wrapClassName("page-jumps");const n=this.renderFooterBtn("btn-page-back",nw(this.namespace));if(this.sideEffect.addEventListener(n,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex-1)}),i.appendChild(n),this.onPlay){const l=this.renderFooterBtn("btn-page-play",sw(this.namespace),ow(this.namespace)),u=()=>{this.sideEffect.setTimeout(()=>{l.classList.toggle(this.wrapClassName("footer-btn-playing"),!1)},500,"returnPlay")};this.sideEffect.addEventListener(l,"click",()=>{this.readonly||(l.classList.toggle(this.wrapClassName("footer-btn-playing"),!0),this.onPlay&&this.onPlay(),u())}),i.appendChild(l)}const r=this.renderFooterBtn("btn-page-next",rw(this.namespace));this.sideEffect.addEventListener(r,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex+1)}),i.appendChild(r);const s=document.createElement("div");s.className=this.wrapClassName("page-number");const o=document.createElement("input");o.className=this.wrapClassName("page-number-input"),o.value=String(this.pageIndex+1),this.readonly&&(o.disabled=!0),this.$pageNumberInput=o,this.sideEffect.addEventListener(o,"focus",()=>{o.select()}),this.sideEffect.addEventListener(o,"change",()=>{this.readonly||o.value&&this.onNewPageIndex(Number(o.value)-1)});const a=document.createElement("span");a.textContent=" / "+this.pages.length,s.appendChild(o),s.appendChild(a),this.$footer.appendChild(i),this.$footer.appendChild(s)}return this.$footer}renderFooterBtn(t,i,n){const r=document.createElement("button");return r.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(t),r.appendChild(i),n&&r.appendChild(n),r}togglePreview(t){if(this.isShowPreview=t!=null?t:!this.isShowPreview,this.$content.classList.toggle(this.wrapClassName("preview-active"),this.isShowPreview),this.isShowPreview){const i=this.$preview.querySelector("."+this.wrapClassName(`preview-page-${this.pageIndex}`));i&&this.$preview.scrollTo({top:i.offsetTop-16})}}wrapClassName(t){return`${this.namespace}-${t}`}}function ji(e,t,i){return Math.min(Math.max(e,t),i)}function hd(e){return e.touches?e.touches[0]:e}function pd(e){e.stopPropagation(),e.cancelable&&e.preventDefault()}class cy{constructor(t){var i,n,r;this.velocity=0,this.paused=!0,this._animationFrameID=null,this._loopTimestamp=0,this.looper=s=>{if(this.paused)return;let o=Math.floor((s-this._loopTimestamp)/1e3*60)+1;for(this._loopTimestamp=s;o-- >0;)this.stepper();this.onStep(this.current,this),!this.paused&&this.current!==this.target&&window.requestAnimationFrame(this.looper)},this.current=(i=t.start)!=null?i:0,this.target=this.current,this.stiffness=(n=t.stiffness)!=null?n:170,this.damping=(r=t.damping)!=null?r:26,this.onStep=t.onStep}stepTo(t,i){this.paused&&i!=null&&(this.current=i),this.paused=!1,this.target=t,this.onStep(this.current,this),this._loopTimestamp=Date.now(),window.requestAnimationFrame(this.looper)}pause(){this.paused=!0}destroy(){this.pause()}stepper(){const t=-this.stiffness*(this.current-this.target),i=-this.damping*this.velocity,n=this.velocity+(t+i)/60,r=this.current+n/60;Math.abs(n-0)<.01&&Math.abs(r-this.target)<.01?(this.current=this.target,this.velocity=0):(this.current=r,this.velocity=n)}}class dy{constructor(t,i,n,r){this.scale=1,this.lastVisit=Date.now(),this.pageOffsetY=0,this.pageOffsetX=0,this.visible=!0,this.index=t,this.page=i,this.scale=n,this.pageOffsetX=(r-i.width)/2;const s=document.createElement("div");s.className="page-renderer-page",s.dataset.index=`${t}`,s.style.width=`${i.width*n}px`,s.style.height=`${i.height*n}px`,i.thumbnail&&(s.style.backgroundImage=`url("${i.thumbnail}")`);const o=document.createElement("img");o.className="page-renderer-page-img",o.width=i.width,o.height=i.height,o.src=i.src,s.appendChild(o),this.$page=s}translateY(t){Math.abs(t-this.pageOffsetY)>=.001&&(this.pageOffsetY=t,this.$page.style.transform=`translate(${this.pageOffsetX*this.scale}px, ${this.pageOffsetY*this.scale}px)`)}setScale(t){Math.abs(t-this.scale)>=.001&&(this.scale=t,this.$page.style.width=`${this.page.width*this.scale}px`,this.$page.style.height=`${this.page.height*this.scale}px`,this.$page.style.transform=`translate(${this.pageOffsetX*this.scale}px, ${this.pageOffsetY*this.scale}px)`)}setVisible(t){t!==this.visible&&(this.visible=t,this.$page.style.opacity=t?"1":"0")}}const hy=window.requestIdleCallback||(e=>window.setTimeout(e,5e3)),py=window.cancelIdleCallback||window.clearTimeout;class fy{constructor(t,i,n){this.pages=t,this.pagesIntrinsicWidth=i,this.scale=n,this.els=new Map,this.maxElCount=200,this.gcTimer=null,this.gc=()=>{if(this.gcTimer=null,this.els.size>this.maxElCount){const r=[...this.els.values()].sort((s,o)=>o.lastVisit-s.lastVisit);for(let s=Math.floor(this.maxElCount/4);s<r.length;s++)this.els.delete(r[s].index)}}}getEl(t){let i=this.els.get(t);return i||(i=new dy(t,this.pages[t],this.scale,this.pagesIntrinsicWidth),this.els.set(t,i)),i.lastVisit=Date.now(),this.els.size>this.maxElCount&&this.gcTimer===null&&(this.gcTimer=hy(this.gc)),i}setScale(t){t!==this.scale&&(this.scale=t,this.els.forEach(i=>i.setScale(t)))}destroy(){this.els.clear(),this.gcTimer!==null&&(py(this.gcTimer),this.gcTimer=null)}}class gy{constructor(t){this._hwaTimeout=NaN,this._turnOffHWA=()=>{window.clearTimeout(this._hwaTimeout),this._hwaTimeout=NaN,this.$pages.classList.toggle("is-hwa",!1)},this.pagesScrollTop=t.pagesScrollTop||0,this.containerWidth=t.containerWidth||1,this.containerHeight=t.containerHeight||1,this.pages=t.pages.map(s=>{if(s.thumbnail)return s;try{const o=new URL(s.src);return o.searchParams.set("x-oss-process","image/resize,l_50"),gc(fc({},s),{thumbnail:o.toString()})}catch(o){return console.error(o),s}});const i=Array(this.pages.length);let n=1/0,r=0;this.pagesIntrinsicHeight=this.pages.reduce((s,o,a)=>(i[a]=s,o.width>r&&(r=o.width),o.height<=n&&(n=o.height),s+o.height),0),this.pagesIntrinsicWidth=r,this.pagesMinHeight=n,this.pagesIntrinsicYs=i,this.scale=this._calcScale(),this.threshold=this._calcThreshold(),this.onPageIndexChanged=t.onPageIndexChanged,this.pageScrollIndex=0,this.pagesScrollTop!==0&&(this.pageScrollIndex=this.findScrollPageIndex(),this.onPageIndexChanged&&this.pageScrollIndex>0&&this.onPageIndexChanged(this.pageScrollIndex)),this.pageElManager=new fy(this.pages,r,this.scale),this.$pages=this.renderPages()}setContainerSize(t,i){t>0&&i>0&&(t!==this.containerWidth||i!==this.containerHeight)&&(this.containerWidth=t,this.containerHeight=i,this.$pages.style.width=`${this.containerWidth}px`,this.$pages.style.height=`${this.containerHeight}px`,this.scale=this._calcScale(),this.threshold=this._calcThreshold(),this.pageElManager.setScale(this.scale),this.$pages.parentElement&&this.pagesScrollTo(this.pagesScrollTop,!0))}renderPages(){const t=document.createElement("div");return t.className="page-renderer-pages-container",t.style.width=`${this.containerWidth}px`,t.style.height=`${this.containerHeight}px`,t}pagesScrollTo(t,i){if(t=ji(t,0,this.pagesIntrinsicHeight-this.containerHeight/this.scale),i||Math.abs(t-this.pagesScrollTop)>=.001){this._turnOnHWA(),this.pagesScrollTop=t;const n=this.findScrollPageIndex(),r=Math.max(n-this.threshold,0),s=Math.min(n+this.threshold,this.pages.length-1);for(let o=0;o<this.$pages.children.length;o++){const a=this.$pages.children[o],l=Number(a.dataset.index);l>=r&&l<=s||(a.remove(),o--)}for(let o=r;o<=s;o++){const a=this.pageElManager.getEl(o);a.$page.parentElement!==this.$pages&&this.$pages.appendChild(a.$page),a.translateY(this.pagesIntrinsicYs[o]-this.pagesScrollTop)}n!==this.pageScrollIndex&&(this.pageScrollIndex=n,this.onPageIndexChanged&&this.onPageIndexChanged(n))}}findScrollPageIndex(){for(let t=0;t<this.pagesIntrinsicYs.length;t++)if(this.pagesIntrinsicYs[t]+this.pages[t].height-this.pagesScrollTop>=.001)return t;return this.pagesIntrinsicYs.length-1}mount(t){t.appendChild(this.$pages),this.pagesScrollTo(this.pagesScrollTop,!0)}unmount(){this.$pages.remove()}destroy(){this.unmount(),this.onPageIndexChanged=void 0,this.pageElManager.destroy(),this._hwaTimeout&&(window.clearTimeout(this._hwaTimeout),this._hwaTimeout=NaN)}_calcScale(){return this.containerWidth/this.pagesIntrinsicWidth||1}_calcThreshold(){return ji(Math.ceil(this.containerHeight/this.scale/this.pagesMinHeight/2),1,this.pages.length)}_turnOnHWA(){this._hwaTimeout?window.clearTimeout(this._hwaTimeout):this.$pages.classList.toggle("is-hwa",!0),this._hwaTimeout=window.setTimeout(this._turnOffHWA,1e3)}}const my=30;class vy{constructor(t){this.sideEffect=new Ir,this.pagesScrollTop=t.pagesScrollTop||0,this.containerWidth=t.containerWidth||1,this.containerHeight=t.containerHeight||1,this.pagesWidth=t.pagesWidth||1,this.pagesHeight=t.pagesHeight||1,this.scale=this._calcScale(),this.scrollbarMinHeight=t.scrollbarMinHeight||my,this.scrollbarHeight=this._calcScrollbarHeight(),this.readonly=t.readonly,this.wrapClassName=t.wrapClassName,this.onDragScroll=t.onDragScroll,this.$scrollbar=this.renderScrollbar()}mount(t){t.appendChild(this.$scrollbar),this.pagesScrollTo(this.pagesScrollTop,!0)}unmount(){this.$scrollbar.remove()}setReadonly(t){this.readonly=t}setContainerSize(t,i){t>0&&i>0&&(t!==this.containerWidth||i!==this.containerHeight)&&(this.containerWidth=t,this.containerHeight=i,this.scale=this._calcScale(),this._updateScrollbarHeight(),this.$scrollbar.parentElement&&this.pagesScrollTo(this.pagesScrollTop,!0))}pagesScrollTo(t,i){if(t=ji(t,0,this.pagesHeight-this.containerHeight/this.scale),i||Math.abs(t-this.pagesScrollTop)>=.001){this.pagesScrollTop=t;const n=this.pagesScrollTop*this.scale,r=this.pagesHeight*this.scale,s=n/(r-this.containerHeight)*(this.containerHeight-this.scrollbarHeight);window.requestAnimationFrame?window.requestAnimationFrame(()=>{this.$scrollbar.style.transform=`translateY(${s}px)`}):this.$scrollbar.style.transform=`translateY(${s}px)`}}destroy(){this.unmount(),this.onDragScroll=void 0,this.sideEffect.flushAll()}renderScrollbar(){const t=document.createElement("button");t.className=this.wrapClassName("scrollbar"),t.style.minHeight=`${this.scrollbarMinHeight}px`,t.style.height=`${this.scrollbarHeight}px`;const i=n=>{if(this.readonly||n.button!=null&&n.button!==0)return;pd(n);const r=this.wrapClassName("scrollbar-dragging");t.classList.toggle(r,!0);const s=this.pagesScrollTop,{clientY:o}=hd(n),a=u=>{if(this.readonly)return;const{clientY:h}=hd(u),p=(h-o)/this.scale;Math.abs(p)>0&&this.onDragScroll&&this.onDragScroll(s+p*(this.pagesHeight*this.scale/this.containerHeight))},l=()=>{t.classList.toggle(r,!1),window.removeEventListener("mousemove",a,!0),window.removeEventListener("touchmove",a,!0),window.removeEventListener("mouseup",l,!0),window.removeEventListener("touchend",l,!0),window.removeEventListener("touchcancel",l,!0)};window.addEventListener("mousemove",a,!0),window.addEventListener("touchmove",a,!0),window.addEventListener("mouseup",l,!0),window.addEventListener("touchend",l,!0),window.addEventListener("touchcancel",l,!0)};return this.sideEffect.addEventListener(t,"mousedown",i),this.sideEffect.addEventListener(t,"touchstart",i),t}_calcScale(){return this.containerWidth/this.pagesWidth||1}_calcScrollbarHeight(){return ji(this.containerHeight/(this.pagesHeight*this.scale)*this.containerHeight,this.scrollbarMinHeight,this.containerHeight)}_updateScrollbarHeight(){const t=this._calcScrollbarHeight();Math.abs(t-this.scrollbarHeight)>.001&&(this.scrollbarHeight=t,this.$scrollbar.style.height=`${t}px`)}}const wy=window.ResizeObserver||tw,Mn=640;class yy{constructor({whiteboardView:t,readonly:i,box:n,pages:r,pageScrollTop:s=0,mountWhiteboard:o,onUserScroll:a}){this.sideEffect=new Ir,this.userScrolling=!1,this.onNewPageIndex=p=>{this.scrollToPage(p)},this.whiteboardView=t,this.readonly=i,this.box=n,this.pages=r,this.mountWhiteboard=o,this._onUserScroll=a;const l=this.debounce(()=>{this.userScrolling=!1,this._onUserScroll&&this._onUserScroll(this.pageRenderer.pagesScrollTop)},{wait:80},"debounce-updateUserScroll");this.updateUserScroll=()=>{this.userScrolling=!0,l()},this.viewer=new dd({readonly:i,box:n,pages:r,onNewPageIndex:this.onNewPageIndex});const{width:u,height:h}=this.whiteboardView.size;this.pageRenderer=new gy({pagesScrollTop:s,pages:this.pages,containerWidth:u,containerHeight:h,onPageIndexChanged:this.viewer.setPageIndex.bind(this.viewer)}),this.scrollbar=new vy({pagesScrollTop:this.pageRenderer.pagesScrollTop,containerWidth:u,containerHeight:h,pagesWidth:this.pageRenderer.pagesIntrinsicWidth,pagesHeight:this.pageRenderer.pagesIntrinsicHeight,readonly:this.readonly,wrapClassName:this.wrapClassName.bind(this),onDragScroll:p=>{this.pageScrollTo(p),this.updateUserScroll()}}),this.pageScrollStepper=new cy({start:this.pageRenderer.pagesScrollTop,onStep:p=>{this.pageScrollTo(p)}}),this.render()}mount(){this.viewer.mount(),this.setupScrollListener();const t=this.debounce(this.renderRatioHeight.bind(this),{wait:80});return this.sideEffect.add(()=>{const i=new wy(t);return i.observe(this.viewer.$content),()=>i.disconnect()}),this.sideEffect.setTimeout(()=>{this.userScrolling||this.pageScrollTo(this.pageRenderer.pagesScrollTop)},100),this}unmount(){return this.viewer.unmount(),this}setReadonly(t){this.readonly!==t&&(this.readonly=t,this.viewer.setReadonly(t),this.scrollbar.setReadonly(t))}destroy(){this.sideEffect.flushAll(),this.pageScrollStepper.destroy(),this._onUserScroll=void 0,this.unmount(),this.viewer.destroy(),this.pageRenderer.destroy(),this.scrollbar.destroy()}syncPageScrollTop(t){!this.userScrolling&&t>=0&&Math.abs(this.pageRenderer.pagesScrollTop-t)>.01&&this.pageScrollStepper.stepTo(t,this.pageRenderer.pagesScrollTop)}render(){this.pageRenderer.mount(this.viewer.$content),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.scrollbar.mount(this.viewer.$content),this.renderRatioHeight()}renderRatioHeight(){const t=this.box.absoluteHeight,i=t<=Mn;if(this.viewer.setSmallBox(i),i){const n=26/Mn,r=26/t,s=26/Mn,o=0,a=Math.max((n+s-(r+o))/2,0);if(this.box.$titleBar){const l=r+a;this.box.$titleBar.style.height=`${l*100}%`}if(this.box.$footer){const l=o+a;this.box.$footer.style.height=`${l*100}%`}}else{if(this.box.$titleBar){const n=Math.max(26/Mn,26/t);this.box.$titleBar.style.height=`${n*100}%`}if(this.box.$footer){const n=Math.max(26/Mn,26/t);this.box.$footer.style.height=`${n*100}%`}}}renderWhiteboardView(){return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view"),this.mountWhiteboard(this.$whiteboardView),this.sideEffect.addEventListener(this.$whiteboardView,"wheel",t=>{pd(t),this.readonly||(this.pageScrollTo(this.pageRenderer.pagesScrollTop+t.deltaY),this.updateUserScroll())},{passive:!1,capture:!0}),this.sideEffect.addEventListener(this.$whiteboardView,"touchmove",t=>{this.readonly||t.touches.length<=1||this.updateUserScroll()},{passive:!0,capture:!0})),this.$whiteboardView}scrollTopPageToEl(t){return t*this.pageRenderer.scale}scrollTopElToPage(t){return t/this.pageRenderer.scale}elScrollTo(t){this.pageScrollTo(this.scrollTopElToPage(t))}pageScrollTo(t){const i=this.scrollTopElToPage(this.whiteboardView.size.height/2);this.whiteboardView.moveCamera({centerY:ji(t+i,i,this.pageRenderer.pagesIntrinsicHeight-i),animationMode:"immediately"})}scrollToPage(t){if(!this.readonly&&!Number.isNaN(t)){const i=this.pageRenderer.pagesIntrinsicYs[t];i>=0&&(this.pageScrollTo(i+5/this.pageRenderer.scale),this.updateUserScroll())}}setupScrollListener(){this.sideEffect.add(()=>{const t=i=>{const{width:n,height:r}=this.whiteboardView.size;if(n<=0||r<=0)return;const s=i.centerY-this.pageRenderer.containerHeight/this.pageRenderer.scale/2;this.pageRenderer.pagesScrollTo(s),this.scrollbar.pagesScrollTo(s)};return this.whiteboardView.callbacks.on("onCameraUpdated",t),()=>this.whiteboardView.callbacks.off("onCameraUpdated",t)}),this.sideEffect.add(()=>{const t=({width:i,height:n})=>{if(i<=0||n<=0)return;this.pageRenderer.setContainerSize(i,n),this.scrollbar.setContainerSize(i,n);const{pagesIntrinsicWidth:r,pagesIntrinsicHeight:s}=this.pageRenderer;this.whiteboardView.moveCameraToContain({originX:0,originY:this.pageRenderer.pagesScrollTop,width:r,height:n/this.pageRenderer.scale,animationMode:"immediately"}),this.whiteboardView.setCameraBound({damping:1,maxContentMode:()=>this.pageRenderer.scale,minContentMode:()=>this.pageRenderer.scale,centerX:r/2,centerY:s/2,width:r,height:s})};return this.whiteboardView.callbacks.on("onSizeUpdated",t),()=>{this.whiteboardView.callbacks.off("onSizeUpdated",t)}},"whiteboard-size-update"),this.sideEffect.addEventListener(window,"keyup",t=>{if(this.readonly||!this.box.focus||this.box.minimized)return;let i=null;switch(t.key){case"PageDown":{i=this.pageRenderer.pagesScrollTop+this.pageRenderer.containerHeight/this.pageRenderer.scale;break}case"PageUp":{i=this.pageRenderer.pagesScrollTop-this.pageRenderer.containerHeight/this.pageRenderer.scale;break}case"ArrowDown":{i=this.pageRenderer.pagesScrollTop+this.pageRenderer.containerHeight/4/this.pageRenderer.scale;break}case"ArrowUp":{i=this.pageRenderer.pagesScrollTop-this.pageRenderer.containerHeight/4/this.pageRenderer.scale;break}}i!==null&&(this._onUserScroll?this._onUserScroll(i):(this.pageScrollTo(i),this.updateUserScroll()))},{capture:!0})}debounce(t,i,n){const r=Dv(t,i);return this.sideEffect.addDisposer(()=>r.cancel(),n),r}wrapClassName(t){return"netless-app-docs-viewer-static-"+t}}class xy{constructor({context:t,whiteboardView:i,box:n,pages:r}){this.sideEffect=new Ir,this.onPlayPPT=()=>{const s=this.context.getRoom();s&&s.pptNextStep()},this._scaleDocsToFitImpl=()=>{const s=this.pages[this.getPageIndex()];s&&(this.whiteboardView.moveCameraToContain({originX:-s.width/2,originY:-s.height/2,width:s.width,height:s.height,animationMode:"immediately"}),this.whiteboardView.setCameraBound({damping:1,maxContentMode:()=>this.whiteboardView.camera.scale,minContentMode:()=>this.whiteboardView.camera.scale,centerX:0,centerY:0,width:s.width,height:s.height}))},this._scaleDocsToFitDebounced=()=>{this.sideEffect.setTimeout(this._scaleDocsToFitImpl,1e3,"_scaleDocsToFitDebounced")},this.scaleDocsToFit=()=>{this._scaleDocsToFitImpl(),this._scaleDocsToFitDebounced()},this.onNewPageIndex=s=>{this.jumpToPage(s,!0)},this.context=t,this.whiteboardView=i,this.box=n,this.pages=r,this.displayer=t.getDisplayer(),this.viewer=new dd({readonly:!t.getIsWritable(),box:n,pages:r,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlayPPT}),this.render(),this.sideEffect.add(()=>{const s=o=>{this.viewer.setReadonly(!o)};return this.context.emitter.on("writableChange",s),()=>this.context.emitter.off("writableChange",s)}),this.sideEffect.add(()=>{const s=o=>{this.jumpToPage(o.index)};return this.context.emitter.on("sceneStateChange",s),()=>this.context.emitter.off("sceneStateChange",s)})}mount(){this.viewer.mount();const t=this.getPageIndex();return t!==0&&this.jumpToPage(t),this.scaleDocsToFit(),this.sideEffect.add(()=>(this.whiteboardView.callbacks.on("onSizeUpdated",this.scaleDocsToFit),()=>{this.whiteboardView.callbacks.off("onSizeUpdated",this.scaleDocsToFit)})),this}unmount(){return this.viewer.unmount(),this}destroy(){this.sideEffect.flushAll(),this.unmount(),this.viewer.destroy()}getPageIndex(){return this.displayer.state.sceneState.index}jumpToPage(t,i){var n,r;if(t=ji(t,0,this.pages.length-1),t!==this.getPageIndex()&&this.context.getIsWritable()){const s=this.context.getInitScenePath(),o=(r=(n=this.context.getScenes())==null?void 0:n[t])==null?void 0:r.name;s&&o&&this.context.setScenePath(`${s}/${o}`),this.scaleDocsToFit()}if(t!==this.viewer.pageIndex&&this.viewer.setPageIndex(t),i){const s=this.context.getRoom();if(s){const o=s.state.globalState.__pptState;s.setGlobalState({__pptState:o&&{uuid:o.uuid,pageIndex:t,disableAutoPlay:o.disableAutoPlay}})}}}render(){this.viewer.$content.appendChild(this.renderMask()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.sideEffect.addEventListener(window,"keydown",t=>{var i;if(this.box.focus)switch(t.key){case"ArrowUp":case"ArrowLeft":{this.jumpToPage(this.getPageIndex()-1,!0);break}case"ArrowRight":case"ArrowDown":{(i=this.context.getRoom())==null||i.pptNextStep();break}}})}renderMask(){if(!this.$mask){const t=document.createElement("div");t.className=this.wrapClassName("mask"),this.$mask=t;const i=document.createElement("button");i.className=this.wrapClassName("back");const n=document.createElement("button");n.className=this.wrapClassName("next")}return this.$mask}renderWhiteboardView(){return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view"),this.sideEffect.addEventListener(this.$whiteboardView,"click",t=>{var i;const n=this.context.getRoom();if(n&&n.state.memberState.currentApplianceName==="clicker"){for(let r=t.target;r;r=r.parentElement)if((i=r.classList)!=null&&i.contains("ppt-event-source"))return;n.pptNextStep()}}),this.context.mountView(this.$whiteboardView)),this.$whiteboardView}wrapClassName(t){return"netless-app-docs-viewer-dynamic-"+t}}const Lr={kind:"DocsViewer",setup(e){const t=e.getBox(),i=e.getScenes();if(!i)throw new Error("[Docs Viewer]: scenes not found.");const n=e.getView();if(!n)throw new Error("[Docs Viewer]: no whiteboard view.");const r=i.map(({ppt:s})=>s?{width:s.width,height:s.height,src:s.src,thumbnail:s.previewURL}:null).filter(s=>Boolean(s));if(r.length<=0)throw new Error("[Docs Viewer]: empty scenes.");t.mountStyles(Iv),r[0].src.startsWith("ppt")?Cy(e,n,t,r):Sy(e,n,t,r)}};function Sy(e,t,i,n){var r;t.disableCameraTransform=!e.getIsWritable();const s=new yy({whiteboardView:t,readonly:!e.getIsWritable(),box:i,pages:n,pageScrollTop:(r=e.getAttributes())==null?void 0:r.pageScrollTop,mountWhiteboard:e.mountView.bind(e),onUserScroll:o=>{var a;((a=e.getAttributes())==null?void 0:a.pageScrollTop)!==o&&!i.readonly&&e.updateAttributes(["pageScrollTop"],o)}}).mount();e.emitter.on("attributesUpdate",o=>{o&&o.pageScrollTop!=null&&s.syncPageScrollTop(o.pageScrollTop)}),e.emitter.on("writableChange",o=>{s.setReadonly(!o),t.disableCameraTransform=!o})}function Cy(e,t,i,n){t.disableCameraTransform=!0;const r=new xy({context:e,whiteboardView:t,box:i,pages:n}).mount();e.mountView(r.$whiteboardView),e.isAddApp&&t.callbacks.once("onSizeUpdated",({width:s,height:o})=>{if(n.length>0&&i.state!=="maximized"){const{width:a,height:l}=n[0],h=l/a*s-o;h!==0&&e.getIsWritable()&&e.emitter.emit("setBoxSize",{width:i.width,height:i.height+h/i.containerRect.height})}})}var ui={exports:{}},W={};/*
126
- object-assign
127
- (c) Sindre Sorhus
128
- @license MIT
129
- */var fd=Object.getOwnPropertySymbols,My=Object.prototype.hasOwnProperty,Iy=Object.prototype.propertyIsEnumerable;function by(e){if(e==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function Ay(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de",Object.getOwnPropertyNames(e)[0]==="5")return!1;for(var t={},i=0;i<10;i++)t["_"+String.fromCharCode(i)]=i;var n=Object.getOwnPropertyNames(t).map(function(s){return t[s]});if(n.join("")!=="0123456789")return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(s){r[s]=s}),Object.keys(Object.assign({},r)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}var gd=Ay()?Object.assign:function(e,t){for(var i,n=by(e),r,s=1;s<arguments.length;s++){i=Object(arguments[s]);for(var o in i)My.call(i,o)&&(n[o]=i[o]);if(fd){r=fd(i);for(var a=0;a<r.length;a++)Iy.call(i,r[a])&&(n[r[a]]=i[r[a]])}}return n};/** @license React v16.14.0
130
- * react.production.min.js
131
- *
132
- * Copyright (c) Facebook, Inc. and its affiliates.
133
- *
134
- * This source code is licensed under the MIT license found in the
135
- * LICENSE file in the root directory of this source tree.
136
- */var Go=gd,Je=typeof Symbol=="function"&&Symbol.for,In=Je?Symbol.for("react.element"):60103,Ey=Je?Symbol.for("react.portal"):60106,Ty=Je?Symbol.for("react.fragment"):60107,Ny=Je?Symbol.for("react.strict_mode"):60108,ky=Je?Symbol.for("react.profiler"):60114,Py=Je?Symbol.for("react.provider"):60109,zy=Je?Symbol.for("react.context"):60110,Dy=Je?Symbol.for("react.forward_ref"):60112,jy=Je?Symbol.for("react.suspense"):60113,Ly=Je?Symbol.for("react.memo"):60115,Vy=Je?Symbol.for("react.lazy"):60116,md=typeof Symbol=="function"&&Symbol.iterator;function bn(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,i=1;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var vd={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},wd={};function Li(e,t,i){this.props=e,this.context=t,this.refs=wd,this.updater=i||vd}Li.prototype.isReactComponent={},Li.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error(bn(85));this.updater.enqueueSetState(this,e,t,"setState")},Li.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function yd(){}yd.prototype=Li.prototype;function Xo(e,t,i){this.props=e,this.context=t,this.refs=wd,this.updater=i||vd}var Jo=Xo.prototype=new yd;Jo.constructor=Xo,Go(Jo,Li.prototype),Jo.isPureReactComponent=!0;var Ko={current:null},xd=Object.prototype.hasOwnProperty,Sd={key:!0,ref:!0,__self:!0,__source:!0};function Cd(e,t,i){var n,r={},s=null,o=null;if(t!=null)for(n in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)xd.call(t,n)&&!Sd.hasOwnProperty(n)&&(r[n]=t[n]);var a=arguments.length-2;if(a===1)r.children=i;else if(1<a){for(var l=Array(a),u=0;u<a;u++)l[u]=arguments[u+2];r.children=l}if(e&&e.defaultProps)for(n in a=e.defaultProps,a)r[n]===void 0&&(r[n]=a[n]);return{$$typeof:In,type:e,key:s,ref:o,props:r,_owner:Ko.current}}function Ry(e,t){return{$$typeof:In,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function qo(e){return typeof e=="object"&&e!==null&&e.$$typeof===In}function By(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,function(i){return t[i]})}var Md=/\/+/g,Vr=[];function Id(e,t,i,n){if(Vr.length){var r=Vr.pop();return r.result=e,r.keyPrefix=t,r.func=i,r.context=n,r.count=0,r}return{result:e,keyPrefix:t,func:i,context:n,count:0}}function bd(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>Vr.length&&Vr.push(e)}function ea(e,t,i,n){var r=typeof e;(r==="undefined"||r==="boolean")&&(e=null);var s=!1;if(e===null)s=!0;else switch(r){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case In:case Ey:s=!0}}if(s)return i(n,e,t===""?"."+ia(e,0):t),1;if(s=0,t=t===""?".":t+":",Array.isArray(e))for(var o=0;o<e.length;o++){r=e[o];var a=t+ia(r,o);s+=ea(r,a,i,n)}else if(e===null||typeof e!="object"?a=null:(a=md&&e[md]||e["@@iterator"],a=typeof a=="function"?a:null),typeof a=="function")for(e=a.call(e),o=0;!(r=e.next()).done;)r=r.value,a=t+ia(r,o++),s+=ea(r,a,i,n);else if(r==="object")throw i=""+e,Error(bn(31,i==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":i,""));return s}function ta(e,t,i){return e==null?0:ea(e,"",t,i)}function ia(e,t){return typeof e=="object"&&e!==null&&e.key!=null?By(e.key):t.toString(36)}function Oy(e,t){e.func.call(e.context,t,e.count++)}function _y(e,t,i){var n=e.result,r=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?na(e,n,i,function(s){return s}):e!=null&&(qo(e)&&(e=Ry(e,r+(!e.key||t&&t.key===e.key?"":(""+e.key).replace(Md,"$&/")+"/")+i)),n.push(e))}function na(e,t,i,n,r){var s="";i!=null&&(s=(""+i).replace(Md,"$&/")+"/"),t=Id(t,s,n,r),ta(e,_y,t),bd(t)}var Ad={current:null};function wt(){var e=Ad.current;if(e===null)throw Error(bn(321));return e}var $y={ReactCurrentDispatcher:Ad,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:Ko,IsSomeRendererActing:{current:!1},assign:Go};W.Children={map:function(e,t,i){if(e==null)return e;var n=[];return na(e,n,null,t,i),n},forEach:function(e,t,i){if(e==null)return e;t=Id(null,null,t,i),ta(e,Oy,t),bd(t)},count:function(e){return ta(e,function(){return null},null)},toArray:function(e){var t=[];return na(e,t,null,function(i){return i}),t},only:function(e){if(!qo(e))throw Error(bn(143));return e}},W.Component=Li,W.Fragment=Ty,W.Profiler=ky,W.PureComponent=Xo,W.StrictMode=Ny,W.Suspense=jy,W.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=$y,W.cloneElement=function(e,t,i){if(e==null)throw Error(bn(267,e));var n=Go({},e.props),r=e.key,s=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=Ko.current),t.key!==void 0&&(r=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)xd.call(t,l)&&!Sd.hasOwnProperty(l)&&(n[l]=t[l]===void 0&&a!==void 0?a[l]:t[l])}var l=arguments.length-2;if(l===1)n.children=i;else if(1<l){a=Array(l);for(var u=0;u<l;u++)a[u]=arguments[u+2];n.children=a}return{$$typeof:In,type:e.type,key:r,ref:s,props:n,_owner:o}},W.createContext=function(e,t){return t===void 0&&(t=null),e={$$typeof:zy,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider={$$typeof:Py,_context:e},e.Consumer=e},W.createElement=Cd,W.createFactory=function(e){var t=Cd.bind(null,e);return t.type=e,t},W.createRef=function(){return{current:null}},W.forwardRef=function(e){return{$$typeof:Dy,render:e}},W.isValidElement=qo,W.lazy=function(e){return{$$typeof:Vy,_ctor:e,_status:-1,_result:null}},W.memo=function(e,t){return{$$typeof:Ly,type:e,compare:t===void 0?null:t}},W.useCallback=function(e,t){return wt().useCallback(e,t)},W.useContext=function(e,t){return wt().useContext(e,t)},W.useDebugValue=function(){},W.useEffect=function(e,t){return wt().useEffect(e,t)},W.useImperativeHandle=function(e,t,i){return wt().useImperativeHandle(e,t,i)},W.useLayoutEffect=function(e,t){return wt().useLayoutEffect(e,t)},W.useMemo=function(e,t){return wt().useMemo(e,t)},W.useReducer=function(e,t,i){return wt().useReducer(e,t,i)},W.useRef=function(e){return wt().useRef(e)},W.useState=function(e){return wt().useState(e)},W.version="16.14.0",ui.exports=W;var _=ui.exports,Ed={exports:{}},Ue={},Td={exports:{}},Nd={};/** @license React v0.19.1
137
- * scheduler.production.min.js
138
- *
139
- * Copyright (c) Facebook, Inc. and its affiliates.
140
- *
141
- * This source code is licensed under the MIT license found in the
142
- * LICENSE file in the root directory of this source tree.
143
- */(function(e){var t,i,n,r,s;if(typeof window=="undefined"||typeof MessageChannel!="function"){var o=null,a=null,l=function(){if(o!==null)try{var M=e.unstable_now();o(!0,M),o=null}catch(v){throw setTimeout(l,0),v}},u=Date.now();e.unstable_now=function(){return Date.now()-u},t=function(M){o!==null?setTimeout(t,0,M):(o=M,setTimeout(l,0))},i=function(M,v){a=setTimeout(M,v)},n=function(){clearTimeout(a)},r=function(){return!1},s=e.unstable_forceFrameRate=function(){}}else{var h=window.performance,p=window.Date,w=window.setTimeout,C=window.clearTimeout;if(typeof console!="undefined"){var E=window.cancelAnimationFrame;typeof window.requestAnimationFrame!="function"&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),typeof E!="function"&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")}if(typeof h=="object"&&typeof h.now=="function")e.unstable_now=function(){return h.now()};else{var T=p.now();e.unstable_now=function(){return p.now()-T}}var c=!1,d=null,f=-1,g=5,m=0;r=function(){return e.unstable_now()>=m},s=function(){},e.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing framerates higher than 125 fps is not unsupported"):g=0<M?Math.floor(1e3/M):5};var x=new MessageChannel,y=x.port2;x.port1.onmessage=function(){if(d!==null){var M=e.unstable_now();m=M+g;try{d(!0,M)?y.postMessage(null):(c=!1,d=null)}catch(v){throw y.postMessage(null),v}}else c=!1},t=function(M){d=M,c||(c=!0,y.postMessage(null))},i=function(M,v){f=w(function(){M(e.unstable_now())},v)},n=function(){C(f),f=-1}}function k(M,v){var N=M.length;M.push(v);e:for(;;){var $=N-1>>>1,U=M[$];if(U!==void 0&&0<q(U,v))M[$]=v,M[N]=U,N=$;else break e}}function D(M){return M=M[0],M===void 0?null:M}function P(M){var v=M[0];if(v!==void 0){var N=M.pop();if(N!==v){M[0]=N;e:for(var $=0,U=M.length;$<U;){var _e=2*($+1)-1,Me=M[_e],Tt=_e+1,ei=M[Tt];if(Me!==void 0&&0>q(Me,N))ei!==void 0&&0>q(ei,Me)?(M[$]=ei,M[Tt]=N,$=Tt):(M[$]=Me,M[_e]=N,$=_e);else if(ei!==void 0&&0>q(ei,N))M[$]=ei,M[Tt]=N,$=Tt;else break e}}return v}return null}function q(M,v){var N=M.sortIndex-v.sortIndex;return N!==0?N:M.id-v.id}var ie=[],ne=[],tt=1,G=null,J=3,it=!1,pe=!1,Qe=!1;function Ze(M){for(var v=D(ne);v!==null;){if(v.callback===null)P(ne);else if(v.startTime<=M)P(ne),v.sortIndex=v.expirationTime,k(ie,v);else break;v=D(ne)}}function Et(M){if(Qe=!1,Ze(M),!pe)if(D(ie)!==null)pe=!0,t(Ei);else{var v=D(ne);v!==null&&i(Et,v.startTime-M)}}function Ei(M,v){pe=!1,Qe&&(Qe=!1,n()),it=!0;var N=J;try{for(Ze(v),G=D(ie);G!==null&&(!(G.expirationTime>v)||M&&!r());){var $=G.callback;if($!==null){G.callback=null,J=G.priorityLevel;var U=$(G.expirationTime<=v);v=e.unstable_now(),typeof U=="function"?G.callback=U:G===D(ie)&&P(ie),Ze(v)}else P(ie);G=D(ie)}if(G!==null)var _e=!0;else{var Me=D(ne);Me!==null&&i(Et,Me.startTime-v),_e=!1}return _e}finally{G=null,J=N,it=!1}}function qt(M){switch(M){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var rn=s;e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(M){M.callback=null},e.unstable_continueExecution=function(){pe||it||(pe=!0,t(Ei))},e.unstable_getCurrentPriorityLevel=function(){return J},e.unstable_getFirstCallbackNode=function(){return D(ie)},e.unstable_next=function(M){switch(J){case 1:case 2:case 3:var v=3;break;default:v=J}var N=J;J=v;try{return M()}finally{J=N}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=rn,e.unstable_runWithPriority=function(M,v){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var N=J;J=M;try{return v()}finally{J=N}},e.unstable_scheduleCallback=function(M,v,N){var $=e.unstable_now();if(typeof N=="object"&&N!==null){var U=N.delay;U=typeof U=="number"&&0<U?$+U:$,N=typeof N.timeout=="number"?N.timeout:qt(M)}else N=qt(M),U=$;return N=U+N,M={id:tt++,callback:v,priorityLevel:M,startTime:U,expirationTime:N,sortIndex:-1},U>$?(M.sortIndex=U,k(ne,M),D(ie)===null&&M===D(ne)&&(Qe?n():Qe=!0,i(Et,U-$))):(M.sortIndex=N,k(ie,M),pe||it||(pe=!0,t(Ei))),M},e.unstable_shouldYield=function(){var M=e.unstable_now();Ze(M);var v=D(ie);return v!==G&&G!==null&&v!==null&&v.callback!==null&&v.startTime<=M&&v.expirationTime<G.expirationTime||r()},e.unstable_wrapCallback=function(M){var v=J;return function(){var N=J;J=v;try{return M.apply(this,arguments)}finally{J=N}}}})(Nd),Td.exports=Nd;/** @license React v16.14.0
144
- * react-dom.production.min.js
145
- *
146
- * Copyright (c) Facebook, Inc. and its affiliates.
147
- *
148
- * This source code is licensed under the MIT license found in the
149
- * LICENSE file in the root directory of this source tree.
150
- */var Rr=ui.exports,Se=gd,de=Td.exports;function S(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,i=1;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}if(!Rr)throw Error(S(227));function Uy(e,t,i,n,r,s,o,a,l){var u=Array.prototype.slice.call(arguments,3);try{t.apply(i,u)}catch(h){this.onError(h)}}var An=!1,Br=null,Or=!1,ra=null,Hy={onError:function(e){An=!0,Br=e}};function Wy(e,t,i,n,r,s,o,a,l){An=!1,Br=null,Uy.apply(Hy,arguments)}function Fy(e,t,i,n,r,s,o,a,l){if(Wy.apply(this,arguments),An){if(An){var u=Br;An=!1,Br=null}else throw Error(S(198));Or||(Or=!0,ra=u)}}var sa=null,kd=null,Pd=null;function zd(e,t,i){var n=e.type||"unknown-event";e.currentTarget=Pd(i),Fy(n,t,void 0,e),e.currentTarget=null}var _r=null,Vi={};function Dd(){if(_r)for(var e in Vi){var t=Vi[e],i=_r.indexOf(e);if(!(-1<i))throw Error(S(96,e));if(!$r[i]){if(!t.extractEvents)throw Error(S(97,e));$r[i]=t,i=t.eventTypes;for(var n in i){var r=void 0,s=i[n],o=t,a=n;if(oa.hasOwnProperty(a))throw Error(S(99,a));oa[a]=s;var l=s.phasedRegistrationNames;if(l){for(r in l)l.hasOwnProperty(r)&&jd(l[r],o,a);r=!0}else s.registrationName?(jd(s.registrationName,o,a),r=!0):r=!1;if(!r)throw Error(S(98,n,e))}}}}function jd(e,t,i){if(Ri[e])throw Error(S(100,e));Ri[e]=t,aa[e]=t.eventTypes[i].dependencies}var $r=[],oa={},Ri={},aa={};function Ld(e){var t=!1,i;for(i in e)if(e.hasOwnProperty(i)){var n=e[i];if(!Vi.hasOwnProperty(i)||Vi[i]!==n){if(Vi[i])throw Error(S(102,i));Vi[i]=n,t=!0}}t&&Dd()}var Lt=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),la=null,Bi=null,Oi=null;function Vd(e){if(e=kd(e)){if(typeof la!="function")throw Error(S(280));var t=e.stateNode;t&&(t=sa(t),la(e.stateNode,e.type,t))}}function Rd(e){Bi?Oi?Oi.push(e):Oi=[e]:Bi=e}function Bd(){if(Bi){var e=Bi,t=Oi;if(Oi=Bi=null,Vd(e),t)for(e=0;e<t.length;e++)Vd(t[e])}}function ua(e,t){return e(t)}function Od(e,t,i,n,r){return e(t,i,n,r)}function ca(){}var _d=ua,ci=!1,da=!1;function ha(){(Bi!==null||Oi!==null)&&(ca(),Bd())}function $d(e,t,i){if(da)return e(t,i);da=!0;try{return _d(e,t,i)}finally{da=!1,ha()}}var Qy=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Ud=Object.prototype.hasOwnProperty,Hd={},Wd={};function Zy(e){return Ud.call(Wd,e)?!0:Ud.call(Hd,e)?!1:Qy.test(e)?Wd[e]=!0:(Hd[e]=!0,!1)}function Yy(e,t,i,n){if(i!==null&&i.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:i!==null?!i.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Gy(e,t,i,n){if(t===null||typeof t=="undefined"||Yy(e,t,i,n))return!0;if(n)return!1;if(i!==null)switch(i.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ce(e,t,i,n,r,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=r,this.mustUseProperty=i,this.propertyName=e,this.type=t,this.sanitizeURL=s}var he={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){he[e]=new Ce(e,0,!1,e,null,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];he[t]=new Ce(t,1,!1,e[1],null,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){he[e]=new Ce(e,2,!1,e.toLowerCase(),null,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){he[e]=new Ce(e,2,!1,e,null,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){he[e]=new Ce(e,3,!1,e.toLowerCase(),null,!1)}),["checked","multiple","muted","selected"].forEach(function(e){he[e]=new Ce(e,3,!0,e,null,!1)}),["capture","download"].forEach(function(e){he[e]=new Ce(e,4,!1,e,null,!1)}),["cols","rows","size","span"].forEach(function(e){he[e]=new Ce(e,6,!1,e,null,!1)}),["rowSpan","start"].forEach(function(e){he[e]=new Ce(e,5,!1,e.toLowerCase(),null,!1)});var pa=/[\-:]([a-z])/g;function fa(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(pa,fa);he[t]=new Ce(t,1,!1,e,null,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(pa,fa);he[t]=new Ce(t,1,!1,e,"http://www.w3.org/1999/xlink",!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(pa,fa);he[t]=new Ce(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1)}),["tabIndex","crossOrigin"].forEach(function(e){he[e]=new Ce(e,1,!1,e.toLowerCase(),null,!1)}),he.xlinkHref=new Ce("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0),["src","href","action","formAction"].forEach(function(e){he[e]=new Ce(e,1,!1,e.toLowerCase(),null,!0)});var Ke=Rr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;Ke.hasOwnProperty("ReactCurrentDispatcher")||(Ke.ReactCurrentDispatcher={current:null}),Ke.hasOwnProperty("ReactCurrentBatchConfig")||(Ke.ReactCurrentBatchConfig={suspense:null});function ga(e,t,i,n){var r=he.hasOwnProperty(t)?he[t]:null,s=r!==null?r.type===0:n?!1:!(!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N");s||(Gy(t,i,r,n)&&(i=null),n||r===null?Zy(t)&&(i===null?e.removeAttribute(t):e.setAttribute(t,""+i)):r.mustUseProperty?e[r.propertyName]=i===null?r.type===3?!1:"":i:(t=r.attributeName,n=r.attributeNamespace,i===null?e.removeAttribute(t):(r=r.type,i=r===3||r===4&&i===!0?"":""+i,n?e.setAttributeNS(n,t,i):e.setAttribute(t,i))))}var Xy=/^(.*)[\\\/]/,Ee=typeof Symbol=="function"&&Symbol.for,Ur=Ee?Symbol.for("react.element"):60103,_i=Ee?Symbol.for("react.portal"):60106,di=Ee?Symbol.for("react.fragment"):60107,Fd=Ee?Symbol.for("react.strict_mode"):60108,Hr=Ee?Symbol.for("react.profiler"):60114,Qd=Ee?Symbol.for("react.provider"):60109,Zd=Ee?Symbol.for("react.context"):60110,Jy=Ee?Symbol.for("react.concurrent_mode"):60111,ma=Ee?Symbol.for("react.forward_ref"):60112,Wr=Ee?Symbol.for("react.suspense"):60113,va=Ee?Symbol.for("react.suspense_list"):60120,wa=Ee?Symbol.for("react.memo"):60115,Yd=Ee?Symbol.for("react.lazy"):60116,Gd=Ee?Symbol.for("react.block"):60121,Xd=typeof Symbol=="function"&&Symbol.iterator;function En(e){return e===null||typeof e!="object"?null:(e=Xd&&e[Xd]||e["@@iterator"],typeof e=="function"?e:null)}function Ky(e){if(e._status===-1){e._status=0;var t=e._ctor;t=t(),e._result=t,t.then(function(i){e._status===0&&(i=i.default,e._status=1,e._result=i)},function(i){e._status===0&&(e._status=2,e._result=i)})}}function yt(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case di:return"Fragment";case _i:return"Portal";case Hr:return"Profiler";case Fd:return"StrictMode";case Wr:return"Suspense";case va:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Zd:return"Context.Consumer";case Qd:return"Context.Provider";case ma:var t=e.render;return t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case wa:return yt(e.type);case Gd:return yt(e.render);case Yd:if(e=e._status===1?e._result:null)return yt(e)}return null}function ya(e){var t="";do{e:switch(e.tag){case 3:case 4:case 6:case 7:case 10:case 9:var i="";break e;default:var n=e._debugOwner,r=e._debugSource,s=yt(e.type);i=null,n&&(i=yt(n.type)),n=s,s="",r?s=" (at "+r.fileName.replace(Xy,"")+":"+r.lineNumber+")":i&&(s=" (created by "+i+")"),i=`
151
- in `+(n||"Unknown")+s}t+=i,e=e.return}while(e);return t}function Vt(e){switch(typeof e){case"boolean":case"number":case"object":case"string":case"undefined":return e;default:return""}}function Jd(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function qy(e){var t=Jd(e)?"checked":"value",i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof i!="undefined"&&typeof i.get=="function"&&typeof i.set=="function"){var r=i.get,s=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(o){n=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Fr(e){e._valueTracker||(e._valueTracker=qy(e))}function Kd(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),n="";return e&&(n=Jd(e)?e.checked?"true":"false":e.value),e=n,e!==i?(t.setValue(e),!0):!1}function xa(e,t){var i=t.checked;return Se({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i!=null?i:e._wrapperState.initialChecked})}function qd(e,t){var i=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;i=Vt(t.value!=null?t.value:i),e._wrapperState={initialChecked:n,initialValue:i,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function eh(e,t){t=t.checked,t!=null&&ga(e,"checked",t,!1)}function Sa(e,t){eh(e,t);var i=Vt(t.value),n=t.type;if(i!=null)n==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+i):e.value!==""+i&&(e.value=""+i);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Ca(e,t.type,i):t.hasOwnProperty("defaultValue")&&Ca(e,t.type,Vt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function th(e,t,i){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,i||t===e.value||(e.value=t),e.defaultValue=t}i=e.name,i!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,i!==""&&(e.name=i)}function Ca(e,t,i){(t!=="number"||e.ownerDocument.activeElement!==e)&&(i==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+i&&(e.defaultValue=""+i))}function e0(e){var t="";return Rr.Children.forEach(e,function(i){i!=null&&(t+=i)}),t}function Ma(e,t){return e=Se({children:void 0},t),(t=e0(t.children))&&(e.children=t),e}function $i(e,t,i,n){if(e=e.options,t){t={};for(var r=0;r<i.length;r++)t["$"+i[r]]=!0;for(i=0;i<e.length;i++)r=t.hasOwnProperty("$"+e[i].value),e[i].selected!==r&&(e[i].selected=r),r&&n&&(e[i].defaultSelected=!0)}else{for(i=""+Vt(i),t=null,r=0;r<e.length;r++){if(e[r].value===i){e[r].selected=!0,n&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function Ia(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(S(91));return Se({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function ih(e,t){var i=t.value;if(i==null){if(i=t.children,t=t.defaultValue,i!=null){if(t!=null)throw Error(S(92));if(Array.isArray(i)){if(!(1>=i.length))throw Error(S(93));i=i[0]}t=i}t==null&&(t=""),i=t}e._wrapperState={initialValue:Vt(i)}}function nh(e,t){var i=Vt(t.value),n=Vt(t.defaultValue);i!=null&&(i=""+i,i!==e.value&&(e.value=i),t.defaultValue==null&&e.defaultValue!==i&&(e.defaultValue=i)),n!=null&&(e.defaultValue=""+n)}function rh(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}var sh={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function oh(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ba(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?oh(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Qr,ah=function(e){return typeof MSApp!="undefined"&&MSApp.execUnsafeLocalFunction?function(t,i,n,r){MSApp.execUnsafeLocalFunction(function(){return e(t,i,n,r)})}:e}(function(e,t){if(e.namespaceURI!==sh.svg||"innerHTML"in e)e.innerHTML=t;else{for(Qr=Qr||document.createElement("div"),Qr.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Qr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Tn(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}function Zr(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Ui={animationend:Zr("Animation","AnimationEnd"),animationiteration:Zr("Animation","AnimationIteration"),animationstart:Zr("Animation","AnimationStart"),transitionend:Zr("Transition","TransitionEnd")},Aa={},lh={};Lt&&(lh=document.createElement("div").style,"AnimationEvent"in window||(delete Ui.animationend.animation,delete Ui.animationiteration.animation,delete Ui.animationstart.animation),"TransitionEvent"in window||delete Ui.transitionend.transition);function Yr(e){if(Aa[e])return Aa[e];if(!Ui[e])return e;var t=Ui[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in lh)return Aa[e]=t[i];return e}var uh=Yr("animationend"),ch=Yr("animationiteration"),dh=Yr("animationstart"),hh=Yr("transitionend"),Nn="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),ph=new(typeof WeakMap=="function"?WeakMap:Map);function Ea(e){var t=ph.get(e);return t===void 0&&(t=new Map,ph.set(e,t)),t}function hi(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.effectTag&1026)!==0&&(i=t.return),e=t.return;while(e)}return t.tag===3?i:null}function fh(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function gh(e){if(hi(e)!==e)throw Error(S(188))}function t0(e){var t=e.alternate;if(!t){if(t=hi(e),t===null)throw Error(S(188));return t!==e?null:e}for(var i=e,n=t;;){var r=i.return;if(r===null)break;var s=r.alternate;if(s===null){if(n=r.return,n!==null){i=n;continue}break}if(r.child===s.child){for(s=r.child;s;){if(s===i)return gh(r),e;if(s===n)return gh(r),t;s=s.sibling}throw Error(S(188))}if(i.return!==n.return)i=r,n=s;else{for(var o=!1,a=r.child;a;){if(a===i){o=!0,i=r,n=s;break}if(a===n){o=!0,n=r,i=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===i){o=!0,i=s,n=r;break}if(a===n){o=!0,n=s,i=r;break}a=a.sibling}if(!o)throw Error(S(189))}}if(i.alternate!==n)throw Error(S(190))}if(i.tag!==3)throw Error(S(188));return i.stateNode.current===i?e:t}function mh(e){if(e=t0(e),!e)return null;for(var t=e;;){if(t.tag===5||t.tag===6)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}function Hi(e,t){if(t==null)throw Error(S(30));return e==null?t:Array.isArray(e)?Array.isArray(t)?(e.push.apply(e,t),e):(e.push(t),e):Array.isArray(t)?[e].concat(t):[e,t]}function Ta(e,t,i){Array.isArray(e)?e.forEach(t,i):e&&t.call(i,e)}var kn=null;function i0(e){if(e){var t=e._dispatchListeners,i=e._dispatchInstances;if(Array.isArray(t))for(var n=0;n<t.length&&!e.isPropagationStopped();n++)zd(e,t[n],i[n]);else t&&zd(e,t,i);e._dispatchListeners=null,e._dispatchInstances=null,e.isPersistent()||e.constructor.release(e)}}function Gr(e){if(e!==null&&(kn=Hi(kn,e)),e=kn,kn=null,e){if(Ta(e,i0),kn)throw Error(S(95));if(Or)throw e=ra,Or=!1,ra=null,e}}function Na(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}function vh(e){if(!Lt)return!1;e="on"+e;var t=e in document;return t||(t=document.createElement("div"),t.setAttribute(e,"return;"),t=typeof t[e]=="function"),t}var Xr=[];function wh(e){e.topLevelType=null,e.nativeEvent=null,e.targetInst=null,e.ancestors.length=0,10>Xr.length&&Xr.push(e)}function yh(e,t,i,n){if(Xr.length){var r=Xr.pop();return r.topLevelType=e,r.eventSystemFlags=n,r.nativeEvent=t,r.targetInst=i,r}return{topLevelType:e,eventSystemFlags:n,nativeEvent:t,targetInst:i,ancestors:[]}}function xh(e){var t=e.targetInst,i=t;do{if(!i){e.ancestors.push(i);break}var n=i;if(n.tag===3)n=n.stateNode.containerInfo;else{for(;n.return;)n=n.return;n=n.tag!==3?null:n.stateNode.containerInfo}if(!n)break;t=i.tag,t!==5&&t!==6||e.ancestors.push(i),i=On(n)}while(i);for(i=0;i<e.ancestors.length;i++){t=e.ancestors[i];var r=Na(e.nativeEvent);n=e.topLevelType;var s=e.nativeEvent,o=e.eventSystemFlags;i===0&&(o|=64);for(var a=null,l=0;l<$r.length;l++){var u=$r[l];u&&(u=u.extractEvents(n,t,s,r,o))&&(a=Hi(a,u))}Gr(a)}}function ka(e,t,i){if(!i.has(e)){switch(e){case"scroll":Vn(t,"scroll",!0);break;case"focus":case"blur":Vn(t,"focus",!0),Vn(t,"blur",!0),i.set("blur",null),i.set("focus",null);break;case"cancel":case"close":vh(e)&&Vn(t,e,!0);break;case"invalid":case"submit":case"reset":break;default:Nn.indexOf(e)===-1&&X(e,t)}i.set(e,null)}}var Sh,Pa,Ch,za=!1,lt=[],Rt=null,Bt=null,Ot=null,Pn=new Map,zn=new Map,Dn=[],Da="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput close cancel copy cut paste click change contextmenu reset submit".split(" "),n0="focus blur dragenter dragleave mouseover mouseout pointerover pointerout gotpointercapture lostpointercapture".split(" ");function r0(e,t){var i=Ea(t);Da.forEach(function(n){ka(n,t,i)}),n0.forEach(function(n){ka(n,t,i)})}function ja(e,t,i,n,r){return{blockedOn:e,topLevelType:t,eventSystemFlags:i|32,nativeEvent:r,container:n}}function Mh(e,t){switch(e){case"focus":case"blur":Rt=null;break;case"dragenter":case"dragleave":Bt=null;break;case"mouseover":case"mouseout":Ot=null;break;case"pointerover":case"pointerout":Pn.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":zn.delete(t.pointerId)}}function jn(e,t,i,n,r,s){return e===null||e.nativeEvent!==s?(e=ja(t,i,n,r,s),t!==null&&(t=_n(t),t!==null&&Pa(t)),e):(e.eventSystemFlags|=n,e)}function s0(e,t,i,n,r){switch(t){case"focus":return Rt=jn(Rt,e,t,i,n,r),!0;case"dragenter":return Bt=jn(Bt,e,t,i,n,r),!0;case"mouseover":return Ot=jn(Ot,e,t,i,n,r),!0;case"pointerover":var s=r.pointerId;return Pn.set(s,jn(Pn.get(s)||null,e,t,i,n,r)),!0;case"gotpointercapture":return s=r.pointerId,zn.set(s,jn(zn.get(s)||null,e,t,i,n,r)),!0}return!1}function o0(e){var t=On(e.target);if(t!==null){var i=hi(t);if(i!==null){if(t=i.tag,t===13){if(t=fh(i),t!==null){e.blockedOn=t,de.unstable_runWithPriority(e.priority,function(){Ch(i)});return}}else if(t===3&&i.stateNode.hydrate){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Jr(e){if(e.blockedOn!==null)return!1;var t=Ba(e.topLevelType,e.eventSystemFlags,e.container,e.nativeEvent);if(t!==null){var i=_n(t);return i!==null&&Pa(i),e.blockedOn=t,!1}return!0}function Ih(e,t,i){Jr(e)&&i.delete(t)}function a0(){for(za=!1;0<lt.length;){var e=lt[0];if(e.blockedOn!==null){e=_n(e.blockedOn),e!==null&&Sh(e);break}var t=Ba(e.topLevelType,e.eventSystemFlags,e.container,e.nativeEvent);t!==null?e.blockedOn=t:lt.shift()}Rt!==null&&Jr(Rt)&&(Rt=null),Bt!==null&&Jr(Bt)&&(Bt=null),Ot!==null&&Jr(Ot)&&(Ot=null),Pn.forEach(Ih),zn.forEach(Ih)}function Ln(e,t){e.blockedOn===t&&(e.blockedOn=null,za||(za=!0,de.unstable_scheduleCallback(de.unstable_NormalPriority,a0)))}function bh(e){function t(r){return Ln(r,e)}if(0<lt.length){Ln(lt[0],e);for(var i=1;i<lt.length;i++){var n=lt[i];n.blockedOn===e&&(n.blockedOn=null)}}for(Rt!==null&&Ln(Rt,e),Bt!==null&&Ln(Bt,e),Ot!==null&&Ln(Ot,e),Pn.forEach(t),zn.forEach(t),i=0;i<Dn.length;i++)n=Dn[i],n.blockedOn===e&&(n.blockedOn=null);for(;0<Dn.length&&(i=Dn[0],i.blockedOn===null);)o0(i),i.blockedOn===null&&Dn.shift()}var Ah={},Eh=new Map,La=new Map,l0=["abort","abort",uh,"animationEnd",ch,"animationIteration",dh,"animationStart","canplay","canPlay","canplaythrough","canPlayThrough","durationchange","durationChange","emptied","emptied","encrypted","encrypted","ended","ended","error","error","gotpointercapture","gotPointerCapture","load","load","loadeddata","loadedData","loadedmetadata","loadedMetadata","loadstart","loadStart","lostpointercapture","lostPointerCapture","playing","playing","progress","progress","seeking","seeking","stalled","stalled","suspend","suspend","timeupdate","timeUpdate",hh,"transitionEnd","waiting","waiting"];function Va(e,t){for(var i=0;i<e.length;i+=2){var n=e[i],r=e[i+1],s="on"+(r[0].toUpperCase()+r.slice(1));s={phasedRegistrationNames:{bubbled:s,captured:s+"Capture"},dependencies:[n],eventPriority:t},La.set(n,t),Eh.set(n,s),Ah[r]=s}}Va("blur blur cancel cancel click click close close contextmenu contextMenu copy copy cut cut auxclick auxClick dblclick doubleClick dragend dragEnd dragstart dragStart drop drop focus focus input input invalid invalid keydown keyDown keypress keyPress keyup keyUp mousedown mouseDown mouseup mouseUp paste paste pause pause play play pointercancel pointerCancel pointerdown pointerDown pointerup pointerUp ratechange rateChange reset reset seeked seeked submit submit touchcancel touchCancel touchend touchEnd touchstart touchStart volumechange volumeChange".split(" "),0),Va("drag drag dragenter dragEnter dragexit dragExit dragleave dragLeave dragover dragOver mousemove mouseMove mouseout mouseOut mouseover mouseOver pointermove pointerMove pointerout pointerOut pointerover pointerOver scroll scroll toggle toggle touchmove touchMove wheel wheel".split(" "),1),Va(l0,2);for(var Th="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),Ra=0;Ra<Th.length;Ra++)La.set(Th[Ra],0);var u0=de.unstable_UserBlockingPriority,c0=de.unstable_runWithPriority,Kr=!0;function X(e,t){Vn(t,e,!1)}function Vn(e,t,i){var n=La.get(t);switch(n===void 0?2:n){case 0:n=d0.bind(null,t,1,e);break;case 1:n=h0.bind(null,t,1,e);break;default:n=qr.bind(null,t,1,e)}i?e.addEventListener(t,n,!0):e.addEventListener(t,n,!1)}function d0(e,t,i,n){ci||ca();var r=qr,s=ci;ci=!0;try{Od(r,e,t,i,n)}finally{(ci=s)||ha()}}function h0(e,t,i,n){c0(u0,qr.bind(null,e,t,i,n))}function qr(e,t,i,n){if(Kr)if(0<lt.length&&-1<Da.indexOf(e))e=ja(null,e,t,i,n),lt.push(e);else{var r=Ba(e,t,i,n);if(r===null)Mh(e,n);else if(-1<Da.indexOf(e))e=ja(r,e,t,i,n),lt.push(e);else if(!s0(r,e,t,i,n)){Mh(e,n),e=yh(e,n,null,t);try{$d(xh,e)}finally{wh(e)}}}}function Ba(e,t,i,n){if(i=Na(n),i=On(i),i!==null){var r=hi(i);if(r===null)i=null;else{var s=r.tag;if(s===13){if(i=fh(r),i!==null)return i;i=null}else if(s===3){if(r.stateNode.hydrate)return r.tag===3?r.stateNode.containerInfo:null;i=null}else r!==i&&(i=null)}}e=yh(e,n,i,t);try{$d(xh,e)}finally{wh(e)}return null}var Rn={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},p0=["Webkit","ms","Moz","O"];Object.keys(Rn).forEach(function(e){p0.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Rn[t]=Rn[e]})});function Nh(e,t,i){return t==null||typeof t=="boolean"||t===""?"":i||typeof t!="number"||t===0||Rn.hasOwnProperty(e)&&Rn[e]?(""+t).trim():t+"px"}function kh(e,t){e=e.style;for(var i in t)if(t.hasOwnProperty(i)){var n=i.indexOf("--")===0,r=Nh(i,t[i],n);i==="float"&&(i="cssFloat"),n?e.setProperty(i,r):e[i]=r}}var f0=Se({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Oa(e,t){if(t){if(f0[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(S(137,e,""));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(S(60));if(!(typeof t.dangerouslySetInnerHTML=="object"&&"__html"in t.dangerouslySetInnerHTML))throw Error(S(61))}if(t.style!=null&&typeof t.style!="object")throw Error(S(62,""))}}function _a(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ph=sh.html;function xt(e,t){e=e.nodeType===9||e.nodeType===11?e:e.ownerDocument;var i=Ea(e);t=aa[t];for(var n=0;n<t.length;n++)ka(t[n],e,i)}function es(){}function $a(e){if(e=e||(typeof document!="undefined"?document:void 0),typeof e=="undefined")return null;try{return e.activeElement||e.body}catch{return e.body}}function zh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Dh(e,t){var i=zh(e);e=0;for(var n;i;){if(i.nodeType===3){if(n=e+i.textContent.length,e<=t&&n>=t)return{node:i,offset:t-e};e=n}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=zh(i)}}function jh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?jh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Lh(){for(var e=window,t=$a();t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=$a(e.document)}return t}function Ua(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Vh="$",Rh="/$",Ha="$?",Wa="$!",Fa=null,Qa=null;function Bh(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function Za(e,t){return e==="textarea"||e==="option"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Ya=typeof setTimeout=="function"?setTimeout:void 0,g0=typeof clearTimeout=="function"?clearTimeout:void 0;function Wi(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break}return e}function Oh(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i===Vh||i===Wa||i===Ha){if(t===0)return e;t--}else i===Rh&&t++}e=e.previousSibling}return null}var Ga=Math.random().toString(36).slice(2),_t="__reactInternalInstance$"+Ga,ts="__reactEventHandlers$"+Ga,Bn="__reactContainere$"+Ga;function On(e){var t=e[_t];if(t)return t;for(var i=e.parentNode;i;){if(t=i[Bn]||i[_t]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Oh(e);e!==null;){if(i=e[_t])return i;e=Oh(e)}return t}e=i,i=e.parentNode}return null}function _n(e){return e=e[_t]||e[Bn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function pi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(S(33))}function Xa(e){return e[ts]||null}function St(e){do e=e.return;while(e&&e.tag!==5);return e||null}function _h(e,t){var i=e.stateNode;if(!i)return null;var n=sa(i);if(!n)return null;i=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(S(231,t,typeof i));return i}function $h(e,t,i){(t=_h(e,i.dispatchConfig.phasedRegistrationNames[t]))&&(i._dispatchListeners=Hi(i._dispatchListeners,t),i._dispatchInstances=Hi(i._dispatchInstances,e))}function m0(e){if(e&&e.dispatchConfig.phasedRegistrationNames){for(var t=e._targetInst,i=[];t;)i.push(t),t=St(t);for(t=i.length;0<t--;)$h(i[t],"captured",e);for(t=0;t<i.length;t++)$h(i[t],"bubbled",e)}}function Ja(e,t,i){e&&i&&i.dispatchConfig.registrationName&&(t=_h(e,i.dispatchConfig.registrationName))&&(i._dispatchListeners=Hi(i._dispatchListeners,t),i._dispatchInstances=Hi(i._dispatchInstances,e))}function v0(e){e&&e.dispatchConfig.registrationName&&Ja(e._targetInst,null,e)}function Fi(e){Ta(e,m0)}var $t=null,Ka=null,is=null;function Uh(){if(is)return is;var e,t=Ka,i=t.length,n,r="value"in $t?$t.value:$t.textContent,s=r.length;for(e=0;e<i&&t[e]===r[e];e++);var o=i-e;for(n=1;n<=o&&t[i-n]===r[s-n];n++);return is=r.slice(e,1<n?1-n:void 0)}function ns(){return!0}function rs(){return!1}function je(e,t,i,n){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=i,e=this.constructor.Interface;for(var r in e)e.hasOwnProperty(r)&&((t=e[r])?this[r]=t(i):r==="target"?this.target=n:this[r]=i[r]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?ns:rs,this.isPropagationStopped=rs,this}Se(je.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!="unknown"&&(e.returnValue=!1),this.isDefaultPrevented=ns)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!="unknown"&&(e.cancelBubble=!0),this.isPropagationStopped=ns)},persist:function(){this.isPersistent=ns},isPersistent:rs,destructor:function(){var e=this.constructor.Interface,t;for(t in e)this[t]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefaultPrevented=rs,this._dispatchInstances=this._dispatchListeners=null}}),je.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null},je.extend=function(e){function t(){}function i(){return n.apply(this,arguments)}var n=this;t.prototype=n.prototype;var r=new t;return Se(r,i.prototype),i.prototype=r,i.prototype.constructor=i,i.Interface=Se({},n.Interface,e),i.extend=n.extend,Hh(i),i},Hh(je);function w0(e,t,i,n){if(this.eventPool.length){var r=this.eventPool.pop();return this.call(r,e,t,i,n),r}return new this(e,t,i,n)}function y0(e){if(!(e instanceof this))throw Error(S(279));e.destructor(),10>this.eventPool.length&&this.eventPool.push(e)}function Hh(e){e.eventPool=[],e.getPooled=w0,e.release=y0}var x0=je.extend({data:null}),S0=je.extend({data:null}),C0=[9,13,27,32],qa=Lt&&"CompositionEvent"in window,$n=null;Lt&&"documentMode"in document&&($n=document.documentMode);var M0=Lt&&"TextEvent"in window&&!$n,Wh=Lt&&(!qa||$n&&8<$n&&11>=$n),Fh=String.fromCharCode(32),Ct={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["compositionend","keypress","textInput","paste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"blur compositionend keydown keypress keyup mousedown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:"blur compositionstart keydown keypress keyup mousedown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"blur compositionupdate keydown keypress keyup mousedown".split(" ")}},Qh=!1;function Zh(e,t){switch(e){case"keyup":return C0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function Yh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Qi=!1;function I0(e,t){switch(e){case"compositionend":return Yh(t);case"keypress":return t.which!==32?null:(Qh=!0,Fh);case"textInput":return e=t.data,e===Fh&&Qh?null:e;default:return null}}function b0(e,t){if(Qi)return e==="compositionend"||!qa&&Zh(e,t)?(e=Uh(),is=Ka=$t=null,Qi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Wh&&t.locale!=="ko"?null:t.data;default:return null}}var A0={eventTypes:Ct,extractEvents:function(e,t,i,n){var r;if(qa)e:{switch(e){case"compositionstart":var s=Ct.compositionStart;break e;case"compositionend":s=Ct.compositionEnd;break e;case"compositionupdate":s=Ct.compositionUpdate;break e}s=void 0}else Qi?Zh(e,i)&&(s=Ct.compositionEnd):e==="keydown"&&i.keyCode===229&&(s=Ct.compositionStart);return s?(Wh&&i.locale!=="ko"&&(Qi||s!==Ct.compositionStart?s===Ct.compositionEnd&&Qi&&(r=Uh()):($t=n,Ka="value"in $t?$t.value:$t.textContent,Qi=!0)),s=x0.getPooled(s,t,i,n),r?s.data=r:(r=Yh(i),r!==null&&(s.data=r)),Fi(s),r=s):r=null,(e=M0?I0(e,i):b0(e,i))?(t=S0.getPooled(Ct.beforeInput,t,i,n),t.data=e,Fi(t)):t=null,r===null?t:t===null?r:[r,t]}},E0={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Gh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!E0[e.type]:t==="textarea"}var Xh={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"blur change click focus input keydown keyup selectionchange".split(" ")}};function Jh(e,t,i){return e=je.getPooled(Xh.change,e,t,i),e.type="change",Rd(i),Fi(e),e}var Un=null,Hn=null;function T0(e){Gr(e)}function ss(e){var t=pi(e);if(Kd(t))return e}function N0(e,t){if(e==="change")return t}var el=!1;Lt&&(el=vh("input")&&(!document.documentMode||9<document.documentMode));function Kh(){Un&&(Un.detachEvent("onpropertychange",qh),Hn=Un=null)}function qh(e){if(e.propertyName==="value"&&ss(Hn))if(e=Jh(Hn,e,Na(e)),ci)Gr(e);else{ci=!0;try{ua(T0,e)}finally{ci=!1,ha()}}}function k0(e,t,i){e==="focus"?(Kh(),Un=t,Hn=i,Un.attachEvent("onpropertychange",qh)):e==="blur"&&Kh()}function P0(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ss(Hn)}function z0(e,t){if(e==="click")return ss(t)}function D0(e,t){if(e==="input"||e==="change")return ss(t)}var j0={eventTypes:Xh,_isInputEventSupported:el,extractEvents:function(e,t,i,n){var r=t?pi(t):window,s=r.nodeName&&r.nodeName.toLowerCase();if(s==="select"||s==="input"&&r.type==="file")var o=N0;else if(Gh(r))if(el)o=D0;else{o=P0;var a=k0}else(s=r.nodeName)&&s.toLowerCase()==="input"&&(r.type==="checkbox"||r.type==="radio")&&(o=z0);if(o&&(o=o(e,t)))return Jh(o,i,n);a&&a(e,r,t),e==="blur"&&(e=r._wrapperState)&&e.controlled&&r.type==="number"&&Ca(r,"number",r.value)}},Wn=je.extend({view:null,detail:null}),L0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function V0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=L0[e])?!!t[e]:!1}function tl(){return V0}var ep=0,tp=0,ip=!1,np=!1,Fn=Wn.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:tl,button:null,buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)},movementX:function(e){if("movementX"in e)return e.movementX;var t=ep;return ep=e.screenX,ip?e.type==="mousemove"?e.screenX-t:0:(ip=!0,0)},movementY:function(e){if("movementY"in e)return e.movementY;var t=tp;return tp=e.screenY,np?e.type==="mousemove"?e.screenY-t:0:(np=!0,0)}}),rp=Fn.extend({pointerId:null,width:null,height:null,pressure:null,tangentialPressure:null,tiltX:null,tiltY:null,twist:null,pointerType:null,isPrimary:null}),Qn={mouseEnter:{registrationName:"onMouseEnter",dependencies:["mouseout","mouseover"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["mouseout","mouseover"]},pointerEnter:{registrationName:"onPointerEnter",dependencies:["pointerout","pointerover"]},pointerLeave:{registrationName:"onPointerLeave",dependencies:["pointerout","pointerover"]}},R0={eventTypes:Qn,extractEvents:function(e,t,i,n,r){var s=e==="mouseover"||e==="pointerover",o=e==="mouseout"||e==="pointerout";if(s&&(r&32)===0&&(i.relatedTarget||i.fromElement)||!o&&!s)return null;if(s=n.window===n?n:(s=n.ownerDocument)?s.defaultView||s.parentWindow:window,o){if(o=t,t=(t=i.relatedTarget||i.toElement)?On(t):null,t!==null){var a=hi(t);(t!==a||t.tag!==5&&t.tag!==6)&&(t=null)}}else o=null;if(o===t)return null;if(e==="mouseout"||e==="mouseover")var l=Fn,u=Qn.mouseLeave,h=Qn.mouseEnter,p="mouse";else(e==="pointerout"||e==="pointerover")&&(l=rp,u=Qn.pointerLeave,h=Qn.pointerEnter,p="pointer");if(e=o==null?s:pi(o),s=t==null?s:pi(t),u=l.getPooled(u,o,i,n),u.type=p+"leave",u.target=e,u.relatedTarget=s,i=l.getPooled(h,t,i,n),i.type=p+"enter",i.target=s,i.relatedTarget=e,n=o,p=t,n&&p)e:{for(l=n,h=p,o=0,e=l;e;e=St(e))o++;for(e=0,t=h;t;t=St(t))e++;for(;0<o-e;)l=St(l),o--;for(;0<e-o;)h=St(h),e--;for(;o--;){if(l===h||l===h.alternate)break e;l=St(l),h=St(h)}l=null}else l=null;for(h=l,l=[];n&&n!==h&&(o=n.alternate,!(o!==null&&o===h));)l.push(n),n=St(n);for(n=[];p&&p!==h&&(o=p.alternate,!(o!==null&&o===h));)n.push(p),p=St(p);for(p=0;p<l.length;p++)Ja(l[p],"bubbled",u);for(p=n.length;0<p--;)Ja(n[p],"captured",i);return(r&64)===0?[u]:[u,i]}};function B0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var fi=typeof Object.is=="function"?Object.is:B0,O0=Object.prototype.hasOwnProperty;function Zn(e,t){if(fi(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),n=Object.keys(t);if(i.length!==n.length)return!1;for(n=0;n<i.length;n++)if(!O0.call(t,i[n])||!fi(e[i[n]],t[i[n]]))return!1;return!0}var _0=Lt&&"documentMode"in document&&11>=document.documentMode,sp={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},Zi=null,il=null,Yn=null,nl=!1;function op(e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;return nl||Zi==null||Zi!==$a(i)?null:(i=Zi,"selectionStart"in i&&Ua(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Yn&&Zn(Yn,i)?null:(Yn=i,e=je.getPooled(sp.select,il,e,t),e.type="select",e.target=Zi,Fi(e),e))}var $0={eventTypes:sp,extractEvents:function(e,t,i,n,r,s){if(r=s||(n.window===n?n.document:n.nodeType===9?n:n.ownerDocument),!(s=!r)){e:{r=Ea(r),s=aa.onSelect;for(var o=0;o<s.length;o++)if(!r.has(s[o])){r=!1;break e}r=!0}s=!r}if(s)return null;switch(r=t?pi(t):window,e){case"focus":(Gh(r)||r.contentEditable==="true")&&(Zi=r,il=t,Yn=null);break;case"blur":Yn=il=Zi=null;break;case"mousedown":nl=!0;break;case"contextmenu":case"mouseup":case"dragend":return nl=!1,op(i,n);case"selectionchange":if(_0)break;case"keydown":case"keyup":return op(i,n)}return null}},U0=je.extend({animationName:null,elapsedTime:null,pseudoElement:null}),H0=je.extend({clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),W0=Wn.extend({relatedTarget:null});function os(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}var F0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Q0={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Z0=Wn.extend({key:function(e){if(e.key){var t=F0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=os(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Q0[e.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:tl,charCode:function(e){return e.type==="keypress"?os(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?os(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Y0=Fn.extend({dataTransfer:null}),G0=Wn.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:tl}),X0=je.extend({propertyName:null,elapsedTime:null,pseudoElement:null}),J0=Fn.extend({deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null}),K0={eventTypes:Ah,extractEvents:function(e,t,i,n){var r=Eh.get(e);if(!r)return null;switch(e){case"keypress":if(os(i)===0)return null;case"keydown":case"keyup":e=Z0;break;case"blur":case"focus":e=W0;break;case"click":if(i.button===2)return null;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":e=Fn;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":e=Y0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":e=G0;break;case uh:case ch:case dh:e=U0;break;case hh:e=X0;break;case"scroll":e=Wn;break;case"wheel":e=J0;break;case"copy":case"cut":case"paste":e=H0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":e=rp;break;default:e=je}return t=e.getPooled(r,t,i,n),Fi(t),t}};if(_r)throw Error(S(101));_r=Array.prototype.slice.call("ResponderEventPlugin SimpleEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" ")),Dd();var q0=_n;sa=Xa,kd=q0,Pd=pi,Ld({SimpleEventPlugin:K0,EnterLeaveEventPlugin:R0,ChangeEventPlugin:j0,SelectEventPlugin:$0,BeforeInputEventPlugin:A0});var rl=[],Yi=-1;function Y(e){0>Yi||(e.current=rl[Yi],rl[Yi]=null,Yi--)}function te(e,t){Yi++,rl[Yi]=e.current,e.current=t}var Ut={},ge={current:Ut},Te={current:!1},gi=Ut;function Gi(e,t){var i=e.type.contextTypes;if(!i)return Ut;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in i)r[s]=t[s];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=r),r}function Ne(e){return e=e.childContextTypes,e!=null}function as(){Y(Te),Y(ge)}function ap(e,t,i){if(ge.current!==Ut)throw Error(S(168));te(ge,t),te(Te,i)}function lp(e,t,i){var n=e.stateNode;if(e=t.childContextTypes,typeof n.getChildContext!="function")return i;n=n.getChildContext();for(var r in n)if(!(r in e))throw Error(S(108,yt(t)||"Unknown",r));return Se({},i,{},n)}function ls(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ut,gi=ge.current,te(ge,e),te(Te,Te.current),!0}function up(e,t,i){var n=e.stateNode;if(!n)throw Error(S(169));i?(e=lp(e,t,gi),n.__reactInternalMemoizedMergedChildContext=e,Y(Te),Y(ge),te(ge,e)):Y(Te),te(Te,i)}var ex=de.unstable_runWithPriority,sl=de.unstable_scheduleCallback,cp=de.unstable_cancelCallback,dp=de.unstable_requestPaint,ol=de.unstable_now,tx=de.unstable_getCurrentPriorityLevel,us=de.unstable_ImmediatePriority,hp=de.unstable_UserBlockingPriority,pp=de.unstable_NormalPriority,fp=de.unstable_LowPriority,gp=de.unstable_IdlePriority,mp={},ix=de.unstable_shouldYield,nx=dp!==void 0?dp:function(){},Mt=null,cs=null,al=!1,vp=ol(),He=1e4>vp?ol:function(){return ol()-vp};function ds(){switch(tx()){case us:return 99;case hp:return 98;case pp:return 97;case fp:return 96;case gp:return 95;default:throw Error(S(332))}}function wp(e){switch(e){case 99:return us;case 98:return hp;case 97:return pp;case 96:return fp;case 95:return gp;default:throw Error(S(332))}}function Ht(e,t){return e=wp(e),ex(e,t)}function yp(e,t,i){return e=wp(e),sl(e,t,i)}function xp(e){return Mt===null?(Mt=[e],cs=sl(us,Sp)):Mt.push(e),mp}function ut(){if(cs!==null){var e=cs;cs=null,cp(e)}Sp()}function Sp(){if(!al&&Mt!==null){al=!0;var e=0;try{var t=Mt;Ht(99,function(){for(;e<t.length;e++){var i=t[e];do i=i(!0);while(i!==null)}}),Mt=null}catch(i){throw Mt!==null&&(Mt=Mt.slice(e+1)),sl(us,ut),i}finally{al=!1}}}function hs(e,t,i){return i/=10,1073741821-(((1073741821-e+t/10)/i|0)+1)*i}function qe(e,t){if(e&&e.defaultProps){t=Se({},t),e=e.defaultProps;for(var i in e)t[i]===void 0&&(t[i]=e[i])}return t}var ps={current:null},fs=null,Xi=null,gs=null;function ll(){gs=Xi=fs=null}function ul(e){var t=ps.current;Y(ps),e.type._context._currentValue=t}function Cp(e,t){for(;e!==null;){var i=e.alternate;if(e.childExpirationTime<t)e.childExpirationTime=t,i!==null&&i.childExpirationTime<t&&(i.childExpirationTime=t);else if(i!==null&&i.childExpirationTime<t)i.childExpirationTime=t;else break;e=e.return}}function Ji(e,t){fs=e,gs=Xi=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.expirationTime>=t&&(dt=!0),e.firstContext=null)}function We(e,t){if(gs!==e&&t!==!1&&t!==0)if((typeof t!="number"||t===1073741823)&&(gs=e,t=1073741823),t={context:e,observedBits:t,next:null},Xi===null){if(fs===null)throw Error(S(308));Xi=t,fs.dependencies={expirationTime:0,firstContext:t,responders:null}}else Xi=Xi.next=t;return e._currentValue}var Wt=!1;function cl(e){e.updateQueue={baseState:e.memoizedState,baseQueue:null,shared:{pending:null},effects:null}}function dl(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,baseQueue:e.baseQueue,shared:e.shared,effects:e.effects})}function Ft(e,t){return e={expirationTime:e,suspenseConfig:t,tag:0,payload:null,callback:null,next:null},e.next=e}function Qt(e,t){if(e=e.updateQueue,e!==null){e=e.shared;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}}function Mp(e,t){var i=e.alternate;i!==null&&dl(i,e),e=e.updateQueue,i=e.baseQueue,i===null?(e.baseQueue=t.next=t,t.next=t):(t.next=i.next,i.next=t)}function Gn(e,t,i,n){var r=e.updateQueue;Wt=!1;var s=r.baseQueue,o=r.shared.pending;if(o!==null){if(s!==null){var a=s.next;s.next=o.next,o.next=a}s=o,r.shared.pending=null,a=e.alternate,a!==null&&(a=a.updateQueue,a!==null&&(a.baseQueue=o))}if(s!==null){a=s.next;var l=r.baseState,u=0,h=null,p=null,w=null;if(a!==null){var C=a;do{if(o=C.expirationTime,o<n){var E={expirationTime:C.expirationTime,suspenseConfig:C.suspenseConfig,tag:C.tag,payload:C.payload,callback:C.callback,next:null};w===null?(p=w=E,h=l):w=w.next=E,o>u&&(u=o)}else{w!==null&&(w=w.next={expirationTime:1073741823,suspenseConfig:C.suspenseConfig,tag:C.tag,payload:C.payload,callback:C.callback,next:null}),xf(o,C.suspenseConfig);e:{var T=e,c=C;switch(o=t,E=i,c.tag){case 1:if(T=c.payload,typeof T=="function"){l=T.call(E,l,o);break e}l=T;break e;case 3:T.effectTag=T.effectTag&-4097|64;case 0:if(T=c.payload,o=typeof T=="function"?T.call(E,l,o):T,o==null)break e;l=Se({},l,o);break e;case 2:Wt=!0}}C.callback!==null&&(e.effectTag|=32,o=r.effects,o===null?r.effects=[C]:o.push(C))}if(C=C.next,C===null||C===a){if(o=r.shared.pending,o===null)break;C=s.next=o.next,o.next=a,r.baseQueue=s=o,r.shared.pending=null}}while(1)}w===null?h=l:w.next=p,r.baseState=h,r.baseQueue=w,Us(u),e.expirationTime=u,e.memoizedState=l}}function Ip(e,t,i){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var n=e[t],r=n.callback;if(r!==null){if(n.callback=null,n=r,r=i,typeof n!="function")throw Error(S(191,n));n.call(r)}}}var Xn=Ke.ReactCurrentBatchConfig,bp=new Rr.Component().refs;function ms(e,t,i,n){t=e.memoizedState,i=i(n,t),i=i==null?t:Se({},t,i),e.memoizedState=i,e.expirationTime===0&&(e.updateQueue.baseState=i)}var vs={isMounted:function(e){return(e=e._reactInternalFiber)?hi(e)===e:!1},enqueueSetState:function(e,t,i){e=e._reactInternalFiber;var n=pt(),r=Xn.suspense;n=Si(n,e,r),r=Ft(n,r),r.payload=t,i!=null&&(r.callback=i),Qt(e,r),Xt(e,n)},enqueueReplaceState:function(e,t,i){e=e._reactInternalFiber;var n=pt(),r=Xn.suspense;n=Si(n,e,r),r=Ft(n,r),r.tag=1,r.payload=t,i!=null&&(r.callback=i),Qt(e,r),Xt(e,n)},enqueueForceUpdate:function(e,t){e=e._reactInternalFiber;var i=pt(),n=Xn.suspense;i=Si(i,e,n),n=Ft(i,n),n.tag=2,t!=null&&(n.callback=t),Qt(e,n),Xt(e,i)}};function Ap(e,t,i,n,r,s,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,s,o):t.prototype&&t.prototype.isPureReactComponent?!Zn(i,n)||!Zn(r,s):!0}function Ep(e,t,i){var n=!1,r=Ut,s=t.contextType;return typeof s=="object"&&s!==null?s=We(s):(r=Ne(t)?gi:ge.current,n=t.contextTypes,s=(n=n!=null)?Gi(e,r):Ut),t=new t(i,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=vs,e.stateNode=t,t._reactInternalFiber=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=r,e.__reactInternalMemoizedMaskedChildContext=s),t}function Tp(e,t,i,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,n),t.state!==e&&vs.enqueueReplaceState(t,t.state,null)}function hl(e,t,i,n){var r=e.stateNode;r.props=i,r.state=e.memoizedState,r.refs=bp,cl(e);var s=t.contextType;typeof s=="object"&&s!==null?r.context=We(s):(s=Ne(t)?gi:ge.current,r.context=Gi(e,s)),Gn(e,i,r,n),r.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(ms(e,t,s,i),r.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(t=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),t!==r.state&&vs.enqueueReplaceState(r,r.state,null),Gn(e,i,r,n),r.state=e.memoizedState),typeof r.componentDidMount=="function"&&(e.effectTag|=4)}var ws=Array.isArray;function Jn(e,t,i){if(e=i.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(S(309));var n=i.stateNode}if(!n)throw Error(S(147,e));var r=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===r?t.ref:(t=function(s){var o=n.refs;o===bp&&(o=n.refs={}),s===null?delete o[r]:o[r]=s},t._stringRef=r,t)}if(typeof e!="string")throw Error(S(284));if(!i._owner)throw Error(S(290,e))}return e}function ys(e,t){if(e.type!=="textarea")throw Error(S(31,Object.prototype.toString.call(t)==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":t,""))}function Np(e){function t(c,d){if(e){var f=c.lastEffect;f!==null?(f.nextEffect=d,c.lastEffect=d):c.firstEffect=c.lastEffect=d,d.nextEffect=null,d.effectTag=8}}function i(c,d){if(!e)return null;for(;d!==null;)t(c,d),d=d.sibling;return null}function n(c,d){for(c=new Map;d!==null;)d.key!==null?c.set(d.key,d):c.set(d.index,d),d=d.sibling;return c}function r(c,d){return c=bi(c,d),c.index=0,c.sibling=null,c}function s(c,d,f){return c.index=f,e?(f=c.alternate,f!==null?(f=f.index,f<d?(c.effectTag=2,d):f):(c.effectTag=2,d)):d}function o(c){return e&&c.alternate===null&&(c.effectTag=2),c}function a(c,d,f,g){return d===null||d.tag!==6?(d=Zl(f,c.mode,g),d.return=c,d):(d=r(d,f),d.return=c,d)}function l(c,d,f,g){return d!==null&&d.elementType===f.type?(g=r(d,f.props),g.ref=Jn(c,d,f),g.return=c,g):(g=Hs(f.type,f.key,f.props,null,c.mode,g),g.ref=Jn(c,d,f),g.return=c,g)}function u(c,d,f,g){return d===null||d.tag!==4||d.stateNode.containerInfo!==f.containerInfo||d.stateNode.implementation!==f.implementation?(d=Yl(f,c.mode,g),d.return=c,d):(d=r(d,f.children||[]),d.return=c,d)}function h(c,d,f,g,m){return d===null||d.tag!==7?(d=Jt(f,c.mode,g,m),d.return=c,d):(d=r(d,f),d.return=c,d)}function p(c,d,f){if(typeof d=="string"||typeof d=="number")return d=Zl(""+d,c.mode,f),d.return=c,d;if(typeof d=="object"&&d!==null){switch(d.$$typeof){case Ur:return f=Hs(d.type,d.key,d.props,null,c.mode,f),f.ref=Jn(c,null,d),f.return=c,f;case _i:return d=Yl(d,c.mode,f),d.return=c,d}if(ws(d)||En(d))return d=Jt(d,c.mode,f,null),d.return=c,d;ys(c,d)}return null}function w(c,d,f,g){var m=d!==null?d.key:null;if(typeof f=="string"||typeof f=="number")return m!==null?null:a(c,d,""+f,g);if(typeof f=="object"&&f!==null){switch(f.$$typeof){case Ur:return f.key===m?f.type===di?h(c,d,f.props.children,g,m):l(c,d,f,g):null;case _i:return f.key===m?u(c,d,f,g):null}if(ws(f)||En(f))return m!==null?null:h(c,d,f,g,null);ys(c,f)}return null}function C(c,d,f,g,m){if(typeof g=="string"||typeof g=="number")return c=c.get(f)||null,a(d,c,""+g,m);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case Ur:return c=c.get(g.key===null?f:g.key)||null,g.type===di?h(d,c,g.props.children,m,g.key):l(d,c,g,m);case _i:return c=c.get(g.key===null?f:g.key)||null,u(d,c,g,m)}if(ws(g)||En(g))return c=c.get(f)||null,h(d,c,g,m,null);ys(d,g)}return null}function E(c,d,f,g){for(var m=null,x=null,y=d,k=d=0,D=null;y!==null&&k<f.length;k++){y.index>k?(D=y,y=null):D=y.sibling;var P=w(c,y,f[k],g);if(P===null){y===null&&(y=D);break}e&&y&&P.alternate===null&&t(c,y),d=s(P,d,k),x===null?m=P:x.sibling=P,x=P,y=D}if(k===f.length)return i(c,y),m;if(y===null){for(;k<f.length;k++)y=p(c,f[k],g),y!==null&&(d=s(y,d,k),x===null?m=y:x.sibling=y,x=y);return m}for(y=n(c,y);k<f.length;k++)D=C(y,c,k,f[k],g),D!==null&&(e&&D.alternate!==null&&y.delete(D.key===null?k:D.key),d=s(D,d,k),x===null?m=D:x.sibling=D,x=D);return e&&y.forEach(function(q){return t(c,q)}),m}function T(c,d,f,g){var m=En(f);if(typeof m!="function")throw Error(S(150));if(f=m.call(f),f==null)throw Error(S(151));for(var x=m=null,y=d,k=d=0,D=null,P=f.next();y!==null&&!P.done;k++,P=f.next()){y.index>k?(D=y,y=null):D=y.sibling;var q=w(c,y,P.value,g);if(q===null){y===null&&(y=D);break}e&&y&&q.alternate===null&&t(c,y),d=s(q,d,k),x===null?m=q:x.sibling=q,x=q,y=D}if(P.done)return i(c,y),m;if(y===null){for(;!P.done;k++,P=f.next())P=p(c,P.value,g),P!==null&&(d=s(P,d,k),x===null?m=P:x.sibling=P,x=P);return m}for(y=n(c,y);!P.done;k++,P=f.next())P=C(y,c,k,P.value,g),P!==null&&(e&&P.alternate!==null&&y.delete(P.key===null?k:P.key),d=s(P,d,k),x===null?m=P:x.sibling=P,x=P);return e&&y.forEach(function(ie){return t(c,ie)}),m}return function(c,d,f,g){var m=typeof f=="object"&&f!==null&&f.type===di&&f.key===null;m&&(f=f.props.children);var x=typeof f=="object"&&f!==null;if(x)switch(f.$$typeof){case Ur:e:{for(x=f.key,m=d;m!==null;){if(m.key===x){switch(m.tag){case 7:if(f.type===di){i(c,m.sibling),d=r(m,f.props.children),d.return=c,c=d;break e}break;default:if(m.elementType===f.type){i(c,m.sibling),d=r(m,f.props),d.ref=Jn(c,m,f),d.return=c,c=d;break e}}i(c,m);break}else t(c,m);m=m.sibling}f.type===di?(d=Jt(f.props.children,c.mode,g,f.key),d.return=c,c=d):(g=Hs(f.type,f.key,f.props,null,c.mode,g),g.ref=Jn(c,d,f),g.return=c,c=g)}return o(c);case _i:e:{for(m=f.key;d!==null;){if(d.key===m)if(d.tag===4&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){i(c,d.sibling),d=r(d,f.children||[]),d.return=c,c=d;break e}else{i(c,d);break}else t(c,d);d=d.sibling}d=Yl(f,c.mode,g),d.return=c,c=d}return o(c)}if(typeof f=="string"||typeof f=="number")return f=""+f,d!==null&&d.tag===6?(i(c,d.sibling),d=r(d,f),d.return=c,c=d):(i(c,d),d=Zl(f,c.mode,g),d.return=c,c=d),o(c);if(ws(f))return E(c,d,f,g);if(En(f))return T(c,d,f,g);if(x&&ys(c,f),typeof f=="undefined"&&!m)switch(c.tag){case 1:case 0:throw c=c.type,Error(S(152,c.displayName||c.name||"Component"))}return i(c,d)}}var Ki=Np(!0),pl=Np(!1),Kn={},ct={current:Kn},qn={current:Kn},er={current:Kn};function mi(e){if(e===Kn)throw Error(S(174));return e}function fl(e,t){switch(te(er,t),te(qn,e),te(ct,Kn),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ba(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ba(t,e)}Y(ct),te(ct,t)}function qi(){Y(ct),Y(qn),Y(er)}function kp(e){mi(er.current);var t=mi(ct.current),i=ba(t,e.type);t!==i&&(te(qn,e),te(ct,i))}function gl(e){qn.current===e&&(Y(ct),Y(qn))}var K={current:0};function xs(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data===Ha||i.data===Wa))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if((t.effectTag&64)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function ml(e,t){return{responder:e,props:t}}var Ss=Ke.ReactCurrentDispatcher,Fe=Ke.ReactCurrentBatchConfig,Zt=0,re=null,me=null,ve=null,Cs=!1;function Le(){throw Error(S(321))}function vl(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!fi(e[i],t[i]))return!1;return!0}function wl(e,t,i,n,r,s){if(Zt=s,re=t,t.memoizedState=null,t.updateQueue=null,t.expirationTime=0,Ss.current=e===null||e.memoizedState===null?rx:sx,e=i(n,r),t.expirationTime===Zt){s=0;do{if(t.expirationTime=0,!(25>s))throw Error(S(301));s+=1,ve=me=null,t.updateQueue=null,Ss.current=ox,e=i(n,r)}while(t.expirationTime===Zt)}if(Ss.current=Es,t=me!==null&&me.next!==null,Zt=0,ve=me=re=null,Cs=!1,t)throw Error(S(300));return e}function en(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ve===null?re.memoizedState=ve=e:ve=ve.next=e,ve}function tn(){if(me===null){var e=re.alternate;e=e!==null?e.memoizedState:null}else e=me.next;var t=ve===null?re.memoizedState:ve.next;if(t!==null)ve=t,me=e;else{if(e===null)throw Error(S(310));me=e,e={memoizedState:me.memoizedState,baseState:me.baseState,baseQueue:me.baseQueue,queue:me.queue,next:null},ve===null?re.memoizedState=ve=e:ve=ve.next=e}return ve}function vi(e,t){return typeof t=="function"?t(e):t}function Ms(e){var t=tn(),i=t.queue;if(i===null)throw Error(S(311));i.lastRenderedReducer=e;var n=me,r=n.baseQueue,s=i.pending;if(s!==null){if(r!==null){var o=r.next;r.next=s.next,s.next=o}n.baseQueue=r=s,i.pending=null}if(r!==null){r=r.next,n=n.baseState;var a=o=s=null,l=r;do{var u=l.expirationTime;if(u<Zt){var h={expirationTime:l.expirationTime,suspenseConfig:l.suspenseConfig,action:l.action,eagerReducer:l.eagerReducer,eagerState:l.eagerState,next:null};a===null?(o=a=h,s=n):a=a.next=h,u>re.expirationTime&&(re.expirationTime=u,Us(u))}else a!==null&&(a=a.next={expirationTime:1073741823,suspenseConfig:l.suspenseConfig,action:l.action,eagerReducer:l.eagerReducer,eagerState:l.eagerState,next:null}),xf(u,l.suspenseConfig),n=l.eagerReducer===e?l.eagerState:e(n,l.action);l=l.next}while(l!==null&&l!==r);a===null?s=n:a.next=o,fi(n,t.memoizedState)||(dt=!0),t.memoizedState=n,t.baseState=s,t.baseQueue=a,i.lastRenderedState=n}return[t.memoizedState,i.dispatch]}function Is(e){var t=tn(),i=t.queue;if(i===null)throw Error(S(311));i.lastRenderedReducer=e;var n=i.dispatch,r=i.pending,s=t.memoizedState;if(r!==null){i.pending=null;var o=r=r.next;do s=e(s,o.action),o=o.next;while(o!==r);fi(s,t.memoizedState)||(dt=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),i.lastRenderedState=s}return[s,n]}function yl(e){var t=en();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e=t.queue={pending:null,dispatch:null,lastRenderedReducer:vi,lastRenderedState:e},e=e.dispatch=Bp.bind(null,re,e),[t.memoizedState,e]}function xl(e,t,i,n){return e={tag:e,create:t,destroy:i,deps:n,next:null},t=re.updateQueue,t===null?(t={lastEffect:null},re.updateQueue=t,t.lastEffect=e.next=e):(i=t.lastEffect,i===null?t.lastEffect=e.next=e:(n=i.next,i.next=e,e.next=n,t.lastEffect=e)),e}function Pp(){return tn().memoizedState}function Sl(e,t,i,n){var r=en();re.effectTag|=e,r.memoizedState=xl(1|t,i,void 0,n===void 0?null:n)}function Cl(e,t,i,n){var r=tn();n=n===void 0?null:n;var s=void 0;if(me!==null){var o=me.memoizedState;if(s=o.destroy,n!==null&&vl(n,o.deps)){xl(t,i,s,n);return}}re.effectTag|=e,r.memoizedState=xl(1|t,i,s,n)}function zp(e,t){return Sl(516,4,e,t)}function bs(e,t){return Cl(516,4,e,t)}function Dp(e,t){return Cl(4,2,e,t)}function jp(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Lp(e,t,i){return i=i!=null?i.concat([e]):null,Cl(4,2,jp.bind(null,t,e),i)}function Ml(){}function Vp(e,t){return en().memoizedState=[e,t===void 0?null:t],e}function As(e,t){var i=tn();t=t===void 0?null:t;var n=i.memoizedState;return n!==null&&t!==null&&vl(t,n[1])?n[0]:(i.memoizedState=[e,t],e)}function Rp(e,t){var i=tn();t=t===void 0?null:t;var n=i.memoizedState;return n!==null&&t!==null&&vl(t,n[1])?n[0]:(e=e(),i.memoizedState=[e,t],e)}function Il(e,t,i){var n=ds();Ht(98>n?98:n,function(){e(!0)}),Ht(97<n?97:n,function(){var r=Fe.suspense;Fe.suspense=t===void 0?null:t;try{e(!1),i()}finally{Fe.suspense=r}})}function Bp(e,t,i){var n=pt(),r=Xn.suspense;n=Si(n,e,r),r={expirationTime:n,suspenseConfig:r,action:i,eagerReducer:null,eagerState:null,next:null};var s=t.pending;if(s===null?r.next=r:(r.next=s.next,s.next=r),t.pending=r,s=e.alternate,e===re||s!==null&&s===re)Cs=!0,r.expirationTime=Zt,re.expirationTime=Zt;else{if(e.expirationTime===0&&(s===null||s.expirationTime===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,a=s(o,i);if(r.eagerReducer=s,r.eagerState=a,fi(a,o))return}catch{}finally{}Xt(e,n)}}var Es={readContext:We,useCallback:Le,useContext:Le,useEffect:Le,useImperativeHandle:Le,useLayoutEffect:Le,useMemo:Le,useReducer:Le,useRef:Le,useState:Le,useDebugValue:Le,useResponder:Le,useDeferredValue:Le,useTransition:Le},rx={readContext:We,useCallback:Vp,useContext:We,useEffect:zp,useImperativeHandle:function(e,t,i){return i=i!=null?i.concat([e]):null,Sl(4,2,jp.bind(null,t,e),i)},useLayoutEffect:function(e,t){return Sl(4,2,e,t)},useMemo:function(e,t){var i=en();return t=t===void 0?null:t,e=e(),i.memoizedState=[e,t],e},useReducer:function(e,t,i){var n=en();return t=i!==void 0?i(t):t,n.memoizedState=n.baseState=t,e=n.queue={pending:null,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},e=e.dispatch=Bp.bind(null,re,e),[n.memoizedState,e]},useRef:function(e){var t=en();return e={current:e},t.memoizedState=e},useState:yl,useDebugValue:Ml,useResponder:ml,useDeferredValue:function(e,t){var i=yl(e),n=i[0],r=i[1];return zp(function(){var s=Fe.suspense;Fe.suspense=t===void 0?null:t;try{r(e)}finally{Fe.suspense=s}},[e,t]),n},useTransition:function(e){var t=yl(!1),i=t[0];return t=t[1],[Vp(Il.bind(null,t,e),[t,e]),i]}},sx={readContext:We,useCallback:As,useContext:We,useEffect:bs,useImperativeHandle:Lp,useLayoutEffect:Dp,useMemo:Rp,useReducer:Ms,useRef:Pp,useState:function(){return Ms(vi)},useDebugValue:Ml,useResponder:ml,useDeferredValue:function(e,t){var i=Ms(vi),n=i[0],r=i[1];return bs(function(){var s=Fe.suspense;Fe.suspense=t===void 0?null:t;try{r(e)}finally{Fe.suspense=s}},[e,t]),n},useTransition:function(e){var t=Ms(vi),i=t[0];return t=t[1],[As(Il.bind(null,t,e),[t,e]),i]}},ox={readContext:We,useCallback:As,useContext:We,useEffect:bs,useImperativeHandle:Lp,useLayoutEffect:Dp,useMemo:Rp,useReducer:Is,useRef:Pp,useState:function(){return Is(vi)},useDebugValue:Ml,useResponder:ml,useDeferredValue:function(e,t){var i=Is(vi),n=i[0],r=i[1];return bs(function(){var s=Fe.suspense;Fe.suspense=t===void 0?null:t;try{r(e)}finally{Fe.suspense=s}},[e,t]),n},useTransition:function(e){var t=Is(vi),i=t[0];return t=t[1],[As(Il.bind(null,t,e),[t,e]),i]}},It=null,Yt=null,wi=!1;function Op(e,t){var i=ft(5,null,null,0);i.elementType="DELETED",i.type="DELETED",i.stateNode=t,i.return=e,i.effectTag=8,e.lastEffect!==null?(e.lastEffect.nextEffect=i,e.lastEffect=i):e.firstEffect=e.lastEffect=i}function _p(e,t){switch(e.tag){case 5:var i=e.type;return t=t.nodeType!==1||i.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,!0):!1;case 13:return!1;default:return!1}}function bl(e){if(wi){var t=Yt;if(t){var i=t;if(!_p(e,t)){if(t=Wi(i.nextSibling),!t||!_p(e,t)){e.effectTag=e.effectTag&-1025|2,wi=!1,It=e;return}Op(It,i)}It=e,Yt=Wi(t.firstChild)}else e.effectTag=e.effectTag&-1025|2,wi=!1,It=e}}function $p(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;It=e}function Ts(e){if(e!==It)return!1;if(!wi)return $p(e),wi=!0,!1;var t=e.type;if(e.tag!==5||t!=="head"&&t!=="body"&&!Za(t,e.memoizedProps))for(t=Yt;t;)Op(e,t),t=Wi(t.nextSibling);if($p(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(S(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var i=e.data;if(i===Rh){if(t===0){Yt=Wi(e.nextSibling);break e}t--}else i!==Vh&&i!==Wa&&i!==Ha||t++}e=e.nextSibling}Yt=null}}else Yt=It?Wi(e.stateNode.nextSibling):null;return!0}function Al(){Yt=It=null,wi=!1}var ax=Ke.ReactCurrentOwner,dt=!1;function Ve(e,t,i,n){t.child=e===null?pl(t,null,i,n):Ki(t,e.child,i,n)}function Up(e,t,i,n,r){i=i.render;var s=t.ref;return Ji(t,r),n=wl(e,t,i,n,s,r),e!==null&&!dt?(t.updateQueue=e.updateQueue,t.effectTag&=-517,e.expirationTime<=r&&(e.expirationTime=0),bt(e,t,r)):(t.effectTag|=1,Ve(e,t,n,r),t.child)}function Hp(e,t,i,n,r,s){if(e===null){var o=i.type;return typeof o=="function"&&!Ql(o)&&o.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(t.tag=15,t.type=o,Wp(e,t,o,n,r,s)):(e=Hs(i.type,null,n,null,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}return o=e.child,r<s&&(r=o.memoizedProps,i=i.compare,i=i!==null?i:Zn,i(r,n)&&e.ref===t.ref)?bt(e,t,s):(t.effectTag|=1,e=bi(o,n),e.ref=t.ref,e.return=t,t.child=e)}function Wp(e,t,i,n,r,s){return e!==null&&Zn(e.memoizedProps,n)&&e.ref===t.ref&&(dt=!1,r<s)?(t.expirationTime=e.expirationTime,bt(e,t,s)):El(e,t,i,n,s)}function Fp(e,t){var i=t.ref;(e===null&&i!==null||e!==null&&e.ref!==i)&&(t.effectTag|=128)}function El(e,t,i,n,r){var s=Ne(i)?gi:ge.current;return s=Gi(t,s),Ji(t,r),i=wl(e,t,i,n,s,r),e!==null&&!dt?(t.updateQueue=e.updateQueue,t.effectTag&=-517,e.expirationTime<=r&&(e.expirationTime=0),bt(e,t,r)):(t.effectTag|=1,Ve(e,t,i,r),t.child)}function Qp(e,t,i,n,r){if(Ne(i)){var s=!0;ls(t)}else s=!1;if(Ji(t,r),t.stateNode===null)e!==null&&(e.alternate=null,t.alternate=null,t.effectTag|=2),Ep(t,i,n),hl(t,i,n,r),n=!0;else if(e===null){var o=t.stateNode,a=t.memoizedProps;o.props=a;var l=o.context,u=i.contextType;typeof u=="object"&&u!==null?u=We(u):(u=Ne(i)?gi:ge.current,u=Gi(t,u));var h=i.getDerivedStateFromProps,p=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function";p||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==n||l!==u)&&Tp(t,o,n,u),Wt=!1;var w=t.memoizedState;o.state=w,Gn(t,n,o,r),l=t.memoizedState,a!==n||w!==l||Te.current||Wt?(typeof h=="function"&&(ms(t,i,h,n),l=t.memoizedState),(a=Wt||Ap(t,i,a,n,w,l,u))?(p||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.effectTag|=4)):(typeof o.componentDidMount=="function"&&(t.effectTag|=4),t.memoizedProps=n,t.memoizedState=l),o.props=n,o.state=l,o.context=u,n=a):(typeof o.componentDidMount=="function"&&(t.effectTag|=4),n=!1)}else o=t.stateNode,dl(e,t),a=t.memoizedProps,o.props=t.type===t.elementType?a:qe(t.type,a),l=o.context,u=i.contextType,typeof u=="object"&&u!==null?u=We(u):(u=Ne(i)?gi:ge.current,u=Gi(t,u)),h=i.getDerivedStateFromProps,(p=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==n||l!==u)&&Tp(t,o,n,u),Wt=!1,l=t.memoizedState,o.state=l,Gn(t,n,o,r),w=t.memoizedState,a!==n||l!==w||Te.current||Wt?(typeof h=="function"&&(ms(t,i,h,n),w=t.memoizedState),(h=Wt||Ap(t,i,a,n,l,w,u))?(p||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,w,u),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,w,u)),typeof o.componentDidUpdate=="function"&&(t.effectTag|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.effectTag|=256)):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&l===e.memoizedState||(t.effectTag|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&l===e.memoizedState||(t.effectTag|=256),t.memoizedProps=n,t.memoizedState=w),o.props=n,o.state=w,o.context=u,n=h):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&l===e.memoizedState||(t.effectTag|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&l===e.memoizedState||(t.effectTag|=256),n=!1);return Tl(e,t,i,n,s,r)}function Tl(e,t,i,n,r,s){Fp(e,t);var o=(t.effectTag&64)!==0;if(!n&&!o)return r&&up(t,i,!1),bt(e,t,s);n=t.stateNode,ax.current=t;var a=o&&typeof i.getDerivedStateFromError!="function"?null:n.render();return t.effectTag|=1,e!==null&&o?(t.child=Ki(t,e.child,null,s),t.child=Ki(t,null,a,s)):Ve(e,t,a,s),t.memoizedState=n.state,r&&up(t,i,!0),t.child}function Zp(e){var t=e.stateNode;t.pendingContext?ap(e,t.pendingContext,t.pendingContext!==t.context):t.context&&ap(e,t.context,!1),fl(e,t.containerInfo)}var Nl={dehydrated:null,retryTime:0};function Yp(e,t,i){var n=t.mode,r=t.pendingProps,s=K.current,o=!1,a;if((a=(t.effectTag&64)!==0)||(a=(s&2)!==0&&(e===null||e.memoizedState!==null)),a?(o=!0,t.effectTag&=-65):e!==null&&e.memoizedState===null||r.fallback===void 0||r.unstable_avoidThisFallback===!0||(s|=1),te(K,s&1),e===null){if(r.fallback!==void 0&&bl(t),o){if(o=r.fallback,r=Jt(null,n,0,null),r.return=t,(t.mode&2)===0)for(e=t.memoizedState!==null?t.child.child:t.child,r.child=e;e!==null;)e.return=r,e=e.sibling;return i=Jt(o,n,i,null),i.return=t,r.sibling=i,t.memoizedState=Nl,t.child=r,i}return n=r.children,t.memoizedState=null,t.child=pl(t,null,n,i)}if(e.memoizedState!==null){if(e=e.child,n=e.sibling,o){if(r=r.fallback,i=bi(e,e.pendingProps),i.return=t,(t.mode&2)===0&&(o=t.memoizedState!==null?t.child.child:t.child,o!==e.child))for(i.child=o;o!==null;)o.return=i,o=o.sibling;return n=bi(n,r),n.return=t,i.sibling=n,i.childExpirationTime=0,t.memoizedState=Nl,t.child=i,n}return i=Ki(t,e.child,r.children,i),t.memoizedState=null,t.child=i}if(e=e.child,o){if(o=r.fallback,r=Jt(null,n,0,null),r.return=t,r.child=e,e!==null&&(e.return=r),(t.mode&2)===0)for(e=t.memoizedState!==null?t.child.child:t.child,r.child=e;e!==null;)e.return=r,e=e.sibling;return i=Jt(o,n,i,null),i.return=t,r.sibling=i,i.effectTag|=2,r.childExpirationTime=0,t.memoizedState=Nl,t.child=r,i}return t.memoizedState=null,t.child=Ki(t,e,r.children,i)}function Gp(e,t){e.expirationTime<t&&(e.expirationTime=t);var i=e.alternate;i!==null&&i.expirationTime<t&&(i.expirationTime=t),Cp(e.return,t)}function kl(e,t,i,n,r,s){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:i,tailExpiration:0,tailMode:r,lastEffect:s}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=n,o.tail=i,o.tailExpiration=0,o.tailMode=r,o.lastEffect=s)}function Xp(e,t,i){var n=t.pendingProps,r=n.revealOrder,s=n.tail;if(Ve(e,t,n.children,i),n=K.current,(n&2)!==0)n=n&1|2,t.effectTag|=64;else{if(e!==null&&(e.effectTag&64)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Gp(e,i);else if(e.tag===19)Gp(e,i);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(te(K,n),(t.mode&2)===0)t.memoizedState=null;else switch(r){case"forwards":for(i=t.child,r=null;i!==null;)e=i.alternate,e!==null&&xs(e)===null&&(r=i),i=i.sibling;i=r,i===null?(r=t.child,t.child=null):(r=i.sibling,i.sibling=null),kl(t,!1,r,i,s,t.lastEffect);break;case"backwards":for(i=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&xs(e)===null){t.child=r;break}e=r.sibling,r.sibling=i,i=r,r=e}kl(t,!0,i,null,s,t.lastEffect);break;case"together":kl(t,!1,null,null,void 0,t.lastEffect);break;default:t.memoizedState=null}return t.child}function bt(e,t,i){e!==null&&(t.dependencies=e.dependencies);var n=t.expirationTime;if(n!==0&&Us(n),t.childExpirationTime<i)return null;if(e!==null&&t.child!==e.child)throw Error(S(153));if(t.child!==null){for(e=t.child,i=bi(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=bi(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}var Jp,Pl,Kp,qp;Jp=function(e,t){for(var i=t.child;i!==null;){if(i.tag===5||i.tag===6)e.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}},Pl=function(){},Kp=function(e,t,i,n,r){var s=e.memoizedProps;if(s!==n){var o=t.stateNode;switch(mi(ct.current),e=null,i){case"input":s=xa(o,s),n=xa(o,n),e=[];break;case"option":s=Ma(o,s),n=Ma(o,n),e=[];break;case"select":s=Se({},s,{value:void 0}),n=Se({},n,{value:void 0}),e=[];break;case"textarea":s=Ia(o,s),n=Ia(o,n),e=[];break;default:typeof s.onClick!="function"&&typeof n.onClick=="function"&&(o.onclick=es)}Oa(i,n);var a,l;i=null;for(a in s)if(!n.hasOwnProperty(a)&&s.hasOwnProperty(a)&&s[a]!=null)if(a==="style")for(l in o=s[a],o)o.hasOwnProperty(l)&&(i||(i={}),i[l]="");else a!=="dangerouslySetInnerHTML"&&a!=="children"&&a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&a!=="autoFocus"&&(Ri.hasOwnProperty(a)?e||(e=[]):(e=e||[]).push(a,null));for(a in n){var u=n[a];if(o=s!=null?s[a]:void 0,n.hasOwnProperty(a)&&u!==o&&(u!=null||o!=null))if(a==="style")if(o){for(l in o)!o.hasOwnProperty(l)||u&&u.hasOwnProperty(l)||(i||(i={}),i[l]="");for(l in u)u.hasOwnProperty(l)&&o[l]!==u[l]&&(i||(i={}),i[l]=u[l])}else i||(e||(e=[]),e.push(a,i)),i=u;else a==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,o=o?o.__html:void 0,u!=null&&o!==u&&(e=e||[]).push(a,u)):a==="children"?o===u||typeof u!="string"&&typeof u!="number"||(e=e||[]).push(a,""+u):a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&(Ri.hasOwnProperty(a)?(u!=null&&xt(r,a),e||o===u||(e=[])):(e=e||[]).push(a,u))}i&&(e=e||[]).push("style",i),r=e,(t.updateQueue=r)&&(t.effectTag|=4)}},qp=function(e,t,i,n){i!==n&&(t.effectTag|=4)};function Ns(e,t){switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var n=null;i!==null;)i.alternate!==null&&(n=i),i=i.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function lx(e,t,i){var n=t.pendingProps;switch(t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return null;case 1:return Ne(t.type)&&as(),null;case 3:return qi(),Y(Te),Y(ge),i=t.stateNode,i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),e!==null&&e.child!==null||!Ts(t)||(t.effectTag|=4),Pl(t),null;case 5:gl(t),i=mi(er.current);var r=t.type;if(e!==null&&t.stateNode!=null)Kp(e,t,r,n,i),e.ref!==t.ref&&(t.effectTag|=128);else{if(!n){if(t.stateNode===null)throw Error(S(166));return null}if(e=mi(ct.current),Ts(t)){n=t.stateNode,r=t.type;var s=t.memoizedProps;switch(n[_t]=t,n[ts]=s,r){case"iframe":case"object":case"embed":X("load",n);break;case"video":case"audio":for(e=0;e<Nn.length;e++)X(Nn[e],n);break;case"source":X("error",n);break;case"img":case"image":case"link":X("error",n),X("load",n);break;case"form":X("reset",n),X("submit",n);break;case"details":X("toggle",n);break;case"input":qd(n,s),X("invalid",n),xt(i,"onChange");break;case"select":n._wrapperState={wasMultiple:!!s.multiple},X("invalid",n),xt(i,"onChange");break;case"textarea":ih(n,s),X("invalid",n),xt(i,"onChange")}Oa(r,s),e=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?n.textContent!==a&&(e=["children",a]):typeof a=="number"&&n.textContent!==""+a&&(e=["children",""+a]):Ri.hasOwnProperty(o)&&a!=null&&xt(i,o)}switch(r){case"input":Fr(n),th(n,s,!0);break;case"textarea":Fr(n),rh(n);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(n.onclick=es)}i=e,t.updateQueue=i,i!==null&&(t.effectTag|=4)}else{switch(o=i.nodeType===9?i:i.ownerDocument,e===Ph&&(e=oh(r)),e===Ph?r==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=o.createElement(r,{is:n.is}):(e=o.createElement(r),r==="select"&&(o=e,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):e=o.createElementNS(e,r),e[_t]=t,e[ts]=n,Jp(e,t,!1,!1),t.stateNode=e,o=_a(r,n),r){case"iframe":case"object":case"embed":X("load",e),a=n;break;case"video":case"audio":for(a=0;a<Nn.length;a++)X(Nn[a],e);a=n;break;case"source":X("error",e),a=n;break;case"img":case"image":case"link":X("error",e),X("load",e),a=n;break;case"form":X("reset",e),X("submit",e),a=n;break;case"details":X("toggle",e),a=n;break;case"input":qd(e,n),a=xa(e,n),X("invalid",e),xt(i,"onChange");break;case"option":a=Ma(e,n);break;case"select":e._wrapperState={wasMultiple:!!n.multiple},a=Se({},n,{value:void 0}),X("invalid",e),xt(i,"onChange");break;case"textarea":ih(e,n),a=Ia(e,n),X("invalid",e),xt(i,"onChange");break;default:a=n}Oa(r,a);var l=a;for(s in l)if(l.hasOwnProperty(s)){var u=l[s];s==="style"?kh(e,u):s==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&ah(e,u)):s==="children"?typeof u=="string"?(r!=="textarea"||u!=="")&&Tn(e,u):typeof u=="number"&&Tn(e,""+u):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Ri.hasOwnProperty(s)?u!=null&&xt(i,s):u!=null&&ga(e,s,u,o))}switch(r){case"input":Fr(e),th(e,n,!1);break;case"textarea":Fr(e),rh(e);break;case"option":n.value!=null&&e.setAttribute("value",""+Vt(n.value));break;case"select":e.multiple=!!n.multiple,i=n.value,i!=null?$i(e,!!n.multiple,i,!1):n.defaultValue!=null&&$i(e,!!n.multiple,n.defaultValue,!0);break;default:typeof a.onClick=="function"&&(e.onclick=es)}Bh(r,n)&&(t.effectTag|=4)}t.ref!==null&&(t.effectTag|=128)}return null;case 6:if(e&&t.stateNode!=null)qp(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(S(166));i=mi(er.current),mi(ct.current),Ts(t)?(i=t.stateNode,n=t.memoizedProps,i[_t]=t,i.nodeValue!==n&&(t.effectTag|=4)):(i=(i.nodeType===9?i:i.ownerDocument).createTextNode(n),i[_t]=t,t.stateNode=i)}return null;case 13:return Y(K),n=t.memoizedState,(t.effectTag&64)!==0?(t.expirationTime=i,t):(i=n!==null,n=!1,e===null?t.memoizedProps.fallback!==void 0&&Ts(t):(r=e.memoizedState,n=r!==null,i||r===null||(r=e.child.sibling,r!==null&&(s=t.firstEffect,s!==null?(t.firstEffect=r,r.nextEffect=s):(t.firstEffect=t.lastEffect=r,r.nextEffect=null),r.effectTag=8))),i&&!n&&(t.mode&2)!==0&&(e===null&&t.memoizedProps.unstable_avoidThisFallback!==!0||(K.current&1)!==0?le===yi&&(le=zs):((le===yi||le===zs)&&(le=Ds),ir!==0&&Re!==null&&(Ai(Re,ke),Af(Re,ir)))),(i||n)&&(t.effectTag|=4),null);case 4:return qi(),Pl(t),null;case 10:return ul(t),null;case 17:return Ne(t.type)&&as(),null;case 19:if(Y(K),n=t.memoizedState,n===null)return null;if(r=(t.effectTag&64)!==0,s=n.rendering,s===null){if(r)Ns(n,!1);else if(le!==yi||e!==null&&(e.effectTag&64)!==0)for(s=t.child;s!==null;){if(e=xs(s),e!==null){for(t.effectTag|=64,Ns(n,!1),r=e.updateQueue,r!==null&&(t.updateQueue=r,t.effectTag|=4),n.lastEffect===null&&(t.firstEffect=null),t.lastEffect=n.lastEffect,n=t.child;n!==null;)r=n,s=i,r.effectTag&=2,r.nextEffect=null,r.firstEffect=null,r.lastEffect=null,e=r.alternate,e===null?(r.childExpirationTime=0,r.expirationTime=s,r.child=null,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null):(r.childExpirationTime=e.childExpirationTime,r.expirationTime=e.expirationTime,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,s=e.dependencies,r.dependencies=s===null?null:{expirationTime:s.expirationTime,firstContext:s.firstContext,responders:s.responders}),n=n.sibling;return te(K,K.current&1|2),t.child}s=s.sibling}}else{if(!r)if(e=xs(s),e!==null){if(t.effectTag|=64,r=!0,i=e.updateQueue,i!==null&&(t.updateQueue=i,t.effectTag|=4),Ns(n,!0),n.tail===null&&n.tailMode==="hidden"&&!s.alternate)return t=t.lastEffect=n.lastEffect,t!==null&&(t.nextEffect=null),null}else 2*He()-n.renderingStartTime>n.tailExpiration&&1<i&&(t.effectTag|=64,r=!0,Ns(n,!1),t.expirationTime=t.childExpirationTime=i-1);n.isBackwards?(s.sibling=t.child,t.child=s):(i=n.last,i!==null?i.sibling=s:t.child=s,n.last=s)}return n.tail!==null?(n.tailExpiration===0&&(n.tailExpiration=He()+500),i=n.tail,n.rendering=i,n.tail=i.sibling,n.lastEffect=t.lastEffect,n.renderingStartTime=He(),i.sibling=null,t=K.current,te(K,r?t&1|2:t&1),i):null}throw Error(S(156,t.tag))}function ux(e){switch(e.tag){case 1:Ne(e.type)&&as();var t=e.effectTag;return t&4096?(e.effectTag=t&-4097|64,e):null;case 3:if(qi(),Y(Te),Y(ge),t=e.effectTag,(t&64)!==0)throw Error(S(285));return e.effectTag=t&-4097|64,e;case 5:return gl(e),null;case 13:return Y(K),t=e.effectTag,t&4096?(e.effectTag=t&-4097|64,e):null;case 19:return Y(K),null;case 4:return qi(),null;case 10:return ul(e),null;default:return null}}function zl(e,t){return{value:e,source:t,stack:ya(t)}}var cx=typeof WeakSet=="function"?WeakSet:Set;function Dl(e,t){var i=t.source,n=t.stack;n===null&&i!==null&&(n=ya(i)),i!==null&&yt(i.type),t=t.value,e!==null&&e.tag===1&&yt(e.type);try{console.error(t)}catch(r){setTimeout(function(){throw r})}}function dx(e,t){try{t.props=e.memoizedProps,t.state=e.memoizedState,t.componentWillUnmount()}catch(i){Ii(e,i)}}function ef(e){var t=e.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){Ii(e,i)}else t.current=null}function hx(e,t){switch(t.tag){case 0:case 11:case 15:case 22:return;case 1:if(t.effectTag&256&&e!==null){var i=e.memoizedProps,n=e.memoizedState;e=t.stateNode,t=e.getSnapshotBeforeUpdate(t.elementType===t.type?i:qe(t.type,i),n),e.__reactInternalSnapshotBeforeUpdate=t}return;case 3:case 5:case 6:case 4:case 17:return}throw Error(S(163))}function tf(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var i=t=t.next;do{if((i.tag&e)===e){var n=i.destroy;i.destroy=void 0,n!==void 0&&n()}i=i.next}while(i!==t)}}function nf(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var i=t=t.next;do{if((i.tag&e)===e){var n=i.create;i.destroy=n()}i=i.next}while(i!==t)}}function px(e,t,i){switch(i.tag){case 0:case 11:case 15:case 22:nf(3,i);return;case 1:if(e=i.stateNode,i.effectTag&4)if(t===null)e.componentDidMount();else{var n=i.elementType===i.type?t.memoizedProps:qe(i.type,t.memoizedProps);e.componentDidUpdate(n,t.memoizedState,e.__reactInternalSnapshotBeforeUpdate)}t=i.updateQueue,t!==null&&Ip(i,t,e);return;case 3:if(t=i.updateQueue,t!==null){if(e=null,i.child!==null)switch(i.child.tag){case 5:e=i.child.stateNode;break;case 1:e=i.child.stateNode}Ip(i,t,e)}return;case 5:e=i.stateNode,t===null&&i.effectTag&4&&Bh(i.type,i.memoizedProps)&&e.focus();return;case 6:return;case 4:return;case 12:return;case 13:i.memoizedState===null&&(i=i.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&bh(i))));return;case 19:case 17:case 20:case 21:return}throw Error(S(163))}function rf(e,t,i){switch(typeof Fl=="function"&&Fl(t),t.tag){case 0:case 11:case 14:case 15:case 22:if(e=t.updateQueue,e!==null&&(e=e.lastEffect,e!==null)){var n=e.next;Ht(97<i?97:i,function(){var r=n;do{var s=r.destroy;if(s!==void 0){var o=t;try{s()}catch(a){Ii(o,a)}}r=r.next}while(r!==n)})}break;case 1:ef(t),i=t.stateNode,typeof i.componentWillUnmount=="function"&&dx(t,i);break;case 5:ef(t);break;case 4:lf(e,t,i)}}function sf(e){var t=e.alternate;e.return=null,e.child=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.alternate=null,e.firstEffect=null,e.lastEffect=null,e.pendingProps=null,e.memoizedProps=null,e.stateNode=null,t!==null&&sf(t)}function of(e){return e.tag===5||e.tag===3||e.tag===4}function af(e){e:{for(var t=e.return;t!==null;){if(of(t)){var i=t;break e}t=t.return}throw Error(S(160))}switch(t=i.stateNode,i.tag){case 5:var n=!1;break;case 3:t=t.containerInfo,n=!0;break;case 4:t=t.containerInfo,n=!0;break;default:throw Error(S(161))}i.effectTag&16&&(Tn(t,""),i.effectTag&=-17);e:t:for(i=e;;){for(;i.sibling===null;){if(i.return===null||of(i.return)){i=null;break e}i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.effectTag&2||i.child===null||i.tag===4)continue t;i.child.return=i,i=i.child}if(!(i.effectTag&2)){i=i.stateNode;break e}}n?jl(e,i,t):Ll(e,i,t)}function jl(e,t,i){var n=e.tag,r=n===5||n===6;if(r)e=r?e.stateNode:e.stateNode.instance,t?i.nodeType===8?i.parentNode.insertBefore(e,t):i.insertBefore(e,t):(i.nodeType===8?(t=i.parentNode,t.insertBefore(e,i)):(t=i,t.appendChild(e)),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=es));else if(n!==4&&(e=e.child,e!==null))for(jl(e,t,i),e=e.sibling;e!==null;)jl(e,t,i),e=e.sibling}function Ll(e,t,i){var n=e.tag,r=n===5||n===6;if(r)e=r?e.stateNode:e.stateNode.instance,t?i.insertBefore(e,t):i.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(Ll(e,t,i),e=e.sibling;e!==null;)Ll(e,t,i),e=e.sibling}function lf(e,t,i){for(var n=t,r=!1,s,o;;){if(!r){r=n.return;e:for(;;){if(r===null)throw Error(S(160));switch(s=r.stateNode,r.tag){case 5:o=!1;break e;case 3:s=s.containerInfo,o=!0;break e;case 4:s=s.containerInfo,o=!0;break e}r=r.return}r=!0}if(n.tag===5||n.tag===6){e:for(var a=e,l=n,u=i,h=l;;)if(rf(a,h,u),h.child!==null&&h.tag!==4)h.child.return=h,h=h.child;else{if(h===l)break e;for(;h.sibling===null;){if(h.return===null||h.return===l)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}o?(a=s,l=n.stateNode,a.nodeType===8?a.parentNode.removeChild(l):a.removeChild(l)):s.removeChild(n.stateNode)}else if(n.tag===4){if(n.child!==null){s=n.stateNode.containerInfo,o=!0,n.child.return=n,n=n.child;continue}}else if(rf(e,n,i),n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return,n.tag===4&&(r=!1)}n.sibling.return=n.return,n=n.sibling}}function Vl(e,t){switch(t.tag){case 0:case 11:case 14:case 15:case 22:tf(3,t);return;case 1:return;case 5:var i=t.stateNode;if(i!=null){var n=t.memoizedProps,r=e!==null?e.memoizedProps:n;e=t.type;var s=t.updateQueue;if(t.updateQueue=null,s!==null){for(i[ts]=n,e==="input"&&n.type==="radio"&&n.name!=null&&eh(i,n),_a(e,r),t=_a(e,n),r=0;r<s.length;r+=2){var o=s[r],a=s[r+1];o==="style"?kh(i,a):o==="dangerouslySetInnerHTML"?ah(i,a):o==="children"?Tn(i,a):ga(i,o,a,t)}switch(e){case"input":Sa(i,n);break;case"textarea":nh(i,n);break;case"select":t=i._wrapperState.wasMultiple,i._wrapperState.wasMultiple=!!n.multiple,e=n.value,e!=null?$i(i,!!n.multiple,e,!1):t!==!!n.multiple&&(n.defaultValue!=null?$i(i,!!n.multiple,n.defaultValue,!0):$i(i,!!n.multiple,n.multiple?[]:"",!1))}}}return;case 6:if(t.stateNode===null)throw Error(S(162));t.stateNode.nodeValue=t.memoizedProps;return;case 3:t=t.stateNode,t.hydrate&&(t.hydrate=!1,bh(t.containerInfo));return;case 12:return;case 13:if(i=t,t.memoizedState===null?n=!1:(n=!0,i=t.child,Ol=He()),i!==null)e:for(e=i;;){if(e.tag===5)s=e.stateNode,n?(s=s.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(s=e.stateNode,r=e.memoizedProps.style,r=r!=null&&r.hasOwnProperty("display")?r.display:null,s.style.display=Nh("display",r));else if(e.tag===6)e.stateNode.nodeValue=n?"":e.memoizedProps;else if(e.tag===13&&e.memoizedState!==null&&e.memoizedState.dehydrated===null){s=e.child.sibling,s.return=e,e=s;continue}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===i)break;for(;e.sibling===null;){if(e.return===null||e.return===i)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}uf(t);return;case 19:uf(t);return;case 17:return}throw Error(S(163))}function uf(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var i=e.stateNode;i===null&&(i=e.stateNode=new cx),t.forEach(function(n){var r=Mx.bind(null,e,n);i.has(n)||(i.add(n),n.then(r,r))})}}var fx=typeof WeakMap=="function"?WeakMap:Map;function cf(e,t,i){i=Ft(i,null),i.tag=3,i.payload={element:null};var n=t.value;return i.callback=function(){Rs||(Rs=!0,_l=n),Dl(e,t)},i}function df(e,t,i){i=Ft(i,null),i.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var r=t.value;i.payload=function(){return Dl(e,t),n(r)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(i.callback=function(){typeof n!="function"&&(Gt===null?Gt=new Set([this]):Gt.add(this),Dl(e,t));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),i}var gx=Math.ceil,ks=Ke.ReactCurrentDispatcher,hf=Ke.ReactCurrentOwner,ae=0,Rl=8,et=16,ht=32,yi=0,Ps=1,pf=2,zs=3,Ds=4,Bl=5,L=ae,Re=null,R=null,ke=0,le=yi,js=null,At=1073741823,tr=1073741823,Ls=null,ir=0,Vs=!1,Ol=0,ff=500,z=null,Rs=!1,_l=null,Gt=null,Bs=!1,nr=null,rr=90,xi=null,sr=0,$l=null,Os=0;function pt(){return(L&(et|ht))!==ae?1073741821-(He()/10|0):Os!==0?Os:Os=1073741821-(He()/10|0)}function Si(e,t,i){if(t=t.mode,(t&2)===0)return 1073741823;var n=ds();if((t&4)===0)return n===99?1073741823:1073741822;if((L&et)!==ae)return ke;if(i!==null)e=hs(e,i.timeoutMs|0||5e3,250);else switch(n){case 99:e=1073741823;break;case 98:e=hs(e,150,100);break;case 97:case 96:e=hs(e,5e3,250);break;case 95:e=2;break;default:throw Error(S(326))}return Re!==null&&e===ke&&--e,e}function Xt(e,t){if(50<sr)throw sr=0,$l=null,Error(S(185));if(e=_s(e,t),e!==null){var i=ds();t===1073741823?(L&Rl)!==ae&&(L&(et|ht))===ae?Ul(e):(Be(e),L===ae&&ut()):Be(e),(L&4)===ae||i!==98&&i!==99||(xi===null?xi=new Map([[e,t]]):(i=xi.get(e),(i===void 0||i>t)&&xi.set(e,t)))}}function _s(e,t){e.expirationTime<t&&(e.expirationTime=t);var i=e.alternate;i!==null&&i.expirationTime<t&&(i.expirationTime=t);var n=e.return,r=null;if(n===null&&e.tag===3)r=e.stateNode;else for(;n!==null;){if(i=n.alternate,n.childExpirationTime<t&&(n.childExpirationTime=t),i!==null&&i.childExpirationTime<t&&(i.childExpirationTime=t),n.return===null&&n.tag===3){r=n.stateNode;break}n=n.return}return r!==null&&(Re===r&&(Us(t),le===Ds&&Ai(r,ke)),Af(r,t)),r}function $s(e){var t=e.lastExpiredTime;if(t!==0||(t=e.firstPendingTime,!bf(e,t)))return t;var i=e.lastPingedTime;return e=e.nextKnownPendingLevel,e=i>e?i:e,2>=e&&t!==e?0:e}function Be(e){if(e.lastExpiredTime!==0)e.callbackExpirationTime=1073741823,e.callbackPriority=99,e.callbackNode=xp(Ul.bind(null,e));else{var t=$s(e),i=e.callbackNode;if(t===0)i!==null&&(e.callbackNode=null,e.callbackExpirationTime=0,e.callbackPriority=90);else{var n=pt();if(t===1073741823?n=99:t===1||t===2?n=95:(n=10*(1073741821-t)-10*(1073741821-n),n=0>=n?99:250>=n?98:5250>=n?97:95),i!==null){var r=e.callbackPriority;if(e.callbackExpirationTime===t&&r>=n)return;i!==mp&&cp(i)}e.callbackExpirationTime=t,e.callbackPriority=n,t=t===1073741823?xp(Ul.bind(null,e)):yp(n,gf.bind(null,e),{timeout:10*(1073741821-t)-He()}),e.callbackNode=t}}}function gf(e,t){if(Os=0,t)return t=pt(),Gl(e,t),Be(e),null;var i=$s(e);if(i!==0){if(t=e.callbackNode,(L&(et|ht))!==ae)throw Error(S(327));if(nn(),e===Re&&i===ke||Ci(e,i),R!==null){var n=L;L|=et;var r=yf();do try{wx();break}catch(a){wf(e,a)}while(1);if(ll(),L=n,ks.current=r,le===Ps)throw t=js,Ci(e,i),Ai(e,i),Be(e),t;if(R===null)switch(r=e.finishedWork=e.current.alternate,e.finishedExpirationTime=i,n=le,Re=null,n){case yi:case Ps:throw Error(S(345));case pf:Gl(e,2<i?2:i);break;case zs:if(Ai(e,i),n=e.lastSuspendedTime,i===n&&(e.nextKnownPendingLevel=Hl(r)),At===1073741823&&(r=Ol+ff-He(),10<r)){if(Vs){var s=e.lastPingedTime;if(s===0||s>=i){e.lastPingedTime=i,Ci(e,i);break}}if(s=$s(e),s!==0&&s!==i)break;if(n!==0&&n!==i){e.lastPingedTime=n;break}e.timeoutHandle=Ya(Mi.bind(null,e),r);break}Mi(e);break;case Ds:if(Ai(e,i),n=e.lastSuspendedTime,i===n&&(e.nextKnownPendingLevel=Hl(r)),Vs&&(r=e.lastPingedTime,r===0||r>=i)){e.lastPingedTime=i,Ci(e,i);break}if(r=$s(e),r!==0&&r!==i)break;if(n!==0&&n!==i){e.lastPingedTime=n;break}if(tr!==1073741823?n=10*(1073741821-tr)-He():At===1073741823?n=0:(n=10*(1073741821-At)-5e3,r=He(),i=10*(1073741821-i)-r,n=r-n,0>n&&(n=0),n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*gx(n/1960))-n,i<n&&(n=i)),10<n){e.timeoutHandle=Ya(Mi.bind(null,e),n);break}Mi(e);break;case Bl:if(At!==1073741823&&Ls!==null){s=At;var o=Ls;if(n=o.busyMinDurationMs|0,0>=n?n=0:(r=o.busyDelayMs|0,s=He()-(10*(1073741821-s)-(o.timeoutMs|0||5e3)),n=s<=r?0:r+n-s),10<n){Ai(e,i),e.timeoutHandle=Ya(Mi.bind(null,e),n);break}}Mi(e);break;default:throw Error(S(329))}if(Be(e),e.callbackNode===t)return gf.bind(null,e)}}return null}function Ul(e){var t=e.lastExpiredTime;if(t=t!==0?t:1073741823,(L&(et|ht))!==ae)throw Error(S(327));if(nn(),e===Re&&t===ke||Ci(e,t),R!==null){var i=L;L|=et;var n=yf();do try{vx();break}catch(r){wf(e,r)}while(1);if(ll(),L=i,ks.current=n,le===Ps)throw i=js,Ci(e,t),Ai(e,t),Be(e),i;if(R!==null)throw Error(S(261));e.finishedWork=e.current.alternate,e.finishedExpirationTime=t,Re=null,Mi(e),Be(e)}return null}function mx(){if(xi!==null){var e=xi;xi=null,e.forEach(function(t,i){Gl(i,t),Be(i)}),ut()}}function mf(e,t){var i=L;L|=1;try{return e(t)}finally{L=i,L===ae&&ut()}}function vf(e,t){var i=L;L&=-2,L|=Rl;try{return e(t)}finally{L=i,L===ae&&ut()}}function Ci(e,t){e.finishedWork=null,e.finishedExpirationTime=0;var i=e.timeoutHandle;if(i!==-1&&(e.timeoutHandle=-1,g0(i)),R!==null)for(i=R.return;i!==null;){var n=i;switch(n.tag){case 1:n=n.type.childContextTypes,n!=null&&as();break;case 3:qi(),Y(Te),Y(ge);break;case 5:gl(n);break;case 4:qi();break;case 13:Y(K);break;case 19:Y(K);break;case 10:ul(n)}i=i.return}Re=e,R=bi(e.current,null),ke=t,le=yi,js=null,tr=At=1073741823,Ls=null,ir=0,Vs=!1}function wf(e,t){do{try{if(ll(),Ss.current=Es,Cs)for(var i=re.memoizedState;i!==null;){var n=i.queue;n!==null&&(n.pending=null),i=i.next}if(Zt=0,ve=me=re=null,Cs=!1,R===null||R.return===null)return le=Ps,js=t,R=null;e:{var r=e,s=R.return,o=R,a=t;if(t=ke,o.effectTag|=2048,o.firstEffect=o.lastEffect=null,a!==null&&typeof a=="object"&&typeof a.then=="function"){var l=a;if((o.mode&2)===0){var u=o.alternate;u?(o.updateQueue=u.updateQueue,o.memoizedState=u.memoizedState,o.expirationTime=u.expirationTime):(o.updateQueue=null,o.memoizedState=null)}var h=(K.current&1)!==0,p=s;do{var w;if(w=p.tag===13){var C=p.memoizedState;if(C!==null)w=C.dehydrated!==null;else{var E=p.memoizedProps;w=E.fallback===void 0?!1:E.unstable_avoidThisFallback!==!0?!0:!h}}if(w){var T=p.updateQueue;if(T===null){var c=new Set;c.add(l),p.updateQueue=c}else T.add(l);if((p.mode&2)===0){if(p.effectTag|=64,o.effectTag&=-2981,o.tag===1)if(o.alternate===null)o.tag=17;else{var d=Ft(1073741823,null);d.tag=2,Qt(o,d)}o.expirationTime=1073741823;break e}a=void 0,o=t;var f=r.pingCache;if(f===null?(f=r.pingCache=new fx,a=new Set,f.set(l,a)):(a=f.get(l),a===void 0&&(a=new Set,f.set(l,a))),!a.has(o)){a.add(o);var g=Cx.bind(null,r,l,o);l.then(g,g)}p.effectTag|=4096,p.expirationTime=t;break e}p=p.return}while(p!==null);a=Error((yt(o.type)||"A React component")+` suspended while rendering, but no fallback UI was specified.
152
-
153
- Add a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.`+ya(o))}le!==Bl&&(le=pf),a=zl(a,o),p=s;do{switch(p.tag){case 3:l=a,p.effectTag|=4096,p.expirationTime=t;var m=cf(p,l,t);Mp(p,m);break e;case 1:l=a;var x=p.type,y=p.stateNode;if((p.effectTag&64)===0&&(typeof x.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Gt===null||!Gt.has(y)))){p.effectTag|=4096,p.expirationTime=t;var k=df(p,l,t);Mp(p,k);break e}}p=p.return}while(p!==null)}R=Cf(R)}catch(D){t=D;continue}break}while(1)}function yf(){var e=ks.current;return ks.current=Es,e===null?Es:e}function xf(e,t){e<At&&2<e&&(At=e),t!==null&&e<tr&&2<e&&(tr=e,Ls=t)}function Us(e){e>ir&&(ir=e)}function vx(){for(;R!==null;)R=Sf(R)}function wx(){for(;R!==null&&!ix();)R=Sf(R)}function Sf(e){var t=If(e.alternate,e,ke);return e.memoizedProps=e.pendingProps,t===null&&(t=Cf(e)),hf.current=null,t}function Cf(e){R=e;do{var t=R.alternate;if(e=R.return,(R.effectTag&2048)===0){if(t=lx(t,R,ke),ke===1||R.childExpirationTime!==1){for(var i=0,n=R.child;n!==null;){var r=n.expirationTime,s=n.childExpirationTime;r>i&&(i=r),s>i&&(i=s),n=n.sibling}R.childExpirationTime=i}if(t!==null)return t;e!==null&&(e.effectTag&2048)===0&&(e.firstEffect===null&&(e.firstEffect=R.firstEffect),R.lastEffect!==null&&(e.lastEffect!==null&&(e.lastEffect.nextEffect=R.firstEffect),e.lastEffect=R.lastEffect),1<R.effectTag&&(e.lastEffect!==null?e.lastEffect.nextEffect=R:e.firstEffect=R,e.lastEffect=R))}else{if(t=ux(R),t!==null)return t.effectTag&=2047,t;e!==null&&(e.firstEffect=e.lastEffect=null,e.effectTag|=2048)}if(t=R.sibling,t!==null)return t;R=e}while(R!==null);return le===yi&&(le=Bl),null}function Hl(e){var t=e.expirationTime;return e=e.childExpirationTime,t>e?t:e}function Mi(e){var t=ds();return Ht(99,yx.bind(null,e,t)),null}function yx(e,t){do nn();while(nr!==null);if((L&(et|ht))!==ae)throw Error(S(327));var i=e.finishedWork,n=e.finishedExpirationTime;if(i===null)return null;if(e.finishedWork=null,e.finishedExpirationTime=0,i===e.current)throw Error(S(177));e.callbackNode=null,e.callbackExpirationTime=0,e.callbackPriority=90,e.nextKnownPendingLevel=0;var r=Hl(i);if(e.firstPendingTime=r,n<=e.lastSuspendedTime?e.firstSuspendedTime=e.lastSuspendedTime=e.nextKnownPendingLevel=0:n<=e.firstSuspendedTime&&(e.firstSuspendedTime=n-1),n<=e.lastPingedTime&&(e.lastPingedTime=0),n<=e.lastExpiredTime&&(e.lastExpiredTime=0),e===Re&&(R=Re=null,ke=0),1<i.effectTag?i.lastEffect!==null?(i.lastEffect.nextEffect=i,r=i.firstEffect):r=i:r=i.firstEffect,r!==null){var s=L;L|=ht,hf.current=null,Fa=Kr;var o=Lh();if(Ua(o)){if("selectionStart"in o)var a={start:o.selectionStart,end:o.selectionEnd};else e:{a=(a=o.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var u=l.anchorOffset,h=l.focusNode;l=l.focusOffset;try{a.nodeType,h.nodeType}catch{a=null;break e}var p=0,w=-1,C=-1,E=0,T=0,c=o,d=null;t:for(;;){for(var f;c!==a||u!==0&&c.nodeType!==3||(w=p+u),c!==h||l!==0&&c.nodeType!==3||(C=p+l),c.nodeType===3&&(p+=c.nodeValue.length),(f=c.firstChild)!==null;)d=c,c=f;for(;;){if(c===o)break t;if(d===a&&++E===u&&(w=p),d===h&&++T===l&&(C=p),(f=c.nextSibling)!==null)break;c=d,d=c.parentNode}c=f}a=w===-1||C===-1?null:{start:w,end:C}}else a=null}a=a||{start:0,end:0}}else a=null;Qa={activeElementDetached:null,focusedElem:o,selectionRange:a},Kr=!1,z=r;do try{xx()}catch(P){if(z===null)throw Error(S(330));Ii(z,P),z=z.nextEffect}while(z!==null);z=r;do try{for(o=e,a=t;z!==null;){var g=z.effectTag;if(g&16&&Tn(z.stateNode,""),g&128){var m=z.alternate;if(m!==null){var x=m.ref;x!==null&&(typeof x=="function"?x(null):x.current=null)}}switch(g&1038){case 2:af(z),z.effectTag&=-3;break;case 6:af(z),z.effectTag&=-3,Vl(z.alternate,z);break;case 1024:z.effectTag&=-1025;break;case 1028:z.effectTag&=-1025,Vl(z.alternate,z);break;case 4:Vl(z.alternate,z);break;case 8:u=z,lf(o,u,a),sf(u)}z=z.nextEffect}}catch(P){if(z===null)throw Error(S(330));Ii(z,P),z=z.nextEffect}while(z!==null);if(x=Qa,m=Lh(),g=x.focusedElem,a=x.selectionRange,m!==g&&g&&g.ownerDocument&&jh(g.ownerDocument.documentElement,g)){for(a!==null&&Ua(g)&&(m=a.start,x=a.end,x===void 0&&(x=m),"selectionStart"in g?(g.selectionStart=m,g.selectionEnd=Math.min(x,g.value.length)):(x=(m=g.ownerDocument||document)&&m.defaultView||window,x.getSelection&&(x=x.getSelection(),u=g.textContent.length,o=Math.min(a.start,u),a=a.end===void 0?o:Math.min(a.end,u),!x.extend&&o>a&&(u=a,a=o,o=u),u=Dh(g,o),h=Dh(g,a),u&&h&&(x.rangeCount!==1||x.anchorNode!==u.node||x.anchorOffset!==u.offset||x.focusNode!==h.node||x.focusOffset!==h.offset)&&(m=m.createRange(),m.setStart(u.node,u.offset),x.removeAllRanges(),o>a?(x.addRange(m),x.extend(h.node,h.offset)):(m.setEnd(h.node,h.offset),x.addRange(m)))))),m=[],x=g;x=x.parentNode;)x.nodeType===1&&m.push({element:x,left:x.scrollLeft,top:x.scrollTop});for(typeof g.focus=="function"&&g.focus(),g=0;g<m.length;g++)x=m[g],x.element.scrollLeft=x.left,x.element.scrollTop=x.top}Kr=!!Fa,Qa=Fa=null,e.current=i,z=r;do try{for(g=e;z!==null;){var y=z.effectTag;if(y&36&&px(g,z.alternate,z),y&128){m=void 0;var k=z.ref;if(k!==null){var D=z.stateNode;switch(z.tag){case 5:m=D;break;default:m=D}typeof k=="function"?k(m):k.current=m}}z=z.nextEffect}}catch(P){if(z===null)throw Error(S(330));Ii(z,P),z=z.nextEffect}while(z!==null);z=null,nx(),L=s}else e.current=i;if(Bs)Bs=!1,nr=e,rr=t;else for(z=r;z!==null;)t=z.nextEffect,z.nextEffect=null,z=t;if(t=e.firstPendingTime,t===0&&(Gt=null),t===1073741823?e===$l?sr++:(sr=0,$l=e):sr=0,typeof Wl=="function"&&Wl(i.stateNode,n),Be(e),Rs)throw Rs=!1,e=_l,_l=null,e;return(L&Rl)!==ae||ut(),null}function xx(){for(;z!==null;){var e=z.effectTag;(e&256)!==0&&hx(z.alternate,z),(e&512)===0||Bs||(Bs=!0,yp(97,function(){return nn(),null})),z=z.nextEffect}}function nn(){if(rr!==90){var e=97<rr?97:rr;return rr=90,Ht(e,Sx)}}function Sx(){if(nr===null)return!1;var e=nr;if(nr=null,(L&(et|ht))!==ae)throw Error(S(331));var t=L;for(L|=ht,e=e.current.firstEffect;e!==null;){try{var i=e;if((i.effectTag&512)!==0)switch(i.tag){case 0:case 11:case 15:case 22:tf(5,i),nf(5,i)}}catch(n){if(e===null)throw Error(S(330));Ii(e,n)}i=e.nextEffect,e.nextEffect=null,e=i}return L=t,ut(),!0}function Mf(e,t,i){t=zl(i,t),t=cf(e,t,1073741823),Qt(e,t),e=_s(e,1073741823),e!==null&&Be(e)}function Ii(e,t){if(e.tag===3)Mf(e,e,t);else for(var i=e.return;i!==null;){if(i.tag===3){Mf(i,e,t);break}else if(i.tag===1){var n=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Gt===null||!Gt.has(n))){e=zl(t,e),e=df(i,e,1073741823),Qt(i,e),i=_s(i,1073741823),i!==null&&Be(i);break}}i=i.return}}function Cx(e,t,i){var n=e.pingCache;n!==null&&n.delete(t),Re===e&&ke===i?le===Ds||le===zs&&At===1073741823&&He()-Ol<ff?Ci(e,ke):Vs=!0:bf(e,i)&&(t=e.lastPingedTime,t!==0&&t<i||(e.lastPingedTime=i,Be(e)))}function Mx(e,t){var i=e.stateNode;i!==null&&i.delete(t),t=0,t===0&&(t=pt(),t=Si(t,e,null)),e=_s(e,t),e!==null&&Be(e)}var If;If=function(e,t,i){var n=t.expirationTime;if(e!==null){var r=t.pendingProps;if(e.memoizedProps!==r||Te.current)dt=!0;else{if(n<i){switch(dt=!1,t.tag){case 3:Zp(t),Al();break;case 5:if(kp(t),t.mode&4&&i!==1&&r.hidden)return t.expirationTime=t.childExpirationTime=1,null;break;case 1:Ne(t.type)&&ls(t);break;case 4:fl(t,t.stateNode.containerInfo);break;case 10:n=t.memoizedProps.value,r=t.type._context,te(ps,r._currentValue),r._currentValue=n;break;case 13:if(t.memoizedState!==null)return n=t.child.childExpirationTime,n!==0&&n>=i?Yp(e,t,i):(te(K,K.current&1),t=bt(e,t,i),t!==null?t.sibling:null);te(K,K.current&1);break;case 19:if(n=t.childExpirationTime>=i,(e.effectTag&64)!==0){if(n)return Xp(e,t,i);t.effectTag|=64}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null),te(K,K.current),!n)return null}return bt(e,t,i)}dt=!1}}else dt=!1;switch(t.expirationTime=0,t.tag){case 2:if(n=t.type,e!==null&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps,r=Gi(t,ge.current),Ji(t,i),r=wl(null,t,n,e,r,i),t.effectTag|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0){if(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ne(n)){var s=!0;ls(t)}else s=!1;t.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,cl(t);var o=n.getDerivedStateFromProps;typeof o=="function"&&ms(t,n,o,e),r.updater=vs,t.stateNode=r,r._reactInternalFiber=t,hl(t,n,e,i),t=Tl(null,t,n,!0,s,i)}else t.tag=0,Ve(null,t,r,i),t=t.child;return t;case 16:e:{if(r=t.elementType,e!==null&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps,Ky(r),r._status!==1)throw r._result;switch(r=r._result,t.type=r,s=t.tag=Ax(r),e=qe(r,e),s){case 0:t=El(null,t,r,e,i);break e;case 1:t=Qp(null,t,r,e,i);break e;case 11:t=Up(null,t,r,e,i);break e;case 14:t=Hp(null,t,r,qe(r.type,e),n,i);break e}throw Error(S(306,r,""))}return t;case 0:return n=t.type,r=t.pendingProps,r=t.elementType===n?r:qe(n,r),El(e,t,n,r,i);case 1:return n=t.type,r=t.pendingProps,r=t.elementType===n?r:qe(n,r),Qp(e,t,n,r,i);case 3:if(Zp(t),n=t.updateQueue,e===null||n===null)throw Error(S(282));if(n=t.pendingProps,r=t.memoizedState,r=r!==null?r.element:null,dl(e,t),Gn(t,n,null,i),n=t.memoizedState.element,n===r)Al(),t=bt(e,t,i);else{if((r=t.stateNode.hydrate)&&(Yt=Wi(t.stateNode.containerInfo.firstChild),It=t,r=wi=!0),r)for(i=pl(t,null,n,i),t.child=i;i;)i.effectTag=i.effectTag&-3|1024,i=i.sibling;else Ve(e,t,n,i),Al();t=t.child}return t;case 5:return kp(t),e===null&&bl(t),n=t.type,r=t.pendingProps,s=e!==null?e.memoizedProps:null,o=r.children,Za(n,r)?o=null:s!==null&&Za(n,s)&&(t.effectTag|=16),Fp(e,t),t.mode&4&&i!==1&&r.hidden?(t.expirationTime=t.childExpirationTime=1,t=null):(Ve(e,t,o,i),t=t.child),t;case 6:return e===null&&bl(t),null;case 13:return Yp(e,t,i);case 4:return fl(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Ki(t,null,n,i):Ve(e,t,n,i),t.child;case 11:return n=t.type,r=t.pendingProps,r=t.elementType===n?r:qe(n,r),Up(e,t,n,r,i);case 7:return Ve(e,t,t.pendingProps,i),t.child;case 8:return Ve(e,t,t.pendingProps.children,i),t.child;case 12:return Ve(e,t,t.pendingProps.children,i),t.child;case 10:e:{n=t.type._context,r=t.pendingProps,o=t.memoizedProps,s=r.value;var a=t.type._context;if(te(ps,a._currentValue),a._currentValue=s,o!==null)if(a=o.value,s=fi(a,s)?0:(typeof n._calculateChangedBits=="function"?n._calculateChangedBits(a,s):1073741823)|0,s===0){if(o.children===r.children&&!Te.current){t=bt(e,t,i);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var l=a.dependencies;if(l!==null){o=a.child;for(var u=l.firstContext;u!==null;){if(u.context===n&&(u.observedBits&s)!==0){a.tag===1&&(u=Ft(i,null),u.tag=2,Qt(a,u)),a.expirationTime<i&&(a.expirationTime=i),u=a.alternate,u!==null&&u.expirationTime<i&&(u.expirationTime=i),Cp(a.return,i),l.expirationTime<i&&(l.expirationTime=i);break}u=u.next}}else o=a.tag===10&&a.type===t.type?null:a.child;if(o!==null)o.return=a;else for(o=a;o!==null;){if(o===t){o=null;break}if(a=o.sibling,a!==null){a.return=o.return,o=a;break}o=o.return}a=o}Ve(e,t,r.children,i),t=t.child}return t;case 9:return r=t.type,s=t.pendingProps,n=s.children,Ji(t,i),r=We(r,s.unstable_observedBits),n=n(r),t.effectTag|=1,Ve(e,t,n,i),t.child;case 14:return r=t.type,s=qe(r,t.pendingProps),s=qe(r.type,s),Hp(e,t,r,s,n,i);case 15:return Wp(e,t,t.type,t.pendingProps,n,i);case 17:return n=t.type,r=t.pendingProps,r=t.elementType===n?r:qe(n,r),e!==null&&(e.alternate=null,t.alternate=null,t.effectTag|=2),t.tag=1,Ne(n)?(e=!0,ls(t)):e=!1,Ji(t,i),Ep(t,n,r),hl(t,n,r,i),Tl(null,t,n,!0,e,i);case 19:return Xp(e,t,i)}throw Error(S(156,t.tag))};var Wl=null,Fl=null;function Ix(e){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined")return!1;var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)return!0;try{var i=t.inject(e);Wl=function(n){try{t.onCommitFiberRoot(i,n,void 0,(n.current.effectTag&64)===64)}catch{}},Fl=function(n){try{t.onCommitFiberUnmount(i,n)}catch{}}}catch{}return!0}function bx(e,t,i,n){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.effectTag=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childExpirationTime=this.expirationTime=0,this.alternate=null}function ft(e,t,i,n){return new bx(e,t,i,n)}function Ql(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ax(e){if(typeof e=="function")return Ql(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ma)return 11;if(e===wa)return 14}return 2}function bi(e,t){var i=e.alternate;return i===null?(i=ft(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.effectTag=0,i.nextEffect=null,i.firstEffect=null,i.lastEffect=null),i.childExpirationTime=e.childExpirationTime,i.expirationTime=e.expirationTime,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{expirationTime:t.expirationTime,firstContext:t.firstContext,responders:t.responders},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i}function Hs(e,t,i,n,r,s){var o=2;if(n=e,typeof e=="function")Ql(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case di:return Jt(i.children,r,s,t);case Jy:o=8,r|=7;break;case Fd:o=8,r|=1;break;case Hr:return e=ft(12,i,t,r|8),e.elementType=Hr,e.type=Hr,e.expirationTime=s,e;case Wr:return e=ft(13,i,t,r),e.type=Wr,e.elementType=Wr,e.expirationTime=s,e;case va:return e=ft(19,i,t,r),e.elementType=va,e.expirationTime=s,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Qd:o=10;break e;case Zd:o=9;break e;case ma:o=11;break e;case wa:o=14;break e;case Yd:o=16,n=null;break e;case Gd:o=22;break e}throw Error(S(130,e==null?e:typeof e,""))}return t=ft(o,i,t,r),t.elementType=e,t.type=n,t.expirationTime=s,t}function Jt(e,t,i,n){return e=ft(7,e,n,t),e.expirationTime=i,e}function Zl(e,t,i){return e=ft(6,e,null,t),e.expirationTime=i,e}function Yl(e,t,i){return t=ft(4,e.children!==null?e.children:[],e.key,t),t.expirationTime=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Ex(e,t,i){this.tag=t,this.current=null,this.containerInfo=e,this.pingCache=this.pendingChildren=null,this.finishedExpirationTime=0,this.finishedWork=null,this.timeoutHandle=-1,this.pendingContext=this.context=null,this.hydrate=i,this.callbackNode=null,this.callbackPriority=90,this.lastExpiredTime=this.lastPingedTime=this.nextKnownPendingLevel=this.lastSuspendedTime=this.firstSuspendedTime=this.firstPendingTime=0}function bf(e,t){var i=e.firstSuspendedTime;return e=e.lastSuspendedTime,i!==0&&i>=t&&e<=t}function Ai(e,t){var i=e.firstSuspendedTime,n=e.lastSuspendedTime;i<t&&(e.firstSuspendedTime=t),(n>t||i===0)&&(e.lastSuspendedTime=t),t<=e.lastPingedTime&&(e.lastPingedTime=0),t<=e.lastExpiredTime&&(e.lastExpiredTime=0)}function Af(e,t){t>e.firstPendingTime&&(e.firstPendingTime=t);var i=e.firstSuspendedTime;i!==0&&(t>=i?e.firstSuspendedTime=e.lastSuspendedTime=e.nextKnownPendingLevel=0:t>=e.lastSuspendedTime&&(e.lastSuspendedTime=t+1),t>e.nextKnownPendingLevel&&(e.nextKnownPendingLevel=t))}function Gl(e,t){var i=e.lastExpiredTime;(i===0||i>t)&&(e.lastExpiredTime=t)}function Ws(e,t,i,n){var r=t.current,s=pt(),o=Xn.suspense;s=Si(s,r,o);e:if(i){i=i._reactInternalFiber;t:{if(hi(i)!==i||i.tag!==1)throw Error(S(170));var a=i;do{switch(a.tag){case 3:a=a.stateNode.context;break t;case 1:if(Ne(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break t}}a=a.return}while(a!==null);throw Error(S(171))}if(i.tag===1){var l=i.type;if(Ne(l)){i=lp(i,l,a);break e}}i=a}else i=Ut;return t.context===null?t.context=i:t.pendingContext=i,t=Ft(s,o),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),Qt(r,t),Xt(r,s),s}function Xl(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Ef(e,t){e=e.memoizedState,e!==null&&e.dehydrated!==null&&e.retryTime<t&&(e.retryTime=t)}function Jl(e,t){Ef(e,t),(e=e.alternate)&&Ef(e,t)}function Kl(e,t,i){i=i!=null&&i.hydrate===!0;var n=new Ex(e,t,i),r=ft(3,null,null,t===2?7:t===1?3:0);n.current=r,r.stateNode=n,cl(r),e[Bn]=n.current,i&&t!==0&&r0(e,e.nodeType===9?e:e.ownerDocument),this._internalRoot=n}Kl.prototype.render=function(e){Ws(e,this._internalRoot,null,null)},Kl.prototype.unmount=function(){var e=this._internalRoot,t=e.containerInfo;Ws(null,e,null,function(){t[Bn]=null})};function or(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Tx(e,t){if(t||(t=e?e.nodeType===9?e.documentElement:e.firstChild:null,t=!(!t||t.nodeType!==1||!t.hasAttribute("data-reactroot"))),!t)for(var i;i=e.lastChild;)e.removeChild(i);return new Kl(e,0,t?{hydrate:!0}:void 0)}function Fs(e,t,i,n,r){var s=i._reactRootContainer;if(s){var o=s._internalRoot;if(typeof r=="function"){var a=r;r=function(){var u=Xl(o);a.call(u)}}Ws(t,o,e,r)}else{if(s=i._reactRootContainer=Tx(i,n),o=s._internalRoot,typeof r=="function"){var l=r;r=function(){var u=Xl(o);l.call(u)}}vf(function(){Ws(t,o,e,r)})}return Xl(o)}function Nx(e,t,i){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:_i,key:n==null?null:""+n,children:e,containerInfo:t,implementation:i}}Sh=function(e){if(e.tag===13){var t=hs(pt(),150,100);Xt(e,t),Jl(e,t)}},Pa=function(e){e.tag===13&&(Xt(e,3),Jl(e,3))},Ch=function(e){if(e.tag===13){var t=pt();t=Si(t,e,null),Xt(e,t),Jl(e,t)}},la=function(e,t,i){switch(t){case"input":if(Sa(e,i),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<i.length;t++){var n=i[t];if(n!==e&&n.form===e.form){var r=Xa(n);if(!r)throw Error(S(90));Kd(n),Sa(n,r)}}}break;case"textarea":nh(e,i);break;case"select":t=i.value,t!=null&&$i(e,!!i.multiple,t,!1)}},ua=mf,Od=function(e,t,i,n,r){var s=L;L|=4;try{return Ht(98,e.bind(null,t,i,n,r))}finally{L=s,L===ae&&ut()}},ca=function(){(L&(1|et|ht))===ae&&(mx(),nn())},_d=function(e,t){var i=L;L|=2;try{return e(t)}finally{L=i,L===ae&&ut()}};function Tf(e,t){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!or(t))throw Error(S(200));return Nx(e,t,null,i)}var kx={Events:[_n,pi,Xa,Ld,oa,Fi,function(e){Ta(e,v0)},Rd,Bd,qr,Gr,nn,{current:!1}]};(function(e){var t=e.findFiberByHostInstance;return Ix(Se({},e,{overrideHookState:null,overrideProps:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ke.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=mh(i),i===null?null:i.stateNode},findFiberByHostInstance:function(i){return t?t(i):null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null}))})({findFiberByHostInstance:On,bundleType:0,version:"16.14.0",rendererPackageName:"react-dom"}),Ue.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=kx,Ue.createPortal=Tf,Ue.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternalFiber;if(t===void 0)throw typeof e.render=="function"?Error(S(188)):Error(S(268,Object.keys(e)));return e=mh(t),e=e===null?null:e.stateNode,e},Ue.flushSync=function(e,t){if((L&(et|ht))!==ae)throw Error(S(187));var i=L;L|=1;try{return Ht(99,e.bind(null,t))}finally{L=i,ut()}},Ue.hydrate=function(e,t,i){if(!or(t))throw Error(S(200));return Fs(null,e,t,!0,i)},Ue.render=function(e,t,i){if(!or(t))throw Error(S(200));return Fs(null,e,t,!1,i)},Ue.unmountComponentAtNode=function(e){if(!or(e))throw Error(S(40));return e._reactRootContainer?(vf(function(){Fs(null,null,e,!1,function(){e._reactRootContainer=null,e[Bn]=null})}),!0):!1},Ue.unstable_batchedUpdates=mf,Ue.unstable_createPortal=function(e,t){return Tf(e,t,2<arguments.length&&arguments[2]!==void 0?arguments[2]:null)},Ue.unstable_renderSubtreeIntoContainer=function(e,t,i,n){if(!or(i))throw Error(S(200));if(e==null||e._reactInternalFiber===void 0)throw Error(S(38));return Fs(e,t,i,!1,n)},Ue.version="16.14.0";function Nf(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Nf)}catch(e){console.error(e)}}Nf(),Ed.exports=Ue;var kf=Ed.exports,Px=Object.defineProperty,zx=Object.defineProperties,Dx=Object.getOwnPropertyDescriptors,Pf=Object.getOwnPropertySymbols,jx=Object.prototype.hasOwnProperty,Lx=Object.prototype.propertyIsEnumerable,zf=(e,t,i)=>t in e?Px(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Oe=(e,t)=>{for(var i in t||(t={}))jx.call(t,i)&&zf(e,i,t[i]);if(Pf)for(var i of Pf(t))Lx.call(t,i)&&zf(e,i,t[i]);return e};const Df={src:"",currentTime:0,hostTime:0,muted:!1,paused:!0,volume:1},jf={currentTimeMaxError:1,syncInterval:1e3,retryInterval:15e3,verbose:!1,log:console.log.bind(console)};let Kt=jf;function Vx(e){Kt=Oe(Oe({},jf),e)}function Qs(e,t){if(e.paused)return e.currentTime;const i=function(n){if(n.player)return n.player.beginTimestamp+n.player.progressTime;if(n.room)return n.room.calibrationTimestamp}(t);return i?e.currentTime+(i-e.hostTime)/1e3:e.currentTime}const Rx=navigator.userAgent.includes("Safari"),Bx=[".aac",".mid",".midi",".mp3",".ogg",".oga",".wav",".weba"];var Ox=typeof global=="object"&&global&&global.Object===Object&&global,_x=typeof self=="object"&&self&&self.Object===Object&&self,Lf=Ox||_x||Function("return this")(),Zs=Lf.Symbol,Vf=Object.prototype,$x=Vf.hasOwnProperty,Ux=Vf.toString,ar=Zs?Zs.toStringTag:void 0,Hx=Object.prototype.toString,Rf=Zs?Zs.toStringTag:void 0;function Wx(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Rf&&Rf in Object(e)?function(t){var i=$x.call(t,ar),n=t[ar];try{t[ar]=void 0;var r=!0}catch{}var s=Ux.call(t);return r&&(i?t[ar]=n:delete t[ar]),s}(e):function(t){return Hx.call(t)}(e)}var Fx=/\s/,Qx=/^\s+/;function Zx(e){return e&&e.slice(0,function(t){for(var i=t.length;i--&&Fx.test(t.charAt(i)););return i}(e)+1).replace(Qx,"")}function ql(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Yx=/^[-+]0x[0-9a-f]+$/i,Gx=/^0b[01]+$/i,Xx=/^0o[0-7]+$/i,Jx=parseInt;function Bf(e){if(typeof e=="number")return e;if(function(n){return typeof n=="symbol"||function(r){return r!=null&&typeof r=="object"}(n)&&Wx(n)=="[object Symbol]"}(e))return NaN;if(ql(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=ql(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Zx(e);var i=Gx.test(e);return i||Xx.test(e)?Jx(e.slice(2),i?2:8):Yx.test(e)?NaN:+e}var eu=function(){return Lf.Date.now()},Kx=Math.max,qx=Math.min;function Ys(e,t,i){var n,r,s,o,a,l,u=0,h=!1,p=!1,w=!0;if(typeof e!="function")throw new TypeError("Expected a function");function C(g){var m=n,x=r;return n=r=void 0,u=g,o=e.apply(x,m)}function E(g){return u=g,a=setTimeout(c,t),h?C(g):o}function T(g){var m=g-l;return l===void 0||m>=t||m<0||p&&g-u>=s}function c(){var g=eu();if(T(g))return d(g);a=setTimeout(c,function(m){var x=t-(m-l);return p?qx(x,s-(m-u)):x}(g))}function d(g){return a=void 0,w&&n?C(g):(n=r=void 0,o)}function f(){var g=eu(),m=T(g);if(n=arguments,r=this,l=g,m){if(a===void 0)return E(l);if(p)return clearTimeout(a),a=setTimeout(c,t),C(l)}return a===void 0&&(a=setTimeout(c,t)),o}return t=Bf(t)||0,ql(i)&&(h=!!i.leading,s=(p="maxWait"in i)?Kx(Bf(i.maxWait)||0,t):s,w="trailing"in i?!!i.trailing:w),f.cancel=function(){a!==void 0&&clearTimeout(a),u=0,n=l=r=a=void 0},f.flush=function(){return a===void 0?o:d(eu())},f}class Of extends ui.exports.Component{constructor(t){super(t),this.seeking=!1,this.mobileSeeking=!1,this.track=null,this.hoverTime=null,this.offset=0,this.secondsPrefix="00:00:",this.minutesPrefix="00:",this.seekPause=!1,this.handleTouchSeeking=i=>{let n=0;for(let r=0;r<i.changedTouches.length;r++)n=i.changedTouches[r].pageX;n=n<0?0:n,this.mobileSeeking&&this.changeCurrentTimePosition(n)},this.handleSeeking=i=>{this.seeking&&this.changeCurrentTimePosition(i.pageX)},this.setTrackWidthState=()=>{this.track&&this.setState({trackWidth:this.track.offsetWidth})},this.handleTrackHover=(i,n)=>{if(this.track){const r=this.props.scale||1;let s;s=i?0:(n.pageX-this.track.getBoundingClientRect().left)/r,this.setState({seekHoverPosition:s,trackWidth:this.track.offsetWidth})}},this.mouseSeekingHandler=i=>{this.setSeeking(!1,i),this.onMouseUp()},this.setSeeking=(i,n)=>{n.preventDefault(),this.handleSeeking(n),this.seeking=i,this.setState({seekHoverPosition:i?this.state.seekHoverPosition:0})},this.mobileTouchSeekingHandler=()=>{this.setMobileSeeking(!1)},this.setMobileSeeking=i=>{this.mobileSeeking=i,this.setState({seekHoverPosition:i?this.state.seekHoverPosition:0})},this.renderBufferProgress=()=>{if(this.props.buffered){const i=Oe(Oe({},this.getPositionStyle(this.props.buffered)),this.props.bufferColor&&{backgroundColor:this.props.bufferColor});return _.createElement("div",{className:"buffered",style:i})}return null},this.renderProgress=()=>{const i=Oe(Oe({},this.getPositionStyle(this.props.current)),this.props.sliderColor&&{backgroundColor:this.props.sliderColor});return _.createElement("div",{className:"connect",style:i})},this.renderHoverProgress=()=>{const i=Oe(Oe({},this.getSeekHoverPosition()),this.props.sliderHoverColor&&{backgroundColor:this.props.sliderHoverColor});return _.createElement("div",{className:"seek-hover",style:i})},this.renderThumb=()=>_.createElement("div",{className:this.isThumbActive()?"thumb active":"thumb",style:this.getThumbHandlerPosition()},_.createElement("div",{style:{backgroundColor:this.props.thumbColor},className:"handler"})),this.onMouseDown=i=>{var n,r;this.props.pause&&!this.props.paused&&(this.props.pause(),this.seekPause=!0),this.setSeeking(!0,i),(r=(n=this.props).onSeekStart)==null||r.call(n)},this.onMouseUp=()=>{var i,n;this.props.play&&this.seekPause&&(this.props.play(),this.seekPause=!1),(n=(i=this.props).onSeekEnd)==null||n.call(i)},this.props.secondsPrefix&&(this.secondsPrefix=this.props.secondsPrefix),this.props.minutesPrefix&&(this.minutesPrefix=this.props.minutesPrefix),this.state={ready:!1,trackWidth:0,seekHoverPosition:0}}componentDidMount(){this.setTrackWidthState(),window.addEventListener("resize",this.setTrackWidthState),window.addEventListener("mousemove",this.handleSeeking),window.addEventListener("mouseup",this.mouseSeekingHandler),window.addEventListener("touchmove",this.handleTouchSeeking),window.addEventListener("touchend",this.mobileTouchSeekingHandler)}componentWillUnmount(){window.removeEventListener("resize",this.setTrackWidthState),window.removeEventListener("mousemove",this.handleSeeking),window.removeEventListener("mouseup",this.mouseSeekingHandler),window.removeEventListener("touchmove",this.handleTouchSeeking),window.removeEventListener("touchend",this.mobileTouchSeekingHandler)}changeCurrentTimePosition(t){if(this.track){const i=this.props.scale||1;let n=(t-this.track.getBoundingClientRect().left)/i;n=Math.min(this.state.trackWidth,Math.max(0,n)),this.setState({seekHoverPosition:n});const r=+(n/this.state.trackWidth*this.props.total).toFixed(0);this.props.onChange(r)}}getPositionStyle(t){return{transform:`scaleX(${100*t/this.props.total/100})`}}getThumbHandlerPosition(){return{transform:`translateX(${this.state.trackWidth/(this.props.total/this.props.current)}px)`}}getSeekHoverPosition(){return{transform:`scaleX(${100*this.state.seekHoverPosition/this.state.trackWidth/100})`}}getHoverTimePosition(){let t=0;return this.hoverTime&&(t=this.state.seekHoverPosition-this.hoverTime.offsetWidth/2,this.props.limitTimeTooltipBySides&&(t<0?t=0:t+this.hoverTime.offsetWidth>this.state.trackWidth&&(t=this.state.trackWidth-this.hoverTime.offsetWidth))),{transform:`translateX(${t}px)`}}secondsToTime(t){t=Math.round(t+this.offset);const i=Math.floor(t/3600),n=t%3600,r=Math.floor(n/60),s=Math.ceil(n%60);return{hh:i.toString(),mm:r<10?"0"+r:r.toString(),ss:s<10?"0"+s:s.toString()}}getHoverTime(){const t=100*this.state.seekHoverPosition/this.state.trackWidth,i=Math.floor(+t*(this.props.total/100)),n=this.secondsToTime(i);return this.props.total+this.offset<60?this.secondsPrefix+n.ss:this.props.total+this.offset<3600?this.minutesPrefix+n.mm+":"+n.ss:n.hh+":"+n.mm+":"+n.ss}isThumbActive(){return this.state.seekHoverPosition>0||this.seeking}drawHoverTime(){return this.props.hideHoverTime?null:_.createElement("div",{className:this.isThumbActive()?"hover-time active":"hover-time",style:this.getHoverTimePosition(),ref:t=>this.hoverTime=t},this.getHoverTime())}render(){return _.createElement("div",{className:"seek-slider"},_.createElement("div",{className:"track",ref:t=>this.track=t,onMouseMove:t=>this.handleTrackHover(!1,t),onMouseLeave:t=>this.handleTrackHover(!0,t),onMouseDown:this.onMouseDown,onTouchStart:t=>{this.setMobileSeeking(!0),this.onMouseDown(t)},onMouseUp:this.onMouseUp,onTouchEnd:this.onMouseUp},_.createElement("div",{className:"main"},this.renderBufferProgress(),this.renderHoverProgress(),this.renderProgress())),this.drawHoverTime(),this.renderThumb())}}class eS extends ui.exports.Component{constructor(t){super(t),this.stageVolume=0,this.updateVolumeTimer=0,this.onVolumeSeeking=!1,this.onClickOperationButton=()=>{const{paused:i}=this.props;i?this.props.play():this.props.pause()},this.operationButton=()=>{const{paused:i}=this.props;return i?_.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNOCA1LjE0djE0bDExLTdsLTExLTd6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="}):_.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTQgMTloNFY1aC00TTYgMTloNFY1SDZ2MTR6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="})},this.operationVolumeButton=()=>this.props.volume>.9?_.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTQgMy4yM3YyLjA2YzIuODkuODYgNSAzLjU0IDUgNi43MXMtMi4xMSA1Ljg0LTUgNi43djIuMDdjNC0uOTEgNy00LjQ5IDctOC43N2MwLTQuMjgtMy03Ljg2LTctOC43N00xNi41IDEyYzAtMS43Ny0xLTMuMjktMi41LTQuMDNWMTZjMS41LS43MSAyLjUtMi4yNCAyLjUtNE0zIDl2Nmg0bDUgNVY0TDcgOUgzeiIgZmlsbD0iI2ZmZiI+PC9wYXRoPjwvc3ZnPgo="}):this.props.volume===0?_.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNNyA5djZoNGw1IDVWNGwtNSA1SDd6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+Cg=="}):_.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1tZGkiIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNNSA5djZoNGw1IDVWNEw5IDltOS41IDNjMC0xLjc3LTEtMy4yOS0yLjUtNC4wM1YxNmMxLjUtLjcxIDIuNS0yLjI0IDIuNS00eiIgZmlsbD0iI2ZmZiI+PC9wYXRoPjwvc3ZnPgo="}),this.handleClickVolume=()=>{this.props.volume===0?this.stageVolume!==0?this.props.setVolume(this.stageVolume):this.props.setVolume(1):(this.stageVolume=this.props.volume,this.props.setVolume(0))},this.onChange=i=>{this.setState({currentTime:i}),i&&this.changeTime(i)},this.changeTime=Ys(i=>{this.props.setCurrentTime(i)},50),this.onVolumeChange=i=>{this.changeVolume(i),this.setState({seekVolume:i/100})},this.changeVolume=Ys(i=>{this.props.setVolume(i/100)},50),this.onVolumeSeekStart=()=>{this.onVolumeSeeking=!0},this.onVolumeSeekEnd=Ys(()=>{this.onVolumeSeeking=!1},500),this.onProgressSeekStart=()=>this.setState({isPlayerSeeking:!0}),this.onProgressSeekEnd=Ys(()=>{this.setState({isPlayerSeeking:!1})},500),this.state={isPlayerSeeking:!1,isVolumeHover:!1,seekVolume:1,visible:!0,currentTime:0},this.stageVolume=t.volume}componentDidMount(){this.updateVolumeTimer=setInterval(()=>{this.onVolumeSeeking||this.setState({seekVolume:this.props.volume}),this.state.isPlayerSeeking||this.setState({currentTime:this.props.currentTime})},100)}componentWillUnmount(){this.updateVolumeTimer&&clearInterval(this.updateVolumeTimer)}render(){const{duration:t,currentTime:i}=this.props;return _.createElement("div",{className:"player-controller",style:{opacity:this.props.visible?"1":"0"}},_.createElement("div",{className:"player-controller-progress"},_.createElement(Of,{total:t,current:this.state.currentTime,onChange:this.onChange,buffered:this.props.buffered,bufferColor:"rgba(255,255,255,0.3)",hideHoverTime:!0,limitTimeTooltipBySides:!0,onSeekStart:this.onProgressSeekStart,onSeekEnd:this.onProgressSeekEnd,play:this.props.play,pause:this.props.pause,paused:this.props.paused,scale:this.props.scale})),_.createElement("div",{className:"player-controller-actions"},_.createElement("div",{className:"player-controller-actions-left"},_.createElement("div",{onClick:this.onClickOperationButton,className:"player-controller-play"},this.operationButton()),_.createElement("div",{className:"player-volume-box",onMouseEnter:()=>this.setState({isVolumeHover:!0}),onMouseLeave:()=>this.setState({isVolumeHover:!1})},_.createElement("div",{onClick:this.handleClickVolume,className:"player-volume"},this.operationVolumeButton()),_.createElement("div",{className:"player-volume-slider"},_.createElement(Of,{total:100,current:100*this.state.seekVolume,onChange:this.onVolumeChange,onSeekStart:this.onVolumeSeekStart,onSeekEnd:this.onVolumeSeekEnd,scale:this.props.scale,limitTimeTooltipBySides:!0,hideHoverTime:!0})))),_.createElement("div",{className:"player-mid-box-time"},_f(Math.floor(i/1e3))," /"," ",_f(Math.floor(t/1e3)))))}}function _f(e){const t=e%60,i=(e-t)/60;if(i>=60){const n=i%60;return`${lr((i-n)/60)}:${lr(n)}:${lr(t)}`}return`${lr(i)}:${lr(t)}`}function lr(e){return e<=9?`0${e}`:`${e}`}class tS extends ui.exports.Component{constructor(){super(...arguments),this.putAttributes=t=>{const{context:i}=this.props,n=i.getAttributes()||{};for(const r in t)n[r]!==t[r]&&i.updateAttributes([r],t[r])}}render(){const{context:t}=this.props,i=t.getRoom(),n=i?void 0:t.getDisplayer(),r=this.putAttributes;return _.createElement(iS,{room:i,player:n,context:t,plugin:{putAttributes:r}})}}class iS extends ui.exports.Component{constructor(t){super(t),this.alertMask=null,this.container=_.createRef(),this.controllerHiddenTimer=0,this.syncPlayerTimer=0,this.retryCount=0,this.decreaseRetryTimer=0,this.noSoundSyncCount=0,this.showController=()=>{this.setState({controllerVisible:!0}),this.debounceHidingController()},this.play=()=>{var i;const n=(i=this.props.room)==null?void 0:i.calibrationTimestamp;this.debug(">>> play",{paused:!1,hostTime:n}),this.isEnabled()&&this.props.plugin.putAttributes({paused:!1,hostTime:n})},this.pause=()=>{const i=Qs(this.getAttributes(),this.props);this.debug(">>> pause",{paused:!0,currentTime:i}),this.isEnabled()&&this.props.plugin.putAttributes({paused:!0,currentTime:i})},this.setVolume=i=>{this.debug(">>> volume",{volume:i}),this.isEnabled()&&this.props.plugin.putAttributes({volume:i}),this.isEnabled()&&this.props.plugin.putAttributes({volume:i,muted:i===0})},this.setCurrentTime=i=>{var n;const r=(n=this.props.room)==null?void 0:n.calibrationTimestamp;this.debug(">>> seek",{currentTime:i/1e3,hostTime:r}),this.isEnabled()&&this.props.plugin.putAttributes({currentTime:i/1e3,hostTime:r})},this.resetPlayer=()=>{var i;(i=this.player)==null||i.autoplay(!1),this.state.NoSound||(this.debug(">>> ended",{paused:!0,currentTime:0}),this.isEnabled()&&this.props.plugin.putAttributes({paused:!0,currentTime:0}))},this.syncPlayerWithAttributes=()=>{var i;const n=this.getAttributes();if(!n)return;const r=this.player;if(!r||this.state.NoSound&&(this.noSoundSyncCount+=1)%8!=0)return;r.paused()!==n.paused&&(this.debug("<<< paused -> %o",n.paused),n.paused?r.pause():(i=r.play())==null||i.catch(this.catchPlayFail)),r.muted()!==n.muted&&(this.debug("<<< muted -> %o",n.muted),r.muted(n.muted)),r.volume()!==n.volume&&(this.debug("<<< volume -> %o",n.volume),r.volume(n.volume));const s=Qs(n,this.props);let o=Kt.currentTimeMaxError;this.state.NoSound&&(o*=3),s>r.duration()?this.resetPlayer():Math.abs(r.currentTime()-s)>o&&(this.debug("<<< currentTime -> %o",s),r.currentTime(s))},this.debounceHidingController=()=>{this.controllerHiddenTimer&&(clearTimeout(this.controllerHiddenTimer),this.controllerHiddenTimer=0),this.controllerHiddenTimer=setTimeout(()=>{this.setState({controllerVisible:!1}),this.controllerHiddenTimer=0},3e3)},this.decreaseRetryCount=()=>{this.player&&this.retryCount>0&&(this.retryCount=this.retryCount-1)},this.catchPlayFail=i=>{var n,r;const s=String(i);if(Rx&&s.includes("NotAllowedError")||s.includes("interact"))(n=this.player)==null||n.autoplay("any"),this.setState({NoSound:!0});else{const o=(r=this.player)==null?void 0:r.error();o&&(this.retryCount<=3?(this.initPlayer(),this.retryCount=this.retryCount+1):(this.debug("catch videojs media error",o),this.setState({MediaError:!0}))),this.debug("catch error",i)}},this.fixPlayFail=()=>{this.debug("try to fix play state"),this.setState({NoSound:!1});const{muted:i,volume:n}=this.getAttributes();this.player&&(this.player.muted(i),this.player.volume(n))},this.initPlayer=async()=>{var i;(i=this.player)==null||i.dispose(),this.player=void 0,this.debug("creating elements ...");const{type:n,src:r,poster:s}=this.getAttributes(),o=document.createElement("div");o.setAttribute("data-vjs-player","");const a=document.createElement("video");a.className="video-js",s&&(a.poster=s),a.setAttribute("playsInline",""),a.setAttribute("webkit-playsinline","");const l=document.createElement("source");new URL(r).pathname.endsWith(".m3u8")?l.type="application/x-mpegURL":a.src=r,l.src=r,n&&(l.type=n),a.appendChild(l),o.appendChild(a),this.container.current.appendChild(o),await new Promise(h=>(window.requestAnimationFrame||window.setTimeout)(h)),this.debug("initializing videojs() ...");const u=su.default(a);this.player=u,window.player=u,u.one("loadedmetadata",this.gracefullyUpdate),u.on("ready",()=>{var h;(h=Kt.onPlayer)==null||h.call(Kt,u),u.on("timeupdate",this.gracefullyUpdate),u.on("volumechange",this.gracefullyUpdate),u.on("seeked",this.gracefullyUpdate),u.on("play",this.gracefullyUpdate),u.on("pause",this.gracefullyUpdate),u.on("ended",this.resetPlayer)}),u.on("error",this.catchPlayFail),this.setState({MediaError:!1})},this.gracefullyUpdate=()=>this.setState({updater:!this.state.updater}),this.setupAlert=i=>{i&&(i.addEventListener("touchstart",this.fixPlayFail),i.addEventListener("click",this.fixPlayFail)),this.alertMask=i},this.setupReload=i=>{i&&(i.addEventListener("touchstart",this.initPlayer),i.addEventListener("click",this.initPlayer))},this.state={NoSound:!1,MediaError:!1,updater:!1,controllerVisible:!1},t.room&&function(i){if(!i.calibrationTimestamp)throw new Error("@netless/app-media-player@0.1.0-alpha.5 requires white-web-sdk@^2.13.8 to work properly.")}(t.room)}getAttributes(){const{context:t}=this.props;let i=t.getAttributes();if(i){if(i=Oe(Oe({},Df),i),this.player){let r=Qs(i,this.props),s=this.player.duration();!i.paused&&r>s&&(n=Oe({},i),i=zx(n,Dx({currentTime:0,paused:!0})),this.resetPlayer())}var n;return i}}isShowingPoster(){const t=this.getAttributes();return!(t!=null&&t.src)||Bx.some(i=>t.src.endsWith(i))}render(){var t,i;if(!this.props.room&&!this.props.player)return null;const n=this.getAttributes();if(!n)return null;const r=1e3*(((t=this.player)==null?void 0:t.duration())||1e3),s=((i=this.player)==null?void 0:i.bufferedPercent())||0;return _.createElement("div",{className:this.isEnabled()?"vjs-p":"vjs-p disabled",onMouseEnter:this.showController,onMouseMove:this.showController},_.createElement("div",{className:"video-js-plugin-player",ref:this.container}),this.isShowingPoster()&&_.createElement("div",{className:"video-js-plugin-poster"},n.poster&&_.createElement("img",{src:n.poster,alt:"",draggable:!1})),_.createElement(eS,{duration:r,volume:n.volume,setVolume:this.setVolume,paused:n.paused,play:this.play,pause:this.pause,currentTime:1e3*Qs(n,this.props),setCurrentTime:this.setCurrentTime,buffered:r*s,visible:!0}),this.state.NoSound&&_.createElement("div",{ref:this.setupAlert,className:"videojs-plugin-muted-alert"}),this.state.MediaError&&_.createElement("div",{className:"videojs-plugin-recovery-mode"},_.createElement("button",{ref:this.setupReload},"Reload Player")))}debug(t,...i){Kt.verbose&&Kt.log(`[MediaPlayer] ${t}`,...i)}componentDidMount(){this.debug("app version =","0.1.0-alpha.5"),this.debug("video.js version =",su.default.VERSION),this.initPlayer(),this.props.context.emitter.on("attributesUpdate",this.syncPlayerWithAttributes),this.syncPlayerTimer=setInterval(this.syncPlayerWithAttributes,Kt.syncInterval),this.decreaseRetryTimer=setInterval(this.decreaseRetryCount,Kt.retryInterval)}componentWillUnmount(){var t;this.debug("unmount"),this.props.context.emitter.off("attributesUpdate",this.syncPlayerWithAttributes),(t=this.player)==null||t.dispose(),clearInterval(this.syncPlayerTimer),clearInterval(this.decreaseRetryTimer)}isEnabled(){return this.props.context.getIsWritable()}}const Gs={kind:"MediaPlayer",setup(e){let t=e.getAttributes();if(!t||!t.src)return e.emitter.emit("destroy",{error:new Error("[MediaPlayer]: Missing 'attributes'.'src'.")});t=Oe(Oe({},Df),t);const i=e.getBox();i.mountStyles(`.vjs-p{display:flex;flex-grow:1}.vjs-p *{pointer-events:auto}.vjs-p.disabled *{pointer-events:none}.vjs-p .video-js-plugin-poster{position:absolute;top:0;left:0;right:0;bottom:0;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgQAAACACAYAAAB0vHFxAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAACBKADAAQAAAABAAAAgAAAAACE3oPTAAAKXUlEQVR4Ae3dYW4ktxEG0LW9FwkC2McycokAOUGAXMLwtQwYvomdP4akHUnNnm6SVUU+/xqpe8ji+yiDWz3a/e7L5v/98se//3pL8K9//O+7t19Hv85eX7RP9vnllz2h4/rkd+wz+ir/0cLfjv/9t1/6igABAgQIENhRwIFgx9StmQABAgQIPAg4EDyA+JIAAQIECOwo8HXHRVvzPIHRzwBHjz9PKudMo31Hj59TdZ2qsueXvb5sO0GHIFsi6iFAgAABAgECOgQB6KbsJ5Dtt0L6rWyPkeRXO+fs+WWvL1v6OgTZElEPAQIECBAIENAhCEA3ZT8Bzwj7WUaMJL8I9X5zZs8ve339kugzkg5BH0ejECBAgACB0gIOBKXjUzwBAgQIEOgj4EDQx9EoBAgQIECgtIADQen4FE+AAAECBPoIOBD0cTQKAQIECBAoLeC3DErHp/iWgE8Zt4RyX5df7nxa1Y3Ob/T4rfWtdl2HYLVErYcAAQIECFwQWL5DsPoJcvX1XdjTpd4iv1JxvStWfu9IfCORwLP7U4cgUXhKIUCAAAECUQIOBFHy5iVAgAABAokEHAgShaEUAgQIECAQJXD7MwTPPqOIWujVeUevb/T4V9ftfecE5HfOKetd8suajLoiBHQIItTNSYAAAQIEkgnc7hAkW0/3ckb/e9qjx+8OYsBvBOT3DUe5L+RXLjIFDxTQIRiIa2gCBAgQIFBFoNkh2P0Z2+j1jx4/+0asvv7q9d/dH9XXX73+3fO7u/7W+3fbHzoErR3hOgECBAgQ2ECg2SHwjG2DXRC4xOj9tdufAHpHLb/eonPHk9+xd7TPcXX9r+oQ9Dc1IgECBAgQKCfgQFAuMgUTIECAAIH+Ag4E/U2NSIAAAQIEygk0P0MQvaLsz3hb9bWu840WOJ5ffsc+2a/KL3tC6jsSmL1/dQiO0nCNAAECBAhsItDsEMw+oTzrHl1f61OorevPrvfZ+6N9WvVmr09+xwnKr7ZP9vyOdcdfze7Tuz4dgvF7ygwECBAgQCC9QLNDkH0F0X+C45NdoHZ99rf8aguofqRA7/8/6BCMTMvYBAgQIECgiED5DkHvZyhFcjtdJp/TVClvlF/KWE4XJb/TVG68INB7f+kQXAjBWwgQIECAwGoCDgSrJWo9BAgQIEDggoADwQU0byFAgAABAqsJfO39DGI1IOuJFbA/Y/3vzi6/u4Kx7189v7vru/v+2HTfz65D8N7EdwgQIECAwHYCw3/LYLUT1HY7pLFg+TaAkl+WX/KAGuXJrwEUfLlaPjoEwRvG9AQIECBAIIPA8A5B779JKQOaGl4F5PtqUfGV/Cqm9lqz/F4tMr6qlo8OQcZdpCYCBAgQIDBZYHiHoNozlMn+5aeTb+0I5Se/2gK5q6/286VDkHs/qY4AAQIECEwRcCCYwmwSAgQIECCQW8CBIHc+qiNAgAABAlMEhn+GYMoqTEKAAAEC7wSqPcN+twDfmCqgQzCV22QECBAgQCCnQHiHoPoJtlV/63rObfFaVfX6X1dy7VX19Vev/1pqr++qvv7q9b8m4dVHAtny1SH4KCXfI0CAAAECmwmEdwiq/U1Om+2PL/Kpnbj85FdbYO3qs/186hCsvd+sjgABAgQInBJwIDjF5CYCBAgQILC2gAPB2vlaHQECBAgQOCUQ/hmCbJ+yPKW20U3yqR22/ORXW2Dt6qN/Ph/n1yFYe79ZHQECBAgQOCXgQHCKyU0ECBAgQGBtAQeCtfO1OgIECBAgcErAgeAUk5sIECBAgMDaAg4Ea+drdQQIECBA4JTA1+///OGnoztd52N/fC7g58PPx+e748sX+8P+qLQ/dAiO0nKNAAECBAhsIuBAsEnQlkmAAAECBI4EHAiOdFwjQIAAAQKbCDgQbBK0ZRIgQIAAgSMBB4IjHdcIECBAgMAmAuH/lsHP//zvb5tYl1ymfErG9lK0/F4oSr6QX8nYThcdne/j/DoEp6NzIwECBAgQWFfAgWDdbK2MAAECBAicFnAgOE3lRgIECBAgsK5A+GcIfv39Pz++5X18pvH2mtfzBeQz37znjPLrqTl/LPnNN585Y7Z8dQhmpm8uAgQIECCQVCC8Q1C9I9Cqv3U96b54Kat6/S8Lufii+vqr138xtpe3VV9/9fpfgvDiQ4Fs+eoQfBiTbxIgQIAAgb0EwjsEe3FbLQECBOYJZPsT6LyVm+mKgA7BFTXvIUCAAAECiwk4ECwWqOUQIECAAIErAg4EV9S8hwABAgQILCYw/DMEnmEttmMeliPfB5BiX8qvWGAP5crvASTZl9Xy0SFItoGUQ4AAAQIEIgSGdwiy/U1MEcgrzynf2unKT361BXJXX+3nS4cg935SHQECBAgQmCIwvENQ7RnKFPWFJpFv7TDlJ7/aArmrr/bzpUOQez+pjgABAgQITBH4Wu0EM0XFJGkE7M80UVwqRH6X2NK8afX87q7v7vvTBP13IToE2RJRDwECBAgQCBBwIAhANyUBAgQIEMgm4ECQLRH1ECBAgACBAIHhv2Uwek2rPcPp7cWnt+jc8eQ317v3bPLrLWq8twK995cOwVtdrwkQIECAwKYC5TsE1f4mqNn7jM9s8b7zya+v5+zR5DdbfK/5eu8vHYK99o/VEiBAgACBDwWaHYLezyg+rOLGN6Pra53QWtdvLP3UW6N9WkVmr09+xwnKr7ZP9vyOdcdfze7Tuz4dgvF7ygwECBAgQCC9QLNDEL2C3ieg3utp1de63rueZ8fLXt+z6+l9f3af7PX1zuPZ8bL7ZK/vWW/39xWYvT90CPrmZzQCBAgQIFBSwIGgZGyKJkCAAAECfQUcCPp6Go0AAQIECJQUaH6GIPpT1iVVFX1aIHp/zX5GdxqmyI3yKxLUJ2XK7xOYv78d7XNcXf+rOgT9TY1IgAABAgTKCTQ7BLv/CWr0+kePn31HVl9/9frv7o/q669e/+753V1/6/277Q8dgtaOcJ0AAQIECGwg0OwQbGBwuMTRz5BGj3+4OBdvC8jvNmHoAPIL5Td5MgEdgmSBKIcAAQIECEQI3O4QrP6MZfT6Ro8fsal2mlN+tdOWX+38VN9XQIegr6fRCBAgQIBASQEHgpKxKZoAAQIECPQVcCDo62k0AgQIECBQUuD2Zwiyr3r1Z4Srry/7/rpbn/zuCsa+X36x/mY/Fnh2f+oQHHu6SoAAAQIEthBYvkOwRYoW+anAsyfkTwdyIURAfiHs3SYdnd/o8btBFBlIh6BIUMokQIAAAQIjBRwIRuoamwABAgQIFBFwICgSlDIJECBAgMBIAQeCkbrGJkCAAAECRQQcCIoEpUwCBAgQIDBSwG8ZjNQ19nABnzIeTjx0AvkN5R0+ePb8stc3PKAnJ9AheBLM7QQIECBAYEUBHYIVU91oTf49+9phy09+IwXsr+d0dQie83I3AQIECBBYUkCHYMlY8yxq9DO80ePnkYypZLTv6PFj1PaZNXt+2evLtlN0CLIloh4CBAgQIBAg4EAQgG5KAgQIECCQTcCBIFsi6iFAgAABAgEC/wdVfx9UuC8B6AAAAABJRU5ErkJggg==);background-repeat:repeat-x;background-position:0 50%;display:flex;align-items:center;justify-content:center}.vjs-p .video-js-plugin-poster img{box-shadow:0 0 5px 10px #0006}.vjs-p .player-controller,.vjs-p .videojs-plugin-muted-alert{pointer-events:auto}.vjs-p.disabled .videojs-plugin-close-icon,.vjs-p.disabled .player-controller{pointer-events:none}.vjs-p .video-js-plugin-player{position:absolute;top:0;left:0;right:0;bottom:0}.video-js,[data-vjs-player]{width:100%;height:100%}.vjs-p .videojs-plugin-muted-alert{pointer-events:auto;cursor:pointer;position:absolute;top:0;left:0;right:0;bottom:0;z-index:43}.vjs-p .videojs-plugin-muted-alert:before{pointer-events:auto;cursor:pointer;position:absolute;top:0;left:0;right:0;bottom:0;z-index:43;content:"\\f104";background:rgba(0,0,0,.3);font-family:VideoJS;font-size:2em;display:flex;align-items:center;justify-content:center;color:#fff}.vjs-p .videojs-plugin-recovery-mode{pointer-events:auto;cursor:pointer;position:absolute;top:0;left:0;right:0;bottom:0;z-index:44}.vjs-p .videojs-plugin-recovery-mode button{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.vjs-p .seek-slider{position:relative;width:100%}.vjs-p .seek-slider:focus{outline:none}.vjs-p .seek-slider .track{padding:10px 0;cursor:pointer;outline:none}.vjs-p .seek-slider .track:focus{border:0;outline:none}.vjs-p .seek-slider .track .main{width:100%;height:3px;background-color:#ffffff4d;border-radius:30px;position:absolute;left:0;top:8.5px;transition:transform .4s;outline:none}.vjs-p .seek-slider .track .main:focus{border:0;outline:none}.vjs-p .seek-slider .track .main .buffered{position:absolute;background-color:#ffffff4d;width:100%;height:100%;transform:scaleX(.8);z-index:2;transform-origin:0 0}.vjs-p .seek-slider .track .main .seek-hover{position:absolute;background-color:#ffffff80;width:100%;height:100%;z-index:1;transform:scaleX(.6);transform-origin:0 0;opacity:0;transition:opacity .4s}.vjs-p .seek-slider .track .main .connect{position:absolute;background-color:#fff;width:100%;height:100%;z-index:3;left:0;transform:scaleX(.13);transform-origin:0 0}.vjs-p .seek-slider .track.active .main{transform:scaleY(2)}.vjs-p .seek-slider .thumb{pointer-events:none;position:absolute;width:12px;height:12px;left:-6px;top:4px;z-index:4;transform:translate(100px)}.vjs-p .seek-slider .thumb .handler{border-radius:100%;width:100%;height:100%;background-color:#fff;opacity:0;transform:scale(.4);cursor:pointer;transition:transform .2s;pointer-events:none}.vjs-p .seek-slider .thumb.active .handler{opacity:1;transform:scale(1)}.vjs-p .seek-slider .hover-time{position:absolute;background-color:#0000004d;line-height:18px;font-size:16px;color:#ddd;top:-25px;left:0;padding:5px 10px;border-radius:5px;box-shadow:0 0 5px #0000004d;opacity:0;transform:translate(150px);pointer-events:none}.vjs-p .seek-slider .hover-time.active{opacity:1}.vjs-p .seek-slider:hover .track .main .seek-hover{opacity:1}.vjs-p .player-controller{position:absolute;z-index:100;bottom:0px;left:0;width:100%;display:flex;flex-direction:column;justify-content:center;align-items:stretch;height:64px;background-image:linear-gradient(0deg,#000,transparent);transition:opacity .2s;color:#fff}.vjs-p .player-menu-box{display:flex;align-items:center;justify-content:center;flex-direction:column;margin-bottom:40px}.vjs-p .player-menu-cell{width:100%;text-align:center;font-size:12px;color:#7a7b7c}.vjs-p .player-multiple-play{width:64px;height:120px}.vjs-p .player-controller-actions-left{display:flex;justify-content:center;align-items:center;flex-shrink:0}.vjs-p .player-right-box{font-size:14px;color:#7a7b7c;cursor:pointer;margin-right:12px}.vjs-p .player-controller-actions{display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding-left:8px;padding-right:8px;margin-top:2px}.vjs-p .player-mid-box-time{font-size:9px;display:flex;justify-content:center;align-items:center;color:#fff;flex-shrink:0;margin-right:8px;font-family:monospace}.vjs-p .player-controller-play{display:flex;align-items:center;justify-content:center;cursor:pointer;padding-right:4px}.vjs-p .player-controller-progress{width:calc(100% - 28px);margin-left:14px;display:flex;align-items:center;justify-content:center;margin-top:8px}.vjs-p .player-volume{display:flex;align-items:center;justify-content:center;cursor:pointer;margin-right:16px;margin-left:8px}.vjs-p .player-volume-slider{width:60px;margin-right:12px;display:flex;align-items:center}.vjs-p .player-volume-box{display:flex;flex-direction:row}.netless-app-media-player-container{display:flex;position:relative;height:100%}
154
- `);const n=document.createElement("div");n.classList.add("netless-app-media-player-container"),kf.render(_.createElement(tS,{context:e}),n),i.mountContent(n),e.emitter.on("destroy",()=>{console.log("[MediaPlayer]: destroy"),kf.unmountComponentAtNode(n)})}},nS=()=>{we.debug&&Vx({verbose:!0}),we.register({kind:Lr.kind,src:Lr}),we.register({kind:Gs.kind,src:Gs})},tu={DocsViewer:Lr.kind,MediaPlayer:Gs.kind},rS={[tu.DocsViewer]:Lr,[tu.MediaPlayer]:Gs};var IS="",bS="",AS="";const $f=new gv({emitter:j}),B=class extends b.InvisiblePlugin{constructor(e){super(e);this.version="1.0.0-canary.33",this.dependencies={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"1.0.0-alpha.30",emittery:"^0.11.0",lodash:"^4.17.21","p-retry":"^4.6.1","side-effect-manager":"^1.1.0",uuid:"^7.0.3","value-enhancer":"^1.3.0","video.js":">=7"},peerDependencies:{"white-web-sdk":"^2.16.0"},devDependencies:{"@netless/app-docs-viewer":"^0.2.9","@netless/app-media-player":"0.1.0-beta.5","@playwright/test":"^1.23.0","@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.22","@tsconfig/svelte":"^2.0.1","@types/debug":"^4.1.7","@types/lodash":"^4.14.182","@types/lodash-es":"^4.17.4","@types/node":"^18.0.0","@types/uuid":"^8.3.1","@typescript-eslint/eslint-plugin":"^4.30.0","@typescript-eslint/parser":"^4.30.0","@vitest/ui":"^0.14.1",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.1",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.0",vitest:"^0.14.1","white-web-sdk":"2.16.10"}},this.emitter=ee,this.viewMode=b.ViewMode.Broadcaster,this.viewMode$=new I.Val(b.ViewMode.Broadcaster),this.isReplay=b.isPlayer(this.displayer),this.containerSizeRatio=B.containerSizeRatio,B.displayer=e.displayer,window.NETLESS_DEPS={dependencies:{"@juggle/resize-observer":"^3.3.1","@netless/telebox-insider":"1.0.0-alpha.30",emittery:"^0.11.0",lodash:"^4.17.21","p-retry":"^4.6.1","side-effect-manager":"^1.1.0",uuid:"^7.0.3","value-enhancer":"^1.3.0","video.js":">=7"},peerDependencies:{"white-web-sdk":"^2.16.0"},devDependencies:{"@netless/app-docs-viewer":"^0.2.9","@netless/app-media-player":"0.1.0-beta.5","@playwright/test":"^1.23.0","@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.22","@tsconfig/svelte":"^2.0.1","@types/debug":"^4.1.7","@types/lodash":"^4.14.182","@types/lodash-es":"^4.17.4","@types/node":"^18.0.0","@types/uuid":"^8.3.1","@typescript-eslint/eslint-plugin":"^4.30.0","@typescript-eslint/parser":"^4.30.0","@vitest/ui":"^0.14.1",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.1",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.0",vitest:"^0.14.1","white-web-sdk":"2.16.10"}}}static async mount(e){var s;const t=e.room;B.container=e.container;const i=e.debug,n=e.cursor;B.params=e,B.displayer=e.room,Ag();let r;if(b.isRoom(t)){if(t.phase!==b.RoomPhase.Connected)throw new Error("[WindowManager]: Room only Connected can be mount");t.phase===b.RoomPhase.Connected&&t.isWritable&&(t.disableSerialization=!1),r=await this.initManager(t)}if(B.isCreated)throw new Error("[WindowManager]: Already created cannot be created again");if(this.debug=Boolean(i),Pt("Already insert room",r),b.isRoom(this.displayer)){if(!r)throw new Error("[WindowManager]: init InvisiblePlugin failed")}else await Yf.default(async o=>{if(r=await t.getInvisiblePlugin(B.kind),!r)throw Pt(`manager is empty. retrying ${o}`),new Error},{retries:10});if(!r)throw new Error("[WindowManager]: create manager failed");e.containerSizeRatio&&(B.containerSizeRatio=e.containerSizeRatio),r.containerSizeRatio=B.containerSizeRatio,await r.ensureAttributes(),r.appManager=new Vg(r),r._pageState=new fv(r.appManager),r.cursorManager=new pv(r.appManager,Boolean(n),e.applianceIcons),r.boxManager=$m(r,ee,j,gt,{collectorContainer:e.collectorContainer,collectorStyles:e.collectorStyles,prefersColorScheme:e.prefersColorScheme,stageRatio:B.containerSizeRatio,containerStyle:e.containerStyle,stageStyle:e.stageStyle,fullscreen:e.fullscreen}),(s=r.appManager)==null||s.setBoxManager(r.boxManager),e.container&&r.bindContainer(e.container),mv(t,r),j.emit("onCreated"),B.isCreated=!0;try{await eg()}catch(o){console.warn("[WindowManager]: indexedDB open failed"),console.log(o)}return r}static async initManager(e){let t=e.getInvisiblePlugin(B.kind);if(!t&&b.isRoom(e))if(e.isWritable===!1){try{await e.setWritable(!0)}catch{throw new Error("[WindowManger]: room must be switched to be writable")}t=await Nu(e),t==null||t.ensureAttributes(),await cr(500),await e.setWritable(!1)}else t=await Nu(e);return t}static initContainer(e,t,i){B.container||(B.container=e);const{playground:n,mainViewElement:r}=bg(e,t);if(B.playground=n,i){const s=document.createElement("style");s.textContent=i,n.appendChild(s)}return r}static get registered(){return Ie.registered}bindContainer(e){var t,i,n,r,s,o;if(b.isRoom(this.displayer)&&this.room.phase!==b.RoomPhase.Connected)throw new Cu;if(B.isCreated&&B.container)B.container.firstChild&&e.appendChild(B.container.firstChild);else{const a=(t=this.boxManager)==null?void 0:t.teleBoxManager.$stage;if(B.params&&a){const l=B.params,u=B.initContainer(e,a,l.overwriteStyles);this.boxManager&&B.playground&&this.boxManager.setRoot(B.playground),this.bindMainView(u,l.disableCameraTransform),B.playground&&((i=this.cursorManager)==null||i.setupWrapper(B.playground))}}j.emit("updateManagerRect"),(n=this.appManager)==null||n.refresh(),(r=this.appManager)==null||r.resetMaximized(),(s=this.appManager)==null||s.resetMinimized(),(o=this.appManager)==null||o.displayerWritableListener(!this.room.isWritable),B.container=e}bindCollectorContainer(e){B.isCreated&&this.boxManager?this.boxManager.setCollector(e):B.params&&(B.params.collectorContainer=e)}static register(e){return Ie.register(e)}static unregister(e){return Ie.unregister(e)}async addApp(e){if(this.appManager)return this.appManager.rootDirRemoving?new Promise((t,i)=>{j.once("rootDirRemoved").then(async()=>{try{const n=await this._addApp(e);t(n)}catch(n){i(n.message)}})}):this._addApp(e);throw new be}async _addApp(e){var t,i,n;if(this.appManager){if(!e.kind||typeof e.kind!="string")throw new wu;const r=await((t=Ie.appClasses.get(e.kind))==null?void 0:t());if(r&&((i=r.config)==null?void 0:i.singleton)&&this.appManager.appProxies.has(e.kind))throw new mu;const s=this.setupScenePath(e,this.appManager);return s===void 0?void 0:((n=e==null?void 0:e.options)!=null&&n.scenePath&&(e.options.scenePath=vg(e.options.scenePath)),await this.appManager.addApp(e,Boolean(s)))}else throw new be}setupScenePath(e,t){let i=!1;if(e.options){const{scenePath:n,scenes:r}=e.options;if(n){if(!mg(n))throw new xu;const s=Object.keys(this.apps||{});for(const o of s){const a=t.store.getAppScenePath(o);if(a&&a===n){if(console.warn(`[WindowManager]: ScenePath ${n} Already opened`),this.boxManager){const l=this.boxManager.getTopBox();l&&this.boxManager.setZIndex(o,l.zIndex+1,!1)}return}}}n&&r&&r.length>0&&(this.isDynamicPPT(r)?(i=!0,ni(this.displayer)[n]||Ti(this.room,n,r)):ni(this.displayer)[n]||Ti(this.room,n,[{name:r[0].name}])),n&&r===void 0&&Ti(this.room,n,[{}])}return i}async setMainViewScenePath(e){this.appManager&&await this.appManager.setMainViewScenePath(e)}async setMainViewSceneIndex(e){this.appManager&&await this.appManager.setMainViewSceneIndex(e)}async nextPage(){if(this.appManager){const e=this.mainViewSceneIndex+1;return e>=this.mainViewScenesLength?(console.warn("[WindowManager]: current page is the last page"),!1):(await this.appManager.setMainViewSceneIndex(e),!0)}else return!1}async prevPage(){if(this.appManager){const e=this.mainViewSceneIndex-1;return e<0?(console.warn("[WindowManager]: current page is the first page"),!1):(await this.appManager.setMainViewSceneIndex(e),!0)}else return!1}async jumpPage(e){return this.appManager?e<0||e>=this.pageState.length?(console.warn(`[WindowManager]: index ${e} out of range`),!1):(await this.appManager.setMainViewSceneIndex(e),!0):!1}async addPage(e){if(this.appManager){const t=e==null?void 0:e.after,i=e==null?void 0:e.scene;if(t){const n=this.mainViewSceneIndex+1;this.room.putScenes(ze,[i||{}],n)}else this.room.putScenes(ze,[i||{}])}}async removePage(e){if(this.appManager){const t=e===void 0?this.pageState.index:e;return this.pageState.length===1?(console.warn("[WindowManager]: can not remove the last page"),!1):t<0||t>=this.pageState.length?(console.warn(`[WindowManager]: index ${e} out of range`),!1):this.appManager.removeSceneByIndex(t)}else return!1}getMainViewScenePath(){var e;return(e=this.appManager)==null?void 0:e.store.getMainViewScenePath()}getMainViewSceneIndex(){var e;return(e=this.appManager)==null?void 0:e.store.getMainViewSceneIndex()}setReadonly(e){var t;this.readonly=e,(t=this.boxManager)==null||t.setReadonly(e),j.emit("setReadonly",e)}switchMainViewToWriter(){var e;return(e=this.appManager)==null?void 0:e.mainViewProxy.mainViewClickHandler()}onAppDestroy(e,t){fg(`destroy-${e}`,t)}setViewMode(e){var i;Pt("setViewMode",e);const t=(i=this.appManager)==null?void 0:i.mainViewProxy;e===b.ViewMode.Broadcaster&&(this.canOperate&&(t==null||t.storeCurrentCamera()),t==null||t.start()),e===b.ViewMode.Freedom&&(t==null||t.stop()),this.viewMode=e,this.viewMode$.setValue(e)}setBoxState(e){if(!!this.canOperate)switch(e){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(e){var t;!this.canOperate||(t=this.boxManager)==null||t.setMaximized(e,!1)}setMinimized(e){var t;!this.canOperate||(t=this.boxManager)==null||t.setMinimized(e,!1)}get mainView(){if(this.appManager)return this.appManager.mainViewProxy.view;throw new be}get camera(){if(this.appManager)return this.appManager.mainViewProxy.view.camera;throw new be}get baseCamera$(){if(this.appManager)return this.appManager.mainViewProxy.camera$;throw new be}get baseSize$(){if(this.appManager)return this.appManager.mainViewProxy.size$;throw new be}get cameraState(){if(this.appManager)return this.appManager.mainViewProxy.cameraState;throw new be}get apps(){var e;return(e=this.appManager)==null?void 0:e.store.apps()}get boxState(){var e;if(this.appManager)return(e=this.appManager.boxManager)==null?void 0:e.boxState;throw new be}get darkMode(){var e,t;return Boolean((t=(e=this.appManager)==null?void 0:e.boxManager)==null?void 0:t.darkMode)}get prefersColorScheme(){var e;if(this.appManager)return(e=this.appManager.boxManager)==null?void 0:e.prefersColorScheme;throw new be}get fullscreen(){var e;if(this.appManager)return(e=this.appManager.boxManager)==null?void 0:e.teleBoxManager.fullscreen;throw new be}get focused(){return this.attributes.focus}get focusedView(){var e,t;return((t=(e=this.appManager)==null?void 0:e.focusApp)==null?void 0:t.view)||this.mainView}get mainViewSceneIndex(){var e;return((e=this._pageState)==null?void 0:e.index)||0}get mainViewSceneDir(){var e;if(this.appManager)return(e=this.appManager)==null?void 0:e.getMainViewSceneDir();throw new be}get topApp(){var e,t;return(t=(e=this.boxManager)==null?void 0:e.getTopBox())==null?void 0:t.id}get mainViewScenesLength(){var e;return((e=this._pageState)==null?void 0:e.length)||0}get canRedoSteps(){var e;return((e=this.focusedView)==null?void 0:e.canRedoSteps)||0}get canUndoSteps(){var e;return((e=this.focusedView)==null?void 0:e.canUndoSteps)||0}get sceneState(){if(this.appManager)return this.appManager.sceneState;throw new be}get pageState(){if(this._pageState)return this._pageState.toObject();throw new be}queryAll(){var e;return Array.from(((e=this.appManager)==null?void 0:e.appProxies.values())||[])}queryOne(e){var t;return(t=this.appManager)==null?void 0:t.appProxies.get(e)}async closeApp(e){var t;return(t=this.appManager)==null?void 0:t.closeApp(e)}moveCamera(e){const t=F({},this.mainView.camera),i=F(F({},t),e);A.isEqual(i,t)||!this.appManager||this.appManager.mainViewProxy.storeCamera(F({id:this.appManager.uid},i))}moveCameraToContain(e){if(!this.appManager)return;const t=this.appManager.mainViewProxy.size$.value;if(t){const i=t.width/e.width,n=t.height/e.height,r=Math.min(i,n);this.appManager.mainViewProxy.storeCamera({id:this.appManager.uid,scale:r,centerX:e.originX,centerY:e.originY})}}convertToPointInWorld(e){return this.mainView.convertToPointInWorld(e)}setCameraBound(e){this.mainView.setCameraBound(e)}onDestroy(){this._destroy()}destroy(){this._destroy()}_destroy(){var e,t,i;(e=this.appManager)==null||e.destroy(),(t=this.cursorManager)==null||t.destroy(),B.container=void 0,B.isCreated=!1,B.playground&&((i=B.playground.parentNode)==null||i.removeChild(B.playground)),B.params=void 0,Pt("Destroyed")}bindMainView(e,t){var i;this.appManager&&(this.appManager.bindMainView(e,Boolean(t)),(i=this.cursorManager)==null||i.setMainViewDivElement(e))}get canOperate(){return b.isRoom(this.displayer)?this.displayer.isWritable&&this.displayer.phase===b.RoomPhase.Connected:!1}get room(){return this.displayer}safeSetAttributes(e){this.canOperate&&this.setAttributes(e)}safeUpdateAttributes(e,t){this.canOperate&&this.updateAttributes(e,t)}setPrefersColorScheme(e){var t,i;(i=(t=this.appManager)==null?void 0:t.boxManager)==null||i.setPrefersColorScheme(e)}setFullscreen(e){var t,i;(i=(t=this.appManager)==null?void 0:t.boxManager)==null||i.teleBoxManager.setFullscreen(e)}cleanCurrentScene(){var e;(e=this.focusedView)==null||e.cleanCurrentScene()}redo(){var e;return((e=this.focusedView)==null?void 0:e.redo())||0}undo(){var e;return((e=this.focusedView)==null?void 0:e.undo())||0}delete(){var e;(e=this.focusedView)==null||e.delete()}copy(){var e;(e=this.focusedView)==null||e.copy()}paste(){var e;(e=this.focusedView)==null||e.paste()}duplicate(){var e;(e=this.focusedView)==null||e.duplicate()}insertText(e,t,i){var n;return((n=this.focusedView)==null?void 0:n.insertText(e,t,i))||""}insertImage(e){var t;return(t=this.focusedView)==null?void 0:t.insertImage(e)}completeImageUpload(e,t){var i;return(i=this.focusedView)==null?void 0:i.completeImageUpload(e,t)}lockImage(e,t){var i;return(i=this.focusedView)==null?void 0:i.lockImage(e,t)}lockImages(e){var t;return(t=this.focusedView)==null?void 0:t.lockImages(e)}refresh(){var e;this._refresh(),(e=this.appManager)==null||e.dispatchInternalEvent(Z.Refresh)}_refresh(){var e,t;(e=this.appManager)==null||e.mainViewProxy.rebind(),B.container&&this.bindContainer(B.container),(t=this.appManager)==null||t.refresher.refresh()}setContainerSizeRatio(e){if(!A.isNumber(e))throw new Error(`[WindowManager]: updateContainerSizeRatio error, ratio must be a number. but got ${e}`);B.containerSizeRatio=e,this.containerSizeRatio=e,j.emit("containerSizeRatioUpdate",e)}setContainerStyle(e){var t;(t=this.boxManager)==null||t.teleBoxManager.setContainerStyle(e)}setStageStyle(e){var t;(t=this.boxManager)==null||t.teleBoxManager.setStageStyle(e)}createPPTHandler(){return{onPageJumpTo:(e,t)=>{var i,n,r,s;(s=(r=(n=(i=this.appManager)==null?void 0:i.focusApp)==null?void 0:n.appContext)==null?void 0:r.whiteBoardView)==null||s.jumpPage(t)},onPageToNext:()=>{var e,t,i,n;this.focused&&((n=(i=(t=(e=this.appManager)==null?void 0:e.focusApp)==null?void 0:t.appContext)==null?void 0:i.whiteBoardView)==null||n.nextPage())},onPageToPrev:()=>{var e,t,i,n;this.focused&&((n=(i=(t=(e=this.appManager)==null?void 0:e.focusApp)==null?void 0:t.appContext)==null?void 0:i.whiteBoardView)==null||n.prevPage())}}}isDynamicPPT(e){var i,n;const t=(n=(i=e[0])==null?void 0:i.ppt)==null?void 0:n.src;return t==null?void 0:t.startsWith("pptx://")}async ensureAttributes(){A.isNull(this.attributes)&&await cr(50),A.isObject(this.attributes)&&(this.attributes[oe.Apps]||this.safeSetAttributes({[oe.Apps]:{}}),this.attributes[oe.Cursors]||this.safeSetAttributes({[oe.Cursors]:{}}),this.attributes._mainScenePath||this.safeSetAttributes({_mainScenePath:uu}),this.attributes._mainSceneIndex||this.safeSetAttributes({_mainSceneIndex:0}),this.attributes[oe.Registered]||this.safeSetAttributes({[oe.Registered]:{}}))}};let we=B;we.kind="WindowManager",we.debug=!1,we.containerSizeRatio=Jf,we.isCreated=!1,nS(),O.AppCreateError=mu,O.AppManagerNotInitError=be,O.AppNotRegisterError=xg,O.BindContainerRoomPhaseInvalidError=Cu,O.BoxManagerNotFoundError=Su,O.BoxNotCreatedError=yu,O.BuiltinApps=tu,O.BuiltinAppsMap=rS,O.InvalidScenePath=xu,O.ParamsInvalidError=wu,O.WhiteWebSDKInvalidError=vu,O.WindowManager=we,O.calculateNextIndex=ro,O.reconnectRefresher=$f,Object.defineProperties(O,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
123
+ }`)(),ha=(t=>(t.Light="light",t.Dark="dark",t.Auto="auto",t))(ha||{}),se=(t=>(t.Normal="normal",t.Minimized="minimized",t.Maximized="maximized",t))(se||{}),fe=(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))(fe||{}),$e=(t=>(t.Close="close",t.Maximize="maximize",t.Minimize="minimize",t))($e||{}),je=(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))(je||{});const vs="dh";function xt(t,e,i){return Math.min(Math.max(t,e),i)}function Rt(t){t.stopPropagation(),t.cancelable&&t.preventDefault()}let tc=1;function ic(){return`New Box ${tc++}`}class da{constructor({readonly$:e,state$:i,title$:s,buttons:r,onEvent:a,onDragStart:n,namespace:o="telebox"}){this.sideEffect=new ye.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:$e.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:$e.Minimize,iconClassName:this.wrapClassName("titlebar-icon-minimize")},{type:$e.Maximize,iconClassName:this.wrapClassName("titlebar-icon-maximize"),isActive:c=>c===se.Maximized},{type:$e.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=vs;const i=document.createElement("h1");i.className=this.wrapClassName("title"),i.dataset.teleBoxHandle=vs,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=vs,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 ua([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 sc=window.ResizeObserver||mr.ResizeObserver;class rc{constructor({id:e=ye.genUID(),title:i=ic(),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:x=!0,titleBar:M,content:y,stage:k,footer:D,styles:T,userStyles:U,bodyStyle:ne=null,stageStyle:J=null,darkMode$:Ce,fence$:Ge,root:ve,rootRect$:Ee,managerMinimized$:xe,managerMaximized$:ze,managerReadonly$:Me,managerStageRect$:Se,managerStageRatio$:Ie,defaultBoxBodyStyle$:De,defaultBoxStageStyle$:_e,collectorRect$:wt}){this.events=new Je.default,this._delegateEvents=new Je.default,this.handleTrackStart=$=>{var F;return(F=this._handleTrackStart)==null?void 0:F.call(this,$)},this._sideEffect=new ye.SideEffectManager,this.id=e,this.namespace=s,this.enableShadowDOM=x;const qe=new v.ValManager;this._sideEffect.addDisposer(()=>qe.destroy());const lt=new v.Val(i),Nt=new v.Val(r),A=new v.Val(u),O=new v.Val(p),Ve=new v.Val(m),Ae=new v.Val(f),ni=new v.Val(g),Pt=new v.Val(null),oo=new v.Val(null),lo=new v.Val(null),cr=v.combine([Pt,ze],([$,F])=>$!=null?$:F),Fi=v.combine([oo,xe],([$,F])=>$!=null?$:F),hr=v.combine([lo,Me],([$,F])=>$!=null?$:F),dr=v.combine([Fi,cr],([$,F])=>$?se.Minimized:F?se.Maximized:se.Normal),ur=new v.Val({width:xt(o,0,1),height:xt(c,0,1)},{compare:Ne}),lp=v.combine([ur,Se],([$,F])=>({width:$.width*F.width,height:$.height*F.height}),{compare:Ne}),Wi=new v.Val({width:a,height:n},{compare:Ne});this._sideEffect.addDisposer(ur.reaction(($,F)=>{Wi.setValue({width:Math.max(a,$.width),height:Math.max(n,$.height)},F)}));const pr=new v.Val({x:l,y:d},{compare:Ne}),gr=v.combine([Wi,Se],([$,F])=>({width:F.width*$.width,height:F.height*$.height}),{compare:Ne}),oi=v.combine([pr,Se],([$,F])=>({x:$.x*F.width,y:$.y*F.height}),{compare:Ne}),cp=new v.Val(ne),hp=new v.Val(J),dp=new v.Val(null),co=new v.Val(Se.value,{compare:Ne}),ho=new v.Val(b),up=v.combine([ho,Ie],([$,F])=>$!=null?$:F),pp=v.combine([co,up],ua,{compare:Ne}),gp={darkMode:Ce,fence:Ge,rootRect:Ee,managerMinimized:xe,managerMaximized:ze,managerReadonly:Me,managerStageRect:Se,managerStageRatio:Ie,defaultBoxBodyStyle:De,defaultBoxStageStyle:_e,collectorRect:wt};v.withReadonlyValueEnhancer(this,gp);const mp={zIndex:Ae,focus:ni,state:dr,minSize:ur,pxMinSize:lp,intrinsicSize:Wi,intrinsicCoord:pr,pxIntrinsicSize:gr,pxIntrinsicCoord:oi,bodyRect:co,stageRect:pp,minimized:Fi,maximized:cr,readonly:hr};v.withReadonlyValueEnhancer(this,mp,qe);const fp={title:lt,visible:Nt,resizable:A,draggable:O,boxRatio:Ve,boxMinimized:oo,boxMaximized:Pt,boxReadonly:lo,stageRatio:ho,bodyStyle:cp,stageStyle:hp};v.withValueEnhancer(this,fp,qe),this.titleBar=M||new da({readonly$:hr,state$:dr,title$:lt,namespace:this.namespace,onDragStart:$=>{var F;return(F=this._handleTrackStart)==null?void 0:F.call(this,$)},onEvent:$=>this._delegateEvents.emit($.type)}),this._sideEffect.addDisposer(v.combine([Ve,Fi]).subscribe(([$,F])=>{!F&&$>0&&this.transform(oi.value.x,oi.value.y,gr.value.width,gr.value.height)})),this._sideEffect.addDisposer(Ge.subscribe($=>{$&&this.move(oi.value.x,oi.value.y)})),this.$box=this._render(),dp.setValue(this.$content.parentElement),y&&this.mountContent(y),k&&this.mountStage(k),D&&this.mountFooter(D),T&&this.mountStyles(T),U&&this.mountUserStyles(U),ve.appendChild(this.$box);const ct=($,F)=>{this._sideEffect.addDisposer($.reaction((bp,yp)=>{yp||this.events.emit(F,bp)}))};ct(Ce,fe.DarkMode),ct(hr,fe.Readonly),ct(Ae,fe.ZIndex),ct(Fi,fe.Minimized),ct(cr,fe.Maximized),ct(dr,fe.State),ct(Wi,fe.IntrinsicResize),ct(pr,fe.IntrinsicMove),this._sideEffect.addDisposer([Nt.reaction(($,F)=>{!F&&!$&&this.events.emit(fe.Close)}),ni.reaction(($,F)=>{F||this.events.emit($?fe.Focus:fe.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=xt(e,0,n.width-o.width),a=xt(i,0,n.height-o.height)):(r=xt(e,-(o.width-120),0+n.width-20),a=xt(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,x)=>this._sideEffect.addDisposer([this._readonly$.subscribe(M=>b.classList.toggle(this.wrapClassName("readonly"),M)),this._draggable$.subscribe(M=>b.classList.toggle(this.wrapClassName("no-drag"),!M)),this._resizable$.subscribe(M=>b.classList.toggle(this.wrapClassName("no-resize"),!M)),this._focus$.subscribe(M=>b.classList.toggle(this.wrapClassName("blur"),!M)),this._darkMode$.subscribe(M=>{b.classList.toggle(this.wrapClassName("color-scheme-dark"),M),b.classList.toggle(this.wrapClassName("color-scheme-light"),!M)})],x);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"),x=this.wrapClassName("maximized"),M="box-maximized-timer";return this._state$.subscribe(y=>{this.$box.classList.toggle(b,y===se.Minimized),y===se.Maximized?(this._sideEffect.flush(M),this.$box.classList.toggle(x,!0)):this._sideEffect.setTimeout(()=>{this.$box.classList.toggle(x,!1)},0,M)})}),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=Kl(this.$box),s=v.combine([this._maximized$,this._minimized$,this._pxIntrinsicSize$,this._pxIntrinsicCoord$,this._collectorRect$,this._rootRect$,this._managerStageRect$],([b,x,M,y,k,D,T])=>{const U=b?{x:-T.x,y:-T.y,width:D.width,height:D.height,scaleX:1,scaleY:1}:{x:y.x,y:y.y,width:M.width,height:M.height,scaleX:1,scaleY:1};if(x&&k){const{width:ne,height:J}=b?this.rootRect:M;U.x=k.x-ne/2+k.width/2-T.x,U.y=k.y-J/2+k.height/2-T.y,U.scaleX=k.width/ne,U.scaleY=k.height/J}return U},{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(v.combine([this._bodyStyle$,this._defaultBoxBodyStyle$],([b,x])=>b!=null?b:x).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=ec,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 sc(()=>{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([v.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(je).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:x}=f;x<0&&(x=0);const M=b-l,y=x-d;let{x:k,y:D}=this.pxIntrinsicCoord,{width:T,height:U}=this.pxIntrinsicSize;switch(u){case je.North:{D=n+y,U=c-y;break}case je.South:{U=c+y;break}case je.West:{k=a+M,T=o-M;break}case je.East:{T=o+M;break}case je.NorthWest:{k=a+M,D=n+y,T=o-M,U=c-y;break}case je.NorthEast:{D=n+y,T=o+M,U=c-y;break}case je.SouthEast:{T=o+M,U=c+y;break}case je.SouthWest:{k=a+M,T=o-M,U=c+y;break}default:{this.move(a+M,n+y);return}}this.transform(k,D,T,U)},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 x=f.target;if((b=x.dataset)!=null&&b.teleBoxHandle){Rt(f),{x:a,y:n}=this.pxIntrinsicCoord,{width:o,height:c}=this.pxIntrinsicSize,{pageX:l,pageY:d}=f,u=x.dataset.teleBoxHandle,r||(r=document.createElement("div"));const M=u?this.wrapClassName(`cursor-${u}`):"";r.className=this.wrapClassName(`track-mask${M?` ${M}`:""}`),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(fe.Destroyed),this.events.clearListeners(),this._delegateEvents.clearListeners()}wrapClassName(e){return`${this.namespace}-${e}`}}var ac="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K";class nc{constructor({minimized$:e,readonly$:i,darkMode$:s,namespace:r="telebox",styles:a={},root:n,onClick:o}){this._sideEffect=new ye.SideEffectManager,this.namespace=r;const c=new v.ValManager;this._sideEffect.addDisposer(()=>c.destroy());const l=new v.Val(void 0),d=v.derive(e),u=new v.Val(a),p=new v.Val(document.createElement("button")),m={styles:u,$collector:p};v.withValueEnhancer(this,m,c);const g={rect:l,visible:d};v.withReadonlyValueEnhancer(this,g,c),p.value.className=this.wrapClassName("collector"),p.value.style.backgroundImage=`url('${ac}')`,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(x=>{const M=b[x];M!=null&&(f.style[x]=M)})}),e.subscribe(b=>{if(b){const{x,y:M,width:y,height:k}=f.getBoundingClientRect(),D=n.getBoundingClientRect();l.setValue({x:x-D.x,y:M-D.y,width:y,height:k})}})],"telebox-collector-el")}))}destroy(){this._sideEffect.flushAll()}wrapClassName(e){return`${this.namespace}-${e}`}}var ue=(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))(ue||{});class oc extends da{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)}),v.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 lc=window.ResizeObserver||mr.ResizeObserver;class cc{constructor({root:e=null,fullscreen:i=!1,prefersColorScheme:s=ha.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 Je.default,this._sideEffect=new ye.SideEffectManager,this.namespace=c;const b=new v.ValManager;this._sideEffect.addDisposer(()=>b.destroy());const x=new v.Val(e),M=new v.Val(l),y=new v.Val(n),k=new v.Val(u),D=new v.Val(p),T=new v.Val(d),U=new v.Val(m),ne=new v.Val(g),J=new v.Val(i),Ce=new v.Val(r),Ge=new v.Val(a),ve=v.combine([Ge,J],([A,O])=>O?!0:A),Ee=v.combine([Ce,J],([A,O])=>O?!1:A);this.setMaximized=(A,O)=>Ge.setValue(A,O),this.setMinimized=(A,O)=>Ce.setValue(A,O);const xe=new v.Val({x:0,y:0,width:window.innerWidth,height:window.innerHeight},{compare:Ne});this._sideEffect.addDisposer(x.subscribe(A=>{this._sideEffect.add(()=>{if(!A)return()=>{};const O=new lc(()=>{const Ve=A.getBoundingClientRect();xe.setValue({x:0,y:0,width:Ve.width,height:Ve.height})});return O.observe(A),()=>O.disconnect()},"calc-root-rect")}));const ze=v.combine([xe,T],ua,{compare:Ne});this.boxes$=new v.Val([]),this.topBox$=new v.Val(void 0),this._sideEffect.addDisposer(this.boxes$.subscribe(A=>{if(A.length>0){const O=A.reduce((Ve,Ae)=>Ve.zIndex>Ae.zIndex?Ve:Ae);this.topBox$.setValue(O)}else this.topBox$.setValue(void 0)}));const Me=window.matchMedia("(prefers-color-scheme: dark)"),Se=new v.Val(!1);Me&&(Se.setValue(Me.matches),this._sideEffect.add(()=>{const A=O=>{Se.setValue(O.matches)};return Me.addEventListener("change",A),()=>Me.removeEventListener("change",A)}));const Ie=new v.Val(s);this._sideEffect.addDisposer(Ie.reaction((A,O)=>{O||this.events.emit(ue.PrefersColorScheme,A)}));const De=v.combine([Se,Ie],([A,O])=>O==="auto"?A:O==="dark"),_e=v.combine([Ee,ve],([A,O])=>A?se.Minimized:O?se.Maximized:se.Normal),wt={darkMode:De,state:_e,root:x,rootRect:xe,stageRect:ze,minimized:Ee,maximized:ve};v.withReadonlyValueEnhancer(this,wt,b);const qe={fullscreen:J,prefersColorScheme:Ie,readonly:M,fence:y,stageRatio:T,containerStyle:k,stageStyle:D,defaultBoxBodyStyle:U,defaultBoxStageStyle:ne};v.withValueEnhancer(this,qe,b);const lt=this.wrapClassName("titlebar-icon-close"),Nt=A=>{var O;if(!A.isPrimary||M.value)return;const Ve=A.target;if(!!Ve.tagName)for(let Ae=Ve;Ae;Ae=Ae.parentElement){if(Ae.classList&&Ae.classList.contains(lt))return;const ni=(O=Ae.dataset)==null?void 0:O.teleBoxID;if(ni){const Pt=this.getBox(ni);if(Pt){this.focusBox(Pt),this.makeBoxTop(Pt);return}}}};this._sideEffect.addEventListener(window,"pointerdown",Nt,!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([De.subscribe(A=>{this.$container.classList.toggle(this.wrapClassName("color-scheme-dark"),A),this.$container.classList.toggle(this.wrapClassName("color-scheme-light"),!A)}),J.subscribe(A=>{this.$container.classList.toggle(this.wrapClassName("is-fullscreen"),Boolean(A))}),v.combine([this.boxes$,J],([A,O])=>O==="no-titlebar"||O===!0&&A.length<=1).subscribe(A=>{this.$container.classList.toggle(this.wrapClassName("hide-fullscreen-titlebar"),A)}),ve.subscribe(A=>{this.$container.classList.toggle(this.wrapClassName("is-maximized"),A)}),Ee.subscribe(A=>{this.$container.classList.toggle(this.wrapClassName("is-minimized"),A)}),k.subscribe(A=>{this.$container.style.cssText=A}),D.subscribe(A=>{this.$stage.style.cssText=A,this.$stage.style.width=ze.value.width+"px",this.$stage.style.height=ze.value.height+"px"}),ze.subscribe(A=>{this.$stage.style.width=A.width+"px",this.$stage.style.height=A.height+"px"}),x.subscribe(A=>{A?A.appendChild(this.$container):this.$container.parentElement&&this.$container.remove()})]),this.collector=o!=null?o:new nc({minimized$:Ee,readonly$:M,darkMode$:De,namespace:c,root:this.$container,onClick:()=>Ce.setValue(!1)}),this.titleBar=new oc({namespace:this.namespace,title$:v.derive(this.topBox$,A=>(A==null?void 0:A.title)||""),boxes$:this.boxes$,darkMode$:De,readonly$:M,state$:_e,rootRect$:xe,root:this.$container,onEvent:A=>{switch(A.type){case $e.Maximize:{this.setMaximized(!ve.value);break}case $e.Minimize:{this.setMinimized(!0);break}case fe.Close:{this.removeTopBox(),this.focusTopBox();break}}}}),this._sideEffect.addDisposer([_e.reaction((A,O)=>{O||this.events.emit(ue.State,A)}),ve.reaction((A,O)=>{O||this.events.emit(ue.Maximized,A)}),Ee.reaction((A,O)=>{O||this.events.emit(ue.Minimized,A)}),De.reaction((A,O)=>{O||this.events.emit(ue.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 rc(he(B(B({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($e.Maximize,()=>{this.setMaximized(!this.maximized)}),s._delegateEvents.on($e.Minimize,()=>{this.setMinimized(!0)}),s._delegateEvents.on($e.Close,()=>{this.remove(s),this.focusTopBox()}),s._intrinsicCoord$.reaction((r,a)=>{a||this.events.emit(ue.IntrinsicMove,s)}),s._intrinsicSize$.reaction((r,a)=>{a||this.events.emit(ue.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(ue.ZIndex,s)})]),this.events.emit(ue.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(ue.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(ue.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(ue.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(ue.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(ue.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 hc=(t,e,i,s,r)=>new dc({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 dc{constructor(e,i){this.context=e,this.sideEffectManager=new ye.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",w.debounce(n=>{a.emit("move",{appId:n.id,x:n.intrinsicX,y:n.intrinsicY})},50)),this.teleBoxManager.events.on("intrinsic_resize",w.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,ke.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=yo,minheight:s=wo,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=pe.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 cc(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 fi(){}function pa(t){return t()}function ga(){return Object.create(null)}function bi(t){t.forEach(pa)}function uc(t){return typeof t=="function"}function pc(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let yi;function wi(t,e){return yi||(yi=document.createElement("a")),yi.href=e,t===yi.href}function gc(t){return Object.keys(t).length===0}function Fe(t,e){t.appendChild(e)}function vi(t,e,i){t.insertBefore(e,i||null)}function Ot(t){t.parentNode.removeChild(t)}function Ke(t){return document.createElement(t)}function xs(t){return document.createTextNode(t)}function Ms(){return xs(" ")}function re(t,e,i){i==null?t.removeAttribute(e):t.getAttribute(e)!==i&&t.setAttribute(e,i)}function mc(t){return Array.from(t.childNodes)}function ma(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function le(t,e,i,s){i===null?t.style.removeProperty(e):t.style.setProperty(e,i,s?"important":"")}let Ss;function Ut(t){Ss=t}const Ht=[],fa=[],xi=[],ba=[],fc=Promise.resolve();let Cs=!1;function bc(){Cs||(Cs=!0,fc.then(ya))}function Is(t){xi.push(t)}const _s=new Set;let Mi=0;function ya(){const t=Ss;do{for(;Mi<Ht.length;){const e=Ht[Mi];Mi++,Ut(e),yc(e.$$)}for(Ut(null),Ht.length=0,Mi=0;fa.length;)fa.pop()();for(let e=0;e<xi.length;e+=1){const i=xi[e];_s.has(i)||(_s.add(i),i())}xi.length=0}while(Ht.length);for(;ba.length;)ba.pop()();Cs=!1,_s.clear(),Ut(t)}function yc(t){if(t.fragment!==null){t.update(),bi(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(Is)}}const wc=new Set;function vc(t,e){t&&t.i&&(wc.delete(t),t.i(e))}function xc(t,e,i,s){const{fragment:r,on_mount:a,on_destroy:n,after_update:o}=t.$$;r&&r.m(e,i),s||Is(()=>{const c=a.map(pa).filter(uc);n?n.push(...c):bi(c),t.$$.on_mount=[]}),o.forEach(Is)}function Mc(t,e){const i=t.$$;i.fragment!==null&&(bi(i.on_destroy),i.fragment&&i.fragment.d(e),i.on_destroy=i.fragment=null,i.ctx=[])}function Sc(t,e){t.$$.dirty[0]===-1&&(Ht.push(t),bc(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function Cc(t,e,i,s,r,a,n,o=[-1]){const c=Ss;Ut(t);const l=t.$$={fragment:null,ctx:null,props:a,update:fi,not_equal:r,bound:ga(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:ga(),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&&Sc(t,u)),p}):[],l.update(),d=!0,bi(l.before_update),l.fragment=s?s(l.ctx):!1,e.target){if(e.hydrate){const u=mc(e.target);l.fragment&&l.fragment.l(u),u.forEach(Ot)}else l.fragment&&l.fragment.c();e.intro&&vc(t.$$.fragment),xc(t,e.target,e.anchor,e.customElement),ya()}Ut(c)}class Ic{$destroy(){Mc(this,1),this.$destroy=fi}$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&&!gc(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function wa(t){let e,i,s,r,a,n,o=t[14]&&va(t),c=t[15]&&xa(t);return{c(){e=Ke("div"),i=Ke("div"),o&&o.c(),s=Ms(),r=Ke("span"),a=xs(t[0]),n=Ms(),c&&c.c(),le(r,"overflow","hidden"),le(r,"white-space","nowrap"),le(r,"text-overflow","ellipsis"),le(r,"max-width","80px"),re(i,"class",t[8]),le(i,"background-color",t[2]),le(i,"color",t[9]),le(i,"opacity",t[11]),re(e,"class","netless-window-manager-cursor-name")},m(l,d){vi(l,e,d),Fe(e,i),o&&o.m(i,null),Fe(i,s),Fe(i,r),Fe(r,a),Fe(i,n),c&&c.m(i,null)},p(l,d){l[14]?o?o.p(l,d):(o=va(l),o.c(),o.m(i,s)):o&&(o.d(1),o=null),d&1&&ma(a,l[0]),l[15]?c?c.p(l,d):(c=xa(l),c.c(),c.m(i,null)):c&&(c.d(1),c=null),d&256&&re(i,"class",l[8]),d&4&&le(i,"background-color",l[2]),d&512&&le(i,"color",l[9]),d&2048&&le(i,"opacity",l[11])},d(l){l&&Ot(e),o&&o.d(),c&&c.d()}}}function va(t){let e,i;return{c(){e=Ke("img"),re(e,"class","netless-window-manager-cursor-selector-avatar"),re(e,"style",t[16]()),wi(e.src,i=t[7])||re(e,"src",i),re(e,"alt","avatar")},m(s,r){vi(s,e,r)},p(s,r){r&128&&!wi(e.src,i=s[7])&&re(e,"src",i)},d(s){s&&Ot(e)}}}function xa(t){let e,i;return{c(){e=Ke("span"),i=xs(t[1]),re(e,"class","netless-window-manager-cursor-tag-name"),le(e,"background-color",t[10])},m(s,r){vi(s,e,r),Fe(e,i)},p(s,r){r&2&&ma(i,s[1]),r&1024&&le(e,"background-color",s[10])},d(s){s&&Ot(e)}}}function _c(t){let e,i,s,r,a,n,o=!t[12]&&wa(t);return{c(){e=Ke("div"),o&&o.c(),i=Ms(),s=Ke("div"),r=Ke("img"),re(r,"class",a="netless-window-manager-cursor-"+t[3]+"-image"),wi(r.src,n=t[6])||re(r,"src",n),re(r,"alt",t[3]),re(s,"class","cursor-image-wrapper"),re(e,"class","netless-window-manager-cursor-mid"),le(e,"transform","translateX("+t[4]+"px) translateY("+t[5]+"px)"),le(e,"display",t[13])},m(c,l){vi(c,e,l),o&&o.m(e,null),Fe(e,i),Fe(e,s),Fe(s,r)},p(c,[l]){c[12]?o&&(o.d(1),o=null):o?o.p(c,l):(o=wa(c),o.c(),o.m(e,i)),l&8&&a!==(a="netless-window-manager-cursor-"+c[3]+"-image")&&re(r,"class",a),l&64&&!wi(r.src,n=c[6])&&re(r,"src",n),l&8&&re(r,"alt",c[3]),l&48&&le(e,"transform","translateX("+c[4]+"px) translateY("+c[5]+"px)"),l&8192&&le(e,"display",c[13])},i:fi,o:fi,d(c){c&&Ot(e),o&&o.d()}}}function Ac(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:x}=e,{color:M}=e,{cursorTagBackgroundColor:y}=e,{opacity:k}=e;const D=()=>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,U])=>`${T}: ${U}`).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,x=T.theme),"color"in T&&i(9,M=T.color),"cursorTagBackgroundColor"in T&&i(10,y=T.cursorTagBackgroundColor),"opacity"in T&&i(11,k=T.opacity)},t.$$.update=()=>{t.$$.dirty&1&&(s=!w.isEmpty(c)),t.$$.dirty&2&&i(15,r=!w.isEmpty(l)),t.$$.dirty&128&&i(14,a=!w.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,x,M,y,k,o,n,a,r,D,f]}class kc extends Ic{constructor(e){super();Cc(this,e,Ac,_c,pc,{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 Tc{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 kc({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=jr(this.manager.room,this.memberId),this.updateComponent(),this.member}updateComponent(){var e;(e=this.component)==null||e.$set(w.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 Nc="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==",Pc="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==",Ec="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+",Dc="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDdweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDcgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT50ZXh0LWN1cnNvcjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxwYXRoIGQ9Ik0xNiwyNi41IEMxNS43MjM4NTc2LDI2LjUgMTUuNSwyNi4yNzYxNDI0IDE1LjUsMjYgQzE1LjUsMjUuNzU0NTQwMSAxNS42NzY4NzUyLDI1LjU1MDM5MTYgMTUuOTEwMTI0NCwyNS41MDgwNTU3IEwxNiwyNS41IEwxOS41LDI1LjUgTDE5LjUsMTQuNSBMMTYsMTQuNSBDMTUuNzIzODU3NiwxNC41IDE1LjUsMTQuMjc2MTQyNCAxNS41LDE0IEMxNS41LDEzLjc1NDU0MDEgMTUuNjc2ODc1MiwxMy41NTAzOTE2IDE1LjkxMDEyNDQsMTMuNTA4MDU1NyBMMTYsMTMuNSBMMjQsMTMuNSBDMjQuMjc2MTQyNCwxMy41IDI0LjUsMTMuNzIzODU3NiAyNC41LDE0IEMyNC41LDE0LjI0NTQ1OTkgMjQuMzIzMTI0OCwxNC40NDk2MDg0IDI0LjA4OTg3NTYsMTQuNDkxOTQ0MyBMMjQsMTQuNSBMMjAuNSwxNC41IEwyMC41LDI1LjUgTDI0LDI1LjUgQzI0LjI3NjE0MjQsMjUuNSAyNC41LDI1LjcyMzg1NzYgMjQuNSwyNiBDMjQuNSwyNi4yNDU0NTk5IDI0LjMyMzEyNDgsMjYuNDQ5NjA4NCAyNC4wODk4NzU2LDI2LjQ5MTk0NDMgTDI0LDI2LjUgTDE2LDI2LjUgWiIgaWQ9InBhdGgtMSI+PC9wYXRoPgogICAgICAgIDxmaWx0ZXIgeD0iLTI4NC4wJSIgeT0iLTgxLjUlIiB3aWR0aD0iNjY4LjElIiBoZWlnaHQ9IjI5My45JSIgZmlsdGVyVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiBpZD0iZmlsdGVyLTIiPgogICAgICAgICAgICA8ZmVNb3JwaG9sb2d5IHJhZGl1cz0iMSIgb3BlcmF0b3I9ImRpbGF0ZSIgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd1NwcmVhZE91dGVyMSI+PC9mZU1vcnBob2xvZ3k+CiAgICAgICAgICAgIDxmZU9mZnNldCBkeD0iMCIgZHk9IjIiIGluPSJzaGFkb3dTcHJlYWRPdXRlcjEiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIj48L2ZlT2Zmc2V0PgogICAgICAgICAgICA8ZmVHYXVzc2lhbkJsdXIgc3RkRGV2aWF0aW9uPSIzIiBpbj0ic2hhZG93T2Zmc2V0T3V0ZXIxIiByZXN1bHQ9InNoYWRvd0JsdXJPdXRlcjEiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgICAgIDxmZUNvbXBvc2l0ZSBpbj0ic2hhZG93Qmx1ck91dGVyMSIgaW4yPSJTb3VyY2VBbHBoYSIgb3BlcmF0b3I9Im91dCIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29tcG9zaXRlPgogICAgICAgICAgICA8ZmVDb2xvck1hdHJpeCB2YWx1ZXM9IjAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgMCAwIDAgMC4xNiAwIiB0eXBlPSJtYXRyaXgiIGluPSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29sb3JNYXRyaXg+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iLTQiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJXaGl0ZWJvYXJkLUd1aWRlbGluZXMiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zODguMDAwMDAwLCAtNjcyLjAwMDAwMCkiPgogICAgICAgICAgICA8ZyBpZD0idGV4dC1jdXJzb3IiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDM5Mi4wMDAwMDAsIDY3Mi4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaLlpIfku70tNDAiIGZpbGw9IiNGRkZGRkYiIG9wYWNpdHk9IjAuMDEiIHg9IjAiIHk9IjAiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcng9IjIiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgiIGZpbGwtcnVsZT0ibm9uemVybyI+CiAgICAgICAgICAgICAgICAgICAgPHVzZSBmaWxsPSJibGFjayIgZmlsbC1vcGFjaXR5PSIxIiBmaWx0ZXI9InVybCgjZmlsdGVyLTIpIiB4bGluazpocmVmPSIjcGF0aC0xIj48L3VzZT4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMSIgZD0iTTE5LDI1IEwxOSwxNSBMMTYsMTUgQzE1LjQ0NzcxNTMsMTUgMTUsMTQuNTUyMjg0NyAxNSwxNCBDMTUsMTMuNTE0NTg5NyAxNS4zNDc5OTkzLDEzLjEwMTkxNSAxNS44NjU0ODc3LDEzLjAxMDA1MjEgTDE2LDEzIEwyNCwxMyBDMjQuNTUyMjg0NywxMyAyNSwxMy40NDc3MTUzIDI1LDE0IEMyNSwxNC40ODU0MTAzIDI0LjY1MjAwMDcsMTQuODk4MDg1IDI0LjEzNDUxMjMsMTQuOTg5OTQ3OSBMMjQsMTUgTDIxLDE1IEwyMSwyNSBMMjQsMjUgQzI0LjU1MjI4NDcsMjUgMjUsMjUuNDQ3NzE1MyAyNSwyNiBDMjUsMjYuNDg1NDEwMyAyNC42NTIwMDA3LDI2Ljg5ODA4NSAyNC4xMzQ1MTIzLDI2Ljk4OTk0NzkgTDI0LDI3IEwxNiwyNyBDMTUuNDQ3NzE1MywyNyAxNSwyNi41NTIyODQ3IDE1LDI2IEMxNSwyNS41MTQ1ODk3IDE1LjM0Nzk5OTMsMjUuMTAxOTE1IDE1Ljg2NTQ4NzcsMjUuMDEwMDUyMSBMMTYsMjUgTDE5LDI1IFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=",Vc="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjhweCIgaGVpZ2h0PSIyOHB4IiB2aWV3Qm94PSIwIDAgMjggMjgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDU1LjEgKDc4MTM2KSAtIGh0dHBzOi8vc2tldGNoYXBwLmNvbSAtLT4KICAgIDx0aXRsZT7nvJbnu4QgMjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxmaWx0ZXIgeD0iLTEyMC4wJSIgeT0iLTEyMC4wJSIgd2lkdGg9IjM0MC4wJSIgaGVpZ2h0PSIzNDAuMCUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0xIj4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iNCIgaW49IlNvdXJjZUdyYXBoaWMiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9Iue8lue7hC0yIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg5LjAwMDAwMCwgOS4wMDAwMDApIiBmaWxsPSIjRkYwMTAwIj4KICAgICAgICAgICAgPGNpcmNsZSBpZD0i5qSt5ZyG5b2iIiBmaWx0ZXI9InVybCgjZmlsdGVyLTEpIiBjeD0iNSIgY3k9IjUiIHI9IjUiPjwvY2lyY2xlPgogICAgICAgICAgICA8cGF0aCBkPSJNNSw4IEM2LjY1Njg1NDI1LDggOCw2LjY1Njg1NDI1IDgsNSBDOCwzLjM0MzE0NTc1IDYuNjU2ODU0MjUsMiA1LDIgQzMuMzQzMTQ1NzUsMiAyLDMuMzQzMTQ1NzUgMiw1IEMyLDYuNjU2ODU0MjUgMy4zNDMxNDU3NSw4IDUsOCBaIE01LDYuMjg1NzE0MjkgQzQuMjg5OTE5NjEsNi4yODU3MTQyOSAzLjcxNDI4NTcxLDUuNzEwMDgwMzkgMy43MTQyODU3MSw1IEMzLjcxNDI4NTcxLDQuMjg5OTE5NjEgNC4yODk5MTk2MSwzLjcxNDI4NTcxIDUsMy43MTQyODU3MSBDNS43MTAwODAzOSwzLjcxNDI4NTcxIDYuMjg1NzE0MjksNC4yODk5MTk2MSA2LjI4NTcxNDI5LDUgQzYuMjg1NzE0MjksNS43MTAwODAzOSA1LjcxMDA4MDM5LDYuMjg1NzE0MjkgNSw2LjI4NTcxNDI5IFoiIGlkPSLmpK3lnIblvaIiIGZpbGwtcnVsZT0ibm9uemVybyI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+";const Ma={[S.ApplianceNames.pencil]:Nc,[S.ApplianceNames.selector]:Pc,[S.ApplianceNames.eraser]:Ec,[S.ApplianceNames.shape]:zc,[S.ApplianceNames.text]:Dc,[S.ApplianceNames.laserPointer]:Vc};class Lc{constructor(e,i,s){var a;this.manager=e,this.enableCursor=i,this.cursorInstances=new Map,this.sideEffectManager=new ye.SideEffectManager,this.store=this.manager.store,this.applianceIcons=Ma,this.onCursorMove=n=>{const o=this.initCursorInstance(n.uid);if(n.state===yr.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 Tc(this.manager,n,this,pe.playground),this.cursorInstances.set(n,o)),o},this.mouseMoveListener=w.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=pe.playground;r&&this.setupWrapper(r),this.sideEffectManager.add(()=>z.on("cursorMove",this.onCursorMove)),this.sideEffectManager.add(()=>z.on("playgroundSizeChange",()=>this.updateContainerRect())),s&&(this.applianceIcons=B(B({},Ma),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=pe.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 $c{constructor(e){this.manager=e,z.on("changePageState",()=>{G.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=w.debounce(()=>{this._onReconnected()},1e3),this._onReconnected=()=>{Xe("onReconnected refresh reactors"),this.releaseDisposers(),this.reactors.forEach((i,s)=>{w.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=>{w.isFunction(e)&&e()}),this.disposers.clear()}refresh(){this._onReconnected()}add(e,i){const s=this.disposers.get(e);return s&&w.isFunction(s)&&s(),w.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&&(w.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 Bc=(t,e)=>{if(S.isPlayer(t))Oc(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),Rc(t,e),t.dynamicPpt.slideStateAdapter.pptHandler||(t.dynamicPpt.slideStateAdapter.pptHandler=e.createPPTHandler())}},Rc=(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 z.emit("removeScenes",{scenePath:s,index:r}),a}},Oc=t=>{const e=t.seekToProgressTime;async function i(s){await z.emit("seekStart");const r=await e.call(t,s);return z.emit("seek",s),r}t.seekToProgressTime=i};var Uc=(()=>`.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 Sa="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Hc=Sa.length,Ca=Array(20),Fc=()=>{for(let t=0;t<20;t++)Ca[t]=Sa.charAt(Math.random()*Hc);return Ca.join("")};function Ia(t){try{return t()}catch(e){console.error(e)}}class pt{constructor(){this.disposers=new Map}addDisposer(e,i=this.genUID()){return this.flush(i),this.disposers.set(i,Array.isArray(e)?()=>e.forEach(Ia):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(Ia),this.disposers.clear()}genUID(){let e;do e=Fc();while(this.disposers.has(e));return e}}var Wc=Object.defineProperty,Zc=Object.defineProperties,Yc=Object.getOwnPropertyDescriptors,_a=Object.getOwnPropertySymbols,Qc=Object.prototype.hasOwnProperty,Gc=Object.prototype.propertyIsEnumerable,As=(t,e,i)=>e in t?Wc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Aa=(t,e)=>{for(var i in e||(e={}))Qc.call(e,i)&&As(t,i,e[i]);if(_a)for(var i of _a(e))Gc.call(e,i)&&As(t,i,e[i]);return t},ka=(t,e)=>Zc(t,Yc(e)),et=(t,e,i)=>(As(t,typeof e!="symbol"?e+"":e,i),i);class qc{constructor(e){et(this,"_subscribers"),et(this,"_bSub"),et(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 ks{constructor(e,i){et(this,"_subscribers"),et(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 qc(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 We extends ks{constructor(){super(...arguments);et(this,"setValue",this._setValue)}}class Jc extends ks{constructor(e,i,s={}){super(i(e.value),ka(Aa({},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}}));et(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 Ft(t,e=s=>s,i={}){return new Jc(t,e,i)}class Xc extends ks{constructor(e,i,s={}){super(i(Ts(e)),ka(Aa({},s),{beforeSubscribe:r=>{let a=Ts(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}}));et(this,"_srcValue"),this._srcValue=()=>i(Ts(e))}get value(){if(this.size<=0){const e=this._srcValue();return this.compare(e,this._value)?this._value:e}return this._value}}function Ts(t){return t.map(Kc)}function Kc(t){return t.value}function Pe(t,e=s=>s,i={}){return new Xc(t,e,i)}function Ta(t){t.onValChanged||(t.onValChanged=eh)}function eh(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 th(t,e,i){Object.keys(e).forEach(s=>{ih(t,s,e[s]),i&&i.attach(e[s])}),Ta(t)}function ih(t,e,i){return Object.defineProperties(t,{[e]:{get(){return i.value}},[`_${e}$`]:{value:i}}),t}function sh(t,e,i){Object.keys(e).forEach(s=>{rh(t,s,e[s]),i&&i.attach(e[s])}),Ta(t)}function rh(t,e,i){return Object.defineProperties(t,{[e]:{get(){return i.value},set(s){i.setValue(s)}},[`_${e}$`]:{value:i},[`set${ah(e)}`]:{value:(s,r)=>i.setValue(s,r)}}),t}function ah(t){return t[0].toUpperCase()+t.slice(1)}const tt=typeof window!="undefined",Na=tt&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),Pa=tt&&"IntersectionObserver"in window,Ea=tt&&"classList"in document.createElement("p"),za=tt&&window.devicePixelRatio>1,nh={elements_selector:".lazy",container:Na||tt?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},Da=t=>Object.assign({},nh,t),Va=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)},oh=(t,e)=>{if(!!e)if(!e.length)Va(t,e);else for(let i=0,s;s=e[i];i+=1)Va(t,s)},Ze="src",Ns="srcset",Ps="sizes",La="poster",Wt="llOriginalAttrs",$a="data",Es="loading",ja="loaded",Ba="applied",lh="entered",zs="error",Ra="native",Oa="data-",Ua="ll-status",be=(t,e)=>t.getAttribute(Oa+e),ch=(t,e,i)=>{var s=Oa+e;if(i===null){t.removeAttribute(s);return}t.setAttribute(s,i)},Zt=t=>be(t,Ua),gt=(t,e)=>ch(t,Ua,e),Si=t=>gt(t,null),Ds=t=>Zt(t)===null,hh=t=>Zt(t)===Es,dh=t=>Zt(t)===zs,Vs=t=>Zt(t)===Ra,uh=[Es,ja,Ba,zs],ph=t=>uh.indexOf(Zt(t))>=0,it=(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)}},Mt=(t,e)=>{if(Ea){t.classList.add(e);return}t.className+=(t.className?" ":"")+e},Be=(t,e)=>{if(Ea){t.classList.remove(e);return}t.className=t.className.replace(new RegExp("(^|\\s+)"+e+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},gh=t=>{t.llTempImage=document.createElement("IMG")},mh=t=>{delete t.llTempImage},Ha=t=>t.llTempImage,Ci=(t,e)=>{if(!e)return;const i=e._observer;!i||i.unobserve(t)},fh=t=>{t.disconnect()},bh=(t,e,i)=>{e.unobserve_entered&&Ci(t,i)},Ls=(t,e)=>{!t||(t.loadingCount+=e)},yh=t=>{!t||(t.toLoadCount-=1)},Fa=(t,e)=>{!t||(t.toLoadCount=e)},wh=t=>t.loadingCount>0,vh=t=>t.toLoadCount>0,Wa=t=>{let e=[];for(let i=0,s;s=t.children[i];i+=1)s.tagName==="SOURCE"&&e.push(s);return e},$s=(t,e)=>{const i=t.parentNode;if(!i||i.tagName!=="PICTURE")return;Wa(i).forEach(e)},Za=(t,e)=>{Wa(t).forEach(e)},Ii=[Ze],Ya=[Ze,La],Yt=[Ze,Ns,Ps],Qa=[$a],_i=t=>!!t[Wt],Ga=t=>t[Wt],qa=t=>delete t[Wt],St=(t,e)=>{if(_i(t))return;const i={};e.forEach(s=>{i[s]=t.getAttribute(s)}),t[Wt]=i},xh=t=>{_i(t)||(t[Wt]={backgroundImage:t.style.backgroundImage})},Mh=(t,e,i)=>{if(!i){t.removeAttribute(e);return}t.setAttribute(e,i)},mt=(t,e)=>{if(!_i(t))return;const i=Ga(t);e.forEach(s=>{Mh(t,s,i[s])})},Sh=t=>{if(!_i(t))return;const e=Ga(t);t.style.backgroundImage=e.backgroundImage},Ja=(t,e,i)=>{Mt(t,e.class_applied),gt(t,Ba),i&&(e.unobserve_completed&&Ci(t,e),it(e.callback_applied,t,i))},Xa=(t,e,i)=>{Mt(t,e.class_loading),gt(t,Es),i&&(Ls(i,1),it(e.callback_loading,t,i))},st=(t,e,i)=>{!i||t.setAttribute(e,i)},Ka=(t,e)=>{st(t,Ps,be(t,e.data_sizes)),st(t,Ns,be(t,e.data_srcset)),st(t,Ze,be(t,e.data_src))},Ch=(t,e)=>{$s(t,i=>{St(i,Yt),Ka(i,e)}),St(t,Yt),Ka(t,e)},Ih=(t,e)=>{St(t,Ii),st(t,Ze,be(t,e.data_src))},_h=(t,e)=>{Za(t,i=>{St(i,Ii),st(i,Ze,be(i,e.data_src))}),St(t,Ya),st(t,La,be(t,e.data_poster)),st(t,Ze,be(t,e.data_src)),t.load()},Ah=(t,e)=>{St(t,Qa),st(t,$a,be(t,e.data_src))},kh=(t,e,i)=>{const s=be(t,e.data_bg),r=be(t,e.data_bg_hidpi),a=za&&r?r:s;!a||(t.style.backgroundImage=`url("${a}")`,Ha(t).setAttribute(Ze,a),Xa(t,e,i))},Th=(t,e,i)=>{const s=be(t,e.data_bg_multi),r=be(t,e.data_bg_multi_hidpi),a=za&&r?r:s;!a||(t.style.backgroundImage=a,Ja(t,e,i))},Nh=(t,e,i)=>{const s=be(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()),Ja(t,e,i)},en={IMG:Ch,IFRAME:Ih,VIDEO:_h,OBJECT:Ah},Ph=(t,e)=>{const i=en[t.tagName];!i||i(t,e)},Eh=(t,e,i)=>{const s=en[t.tagName];!s||(s(t,e),Xa(t,e,i))},zh=["IMG","IFRAME","VIDEO","OBJECT"],Dh=t=>zh.indexOf(t.tagName)>-1,tn=(t,e)=>{e&&!wh(e)&&!vh(e)&&it(t.callback_finish,e)},sn=(t,e,i)=>{t.addEventListener(e,i),t.llEvLisnrs[e]=i},Vh=(t,e,i)=>{t.removeEventListener(e,i)},js=t=>!!t.llEvLisnrs,Lh=(t,e,i)=>{js(t)||(t.llEvLisnrs={});const s=t.tagName==="VIDEO"?"loadeddata":"load";sn(t,s,e),sn(t,"error",i)},Bs=t=>{if(!js(t))return;const e=t.llEvLisnrs;for(let i in e){const s=e[i];Vh(t,i,s)}delete t.llEvLisnrs},rn=(t,e,i)=>{mh(t),Ls(i,-1),yh(i),Be(t,e.class_loading),e.unobserve_completed&&Ci(t,i)},$h=(t,e,i,s)=>{const r=Vs(e);rn(e,i,s),Mt(e,i.class_loaded),gt(e,ja),it(i.callback_loaded,e,s),r||tn(i,s)},jh=(t,e,i,s)=>{const r=Vs(e);rn(e,i,s),Mt(e,i.class_error),gt(e,zs),it(i.callback_error,e,s),i.restore_on_error&&mt(e,Yt),r||tn(i,s)},Rs=(t,e,i)=>{const s=Ha(t)||t;if(js(s))return;Lh(s,n=>{$h(n,t,e,i),Bs(s)},n=>{jh(n,t,e,i),Bs(s)})},Bh=(t,e,i)=>{gh(t),Rs(t,e,i),xh(t),kh(t,e,i),Th(t,e,i),Nh(t,e,i)},Rh=(t,e,i)=>{Rs(t,e,i),Eh(t,e,i)},Os=(t,e,i)=>{Dh(t)?Rh(t,e,i):Bh(t,e,i)},Oh=(t,e,i)=>{t.setAttribute("loading","lazy"),Rs(t,e,i),Ph(t,e),gt(t,Ra)},an=t=>{t.removeAttribute(Ze),t.removeAttribute(Ns),t.removeAttribute(Ps)},Uh=t=>{$s(t,e=>{an(e)}),an(t)},nn=t=>{$s(t,e=>{mt(e,Yt)}),mt(t,Yt)},Hh={IMG:nn,IFRAME:t=>{mt(t,Ii)},VIDEO:t=>{Za(t,e=>{mt(e,Ii)}),mt(t,Ya),t.load()},OBJECT:t=>{mt(t,Qa)}},Fh=t=>{const e=Hh[t.tagName];if(!e){Sh(t);return}e(t)},Wh=(t,e)=>{Ds(t)||Vs(t)||(Be(t,e.class_entered),Be(t,e.class_exited),Be(t,e.class_applied),Be(t,e.class_loading),Be(t,e.class_loaded),Be(t,e.class_error))},Zh=(t,e)=>{Fh(t),Wh(t,e),Si(t),qa(t)},Yh=(t,e,i,s)=>{!i.cancel_on_exit||!hh(t)||t.tagName==="IMG"&&(Bs(t),Uh(t),nn(t),Be(t,i.class_loading),Ls(s,-1),Si(t),it(i.callback_cancel,t,e,s))},Qh=(t,e,i,s)=>{const r=ph(t);gt(t,lh),Mt(t,i.class_entered),Be(t,i.class_exited),bh(t,i,s),it(i.callback_enter,t,e,s),!r&&Os(t,i,s)},Gh=(t,e,i,s)=>{Ds(t)||(Mt(t,i.class_exited),Yh(t,e,i,s),it(i.callback_exit,t,e,s))},qh=["IMG","IFRAME","VIDEO"],on=t=>t.use_native&&"loading"in HTMLImageElement.prototype,Jh=(t,e,i)=>{t.forEach(s=>{qh.indexOf(s.tagName)!==-1&&Oh(s,e,i)}),Fa(i,0)},Xh=t=>t.isIntersecting||t.intersectionRatio>0,Kh=t=>({root:t.container===document?null:t.container,rootMargin:t.thresholds||t.threshold+"px"}),ed=(t,e,i)=>{t.forEach(s=>Xh(s)?Qh(s.target,s,e,i):Gh(s.target,s,e,i))},td=(t,e)=>{e.forEach(i=>{t.observe(i)})},id=(t,e)=>{fh(t),td(t,e)},sd=(t,e)=>{!Pa||on(t)||(e._observer=new IntersectionObserver(i=>{ed(i,t,e)},Kh(t)))},ln=t=>Array.prototype.slice.call(t),Ai=t=>t.container.querySelectorAll(t.elements_selector),rd=t=>ln(t).filter(Ds),ad=t=>dh(t),nd=t=>ln(t).filter(ad),cn=(t,e)=>rd(t||Ai(e)),od=(t,e)=>{nd(Ai(t)).forEach(s=>{Be(s,t.class_error),Si(s)}),e.update()},ld=(t,e)=>{!tt||(e._onlineHandler=()=>{od(t,e)},window.addEventListener("online",e._onlineHandler))},cd=t=>{!tt||window.removeEventListener("online",t._onlineHandler)},Qt=function(t,e){const i=Da(t);this._settings=i,this.loadingCount=0,sd(i,this),ld(i,this),this.update(e)};Qt.prototype={update:function(t){const e=this._settings,i=cn(t,e);if(Fa(this,i.length),Na||!Pa){this.loadAll(i);return}if(on(e)){Jh(i,e,this);return}id(this._observer,i)},destroy:function(){this._observer&&this._observer.disconnect(),cd(this),Ai(this._settings).forEach(t=>{qa(t)}),delete this._observer,delete this._settings,delete this._onlineHandler,delete this.loadingCount,delete this.toLoadCount},loadAll:function(t){const e=this._settings;cn(t,e).forEach(s=>{Ci(s,this),Os(s,e,this)})},restoreAll:function(){const t=this._settings;Ai(t).forEach(e=>{Zh(e,t)})}},Qt.load=(t,e)=>{const i=Da(e);Os(t,i)},Qt.resetStatus=t=>{Si(t)},tt&&oh(Qt,window.lazyLoadOptions);class hd{constructor({namespace:e,pages$:i,sideEffect:s,readonly$:r,events:a,wrapClassName:n,root:o,pagesIndex$:c}){this.showPreview$=new We(!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 Qt({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 dd(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 ud(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 pd(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 gd(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 md(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 fd{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",dd(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",ud(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",gd(this.namespace),md(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",pd(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 bd{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 hn{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 pt,this.events=new bd;const n=new We(r);sh(this,{pages:n}),this.preview=new hd({pages$:n,readonly$:e,pagesIndex$:i,root:s.$body,sideEffect:this.sideEffect,events:this.events,namespace:this.namespace,wrapClassName:this.wrapClassName}),this.footer=new fd({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 rt(t,e,i){return Math.min(Math.max(t,e),i)}function dn(t){return t.touches?t.touches[0]:t}function un(t){t.stopPropagation(),t.cancelable&&t.preventDefault()}function pn(t,e){return t.width===e.width&&t.height===e.height}class yd{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 wd{constructor(e,i,s,r,a,n){this.index=e,this.lastVisit=Date.now(),this.sideEffect=new pt;const o=Ft(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)),xd=window.cancelIdleCallback||window.clearTimeout;class Md{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 wd(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&&(xd(this.gcTimer),this.gcTimer=null)}}class Sd{constructor({pagesScrollTop$:e,containerRect$:i,pages$:s,pagesSize$:r}){this.sideEffect=new pt,s=Ft(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(B({},g),{thumbnail:f.toString()})}catch(f){return console.error(f),g}}));const a=Ft(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=Ft(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])=>rt(Math.ceil(g.height/b/f/2),1,m.length));th(this,{pagesScrollTop:e,containerRect:i,pages:s,pagesSize:r,pagesIndex:o,pagesYs:a,pagesMinHeight:n,scale:c}),this.pageElManager=new Md(s,r,c,a,e),this.$pages=this.renderPages();const d=new We(!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),x=Math.min(m+g,f.length-1);for(let M=0;M<this.$pages.children.length;M++){const y=this.$pages.children[M],k=Number(y.dataset.index);k>=b&&k<=x||(y.remove(),M--)}for(let M=b;M<=x;M++){const y=this.pageElManager.getEl(M);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 Cd=30;class Id{constructor({pagesScrollTop$:e,containerRect$:i,stageRect$:s,pagesSize$:r,readonly$:a,scrollbarMinHeight:n=Cd,wrapClassName:o,onDragScroll:c}){this.sideEffect=new pt,this.scrolling$=new We(!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])=>rt(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])=>rt(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;un(s);const r=this.wrapClassName("scrollbar-dragging");e.classList.toggle(r,!0);const a=this.pagesScrollTop$.value,{clientY:n}=dn(s),o=l=>{if(!l.isPrimary||this.readonly$.value)return;const{clientY:d}=dn(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 _d{constructor({whiteboard:e,readonly$:i,box:s,pages:r,pagesScrollTop:a=0,onUserScroll:n}){this.sideEffect=new pt,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 We(r);this.pagesScrollTop$=new We(a),this.pagesSize$=Ft(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:pn}),this.pageRenderer=new Sd({pagesScrollTop$:this.pagesScrollTop$,containerRect$:s._stageRect$,pages$:c,pagesSize$:this.pagesSize$}),this.viewer=new hn({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 Id({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 yd({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:rt(e+i,i,this.pagesSize$.value.height-i),animationMode:"immediately"})}userScrollToPageIndex(e){var i;if(e=rt(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,rt(this.pageRenderer.pagesScrollTop+this.pageRenderer.containerRect.height/this.pageRenderer.scale*rt(e,-1,1),0,this.pageRenderer.pagesSize.height-this.pageRenderer.containerRect.height/this.pageRenderer.scale))}setupScrollListener(){this.sideEffect.addEventListener(this.box.$main,"wheel",e=>{un(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 Ad{constructor({readonly$:e,context:i,whiteboard:s,box:r,pages:a}){this.sideEffect=new pt,this.context=i,this.whiteboard=s,this.box=r,this.pages=a;const n=new We(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 hn({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(rt(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 ki={kind:"DocsViewer",setup(t){const e=t.box,i=t.getScenes();if(!i)throw new Error("[Docs Viewer]: scenes not found.");const s=new pt,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(Uc);const a=new We(!t.isWritable);s.addDisposer(t.emitter.on("writableChange",n=>{a.setValue(!n)})),r[0].src.startsWith("ppt")?Td(s,t,e,r,a):kd(s,t,e,r,a),s.addDisposer(t.emitter.on("destroy",()=>{s.flushAll()}))}};function kd(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 _d({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 Td(t,e,i,s,r){const a=e.createWhiteBoardView();a.view.disableCameraTransform=!0;const n=new Ad({context:e,whiteboard:a,box:i,pages:s,readonly$:r});t.addDisposer(()=>n.destroy());const o=new We({width:s[0].width,height:s[0].height},{compare:pn});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 at(){}function gn(t){return t()}function mn(){return Object.create(null)}function Ti(t){t.forEach(gn)}function Nd(t){return typeof t=="function"}function fn(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let Ni;function bn(t,e){return Ni||(Ni=document.createElement("a")),Ni.href=e,t===Ni.href}function Pd(t){return Object.keys(t).length===0}function L(t,e){t.appendChild(e)}function Ct(t,e,i){t.insertBefore(e,i||null)}function ft(t){t.parentNode.removeChild(t)}function It(t){return document.createElement(t)}function R(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Us(t){return document.createTextNode(t)}function Ed(){return Us(" ")}function I(t,e,i){i==null?t.removeAttribute(e):t.getAttribute(e)!==i&&t.setAttribute(e,i)}function zd(t){return Array.from(t.childNodes)}function Dd(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}let Gt;function qt(t){Gt=t}function yn(){if(!Gt)throw new Error("Function called outside component initialization");return Gt}function Vd(t){yn().$$.on_mount.push(t)}function Ld(t){yn().$$.on_destroy.push(t)}const Jt=[],Xt=[],Pi=[],wn=[],$d=Promise.resolve();let Hs=!1;function jd(){Hs||(Hs=!0,$d.then(vn))}function Fs(t){Pi.push(t)}const Ws=new Set;let Ei=0;function vn(){const t=Gt;do{for(;Ei<Jt.length;){const e=Jt[Ei];Ei++,qt(e),Bd(e.$$)}for(qt(null),Jt.length=0,Ei=0;Xt.length;)Xt.pop()();for(let e=0;e<Pi.length;e+=1){const i=Pi[e];Ws.has(i)||(Ws.add(i),i())}Pi.length=0}while(Jt.length);for(;wn.length;)wn.pop()();Hs=!1,Ws.clear(),qt(t)}function Bd(t){if(t.fragment!==null){t.update(),Ti(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(Fs)}}const zi=new Set;let Rd;function xn(t,e){t&&t.i&&(zi.delete(t),t.i(e))}function Od(t,e,i,s){if(t&&t.o){if(zi.has(t))return;zi.add(t),Rd.c.push(()=>{zi.delete(t),s&&(i&&t.d(1),s())}),t.o(e)}}function Ud(t){t&&t.c()}function Mn(t,e,i,s){const{fragment:r,on_mount:a,on_destroy:n,after_update:o}=t.$$;r&&r.m(e,i),s||Fs(()=>{const c=a.map(gn).filter(Nd);n?n.push(...c):Ti(c),t.$$.on_mount=[]}),o.forEach(Fs)}function Sn(t,e){const i=t.$$;i.fragment!==null&&(Ti(i.on_destroy),i.fragment&&i.fragment.d(e),i.on_destroy=i.fragment=null,i.ctx=[])}function Hd(t,e){t.$$.dirty[0]===-1&&(Jt.push(t),jd(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function Cn(t,e,i,s,r,a,n,o=[-1]){const c=Gt;qt(t);const l=t.$$={fragment:null,ctx:null,props:a,update:at,not_equal:r,bound:mn(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:mn(),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&&Hd(t,u)),p}):[],l.update(),d=!0,Ti(l.before_update),l.fragment=s?s(l.ctx):!1,e.target){if(e.hydrate){const u=zd(e.target);l.fragment&&l.fragment.l(u),u.forEach(ft)}else l.fragment&&l.fragment.c();e.intro&&xn(t.$$.fragment),Mn(t,e.target,e.anchor,e.customElement),vn()}qt(c)}class In{$destroy(){Sn(this,1),this.$destroy=at}$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&&!Pd(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Fd={"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"},Wd=["application/x-mpegurl","application/vnd.apple.mpegurl"];function Zd(t){if(!t)return;const e=t.lastIndexOf(".");if(!~e)return;const i=t.slice(e+1);return Fd[i]}async function Yd(t){try{return await t.play(),!0}catch(e){return t.muted=!0,await t.play(),console.debug(e),!1}}function Qd(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 Gd(){const t={loadSource(i){},attachMedia(i){}};let e=window.Hls;if(e===null||e===!1)return t;if(e===void 0&&(await Qd("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 qd(t){return"canPlayType"in t&&!t.canPlayType("application/vnd.apple.mpegurl")}function Jd(t,e,i){return t<e?e:t>i?i:t}function Xd(t){return Array.isArray(t)?t[0]:t}function Kd(t){let e,i,s,r,a,n,o,c,l,d,u,p,m,g,f,b,x,M,y,k,D,T,U,ne,J,Ce,Ge,ve,Ee,xe,ze,Me,Se,Ie,De,_e,wt,qe;return{c(){e=R("svg"),i=R("symbol"),s=R("path"),r=R("path"),a=R("symbol"),n=R("path"),o=R("symbol"),c=R("path"),l=R("symbol"),d=R("path"),u=R("symbol"),p=R("path"),m=R("symbol"),g=R("path"),f=R("symbol"),b=R("path"),x=R("symbol"),M=R("path"),y=R("symbol"),k=R("path"),D=R("symbol"),T=R("path"),U=R("symbol"),ne=R("path"),J=R("symbol"),Ce=R("path"),Ge=R("path"),ve=R("symbol"),Ee=R("path"),xe=R("symbol"),ze=R("path"),Me=R("symbol"),Se=R("path"),Ie=R("symbol"),De=R("path"),_e=R("symbol"),wt=R("path"),qe=R("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(M,"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(x,"id","plyr-logo-vimeo"),I(x,"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(D,"id","plyr-muted"),I(D,"viewBox","0 0 18 18"),I(ne,"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(U,"id","plyr-pause"),I(U,"viewBox","0 0 18 18"),I(Ce,"d","M13.293 3.293L7.022 9.564l1.414 1.414 6.271-6.271L17 7V1h-6z"),I(Ge,"d","M13 15H3V5h5V3H2a1 1 0 00-1 1v12a1 1 0 001 1h12a1 1 0 001-1v-6h-2v5z"),I(J,"id","plyr-pip"),I(J,"viewBox","0 0 18 18"),I(Ee,"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(ve,"id","plyr-play"),I(ve,"viewBox","0 0 18 18"),I(ze,"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(xe,"id","plyr-restart"),I(xe,"viewBox","0 0 18 18"),I(Se,"d","M10.125 1L0 9l10.125 8v-6.171L18 17V1l-7.875 6.171z"),I(Me,"id","plyr-rewind"),I(Me,"viewBox","0 0 18 18"),I(De,"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(Ie,"id","plyr-settings"),I(Ie,"viewBox","0 0 18 18"),I(wt,"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(qe,"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(_e,"id","plyr-volume"),I(_e,"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(lt,Nt){Ct(lt,e,Nt),L(e,i),L(i,s),L(i,r),L(e,a),L(a,n),L(e,o),L(o,c),L(e,l),L(l,d),L(e,u),L(u,p),L(e,m),L(m,g),L(e,f),L(f,b),L(e,x),L(x,M),L(e,y),L(y,k),L(e,D),L(D,T),L(e,U),L(U,ne),L(e,J),L(J,Ce),L(J,Ge),L(e,ve),L(ve,Ee),L(e,xe),L(xe,ze),L(e,Me),L(Me,Se),L(e,Ie),L(Ie,De),L(e,_e),L(_e,wt),L(_e,qe)},p:at,i:at,o:at,d(lt){lt&&ft(e)}}}class eu extends In{constructor(e){super();Cn(this,e,null,Kd,fn,{})}}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 tu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _n(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 iu(t,e,i){return e&&_n(t.prototype,e),i&&_n(t,i),t}function su(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function An(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 kn(t){for(var e=1;e<arguments.length;e++){var i=arguments[e]!=null?arguments[e]:{};e%2?An(Object(i),!0).forEach(function(s){su(t,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):An(Object(i)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(i,s))})}return t}var Tn={addCSS:!0,thumbWidth:15,watch:!0};function ru(t,e){return function(){return Array.from(document.querySelectorAll(e)).includes(this)}.call(t,e)}function au(t,e){if(t&&e){var i=new Event(e,{bubbles:!0});t.dispatchEvent(i)}}var Kt=function(t){return t!=null?t.constructor:null},Zs=function(t,e){return!!(t&&e&&t instanceof e)},Nn=function(t){return t==null},Pn=function(t){return Kt(t)===Object},nu=function(t){return Kt(t)===Number&&!Number.isNaN(t)},En=function(t){return Kt(t)===String},ou=function(t){return Kt(t)===Boolean},lu=function(t){return Kt(t)===Function},zn=function(t){return Array.isArray(t)},Dn=function(t){return Zs(t,NodeList)},cu=function(t){return Zs(t,Element)},hu=function(t){return Zs(t,Event)},du=function(t){return Nn(t)||(En(t)||zn(t)||Dn(t))&&!t.length||Pn(t)&&!Object.keys(t).length},ce={nullOrUndefined:Nn,object:Pn,number:nu,string:En,boolean:ou,function:lu,array:zn,nodeList:Dn,element:cu,event:hu,empty:du};function uu(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 pu(t,e){if(1>e){var i=uu(e);return parseFloat(t.toFixed(i))}return Math.round(t/e)*e}var gu=function(){function t(e,i){tu(this,t),ce.element(e)?this.element=e:ce.string(e)&&(this.element=document.querySelector(e)),ce.element(this.element)&&ce.empty(this.element.rangeTouch)&&(this.config=kn({},Tn,{},i),this.init())}return iu(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||!ce.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+pu(i/100*(n-a),o)}},{key:"set",value:function(e){t.enabled&&ce.event(e)&&!e.target.disabled&&(e.preventDefault(),e.target.value=this.get(e),au(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(ce.empty(e)||ce.string(e)?s=Array.from(document.querySelectorAll(ce.string(e)?e:'input[type="range"]')):ce.element(e)?s=[e]:ce.nodeList(e)?s=Array.from(e):ce.array(e)&&(s=e.filter(ce.element)),ce.empty(s))return null;var r=kn({},Tn,{},i);if(ce.string(e)&&r.watch){var a=new MutationObserver(function(n){Array.from(n).forEach(function(o){Array.from(o.addedNodes).forEach(function(c){ce.element(c)&&ru(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 _t=t=>t!=null?t.constructor:null,Ye=(t,e)=>Boolean(t&&e&&t instanceof e),Ys=t=>t==null,Vn=t=>_t(t)===Object,mu=t=>_t(t)===Number&&!Number.isNaN(t),Di=t=>_t(t)===String,fu=t=>_t(t)===Boolean,Ln=t=>_t(t)===Function,$n=t=>Array.isArray(t),bu=t=>Ye(t,WeakMap),jn=t=>Ye(t,NodeList),yu=t=>_t(t)===Text,wu=t=>Ye(t,Event),vu=t=>Ye(t,KeyboardEvent),xu=t=>Ye(t,window.TextTrackCue)||Ye(t,window.VTTCue),Mu=t=>Ye(t,TextTrack)||!Ys(t)&&Di(t.kind),Su=t=>Ye(t,Promise)&&Ln(t.then),Cu=t=>t!==null&&typeof t=="object"&&t.nodeType===1&&typeof t.style=="object"&&typeof t.ownerDocument=="object",Bn=t=>Ys(t)||(Di(t)||$n(t)||jn(t))&&!t.length||Vn(t)&&!Object.keys(t).length;var h={nullOrUndefined:Ys,object:Vn,number:mu,string:Di,boolean:fu,function:Ln,array:$n,weakMap:bu,nodeList:jn,element:Cu,textNode:yu,event:wu,keyboardEvent:vu,cue:xu,track:Mu,promise:Su,url:t=>{if(Ye(t,window.URL))return!0;if(!Di(t))return!1;let e=t;t.startsWith("http://")&&t.startsWith("https://")||(e=`http://${t}`);try{return!Bn(new URL(e).hostname)}catch{return!1}},empty:Bn};const Qs=(()=>{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 Rn(t,e){setTimeout(()=>{try{t.hidden=!0,t.offsetHeight,t.hidden=!1}catch{}},e)}const ae={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 Iu(t){return JSON.parse(JSON.stringify(t))}function On(t,e){return e.split(".").reduce((i,s)=>i&&i[s],t)}function K(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]:{}}),K(t[s],i[s])):Object.assign(t,{[s]:i[s]})}),K(t,...e)):t}function Un(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 Gs(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)&&Gs(s,e),h.string(i)&&(s.innerText=i),s}function _u(t,e){h.element(t)&&h.element(e)&&e.parentNode.insertBefore(t,e.nextSibling)}function Hn(t,e,i,s){h.element(e)&&e.appendChild(N(t,i,s))}function Qe(t){h.nodeList(t)||h.array(t)?Array.from(t).forEach(Qe):h.element(t)&&h.element(t.parentNode)&&t.parentNode.removeChild(t)}function Vi(t){if(!h.element(t))return;let{length:e}=t.childNodes;for(;e>0;)t.removeChild(t.lastChild),e-=1}function Li(t,e){return h.element(e)&&h.element(e.parentNode)&&h.element(t)?(e.parentNode.replaceChild(t,e),t):null}function Re(t,e){if(!h.string(t)||h.empty(t))return{};const i={},s=K({},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}}),K(s,i)}function bt(t,e){if(!h.element(t))return;let i=e;h.boolean(i)||(i=!t.hidden),t.hidden=i}function H(t,e,i){if(h.nodeList(t))return Array.from(t).map(s=>H(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 $i(t,e){return h.element(t)&&t.classList.contains(e)}function yt(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 Au(t,e){const{prototype:i}=Element;return(i.closest||function(){let s=this;do{if(yt.matches(s,e))return s;s=s.parentElement||s.parentNode}while(s!==null&&s.nodeType===1);return null}).call(t,e)}function At(t){return this.elements.container.querySelectorAll(t)}function ee(t){return this.elements.container.querySelector(t)}function qs(t=null,e=!1){h.element(t)&&(t.focus({preventScroll:!0}),e&&H(t,this.config.classNames.tabFocus))}const Fn={"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=ae.isIPhone&&i&&q.playsinline,r=q[t]||e!=="html5";return{api:r,ui:r&&q.rangeInput&&(t!=="video"||!ae.isIPhone||s)}},pip:!(ae.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(Fn).includes(i)&&(i+=`; codecs="${Fn[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:Qs!==!1,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches},ku=(()=>{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 kt(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;ku&&(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 W(t,e="",i,s=!0,r=!1){kt.call(this,t,e,i,!0,s,r)}function ji(t,e="",i,s=!0,r=!1){kt.call(this,t,e,i,!1,s,r)}function Js(t,e="",i,s=!0,r=!1){const a=(...n)=>{ji(t,e,a,s,r),i.apply(this,n)};kt.call(this,t,e,a,!0,s,r)}function P(t,e="",i=!1,s={}){if(!h.element(t)||h.empty(e))return;const r=new CustomEvent(e,{bubbles:i,detail:he(B({},s),{plyr:this})});t.dispatchEvent(r)}function Tu(){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 Nu(){return new Promise(t=>this.ready?setTimeout(t,0):W.call(this,this.elements.container,"ready",t)).then(()=>{})}function Oe(t){h.promise(t)&&t.then(null,()=>{})}function Xs(t){return h.array(t)?t.filter((e,i)=>t.indexOf(e)===i):t}function Wn(t,e){return h.array(t)&&t.length?t.reduce((i,s)=>Math.abs(s-e)<Math.abs(i-e)?s:i):null}function Zn(t){return!(!window||!window.CSS)&&window.CSS.supports(t)}const Yn=[[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(B({},t),{[e/i]:[e,i]}),{});function Qn(t){return h.array(t)||h.string(t)&&t.includes(":")?(h.array(t)?t:t.split(":")).map(Number).every(h.number):!1}function Bi(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 Ks(t){const e=s=>Qn(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 Bi(i)}function Tt(t){if(!this.isVideo)return{};const{wrapper:e}=this.elements,i=Ks.call(this,t);if(!h.array(i))return{};const[s,r]=Bi(i),a=100/s*r;if(Zn(`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 Gn(t,e,i=.05){const s=t/e,r=Wn(Object.keys(Yn),s);return Math.abs(r-s)<=i?Yn[r]:[t,e]}function Pu(){return[Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)]}const nt={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:nt.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)||Tt.call(t),Object.defineProperty(t.media,"quality",{get(){const e=nt.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=nt.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||Oe(t.play())}),t.media.load())}P.call(t,t.media,"qualitychange",!1,{quality:e})}}})},cancelRequests(){this.isHTML5&&(Qe(nt.getSources.call(this)),this.media.setAttribute("src",this.config.blankVideo),this.media.load(),this.debug.log("Cancelled network requests"))}};function Eu(t){return`${t}-${Math.floor(1e4*Math.random())}`}function er(t,...e){return h.empty(t)?t:t.toString().replace(/{(\d+)}/g,(i,s)=>e[s].toString())}function zu(t,e){return t===0||e===0||Number.isNaN(t)||Number.isNaN(e)?0:(t/e*100).toFixed(2)}const ei=(t="",e="",i="")=>t.replace(new RegExp(e.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),"g"),i.toString()),qn=(t="")=>t.toString().replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase());function Du(t=""){let e=t.toString();return e=ei(e,"-"," "),e=ei(e,"_"," "),e=qn(e),ei(e," ","")}function Vu(t=""){let e=t.toString();return e=Du(e),e.charAt(0).toLowerCase()+e.slice(1)}function Lu(t){const e=document.createDocumentFragment(),i=document.createElement("div");return e.appendChild(i),i.innerHTML=t,e.firstChild.innerText}function $u(t){const e=document.createElement("div");return e.appendChild(t),e.innerHTML}const Jn={pip:"PIP",airplay:"AirPlay",html5:"HTML5",vimeo:"Vimeo",youtube:"YouTube"},ie={get(t="",e={}){if(h.empty(t)||h.empty(e))return"";let i=On(e.i18n,t);if(h.empty(i))return Object.keys(Jn).includes(t)?Jn[t]:"";const s={"{seektime}":e.seekTime,"{title}":e.title};return Object.entries(s).forEach(([r,a])=>{i=ei(i,r,a)}),i}};class ti{constructor(e){_(this,"get",i=>{if(!ti.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(!ti.supported||!this.enabled||!h.object(i))return;let s=this.get();h.empty(s)&&(s={}),K(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 ii(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 Xn(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=ti.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)}}ii(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 Kn=t=>Math.trunc(t/60/60%60,10),ju=t=>Math.trunc(t%60,10);function Ri(t=0,e=!1,i=!1){if(!h.number(t))return Ri(void 0,e,i);const s=c=>`0${c}`.slice(-2);let r=Kn(t);const a=(n=t,Math.trunc(n/60%60,10));var n;const o=ju(t);return r=e||r>0?`${r}:`:"",`${i&&t>0?"-":""}${r}${s(a)}:${s(o)}`}const C={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||ae.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:i}},findElements(){try{return this.elements.controls=ee.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:At.call(this,this.config.selectors.buttons.play),pause:ee.call(this,this.config.selectors.buttons.pause),restart:ee.call(this,this.config.selectors.buttons.restart),rewind:ee.call(this,this.config.selectors.buttons.rewind),fastForward:ee.call(this,this.config.selectors.buttons.fastForward),mute:ee.call(this,this.config.selectors.buttons.mute),pip:ee.call(this,this.config.selectors.buttons.pip),airplay:ee.call(this,this.config.selectors.buttons.airplay),settings:ee.call(this,this.config.selectors.buttons.settings),captions:ee.call(this,this.config.selectors.buttons.captions),fullscreen:ee.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=ee.call(this,this.config.selectors.progress),this.elements.inputs={seek:ee.call(this,this.config.selectors.inputs.seek),volume:ee.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:ee.call(this,this.config.selectors.display.buffer),currentTime:ee.call(this,this.config.selectors.display.currentTime),duration:ee.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=C.getIconUrl.call(this),r=`${s.cors?"":s.url}#${this.config.iconPrefix}`,a=document.createElementNS(i,"svg");Gs(a,K(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=ie.get(t,this.config);return N("span",he(B({},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=K({},e);let s=Vu(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)||K(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(C.createIcon.call(this,r.iconPressed,{class:"icon--pressed"})),a.appendChild(C.createIcon.call(this,r.icon,{class:"icon--not-pressed"})),a.appendChild(C.createLabel.call(this,r.labelPressed,{class:"label--pressed"})),a.appendChild(C.createLabel.call(this,r.label,{class:"label--not-pressed"}))):(a.appendChild(C.createIcon.call(this,r.icon)),a.appendChild(C.createLabel.call(this,r.label))),K(i,Re(this.config.selectors.buttons[s],i)),Gs(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",K(Re(this.config.selectors.inputs[t]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":ie.get(t,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},e));return this.elements.inputs[t]=i,C.updateRangeFill.call(this,i),gu.setup(i),i},createProgress(t,e){const i=N("progress",K(Re(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?ie.get(s,this.config):"";i.innerText=`% ${r.toLowerCase()}`}return this.elements.display[t]=i,i},createTime(t,e){const i=Re(this.config.selectors.display[t],e),s=N("div",K(i,{class:`${i.class?i.class:""} ${this.config.classNames.display.time} `.trim(),"aria-label":ie.get(t,this.config)}),"00:00");return this.elements.display[t]=s,s},bindMenuItemShortcuts(t,e){W.call(this,t,"keydown keyup",i=>{if(!["Space","ArrowUp","ArrowDown","ArrowRight"].includes(i.key)||(i.preventDefault(),i.stopPropagation(),i.type==="keydown"))return;const s=yt(t,'[role="menuitemradio"]');if(!s&&["Space","ArrowRight"].includes(i.key))C.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)),qs.call(this,r,!0))}},!1),W.call(this,t,"keyup",i=>{i.key==="Return"&&C.focusFirstMenuItem.call(this,null,!0)})},createMenuItem({value:t,list:e,type:i,title:s,badge:r=null,checked:a=!1}){const n=Re(this.config.selectors.inputs[i]),o=N("button",K(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=>yt(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)}C.showMenuPanel.call(this,"home",h.keyboardEvent(l))}},i,!1),C.bindMenuItemShortcuts.call(this,o,i),e.appendChild(o)},formatTime(t=0,e=!1){return h.number(t)?Ri(t,Kn(this.duration)>0,e):t},updateTimeDisplay(t=null,e=0,i=!1){h.element(t)&&h.number(e)&&(t.innerText=C.formatTime(e,i))},updateVolume(){this.supported.ui&&(h.element(this.elements.inputs.volume)&&C.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,C.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=zu(this.currentTime,this.duration),t.type==="timeupdate"&&C.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(yt(e,this.config.selectors.inputs.seek)){e.setAttribute("aria-valuenow",this.currentTime);const i=C.formatTime(this.currentTime),s=C.formatTime(this.duration),r=ie.get("seekLabel",this.config);e.setAttribute("aria-valuetext",r.replace("{currentTime}",i).replace("{duration}",s))}else if(yt(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);ae.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=>H(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(!$i(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=C.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;C.updateTimeDisplay.call(this,this.elements.display.currentTime,e?this.duration-this.currentTime:this.currentTime,e),t&&t.type==="timeupdate"&&this.media.seeking||C.updateProgress.call(this,t)},durationUpdate(){if(!this.supported.ui||!this.config.invertTime&&this.currentTime)return;if(this.duration>=2**32)return bt(this.elements.display.currentTime,!0),void bt(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&&C.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),t&&C.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),this.config.markers.enabled&&C.setMarkers.call(this),C.updateSeekTooltip.call(this)},toggleMenuButton(t,e){bt(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=C.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?ie.get("normal",this.config):`${e}&times;`;case"quality":if(h.number(e)){const i=ie.get(`qualityLabel.${e}`,this.config);return i.length?i:`${e}p`}return qn(e);case"captions":return Z.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=Xs(t).filter(a=>this.config.quality.options.includes(a)));const s=!h.empty(this.options.quality)&&this.options.quality.length>1;if(C.toggleMenuButton.call(this,e,s),Vi(i),C.checkMenu.call(this),!s)return;const r=a=>{const n=ie.get(`qualityBadge.${a}`,this.config);return n.length?C.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=>{C.createMenuItem.call(this,{value:a,list:i,type:e,title:C.getLabel.call(this,"quality",a),badge:r(a)})}),C.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=Z.getTracks.call(this),s=Boolean(i.length);if(C.toggleMenuButton.call(this,t,s),Vi(e),C.checkMenu.call(this),!s)return;const r=i.map((a,n)=>({value:n,checked:this.captions.toggled&&this.currentTrack===n,title:Z.getLabel.call(this,a),badge:a.language&&C.createBadge.call(this,a.language.toUpperCase()),list:e,type:"language"}));r.unshift({value:-1,checked:!this.captions.toggled,title:ie.get("disabled",this.config),list:e,type:"language"}),r.forEach(C.createMenuItem.bind(this)),C.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;C.toggleMenuButton.call(this,t,i),Vi(e),C.checkMenu.call(this),i&&(this.options.speed.forEach(s=>{C.createMenuItem.call(this,{value:s,list:e,type:t,title:C.getLabel.call(this,"speed",s)})}),C.updateSetting.call(this,t,e))},checkMenu(){const{buttons:t}=this.elements.settings,e=!h.empty(t)&&Object.values(t).some(i=>!i.hidden);bt(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"]');qs.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),bt(e,!r),H(this.elements.container,this.config.classNames.menu.open,r),r&&h.keyboardEvent(t)?C.focusFirstMenuItem.call(this,null,!0):r||s||qs.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 Qe(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=C.getMenuSize.call(this,i),n=o=>{o.target===s&&["width","height"].includes(o.propertyName)&&(s.style.width="",s.style.height="",ji.call(this,s,Qs,n))};W.call(this,s,Qs,n),s.style.width=`${a.width}px`,s.style.height=`${a.height}px`}bt(r,!0),bt(i,!1),C.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}=C;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",Re(this.config.selectors.controls.wrapper));this.elements.controls=l;const d={class:"plyr__controls__item"};return Xs(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",Re(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",K({},d,{class:`${d.class} plyr__volume`.trim()})),this.elements.volume=p,l.appendChild(p)),u==="mute"&&p.appendChild(i.call(this,"mute")),u==="volume"&&!ae.isIos){const m={max:1,step:.05,value:this.config.volume};p.appendChild(r.call(this,"volume",K(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",K({},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(x=>{const M=N("button",K(Re(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,M,x),W.call(this,M,"click",()=>{c.call(this,x,!1)});const y=N("span",null,ie.get(x,this.config)),k=N("span",{class:this.config.classNames.menu.value});k.innerHTML=t[x],y.appendChild(k),M.appendChild(y),b.appendChild(M);const D=N("div",{id:`plyr-settings-${t.id}-${x}`,hidden:""}),T=N("button",{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--back`});T.appendChild(N("span",{"aria-hidden":!0},ie.get(x,this.config))),T.appendChild(N("span",{class:this.config.classNames.hidden},ie.get("menuBack",this.config))),W.call(this,D,"keydown",U=>{U.key==="ArrowLeft"&&(U.preventDefault(),U.stopPropagation(),c.call(this,"home",!0))},!1),W.call(this,T,"click",()=>{c.call(this,"home",!1)}),D.appendChild(T),D.appendChild(N("div",{role:"menu"})),g.appendChild(D),this.elements.settings.buttons[x]=M,this.elements.settings.panels[x]=D}),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=K({},d,{element:"a",href:this.download,target:"_blank"});this.isHTML5&&(p.download="");const{download:m}=this.config.urls;!h.url(m)&&this.isEmbed&&K(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,nt.getQualityOptions.call(this)),o.call(this),l},inject(){if(this.config.loadSprite){const r=C.getIconUrl.call(this);r.cors&&Xn(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=C.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:Z.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=ei(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)||C.findElements.call(this),!h.empty(this.elements.buttons)){const r=a=>{const n=this.config.classNames.controlPressed;Object.defineProperty(a,"pressed",{enumerable:!0,get:()=>$i(a,n),set(o=!1){H(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(ae.isEdge&&Rn(s),this.config.tooltips.controls){const{classNames:r,selectors:a}=this.config,n=`${a.controls.wrapper} ${a.labels} .${r.hidden}`,o=At.call(this,n);Array.from(o).forEach(c=>{H(c,this.config.classNames.hidden,!1),H(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=>H(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 eo(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 to(t){const e=new URLSearchParams;return h.object(t)&&Object.entries(t).forEach(([i,s])=>{e.set(i,s)}),e}const Z={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")&&C.setCaptionsMenu.call(this));if(h.element(this.elements.captions)||(this.elements.captions=N("div",Re(this.config.selectors.captions)),_u(this.elements.captions,this.elements.wrapper)),ae.isIE&&window.URL){const s=this.media.querySelectorAll("track");Array.from(s).forEach(r=>{const a=r.getAttribute("src"),n=eo(a);n!==null&&n.hostname!==window.location.href.hostname&&["http:","https:"].includes(n.protocol)&&ii(a,"blob").then(o=>{r.setAttribute("src",window.URL.createObjectURL(o))}).catch(()=>{Qe(r)})})}const t=Xs((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";W.call(this,this.media.textTracks,s,Z.update.bind(this))}setTimeout(Z.update.bind(this),0)},update(){const t=Z.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"),W.call(this,n,"cuechange",()=>Z.updateCues.call(this))}),(a&&this.language!==i||!t.includes(r))&&(Z.setLanguage.call(this,i),Z.toggle.call(this,e&&a)),this.elements&&H(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")&&C.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=Z.getTracks.call(this),n=Z.findTrack.call(this,[this.captions.language,...this.captions.languages],!0);return this.captions.language=n.language,void Z.set.call(this,a.indexOf(n))}this.elements.buttons.captions&&(this.elements.buttons.captions.pressed=r),H(this.elements.container,s,r),this.captions.toggled=r,C.updateSetting.call(this,"captions"),P.call(this,this.media,r?"captionsenabled":"captionsdisabled")}setTimeout(()=>{r&&this.captions.toggled&&(this.captions.currentTrackNode.mode="hidden")})},set(t,e=!0){const i=Z.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,C.updateSetting.call(this,"captions"),e||(this.captions.language=r,this.storage.set({language:r})),this.isVimeo&&this.embed.enableTextTrack(r),P.call(this,this.media,"languagechange")}Z.toggle.call(this,!0,e),this.isHTML5&&this.isVideo&&Z.updateCues.call(this)}else this.debug.warn("Track not found",t);else this.debug.warn("Invalid caption argument",t);else Z.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=Z.getTracks.call(this),r=Z.findTrack.call(this,[i]);Z.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=Z.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 Z.getTracks.call(this)[this.currentTrack]},getLabel(t){let e=t;return!h.track(e)&&q.textTracks&&this.captions.toggled&&(e=Z.getCurrentTrack.call(this)),h.track(e)?h.empty(e.label)?h.empty(e.language)?ie.get("enabled",this.config):t.language.toUpperCase():e.label:ie.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=Z.getCurrentTrack.call(this);e=Array.from((s||{}).activeCues||[]).map(r=>r.getCueAsHTML()).map($u)}const i=e.map(s=>s.trim()).join(`
125
+ `);if(i!==this.elements.captions.innerHTML){Vi(this.elements.captions);const s=N("span",Re(this.config.selectors.caption));s.innerHTML=i,this.elements.captions.appendChild(s),P.call(this,this.media,"cuechange")}}},io={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:[]}},tr={active:"picture-in-picture",inactive:"inline"},ot={html5:"html5",youtube:"youtube",vimeo:"vimeo"},ir={audio:"audio",video:"video"};function Bu(t){return/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(t)?ot.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(t)?ot.vimeo:null}const sr=()=>{};class Ru{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):sr}get warn(){return this.enabled?Function.prototype.bind.call(console.warn,console):sr}get error(){return this.enabled?Function.prototype.bind.call(console.error,console):sr}}class Ue{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;P.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":"",H(this.target,this.player.config.classNames.fullscreen.fallback,i),ae.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(ae.isIos||!this.active||i.key!=="Tab")return;const s=document.activeElement,r=At.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)":Ue.native?"Native":"Fallback",this.player.debug.log(`${i} fullscreen enabled`)}else this.player.debug.log("Fullscreen not supported and fallback disabled");H(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.enabled)}),_(this,"enter",()=>{this.enabled&&(ae.isIos&&this.player.config.fullscreen.iosNative?this.player.isVimeo?this.player.embed.requestFullscreen():this.target.webkitEnterFullscreen():!Ue.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(ae.isIos&&this.player.config.fullscreen.iosNative)this.target.webkitExitFullscreen(),Oe(this.player.play());else if(!Ue.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=Ue.prefix,this.property=Ue.property,this.scrollPosition={x:0,y:0},this.forceFallback=e.config.fullscreen.fallback==="force",this.player.elements.fullscreen=e.config.fullscreen.container&&Au(this.player.elements.container,e.config.fullscreen.container),W.call(this.player,document,this.prefix==="ms"?"MSFullscreenChange":`${this.prefix}fullscreenchange`,()=>{this.onChange()}),W.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")}),W.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 Ue.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(Ue.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(!Ue.native||this.forceFallback)return $i(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 ae.isIos&&this.player.config.fullscreen.iosNative?this.player.media:this.player.elements.fullscreen||this.player.elements.container}}function Oi(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 Q={addStyleHook(){H(this.elements.container,this.config.selectors.container.replace(".",""),!0),H(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 Q.toggleNativeControls.call(this,!0);h.element(this.elements.controls)||(C.inject.call(this),this.listeners.controls()),Q.toggleNativeControls.call(this),this.isHTML5&&Z.setup.call(this),this.volume=null,this.muted=null,this.loop=null,this.quality=null,this.speed=null,C.updateVolume.call(this),C.timeUpdate.call(this),C.durationUpdate.call(this),Q.checkPlaying.call(this),H(this.elements.container,this.config.classNames.pip.supported,q.pip&&this.isHTML5&&this.isVideo),H(this.elements.container,this.config.classNames.airplay.supported,q.airplay&&this.isHTML5),H(this.elements.container,this.config.classNames.isIos,ae.isIos),H(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout(()=>{P.call(this,this.media,"ready")},0),Q.setTitle.call(this),this.poster&&Q.setPoster.call(this,this.poster,!1).catch(()=>{}),this.config.duration&&C.durationUpdate.call(this),this.config.mediaMetadata&&C.setMediaMetadata.call(this)},setTitle(){let t=ie.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=ee.call(this,"iframe");if(!h.element(e))return;const i=h.empty(this.config.title)?"video":this.config.title,s=ie.get("frameTitle",this.config);e.setAttribute("title",s.replace("{title}",i))}},togglePoster(t){H(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"),Nu.call(this).then(()=>Oi(t)).catch(i=>{throw t===this.poster&&Q.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:""}),Q.togglePoster.call(this,!0),t)))},checkPlaying(t){H(this.elements.container,this.config.classNames.playing,this.playing),H(this.elements.container,this.config.classNames.paused,this.paused),H(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",ie.get(this.playing?"pause":"play",this.config))}),h.event(t)&&t.type==="timeupdate"||Q.toggleControls.call(this)},checkLoading(t){this.loading=["stalled","waiting"].includes(t.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout(()=>{H(this.elements.container,this.config.classNames.loading,this.loading),Q.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(B({},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 Ou{constructor(e){_(this,"firstTouch",()=>{const{player:i}=this,{elements:s}=i;i.touch=!0,H(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;H(At.call(s,`.${l}`),l,!1)})(),n!=="focusout"&&(this.focusTimer=setTimeout(()=>{const l=document.activeElement;r.container.contains(l)&&H(document.activeElement,s.config.classNames.tabFocus,!0)},10)))}),_(this,"global",(i=!0)=>{const{player:s}=this;s.config.keyboard.global&&kt.call(s,window,"keydown keyup",this.handleKey,i,!1),kt.call(s,document.body,"click",this.toggleMenu,i),Js.call(s,document.body,"touchstart",this.firstTouch),kt.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&&W.call(i,r.container,"keydown keyup",this.handleKey,!1),W.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)&&(Q.toggleControls.call(i,!0),d=i.touch?3e3:2e3),clearTimeout(a.controls),a.controls=setTimeout(()=>Q.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]=Ks.call(i),p=Zn(`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]=Pu(),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)};W.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"?W:ji).call(i,window,"resize",o)))})}),_(this,"media",()=>{const{player:i}=this,{elements:s}=i;if(W.call(i,i.media,"timeupdate seeking seeked",a=>C.timeUpdate.call(i,a)),W.call(i,i.media,"durationchange loadeddata loadedmetadata",a=>C.durationUpdate.call(i,a)),W.call(i,i.media,"ended",()=>{i.isHTML5&&i.isVideo&&i.config.resetOnEnd&&(i.restart(),i.pause())}),W.call(i,i.media,"progress playing seeking seeked",a=>C.updateProgress.call(i,a)),W.call(i,i.media,"volumechange",a=>C.updateVolume.call(i,a)),W.call(i,i.media,"playing play pause ended emptied timeupdate",a=>Q.checkPlaying.call(i,a)),W.call(i,i.media,"waiting canplay seeked playing",a=>Q.checkLoading.call(i,a)),i.supported.ui&&i.config.clickToPlay&&!i.isAudio){const a=ee.call(i,`.${i.config.classNames.video}`);if(!h.element(a))return;W.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,()=>{Oe(i.play())},"play")):this.proxy(n,()=>{Oe(i.togglePlay())},"play")))})}i.supported.ui&&i.config.disableContextMenu&&W.call(i,s.wrapper,"contextmenu",a=>{a.preventDefault()},!1),W.call(i,i.media,"volumechange",()=>{i.storage.set({volume:i.volume,muted:i.muted})}),W.call(i,i.media,"ratechange",()=>{C.updateSetting.call(i,"speed"),i.storage.set({speed:i.speed})}),W.call(i,i.media,"qualitychange",a=>{C.updateSetting.call(i,"quality",null,a.detail.quality)}),W.call(i,i.media,"ready qualitychange",()=>{C.setDownloadUrl.call(i)});const r=i.config.events.concat(["keyup","keydown"]).join(" ");W.call(i,i.media,r,a=>{let{detail:n={}}=a;a.type==="error"&&(n=i.media.error),P.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);W.call(o,i,s,d=>this.proxy(d,r,a),n&&!l)}),_(this,"controls",()=>{const{player:i}=this,{elements:s}=i,r=ae.isIE?"change":"input";if(s.buttons.play&&Array.from(s.buttons.play).forEach(a=>{this.bind(a,"click",()=>{Oe(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",()=>{P.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(),C.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(),C.toggleMenu.call(i,a)):C.focusFirstMenuItem.call(i,null,!0))},null,!1),this.bind(s.settings.menu,"keydown",a=>{a.key==="Escape"&&C.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),Oe(i.play())):!l&&i.playing&&(n.setAttribute(o,""),i.pause())}),ae.isIos){const a=At.call(i,'input[type="range"]');Array.from(a).forEach(n=>this.bind(n,r,o=>Rn(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=>C.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)}),ae.isWebkit&&Array.from(At.call(i,'input[type="range"]')).forEach(a=>{this.bind(a,"input",n=>C.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,C.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;H(s.controls,a.classNames.noTransition,!0),Q.toggleControls.call(i,!0),setTimeout(()=>{H(s.controls,a.classNames.noTransition,!1)},0);const o=this.touch?3e3:4e3;clearTimeout(n.controls),n.controls=setTimeout(()=>Q.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&&yt(m,g)||e.key==="Space"&&yt(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||Oe(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){C.toggleMenu.call(this.player,e)}}function Uu(t,e){return t(e={exports:{}},e.exports),e.exports}var Hu=Uu(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,x=[],M=p.length,y=M;for(g=function(k,D){D.length&&x.push(k),--y||m(x)};M--;)f=p[M],(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,x,M=document,y=g.async,k=(g.numRetries||0)+1,D=g.before||i,T=p.replace(/[\?|#].*$/,""),U=p.replace(/^(css|img)!/,"");f=f||0,/(^css!|\.css$)/.test(T)?((x=M.createElement("link")).rel="stylesheet",x.href=U,(b="hideFocus"in x)&&x.relList&&(b=0,x.rel="preload",x.as="style")):/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(T)?(x=M.createElement("img")).src=U:((x=M.createElement("script")).src=p,x.async=y===void 0||y),x.onload=x.onerror=x.onbeforeload=function(ne){var J=ne.type[0];if(b)try{x.sheet.cssText.length||(J="e")}catch(Ce){Ce.code!=18&&(J="e")}if(J=="e"){if((f+=1)<k)return l(p,m,g,f)}else if(x.rel=="preload"&&x.as=="style")return x.rel="stylesheet";m(p,J,ne.defaultPrevented)},D(p,x)!==!1&&M.head.appendChild(x)}function d(p,m,g){var f,b,x=(p=p.push?p:[p]).length,M=x,y=[];for(f=function(k,D,T){if(D=="e"&&y.push(k),D=="b"){if(!T)return;y.push(k)}--x||m(y)},b=0;b<M;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 x(M,y){d(p,function(k){c(b,k),M&&c({success:M,error:y},k),o(f,k)},b)}if(b.returnPromise)return new Promise(x);x()}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 rr(t){return new Promise((e,i)=>{Hu(t,{success:e,error:i})})}function Fu(t){return h.empty(t)?null:h.number(Number(t))?t:t.match(/^.*(vimeo.com\/|video\/)(\d+).*/)?RegExp.$2:t}function Wu(t){const e=t.match(/^.*(vimeo.com\/|video\/)(\d+)(\?.*&*h=|\/)+([\d,a-f]+)/);return e&&e.length===5?e[4]:null}function si(t){t&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===t&&(this.media.paused=!t,P.call(this,this.media,t?"play":"pause"))}const ar={setup(){const t=this;H(t.elements.wrapper,t.config.classNames.embed,!0),t.options.speed=t.config.speed.options,Tt.call(t),h.object(window.Vimeo)?ar.ready.call(t):rr(t.config.urls.vimeo.sdk).then(()=>{ar.ready.call(t)}).catch(e=>{t.debug.warn("Vimeo SDK (player.js) failed to load",e)})},ready(){const t=this,e=t.config.vimeo,M=e,{premium:i,referrerPolicy:s}=M,r=mo(M,["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=Wu(a);const o=n?{h:n}:{};i&&Object.assign(r,{controls:!1,sidedock:!1});const c=to(B(B({loop:t.config.loop.active,autoplay:t.autoplay,muted:t.muted,gesture:"media",playsinline:!this.config.fullscreen.iosNative},o),r)),l=Fu(a),d=N("iframe"),u=er(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=Li(d,t.media);else{const y=N("div",{class:t.config.classNames.embedContainer,"data-poster":t.poster});y.appendChild(d),t.media=Li(y,t.media)}e.customControls||ii(er(t.config.urls.vimeo.api,u)).then(y=>{!h.empty(y)&&y.thumbnail_url&&Q.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=()=>(si.call(t,!0),t.embed.play()),t.media.pause=()=>(si.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:D,paused:T,volume:U}=t,ne=T&&!k.hasPlayed;D.seeking=!0,P.call(t,D,"seeking"),Promise.resolve(ne&&k.setVolume(0)).then(()=>k.setCurrentTime(y)).then(()=>ne&&k.pause()).then(()=>ne&&k.setVolume(U)).catch(()=>{})}});let m=t.config.speed.selected;Object.defineProperty(t.media,"playbackRate",{get:()=>m,set(y){t.embed.setPlaybackRate(y).then(()=>{m=y,P.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,P.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,P.call(t,t.media,"volumechange")})}});let b,{loop:x}=t.config;Object.defineProperty(t.media,"loop",{get:()=>x,set(y){const k=h.boolean(y)?y:t.config.loop.active;t.embed.setLoop(k).then(()=>{x=k})}}),t.embed.getVideoUrl().then(y=>{b=y,C.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,D]=y;t.embed.ratio=Gn(k,D),Tt.call(this)}),t.embed.setAutopause(t.config.autopause).then(y=>{t.config.autopause=y}),t.embed.getVideoTitle().then(y=>{t.config.title=y,Q.setTitle.call(this)}),t.embed.getCurrentTime().then(y=>{p=y,P.call(t,t.media,"timeupdate")}),t.embed.getDuration().then(y=>{t.media.duration=y,P.call(t,t.media,"durationchange")}),t.embed.getTextTracks().then(y=>{t.media.textTracks=y,Z.setup.call(t)}),t.embed.on("cuechange",({cues:y=[]})=>{const k=y.map(D=>Lu(D.text));Z.updateCues.call(t,k)}),t.embed.on("loaded",()=>{t.embed.getPaused().then(y=>{si.call(t,!y),y||P.call(t,t.media,"playing")}),h.element(t.embed.element)&&t.supported.ui&&t.embed.element.setAttribute("tabindex",-1)}),t.embed.on("bufferstart",()=>{P.call(t,t.media,"waiting")}),t.embed.on("bufferend",()=>{P.call(t,t.media,"playing")}),t.embed.on("play",()=>{si.call(t,!0),P.call(t,t.media,"playing")}),t.embed.on("pause",()=>{si.call(t,!1)}),t.embed.on("timeupdate",y=>{t.media.seeking=!1,p=y.seconds,P.call(t,t.media,"timeupdate")}),t.embed.on("progress",y=>{t.media.buffered=y.percent,P.call(t,t.media,"progress"),parseInt(y.percent,10)===1&&P.call(t,t.media,"canplaythrough"),t.embed.getDuration().then(k=>{k!==t.media.duration&&(t.media.duration=k,P.call(t,t.media,"durationchange"))})}),t.embed.on("seeked",()=>{t.media.seeking=!1,P.call(t,t.media,"seeked")}),t.embed.on("ended",()=>{t.media.paused=!0,P.call(t,t.media,"ended")}),t.embed.on("error",y=>{t.media.error=y,P.call(t,t.media,"error")}),e.customControls&&setTimeout(()=>Q.build.call(t),0)}};function Zu(t){return h.empty(t)?null:t.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)?RegExp.$2:t}function ri(t){t&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===t&&(this.media.paused=!t,P.call(this,this.media,t?"play":"pause"))}function Yu(t){return t.noCookie?"https://www.youtube-nocookie.com":window.location.protocol==="http:"?"http://www.youtube.com":void 0}const Ui={setup(){if(H(this.elements.wrapper,this.config.classNames.embed,!0),h.object(window.YT)&&h.function(window.YT.Player))Ui.ready.call(this);else{const t=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=()=>{h.function(t)&&t(),Ui.ready.call(this)},rr(this.config.urls.youtube.sdk).catch(e=>{this.debug.warn("YouTube API failed to load",e)})}},getTitle(t){ii(er(this.config.urls.youtube.api,t)).then(e=>{if(h.object(e)){const{title:i,height:s,width:r}=e;this.config.title=i,Q.setTitle.call(this),this.embed.ratio=Gn(r,s)}Tt.call(this)}).catch(()=>{Tt.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=Zu(s),a=N("div",{id:Eu(t.provider),"data-poster":e.customControls?t.poster:void 0});if(t.media=Li(a,t.media),e.customControls){const n=o=>`https://i.ytimg.com/vi/${r}/${o}default.jpg`;Oi(n("maxres"),121).catch(()=>Oi(n("sd"),121)).catch(()=>Oi(n("hq"))).then(o=>Q.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:Yu(e),playerVars:K({},{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},P.call(t,t.media,"error")}},onPlaybackRateChange(n){const o=n.target;t.media.playbackRate=o.getPlaybackRate(),P.call(t,t.media,"ratechange")},onReady(n){if(h.function(t.media.play))return;const o=n.target;Ui.getTitle.call(t,r),t.media.play=()=>{ri.call(t,!0),o.playVideo()},t.media.pause=()=>{ri.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,P.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),P.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),P.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),P.call(t,t.media,"timeupdate"),P.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)&&P.call(t,t.media,"progress"),t.media.lastBuffered=t.media.buffered,t.media.buffered===1&&(clearInterval(t.timers.buffering),P.call(t,t.media,"canplaythrough"))},200),e.customControls&&setTimeout(()=>Q.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,P.call(t,t.media,"seeked")),n.data){case-1:P.call(t,t.media,"timeupdate"),t.media.buffered=o.getVideoLoadedFraction(),P.call(t,t.media,"progress");break;case 0:ri.call(t,!1),t.media.loop?(o.stopVideo(),o.playVideo()):P.call(t,t.media,"ended");break;case 1:e.customControls&&!t.config.autoplay&&t.media.paused&&!t.embed.hasPlayed?t.media.pause():(ri.call(t,!0),P.call(t,t.media,"playing"),t.timers.playing=setInterval(()=>{P.call(t,t.media,"timeupdate")},50),t.media.duration!==o.getDuration()&&(t.media.duration=o.getDuration(),P.call(t,t.media,"durationchange")));break;case 2:t.muted||t.embed.unMute(),ri.call(t,!1);break;case 3:P.call(t,t.media,"waiting")}P.call(t,t.elements.container,"statechange",!1,{code:n.data})}}})}},so={setup(){this.media?(H(this.elements.container,this.config.classNames.type.replace("{0}",this.type),!0),H(this.elements.container,this.config.classNames.provider.replace("{0}",this.provider),!0),this.isEmbed&&H(this.elements.container,this.config.classNames.type.replace("{0}","video"),!0),this.isVideo&&(this.elements.wrapper=N("div",{class:this.config.classNames.video}),Un(this.media,this.elements.wrapper),this.elements.poster=N("div",{class:this.config.classNames.poster}),this.elements.wrapper.appendChild(this.elements.poster)),this.isHTML5?nt.setup.call(this):this.isYouTube?Ui.setup.call(this):this.isVimeo&&ar.setup.call(this)):this.debug.warn("No media element found!")}};class Qu{constructor(e){_(this,"load",()=>{this.enabled&&(h.object(window.google)&&h.object(window.google.ima)?this.ready():rr(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=Ri(Math.max(this.manager.getRemainingTime(),0)),r=`${ie.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=>{P.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,Oe(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/?${to({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 ro(t=0,e=0,i=255){return Math.min(Math.max(t,e),i)}const Gu=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},ao=(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 nr{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=>{ii(i).then(r=>{const a={frames:Gu(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=Ri(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):Js.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=ro(o,a,n);r.style.left=`${c}px`,r.style.setProperty("--preview-arrow-offset",o-c+"px")}),_(this,"setScrubbingContainerSize",()=>{const{width:i,height:s}=ao(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}=ao(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 or={insertElements(t,e){h.string(e)?Hn(t,this.media,{src:e}):h.array(e)&&e.forEach(i=>{Hn(t,this.media,i)})},change(t){On(t,"sources.length")?(nt.cancelRequests.call(this),this.destroy.call(this,()=>{this.options.quality=[],Qe(this.media),this.media=null,h.element(this.elements.container)&&this.elements.container.removeAttribute("class");const{sources:e,type:i}=t,[{provider:s=ot.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","")),Q.addStyleHook.call(this),this.isHTML5&&or.insertElements.call(this,"source",e),this.config.title=t.title,so.setup.call(this),this.isHTML5&&Object.keys(t).includes("tracks")&&or.insertElements.call(this,"track",t.tracks),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&Q.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 nr(this))),this.fullscreen.update()},!0)):this.debug.warn("Invalid source format")}};class ai{constructor(e,i){if(_(this,"play",()=>h.function(this.media.play)?(this.ads&&this.ads.enabled&&this.ads.managerPromise.then(()=>this.ads.play()).catch(()=>Oe(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=$i(this.elements.container,this.config.classNames.hideControls),l=o===void 0?void 0:!o,d=H(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)&&C.toggleMenu.call(this,!1),d!==c){const u=d?"controlshidden":"controlsshown";P.call(this,this.media,u)}return!d}return!1}),_(this,"on",(o,c)=>{W.call(this,this.elements.container,o,c)}),_(this,"once",(o,c)=>{Js.call(this,this.elements.container,o,c)}),_(this,"off",(o,c)=>{ji(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&&(Qe(this.elements.buttons.play),Qe(this.elements.captions),Qe(this.elements.controls),Qe(this.elements.wrapper),this.elements.buttons.play=null,this.elements.captions=null,this.elements.controls=null,this.elements.wrapper=null),h.function(o)&&o()):(Tu.call(this),nt.cancelRequests.call(this),Li(this.elements.original,this.elements.container),P.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?(Q.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=K({},io,ai.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 Ru(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=eo(a.getAttribute("src")),this.provider=Bu(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(ot).includes(this.provider))return void this.debug.error("Setup failed: Invalid provider");this.type=ir.video;break;case"video":case"audio":this.type=r,this.provider=ot.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 Ou(this),this.storage=new ti(this),this.media.plyr=this,h.element(this.elements.container)||(this.elements.container=N("div",{tabindex:0}),Un(this.media,this.elements.container)),Q.migrateStyles.call(this),Q.addStyleHook.call(this),so.setup.call(this),this.config.debug&&W.call(this,this.elements.container,this.config.events.join(" "),o=>{this.debug.log(`event: ${o.type}`)}),this.fullscreen=new Ue(this),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&Q.build.call(this),this.listeners.container(),this.listeners.global(),this.config.ads.enabled&&(this.ads=new Qu(this)),this.isHTML5&&this.config.autoplay&&this.once("canplay",()=>Oe(this.play())),this.lastSeekTime=0,this.config.previewThumbnails.enabled&&(this.previewThumbnails=new nr(this))):this.debug.error("Setup failed: no support")}get isHTML5(){return this.provider===ot.html5}get isEmbed(){return this.isYouTube||this.isVimeo}get isYouTube(){return this.provider===ot.youtube}get isVimeo(){return this.provider===ot.vimeo}get isVideo(){return this.type===ir.video}get isAudio(){return this.type===ir.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=ro(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=Wn(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){or.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,C.setDownloadUrl.call(this))}set poster(e){this.isVideo?Q.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=Bi(Ks.call(this));return h.array(e)?e.join(":"):e}set ratio(e){this.isVideo?h.string(e)&&Qn(e)?(this.config.ratio=Bi(e),Tt.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){Z.toggle.call(this,e,!1)}set currentTrack(e){Z.set.call(this,e,!1),Z.setup.call(this)}get currentTrack(){const{toggled:e,currentTrack:i}=this.captions;return e?i:-1}set language(e){Z.setLanguage.call(this,e,!1)}get language(){return(Z.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?tr.active:tr.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===tr.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 nr(this))}static supported(e,i,s){return q.check(e,i,s)}static loadSprite(e,i){return Xn(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 ai(r,i))}}ai.defaults=Iu(io);function qu(t){let e,i,s;return{c(){e=It("video"),i=It("source"),bn(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){Ct(r,e,a),L(e,i),t[8](e)},p:at,d(r){r&&ft(e),t[8](null)}}}function Ju(t){let e,i,s;return{c(){e=It("audio"),i=It("source"),bn(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){Ct(r,e,a),L(e,i),t[7](e)},p:at,d(r){r&&ft(e),t[7](null)}}}function Xu(t){let e,i,s=JSON.stringify({src:t[3],type:t[0].state.type})+"",r;return{c(){e=It("div"),i=Us(`Invalid "src" or "type".
126
+ `),r=Us(s),I(e,"data-app-kind","Plyr"),I(e,"class","plyr--audio")},m(a,n){Ct(a,e,n),L(e,i),L(e,r)},p(a,n){n&1&&s!==(s=JSON.stringify({src:a[3],type:a[0].state.type})+"")&&Dd(r,s)},d(a){a&&ft(e)}}}function Ku(t){let e;return{c(){e=It("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){Ct(i,e,s),t[6](e)},p:at,d(i){i&&ft(e),t[6](null)}}}function ep(t){let e,i,s,r;function a(c,l){return c[0].state.provider==="youtube"?Ku:c[2]?(e==null&&(e=!!c[2].startsWith("audio/")),e?Ju:qu):Xu}let n=a(t),o=n(t);return s=new eu({}),{c(){o.c(),i=Ed(),Ud(s.$$.fragment)},m(c,l){o.m(c,l),Ct(c,i,l),Mn(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||(xn(s.$$.fragment,c),r=!0)},o(c){Od(s.$$.fragment,c),r=!1},d(c){o.d(c),c&&ft(i),Sn(s,c)}}}function tp(t,e,i){let{storage:s}=e,{sync:r}=e;const a=s.state.provider?void 0:s.state.type||Zd(s.state.src),{src:n,poster:o}=s.state,c=Wd.includes(String(a).toLowerCase());let l,d;Vd(async()=>{if(l){if(c&&qd(l)){const g=await Gd();g.loadSource(n),g.attachMedia(l)}d=new ai(l,{fullscreen:{enabled:!1},controls:["play","progress","current-time","mute","volume"],clickToPlay:!1,youtube:{autoplay:!0},loadSprite:!1}),i(5,r.player=d,r)}}),Ld(()=>{try{r.dispose(),d==null||d.destroy()}catch(g){console.warn("[Plyr] destroy plyr error",g)}});function u(g){Xt[g?"unshift":"push"](()=>{l=g,i(1,l)})}function p(g){Xt[g?"unshift":"push"](()=>{l=g,i(1,l)})}function m(g){Xt[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 ip extends In{constructor(e){super();Cn(this,e,tp,ep,fn,{storage:0,sync:5})}}class sp{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():Yd(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=Xd(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=Jd(this._interval+(e?2e3:-2e3),1e3,15e3),clearTimeout(this._sync_timer),this._sync_timer=setInterval(this.syncAll.bind(this),this._interval)}}var rp=(()=>`@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 ap={volume:1,paused:!0,muted:!1,currentTime:0},Hi={kind:"Plyr",config:{minwidth:300,minheight:80},setup(t){const e=t.storage;if(e.ensureState(ap),!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(rp);const s=new sp(t),r=new ip({target:i.$content,props:{storage:t.storage,sync:s}});t.emitter.on("destroy",()=>{try{s.dispose(),r.$destroy()}catch{}})}},np=()=>{pe.register({kind:ki.kind,src:ki}),pe.register({kind:Hi.kind,src:Hi})},lr={DocsViewer:ki.kind,MediaPlayer:Hi.kind},op={[lr.DocsViewer]:ki,[lr.MediaPlayer]:Hi};var Ap="",kp="";const no=new jc({emitter:z}),j=class extends S.InvisiblePlugin{constructor(t){super(t);this.version="1.0.0-canary.36",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=G,this.viewMode=S.ViewMode.Broadcaster,this.viewMode$=new v.Val(S.ViewMode.Broadcaster),this.isReplay=S.isPlayer(this.displayer),this.containerSizeRatio=j.containerSizeRatio,j.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;j.container=t.container;const i=t.debug,s=t.cursor;j.params=t,j.displayer=t.room,qo();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(j.isCreated)throw new Error("[WindowManager]: Already created cannot be created again");if(this.debug=Boolean(i),Xe("Already insert room",r),S.isRoom(this.displayer)){if(!r)throw new Error("[WindowManager]: init InvisiblePlugin failed")}else await bo.default(async n=>{if(r=await e.getInvisiblePlugin(j.kind),!r)throw Xe(`manager is empty. retrying ${n}`),new Error},{retries:10});if(!r)throw new Error("[WindowManager]: create manager failed");t.containerSizeRatio&&(j.containerSizeRatio=t.containerSizeRatio),r.containerSizeRatio=j.containerSizeRatio,await r.ensureAttributes(),r.appManager=new al(r),r._pageState=new $c(r.appManager),r.cursorManager=new Lc(r.appManager,Boolean(s),t.applianceIcons),r.boxManager=hc(r,G,z,He,{collectorContainer:t.collectorContainer,collectorStyles:t.collectorStyles,prefersColorScheme:t.prefersColorScheme,stageRatio:j.containerSizeRatio,containerStyle:t.containerStyle,stageStyle:t.stageStyle,fullscreen:t.fullscreen}),(a=r.appManager)==null||a.setBoxManager(r.boxManager),t.container&&r.bindContainer(t.container),Bc(e,r),z.emit("onCreated"),j.isCreated=!0;try{await So()}catch(n){console.warn("[WindowManager]: indexedDB open failed"),console.log(n)}return r}static async initManager(t){let e=t.getInvisiblePlugin(j.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 Rr(t),e==null||e.ensureAttributes(),await li(500),await t.setWritable(!1)}else e=await Rr(t);return e}static initContainer(t,e,i){j.container||(j.container=t);const{playground:s,mainViewElement:r}=Go(t,e);if(j.playground=s,i){const a=document.createElement("style");a.textContent=i,s.appendChild(a)}return r}static get registered(){return ge.registered}bindContainer(t){var e,i,s,r,a,n;if(S.isRoom(this.displayer)&&this.room.phase!==S.RoomPhase.Connected)throw new zr;if(j.isCreated&&j.container)j.container.firstChild&&t.appendChild(j.container.firstChild);else{const o=(e=this.boxManager)==null?void 0:e.teleBoxManager.$stage;if(j.params&&o){const c=j.params,l=j.initContainer(t,o,c.overwriteStyles);this.boxManager&&j.playground&&this.boxManager.setRoot(j.playground),this.bindMainView(l,c.disableCameraTransform),j.playground&&((i=this.cursorManager)==null||i.setupWrapper(j.playground))}}z.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),j.container=t}bindCollectorContainer(t){j.isCreated&&this.boxManager?this.boxManager.setCollector(t):j.params&&(j.params.collectorContainer=t)}static register(t){return ge.register(t)}static unregister(t){return ge.unregister(t)}async addApp(t){if(this.appManager)return this.appManager.rootDirRemoving?new Promise((e,i)=>{z.once("rootDirRemoved").then(async()=>{try{const s=await this._addApp(t);e(s)}catch(s){i(s.message)}})}):this._addApp(t);throw new me}async _addApp(t){var e,i,s;if(this.appManager){if(!t.kind||typeof t.kind!="string")throw new Tr;const r=await((e=ge.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 Ar;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=Ro(t.options.scenePath)),await this.appManager.addApp(t,Boolean(a)))}else throw new me}setupScenePath(t,e){let i=!1;if(t.options){const{scenePath:s,scenes:r}=t.options;if(s){if(!Bo(s))throw new Pr;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,dt(this.displayer)[s]||vt(this.room,s,r)):dt(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),z.emit("setReadonly",t)}switchMainViewToWriter(){var t;return(t=this.appManager)==null?void 0:t.mainViewProxy.mainViewClickHandler()}onAppDestroy(t,e){$o(`destroy-${t}`,e)}setViewMode(t){var i;Xe("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 me}get camera(){if(this.appManager)return this.appManager.mainViewProxy.view.camera;throw new me}get baseCamera(){if(this.appManager)return this.appManager.mainViewProxy.camera$.value;throw new me}get baseSize(){if(this.appManager)return this.appManager.mainViewProxy.size$.value;throw new me}get cameraState(){if(this.appManager)return this.appManager.mainViewProxy.cameraState;throw new me}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 me}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 me}get fullscreen(){var t;if(this.appManager)return(t=this.appManager.boxManager)==null?void 0:t.teleBoxManager.fullscreen;throw new me}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 me}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 me}get pageState(){if(this._pageState)return this._pageState.toObject();throw new me}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=B({},this.mainView.camera),i=B(B({},e),t);if(!w.isEqual(i,e)&&!!this.appManager)if(t.animationMode===S.AnimationMode.Immediately)this.appManager.mainViewProxy.storeCamera(B({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*ci(r,a)),n?this.mainView.moveCamera(he(B({},t),{scale:n})):this.mainView.moveCamera(t),this.appManager.dispatchInternalEvent(Y.MoveCamera,t),setTimeout(()=>{!this.appManager||this.appManager.mainViewProxy.storeCamera(B({id:this.appManager.uid},i))},200)}}moveCameraToContain(t){if(!this.appManager)return;const e={};w.isNumber(t.originX)&&(e.centerX=t.originX),w.isNumber(t.originY)&&(e.centerY=t.originY),t.animationMode===S.AnimationMode.Immediately?(this.appManager.mainViewProxy.storeSize({id:this.appManager.uid,width:t.width,height:t.height}),this.mainView.moveCameraToContain(t),!w.isEmpty(e)&&this.appManager.mainViewProxy.camera$.value&&this.appManager.mainViewProxy.storeCamera(he(B({},this.appManager.mainViewProxy.camera$.value),{id:this.appManager.uid,centerX:this.mainView.camera.centerX,centerY:this.mainView.camera.centerY}))):(this.appManager.dispatchInternalEvent(Y.MoveCameraToContain,t),this.mainView.moveCameraToContain(t),setTimeout(()=>{!this.appManager||(this.appManager.mainViewProxy.storeSize({id:this.appManager.uid,width:t.width,height:t.height}),!w.isEmpty(e)&&this.appManager.mainViewProxy.camera$.value&&this.appManager.mainViewProxy.storeCamera(he(B({},this.appManager.mainViewProxy.camera$.value),{id:this.appManager.uid,centerX:this.mainView.camera.centerX,centerY:this.mainView.camera.centerY})))},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(),j.container=void 0,j.isCreated=!1,j.playground&&((i=j.playground.parentNode)==null||i.removeChild(j.playground)),j.params=void 0,Xe("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(),j.container&&this.bindContainer(j.container),(e=this.appManager)==null||e.refresher.refresh()}setContainerSizeRatio(t){if(!w.isNumber(t))throw new Error(`[WindowManager]: updateContainerSizeRatio error, ratio must be a number. but got ${t}`);j.containerSizeRatio=t,this.containerSizeRatio=t,z.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(){w.isNull(this.attributes)&&await li(50),w.isObject(this.attributes)&&(this.attributes[te.Apps]||this.safeSetAttributes({[te.Apps]:{}}),this.attributes[te.Cursors]||this.safeSetAttributes({[te.Cursors]:{}}),this.attributes._mainScenePath||this.safeSetAttributes({_mainScenePath:vr}),this.attributes._mainSceneIndex||this.safeSetAttributes({_mainSceneIndex:0}),this.attributes[te.Registered]||this.safeSetAttributes({[te.Registered]:{}}))}};let pe=j;pe.kind="WindowManager",pe.debug=!1,pe.containerSizeRatio=vo,pe.isCreated=!1,np(),E.AppCreateError=Ar,E.AppManagerNotInitError=me,E.AppNotRegisterError=Fo,E.BindContainerRoomPhaseInvalidError=zr,E.BoxManagerNotFoundError=Er,E.BoxNotCreatedError=Nr,E.BuiltinApps=lr,E.BuiltinAppsMap=op,E.InvalidScenePath=Pr,E.ParamsInvalidError=Tr,E.WhiteWebSDKInvalidError=kr,E.WindowManager=pe,E.calculateNextIndex=Ki,E.reconnectRefresher=no,Object.defineProperties(E,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});