@netless/app-slide 0.2.100 → 0.2.101

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/main.cjs.js CHANGED
@@ -8002,7 +8002,7 @@ self.onmessage = function(e) {
8002
8002
  key, outputData, maxDis
8003
8003
  });
8004
8004
  };
8005
- `],{type:"text/javascript"});this.worker=new Worker(URL.createObjectURL(n)),this.worker.onmessage=r=>{this.outputData.set(r.data.key,{data:r.data.outputData,maxDis:r.data.maxDis})},this.outputData.set("111","222")}createSdfByWorker(t,e,n,r,o,s,a,l){const h=document.createElement("canvas");h.width=o,h.height=s;const u=h.getContext("2d");if(!u||!this.worker)return;u.drawImage(a,t,e,n,r);const{data:p}=u.getImageData(0,0,o,s);this.worker.postMessage({data:p,key:l,width:o,height:s})}createSdf(t,e,n){const r=document.createElement("canvas");r.width=t,r.height=e;const o=r.getContext("2d");if(!o)return{src:"",maxDis:1};o.drawImage(n,0,0);let s=0;const{data:a}=o.getImageData(0,0,t,e),l=[],h=[],u=function(J,it,ft){l[it*t+J]=ft},p=function(J,it){return l[it*t+J]},y=function(J,it,ft){h[it*t+J]=ft},b=function(J,it){return h[it*t+J]},w=function(J,it){return J>=0&&J<t&&it>=0&&it<e},M=function(J,it){return a[4*(it*t+J)+3]>10};for(let J=0;J<e;++J)for(let it=0;it<t;++it){const ft=M(it,J),et=!!w(it,J-1)&&M(it,J-1),gt=!!w(it,J+1)&&M(it,J+1),lt=!!w(it-1,J)&&M(it-1,J),mt=!!w(it+1,J)&&M(it+1,J);ft!==et||ft!==gt||ft!==lt||ft!==mt?(u(it,J,0),y(it,J,[it,J])):(u(it,J,Number.MAX_SAFE_INTEGER),y(it,J,[-1,-1]))}const I=function(J,it,ft){const et=Math.sqrt(2);let gt,lt,mt;switch(ft){case"TL":gt=-1,lt=-1,mt=et;break;case"T":gt=0,lt=-1,mt=1;break;case"TR":gt=1,lt=-1,mt=et;break;case"L":gt=-1,lt=0,mt=1;break;case"R":gt=1,lt=0,mt=1;break;case"BL":gt=-1,lt=1,mt=et;break;case"B":gt=0,lt=1,mt=1;break;case"BR":gt=1,lt=1,mt=et}const Ut=w(J+gt,it+lt);if((Ut?p(J+gt,it+lt):Number.MAX_SAFE_INTEGER)+mt<p(J,it)){const Ft=Ut?b(J+gt,it+lt):[-1,-1],Mt=Math.sqrt(Math.pow(J-Ft[0],2)+Math.pow(it-Ft[1],2));y(J,it,Ft),u(J,it,Mt),Mt>s&&(s=Mt)}};for(let J=0;J<e;++J)for(let it=0;it<t;++it){const ft=["TL","T","TR","L"];for(const et of ft)I(it,J,et)}for(let J=e-1;J>=0;--J)for(let it=t-1;it>=0;--it){const ft=["R","BL","B","BR"];for(const et of ft)I(it,J,et)}const H=[];for(let J=0;J<e;++J)for(let it=0;it<t;++it)H.push(0,0,0,Math.ceil(p(it,J)/s*255));return o.putImageData(new ImageData(Uint8ClampedArray.from(H),t,e),0,0),{src:r.toDataURL("image/png"),maxDis:s}}getSdf(t,e,n){return VS(this,void 0,void 0,function*(){const r=Math.ceil(e.width),o=Math.ceil(e.height),s=Math.ceil(e.width-t.width)/2,a=Math.ceil(e.height-t.height)/2;let l=yield this.localStorage.getItem(`sdf-${n}-src`),h=yield this.localStorage.getItem(`sdf-${n}-maxDis`);if(!(l&&h||this.loadingSdfKeys.has(n))){this.loadingSdfKeys.add(n);const u=this.renderer.plugins.extract.image(t,"image/png");u.addEventListener("load",()=>{this.createSdfByWorker(s,a,t.width,t.height,r,o,u,n)}),u.addEventListener("error",()=>null),yield sh(()=>!!this.outputData.has(n),5e3),this.loadingSdfKeys.delete(n);const p=this.outputData.get(n);if(p){this.outputData.delete(n);const y=document.createElement("canvas");y.width=r,y.height=o;const b=y.getContext("2d");if(!b)return null;b.putImageData(new ImageData(Uint8ClampedArray.from(p.data),r,o),0,0),l=y.toDataURL("image/png"),h=p.maxDis,this.localStorage.setItem(`sdf-${n}-src`,l).catch(()=>{}),this.localStorage.setItem(`sdf-${n}-maxDis`,h).catch(()=>{})}}return!l||!h?null:(document.createElement("img").src=l,le.t.fromURL(l).then(u=>({texture:u,maxDis:h})).catch(()=>null))})}destroy(){var t;(t=this.worker)===null||t===void 0||t.terminate(),this.worker=null}}var ia=function(i,t,e,n){return new(e||(e=Promise))(function(r,o){function s(h){try{l(n.next(h))}catch(u){o(u)}}function a(h){try{l(n.throw(h))}catch(u){o(u)}}function l(h){var u;h.done?r(h.value):(u=h.value,u instanceof e?u:new e(function(p){p(u)})).then(s,a)}l((n=n.apply(i,t||[])).next())})};class XS{constructor(t,e,n,r,o,s,a,l,h,u,p,y,b,w,M,I,H,J,it){this.loader=t,this.mode=e,this.renderer=n,this.ticker=r,this.view=o,this.clock=s,this.objPoolGroup=a,this.errorChannel=l,this.localstorage=h,this.logger=u,this.loaderDelegate=p,this.urlInterrupter=y,this.isPlayerPaused=b,this.maxResolution=w,this.volumeAdjuster=M,this.forceCanvas=I,this.globalEventHub=H,this.enableWebAudio=J,this.customLinks=it,this.currentStageIndex=0,this.cacheCount=ms.isDesktop()?2:1,this.stageStates=Object.create(null),this.stageJsons=Object.create(null),this.stageCtxs=Object.create(null),this.stageImpls=Object.create(null),this.taskId="",this.url="",this.runningAudio=new Map,this.activeMedia=new Set,this.microTaskManager=new GS(r),this.sdfManager=new WS(n,h)}setResourceData(t,e){this.taskId=t,this.url=e}createCtx(t){const{task:e}=this.stageStates[t];e.addMTask(()=>ia(this,void 0,void 0,function*(){const n=new Ob(this.loader),r=new gi.a,o={taskId:this.taskId,prefix:this.url,mode:this.mode,renderer:this.renderer,graphicsTexture:new Bb(this.maxResolution),stageWidth:0,stageHeight:0,ticker:this.ticker,timingTargets:new Ub(r),eventHub:r,view:this.view,medias:Object.create(null),lastViewedIndex:0,conflictTimeNodeManager:new kb,clock:this.clock,spriteTexture:n,slideIndex:t,objectPoolGroup:this.objPoolGroup,hasBackgroundFillShape:!1,slideScopeEventHub:new gi.a,logger:this.logger,sdfManager:this.sdfManager,loaderDelegate:this.loaderDelegate,runningAudio:this.runningAudio,activeMedia:this.activeMedia,isPlayerPaused:this.isPlayerPaused,timingEventHub:new gi.a,maxResolution:this.maxResolution,animatedIds:new Set,volumeAdjuster:this.volumeAdjuster,forceCanvas:this.forceCanvas,globalEventHub:this.globalEventHub,latestChangeFullscreenTargetId:"",isRendering:!1,urlInterrupter:this.urlInterrupter,enableWebAudio:this.enableWebAudio};this.stageCtxs[t]=o}),"@StagePool[createCtx]")}loadStageJson(t){const{task:e}=this.stageStates[t];e.addMTask(n=>ia(this,void 0,void 0,function*(){var r;const o=yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/slide-${t}.json`,n);if(((r=this.stageStates[t])===null||r===void 0?void 0:r.task)!==e)throw new Ha(t);this.stageJsons[t]=o,this.stageCtxs[t].stageWidth=o.width,this.stageCtxs[t].stageHeight=o.height,this.stageCtxs[t].featureList=o.featureList}),"@StagePool[loadStageJson]")}loadSpriteSheets(t){const{task:e}=this.stageStates[t];e.addMTask(()=>{const n=this.stageJsons[t],{coloredSheets:r,sheets:o}=n,s=r||o;return s&&s.forEach(a=>{this.addSpriteSheetLoadTask(e,t,a)}),Promise.resolve()},"@StagePool[loadSpriteSheets]")}addSpriteSheetLoadTask(t,e,n){t.addSubMTask(r=>{const{spriteTexture:o}=this.stageCtxs[e],s=this.getSpriteSheetTextureScale(e);return o.loadSpriteSheetItem(this.url,this.taskId,n,s,r)},this.getSpriteSheetTaskName(n),{timeoutMs:this.getSpriteSheetTaskTimeoutMs()})}getSpriteSheetTextureScale(t){const{stageWidth:e,stageHeight:n}=this.stageCtxs[t];return this.getTextureScale(e,n)}getTextureScale(t,e){let n=1;if(t>this.maxResolution.x||e>this.maxResolution.y){n=this.maxResolution.x/t;const r=n*e;r>this.maxResolution.y&&(n*=this.maxResolution.y/r)}return Math.min(1,n)}getSpriteSheetTaskName(t){return`@StagePool[spriteTexture.loadSpriteSheetItem:${t}]`}getSpriteSheetTaskTimeoutMs(){const t=this.loader.estimateMaxResourceLoadDurationMs()+this.loader.estimateMaxImageLoadDurationMs()+1e4;return Math.max(6e4,t)}getStageTaskTimeoutMs(){const t=this.loader.estimateMaxImageLoadDurationMs()+1e4;return Math.max(6e4,t)}insertCustomLinksFromScope(t,e){t&&t.length&&t.forEach(n=>{n&&(n.type==="Shape"||n.type==="Picture"?n.id===e.shapeId&&(n.hlinkClick&&this.logger.warn(`Custom link ${e.shapeId} already has action, will force rewrite`,this.taskId),n.hlinkClick={uuid:`customLink-${e.pageIndex}-${e.shapeId}`,action:"",target:e.link}):n.children&&this.insertCustomLinksFromScope(n.children,e))})}insertCustomLinks(t,e){return e&&e.length&&e.forEach(n=>{let r;r=n.shapeId.startsWith("master")?t.children[1]:n.shapeId.startsWith("layout")?t.children[2]:t.children[3],r?this.insertCustomLinksFromScope(r.children,n):this.logger.error("Cannot find scope for custom link "+n.shapeId,this.taskId)}),t}createStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>{var n;let r=this.stageJsons[t];const o=this.stageCtxs[t],s=(n=this.customLinks)===null||n===void 0?void 0:n.filter(l=>l.pageIndex===t);r=this.insertCustomLinks(r,s);const a=new US(r,o,{x:0,y:0},e);return this.stageImpls[t]=a,Promise.resolve()},"@StagePool[createStage]")}preRenderStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>(this.stageImpls[t].preRender(e),Promise.resolve()),"@StagePool[preRenderStage]")}createGraphicsTexture(t){const{task:e}=this.stageStates[t];e.addMTask(()=>ia(this,void 0,void 0,function*(){const n=this.stageCtxs[t];n.graphicsTexture.pack().forEach((r,o)=>{e.addSubMTask(s=>n.graphicsTexture.render(r,o,this.objPoolGroup,1,s),"@StagePool[graphicsTexture.render]")})}),"@StagePool[createGraphicsTexture]")}renderStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>ia(this,void 0,void 0,function*(){yield this.stageImpls[t].render(e)}),"@StagePool[renderStage]")}destroyStageByIndex(t){this.detachAndDisposeStage(t)}destroyStage(){this.getTrackedStageIndexes().forEach(t=>{Math.abs(this.currentStageIndex-t)>this.cacheCount&&this.destroyStageByIndex(t)})}destroyAllStage(){this.getTrackedStageIndexes().forEach(t=>{this.destroyStageByIndex(t)})}preloadResource(t){return ia(this,void 0,void 0,function*(){const e=yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/slide-${t}.json`),{coloredSheets:n,sheets:r}=e,o=n||r;for(const s of o){yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/${s}.json`);const a=this.getTextureScale(e.width,e.height);yield this.loader.fetchPng(`${this.url}/${this.taskId}/jsonOutput/${s}.png`,a)}})}preload(t,e=!1){const n=this.stageStates[t];if(n)return n.preloadPromise;if(this.stageImpls[t])return Promise.resolve();let r,o;const s=new Promise((l,h)=>{r=l,o=h});let a;try{a=new zS(t,this.taskId,this.logger,this.getStageTaskTimeoutMs())}catch(l){return o(l),s}a.on("task-error",(l,h)=>{o(l),this.detachAndDisposeStage(h,a),this.errorChannel.emit("error",l,h)}),a.once("task-cancel",l=>o(l)),a.once("task-finish",()=>{const l=this.stageStates[t];(l==null?void 0:l.task)===a&&(l.state="finish",Object.keys(this.stageStates).length>2*this.cacheCount+1&&this.destroyStage(),r())});try{this.stageStates[t]={state:"load",task:a,preloadPromise:s},this.createCtx(t),this.loadStageJson(t),this.loadSpriteSheets(t),this.createStage(t),this.preRenderStage(t),this.createGraphicsTexture(t),this.renderStage(t),this.microTaskManager.addTask(a),e&&a.applyAll().catch(l=>{o(l)})}catch(l){o(l),this.detachAndDisposeStage(t,a)}return s}getTrackedStageIndexes(){const t=new Set([...Object.keys(this.stageStates),...Object.keys(this.stageJsons),...Object.keys(this.stageImpls),...Object.keys(this.stageCtxs)]);return Array.from(t).map(e=>parseInt(e,10))}detachAndDisposeStage(t,e){const n=this.stageStates[t];if(e&&(n==null?void 0:n.task)!==e)return;const r=this.stageImpls[t],o=this.stageCtxs[t];delete this.stageStates[t],delete this.stageJsons[t],delete this.stageImpls[t],delete this.stageCtxs[t],(n==null?void 0:n.state)==="load"?(n.task.cancel(),this.disposeDetachedStage(t,r,o),n.task.whenIdle(1e4).then(s=>{s||this.logger.warn(`stage ${t} tasks did not stop within 10000ms after cleanup`,this.taskId)}).catch(s=>{this.logger.warn(`wait for stage ${t} tasks to stop error: ${s}`,this.taskId)})):this.disposeDetachedStage(t,r,o)}disposeDetachedStage(t,e,n){var r;try{n==null||n.slideScopeEventHub.removeAllListeners(),e?e.destroy():(n==null||n.eventHub.removeAllListeners(),n==null||n.timingEventHub.removeAllListeners(),n==null||n.graphicsTexture.destroy(),(r=n==null?void 0:n.bgTexture)===null||r===void 0||r.destroy(!0),n==null||n.spriteTexture.destroy())}catch(o){this.logger.warn(`cleanup failed stage ${t} error: ${o}`,this.taskId)}}getStageJson(t){return this.stageJsons[t]||null}getStage(t){return ia(this,void 0,void 0,function*(){this.currentStageIndex=t;const e=this.stageStates[t];return(e==null?void 0:e.state)==="finish"&&this.stageImpls[t]?this.stageImpls[t]:(e==null?void 0:e.state)==="load"?(yield e.task.applyAll(),this.stageImpls[t]):(yield this.preload(t,!0),this.stageImpls[t])})}destroy(){this.microTaskManager.destroy(),this.runningAudio.clear(),this.sdfManager.destroy()}}const YS=new class extends o0{createObject(){return document.createElement("img")}resetObject(i){i.removeAttribute("src")}};var k0=function(i,t,e,n){return new(e||(e=Promise))(function(r,o){function s(h){try{l(n.next(h))}catch(u){o(u)}}function a(h){try{l(n.throw(h))}catch(u){o(u)}}function l(h){var u;h.done?r(h.value):(u=h.value,u instanceof e?u:new e(function(p){p(u)})).then(s,a)}l((n=n.apply(i,t||[])).next())})};class Lr{constructor(t){var e;this.logger=t,this.taskId="",this.isIndexDBReady=!1,this.memoryCache=new Map,(e=Lr.localCache)===null||e===void 0||e.ready(n=>{n||(this.isIndexDBReady=!0)}).catch(()=>{t.warn("local storage not ready",this.taskId)})}get couldUseIndexDBCache(){return this.isIndexDBReady&&this.taskId.length>0}attachTaskId(t){this.taskId=t}getItem(t){return k0(this,void 0,void 0,function*(){let e=null;if(this.couldUseIndexDBCache&&Lr.localCache)try{e=yield Ga(()=>Lr.localCache.getItem(`${this.taskId}/${t}`),500)}catch{}return e=e===zo?null:e,e||this.memoryCache.get(t)||null})}setItem(t,e,n=!1){return k0(this,void 0,void 0,function*(){if(!this.couldUseIndexDBCache)return n&&this.memoryCache.set(t,e),Promise.resolve();if(Lr.localCache){let r=null;try{r=yield Ga(()=>Lr.localCache.setItem(`${this.taskId}/${t}`,e).catch(()=>{n&&this.memoryCache.set(t,e)}),500)}catch{}r!==zo&&r!==null||!n||this.memoryCache.set(t,e)}})}dispose(){var t;this.memoryCache=new Map,this.couldUseIndexDBCache&&((t=Lr.localCache)===null||t===void 0||t.keys().then(e=>{e.filter(n=>n.indexOf(this.taskId)>=0).forEach(n=>{var r;(r=Lr.localCache)===null||r===void 0||r.removeItem(n).catch(()=>{})})}).catch(()=>{}))}}Lr.localCache=null;try{Lr.localCache=P.createInstance({name:"slide_local_cache",driver:P.INDEXEDDB,version:1})}catch{}const qS=new Ie.j;class wc{constructor(t){this.localStorage=t}canvas(t,e,n,r){let o,s,a,l=!1,h=!1;t&&(t instanceof le.p?a=t:(a=e.generateTexture(t),h=!0)),a?(o=a.baseTexture.resolution,s=a.frame,l=!1):(o=e.resolution,l=!0,s=qS,s.width=e.width,s.height=e.height,e.renderTexture.bind(null));const u=Math.floor(s.width*o+1e-4),p=Math.floor(s.height*o+1e-4);let y=document.createElement("canvas");y.width=u,y.height=p;const b=y.getContext("2d");if(!b)throw new Error("ctx");if(n)b.putImageData(n,0,0);else{const w=b.getImageData(0,0,u,p),M=new Uint8Array(4*u*p),{gl:I}=e;I.readPixels(s.x*o,s.y*o,u,p,I.RGBA,I.UNSIGNED_BYTE,M),wc.arrayPostDivide(M,w.data),b.putImageData(w,0,0),r&&this.localStorage.setItem(r,w).catch(()=>{})}if(l){const w=document.createElement("canvas");w.width=u,w.height=p;const M=w.getContext("2d");M.scale(1,-1),M.drawImage(y,0,-p),y=w}return h&&(a==null||a.destroy(!0)),y}static arrayPostDivide(t,e){for(let n=0;n<t.length;n+=4){const r=e[n+3]=t[n+3];r!==0?(e[n]=Math.round(Math.min(255*t[n]/r,255)),e[n+1]=Math.round(Math.min(255*t[n+1]/r,255)),e[n+2]=Math.round(Math.min(255*t[n+2]/r,255))):(e[n]=t[n],e[n+1]=t[n+1],e[n+2]=t[n+2])}}}class U0 extends gi.a{constructor(){super(...arguments),this._volume=.5}get volume(){return this._volume}set volume(t){t<0&&(t=0),t>1&&(t=1),this._volume=t,this.emit("update",this._volume)}}var gs=function(i,t,e,n){return new(e||(e=Promise))(function(r,o){function s(h){try{l(n.next(h))}catch(u){o(u)}}function a(h){try{l(n.throw(h))}catch(u){o(u)}}function l(h){var u;h.done?r(h.value):(u=h.value,u instanceof e?u:new e(function(p){p(u)})).then(s,a)}l((n=n.apply(i,t||[])).next())})};xn.skipHello();const G0={randomBar:"RandomLines",circle:"Shape",ripple:"Ripples",wipe:"Erase",dissolve:"Dissolve",morph:"Smooth",fade:"FadeInOut",push:"Push",split:"Separation",reveal:"Display",pull:"Uncover",cover:"Cover",flash:"Flash",checker:"Checkerboard",blinds:"WindowShades",curtains:"Curtain",fallOver:"Fall",drape:"Suspension",wheel:"Clock",comb:"Combing",warp:"Scale",peelOff:"PeelOff",flip:"Flip",gallery:"Gallery",switch:"Switch",prism:"Prism",doors:"Doors"},ze={mainSeqStepChange:"mainSeqStepChange",mainSeqStateChange:"mainSeqStateChange",interactiveSeqStateChange:"interactiveSeqStateChange",interactiveSeqAction:"interactiveSeqAction",mainSeqStepStart:"mainSeqStepStart",mainSeqStepEnd:"mainSeqStepEnd",slideChange:"slideChange",renderStart:"renderStart",renderEnd:"renderEnd",hyperlinkTrigger:"hyperlinkTrigger",animateStart:"animateStart",animateEnd:"animateEnd",mediaSeek:"mediaSeek",mediaPlay:"mediaPlay",mediaPause:"mediaPause",mediaStop:"mediaStop",requestNextStep:"requestNextStep",requestNextSlide:"requestNextSlide",requestPrevSlide:"requestPrevSlide",requestGotoSlide:"requestGotoSlide",requestOpenUrl:"requestOpenUrl",userInput:"userInput",fullscreenChange:"fullscreenChange",changeLocalFullscreenState:"changeLocalFullscreenState",useraddLink:"useraddLink"};class ur extends gi.a{constructor(t,e={}){super(),this.errorChannel=new gi.a,this.transactionPlayer=null,this.isForward=!0,this.drawCall=0,this.scale=1,this._isPaused=!1,this.maxResolution=new Ie.g(0,0),this.transitionResolution=new Ie.g(0,0),this.isNVIDIA=!1,this.fps=new Eb,this.designWidth=0,this.designHeight=0,this.currentIndex=0,this.slideCount=0,this.runtime={drawCall:0,fps:0},this.globalEventHub=new gi.a,this.globalVideoBackground=new Zi,this.globalVideoSprite=new pi,this.onMousemoveTimeout=null,this.cacheFunctionMap=new Map,this.enableAutoForward=!1,this.isPlayerPaused=()=>this._isPaused,this.onWebGLLost=()=>{this.errorChannel.emit("error",new Hn(Yn.CanvasCrash,"webgl context lost."))},this.fullscreenOnMousemove=({index:o,targetId:s})=>{this.globalEventHub.emit("controllerShowStatusChange",{slideIndex:o,targetId:s,status:!0}),this.onMousemoveTimeout&&clearTimeout(this.onMousemoveTimeout),this.onMousemoveTimeout=setTimeout(()=>{this.globalEventHub.emit("controllerShowStatusChange",{slideIndex:o,targetId:s,status:!1})},Wo.hoverHiddeDelay)},this.fullscreenOnMouseleave=({index:o,targetId:s})=>{this.globalEventHub.emit("controllerShowStatusChange",{slideIndex:o,targetId:s,status:!1})},this.calculateFullscreenVideoPosition=o=>{const{width:s,height:a}=o,{designWidth:l,designHeight:h}=this,u=Math.min(l/s,h/a);return{x:(l-s*u)/2,y:(h-a*u)/2,width:s*u,height:a*u}},this.onRequestFullscreenVideo=o=>{const{texture:s,index:a,targetId:l}=o;if(a!==this.currentIndex)return void s.destroy(!1);this.onRequestCancelFullscreenVideo(),this.globalVideoBackground.width=this.designWidth,this.globalVideoBackground.height=this.designHeight,this.globalVideoBackground.beginFill(0,1),this.globalVideoBackground.drawRect(0,0,this.designWidth,this.designHeight),this.globalVideoBackground.endFill(),this.globalVideoBackground.interactive=!0,this.app.stage.addChild(this.globalVideoBackground);const{x:h,y:u,width:p,height:y}=this.calculateFullscreenVideoPosition(s);this.globalVideoSprite.texture=s,this.globalVideoSprite.width=p,this.globalVideoSprite.height=y,this.globalVideoSprite.position.x=h,this.globalVideoSprite.position.y=u,this.globalVideoBackground.addChild(this.globalVideoSprite),this.globalEventHub.emit("onFullscreenChange",{status:!0,targetId:l,slideIndex:this.currentIndex}),this.clearFullscreenEventListenersWithAppView();const b={handleEvent:()=>{var w;(w=this.currentStage)===null||w===void 0||w.ctx.eventHub.emit(ze.userInput)}};if(this.app.view.addEventListener("pointerdown",b,!1),this.cacheFunctionMap.set("pointerdown",b),ms.isDesktop()){const w={handleEvent:()=>{this.fullscreenOnMouseleave({index:a,targetId:l})}};this.app.view.addEventListener("mouseout",w,!1);const M={handleEvent:()=>{this.globalEventHub.emit("controllerShowStatusChange",{slideIndex:a,targetId:l,status:!0})}};this.app.view.addEventListener("mouseover",M,!1);const I={handleEvent:()=>{this.fullscreenOnMousemove({index:a,targetId:l})}},H={handleEvent:()=>{var J;(J=this.currentStage)===null||J===void 0||J.ctx.globalEventHub.emit("togglePlayStatus",l)}};this.app.view.addEventListener("mousemove",I,!1),this.app.view.addEventListener("click",H,!1),this.cacheFunctionMap.set("click",H),this.cacheFunctionMap.set("mouseover",M),this.cacheFunctionMap.set("mousemove",I),this.cacheFunctionMap.set("mouseout",w)}else{const w={handleEvent:()=>{var M;this.fullscreenOnMousemove({index:a,targetId:l}),(M=this.currentStage)===null||M===void 0||M.ctx.globalEventHub.emit("togglePlayStatus",l)}};this.app.view.addEventListener("touchstart",w,!1),this.cacheFunctionMap.set("touchstart",w)}},this.onRequestCancelFullscreenVideo=(o=!1)=>{var s,a;this.globalVideoSprite.texture.destroy(!1);try{this.globalVideoBackground.removeChild(this.globalVideoSprite)}catch{this.logger.error("removeChild error: PPTPlayer:1057",this.taskId)}try{this.app.stage.removeChild(this.globalVideoBackground)}catch{this.logger.error("removeChild error: PPTPlayer:1062",this.taskId)}this.globalEventHub.emit("onFullscreenChange",{status:!1,slideIndex:this.currentIndex,targetId:(s=this.currentStage)===null||s===void 0?void 0:s.ctx.latestChangeFullscreenTargetId}),this.clearFullscreenEventListenersWithAppView(),o&&this.emit(ze.changeLocalFullscreenState,{status:!1,slideIndex:this.currentIndex,targetId:(a=this.currentStage)===null||a===void 0?void 0:a.ctx.latestChangeFullscreenTargetId})},this.logger=t.logger,this.tracker=t.tracker,this.mode=t.mode,this.volumeAdjuster=t.volumeAdjuster,this.localStorage=new Lr(this.logger),this.cachedExtract=new wc(this.localStorage),this.enableWebAudio=!!vi()(t.enableWebAudio)||t.enableWebAudio,this.enableAutoForward=!vi()(t.enableAutoForward)&&t.enableAutoForward,this.config={minFPS:vi()(e.minFPS)?30:e.minFPS,maxFPS:vi()(e.maxFPS)?40:e.maxFPS,resolution:vi()(e.resolution)?1:e.resolution,autoFPS:!vi()(e.autoFPS)&&e.autoFPS,autoResolution:!vi()(e.autoResolution)&&e.autoResolution,transactionBgColor:vi()(e.transactionBgColor)?0:e.transactionBgColor,maxResolutionLevel:this.getMaxResolution(e.maxResolutionLevel),forceCanvas:!vi()(e.forceCanvas)&&e.forceCanvas,enableNvidiaDetect:!vi()(e.enableNvidiaDetect)&&e.enableNvidiaDetect,transitionResolutionLevel:this.getMaxResolution(e.transitionResolutionLevel),antialias:!!vi()(e.antialias)||e.antialias},this.updateMaxResolutionLevel(this.config.maxResolutionLevel),this.updateTransitionResolutionLevel(this.config.transitionResolutionLevel),this.loader=new Cb(this.localStorage,t.useLocalCache,this.logger,this.tracker,t.resourceTimeout,t.loadDelegate,t.urlInterrupter,t.resourceMaxRetries,t.onResourceMaxRetries);const n=xn.isWebGLSupported();this.app=new Vl({antialias:this.config.antialias,autoDensity:!1,backgroundColor:16777215,forceCanvas:this.config.forceCanvas||!n}),globalThis.__PIXI_APP__=this.app,this.tracker({name:"slidePlayerCreate",result:"",reason:"",payload:{webgl:n,resolution:this.config.resolution,minFPS:this.config.minFPS,maxFPS:this.config.maxFPS,maxResolutionLevel:this.config.maxResolutionLevel,forceCanvas:this.config.forceCanvas}}),this.updateConfig(this.config),this.app.ticker.maxFPS=60,this.app.ticker.minFPS=this.config.minFPS,this.app.ticker.maxFPS=this.config.maxFPS,this.app.view.style.zIndex="1",this.app.stage.sortableChildren=!0;const r=this.app.renderer;if(r.gl){const{drawElements:o}=r.gl,s=r.gl.getExtension("WEBGL_debug_renderer_info"),a=r.gl.getParameter(s.UNMASKED_RENDERER_WEBGL);/nvidia/i.test(a)&&this.config.enableNvidiaDetect&&(this.isNVIDIA=!0),r.gl.drawElements=(...l)=>{o.call(r.gl,...l),this.drawCall+=1}}this.fps.on("update",o=>{if(o<this.config.minFPS){if(this.config.autoResolution){const s=.7*this.scale,a=this.app.renderer.resolution,l=Math.max(s,a-.1);l>=s&&this.updateResolution(l)}}else if(o>this.config.maxFPS&&this.config.autoResolution){const s=this.scale*this.config.resolution,a=this.app.renderer.resolution,l=Math.min(s,a+.1);l<=this.config.resolution&&this.updateResolution(l)}}),this.app.ticker.add(()=>{this.runtime.drawCall=this.drawCall,this.runtime.fps=Math.floor(this.app.ticker.minFPS),this.drawCall=0},null,nr.c.LOW),this.clock=new Rb(this.app.ticker),this.objPoolGroup=Zs(),this.stagePool=new XS(this.loader,this.mode,this.app.renderer,this.app.ticker,this.app.view,this.clock,this.objPoolGroup,this.errorChannel,this.localStorage,this.logger,t.loadDelegate,t.urlInterrupter,this.isPlayerPaused,this.maxResolution,this.volumeAdjuster,this.config.forceCanvas,this.globalEventHub,this.enableWebAudio,t.customLinks),this.app.view.addEventListener("webglcontextlost",this.onWebGLLost);try{this.config.forceCanvas||(this.transactionPlayer=new jx)}catch(o){/Error creating WebGL context/.test(o.message)?this.errorChannel.emit("error",new Hn(Yn.CanvasCrash,"webgl context lost.")):this.errorChannel.emit("error",new Hn(Yn.RuntimeWarn,o.message))}this.globalEventHub.on("requestFullscreen",this.onRequestFullscreenVideo),this.globalEventHub.on("requestCancelFullscreen",this.onRequestCancelFullscreenVideo),this.mode==="addLink"&&this.globalEventHub.on("user-add-click",o=>{this.emit(ze.useraddLink,o)}),this.enableAutoForward&&this.on(ze.mainSeqStepEnd,()=>{this.startAutoForwardTimer(this.currentStage)})}get view(){return this.app.renderer?this.app.view:null}get nextSlideIndex(){var t;return!((t=this.currentStage)===null||t===void 0)&&t.json.nextIndex?this.currentStage.json.nextIndex:this.currentIndex+1}get prevSlideIndex(){var t;return!((t=this.currentStage)===null||t===void 0)&&t.json.prevIndex?this.currentStage.json.prevIndex:this.currentIndex-1}getMaxResolution(t){return!vi()(t)&&Number.isInteger(t)?(t<1&&(t=1),t>4&&(t=4),t):ur.platform.isAndroid()||ur.platform.isIOS()?2:4}updateMaxResolutionLevel(t){t<0&&(t=0),t>4&&(t=4);const e=[640,960,1280,1920,3200][t],n=[360,540,720,1080,1800][t];this.maxResolution.set(e,n)}updateTransitionResolutionLevel(t){t<0&&(t=0),t>4&&(t=4);const e=[640,960,1280,1920,3200][t],n=[360,540,720,1080,1800][t];this.transitionResolution.set(e,n)}updateConfig(t){vi()(t.maxFPS)||vi()(t.minFPS)||(this.config.maxFPS=t.maxFPS,this.app.ticker.maxFPS=t.maxFPS,this.config.minFPS=t.minFPS,this.app.ticker.minFPS=t.minFPS),vi()(t.resolution)||(this.config.resolution=t.resolution,this.updateResolution(this.scale*this.config.resolution)),vi()(t.autoFPS)||(this.config.autoFPS=t.autoFPS),vi()(t.autoResolution)||(this.config.autoResolution=t.autoResolution),vi()(t.transactionBgColor)||(this.config.transactionBgColor=t.transactionBgColor),this.taskId&&this.logger.info("ppt player update config: "+JSON.stringify(this.config),this.taskId),vi()(t.maxResolutionLevel)||(this.config.maxResolutionLevel=t.maxResolutionLevel,this.updateMaxResolutionLevel(this.config.maxResolutionLevel)),vi()(t.transitionResolutionLevel)||(this.config.transitionResolutionLevel=t.transitionResolutionLevel,this.updateTransitionResolutionLevel(this.config.transitionResolutionLevel))}preload(t){return gs(this,void 0,void 0,function*(){if(t<1||t>this.slideCount)return;const e=Date.now();this.logger.info(`preload slide ${t} begin`,this.taskId),yield this.stagePool.preload(t),this.logger.info(`preload slide ${t} end`,this.taskId),this.tracker({name:"slidePreload",reason:"",result:"",payload:{duration:Date.now()-e,index:t}})})}preloadResource(t){return gs(this,void 0,void 0,function*(){if(t<1||t>this.slideCount)return;const e=Date.now();this.logger.info(`preload slide resource ${t} begin`,this.taskId),yield this.stagePool.preloadResource(t),this.logger.info(`preload slide resource ${t} end`,this.taskId),this.tracker({name:"slidePreloadResource",reason:"",result:"",payload:{duration:Date.now()-e,index:t}})})}setResourceData(t,e){this.logger.info("ppt player init config: "+JSON.stringify(this.config),t),this.logger.info("set resource to "+e,t),this.taskId=t,this.url=e,this.stagePool.setResourceData(t,e),this.localStorage.attachTaskId(t),this.loader.attachTaskId(t)}setInteractive(t){this.app.stage.interactive=t,this.app.stage.interactiveChildren=t}translateEvent(t,e){e.forEach(n=>{t.on(n,(...r)=>{var o,s,a,l;n===ze.requestGotoSlide&&r[0]!==this.currentIndex&&((s=(o=this.currentStage)===null||o===void 0?void 0:o.timing)===null||s===void 0||s.setMainSeqStep(0,"start"),(l=(a=this.currentStage)===null||a===void 0?void 0:a.timing)===null||l===void 0||l.destroy()),this.emit(n,...r)})})}clearAutoForwardTimer(){this.enableAutoForward&&this.autoForwardTimer&&(this.clock.clearTimeout(this.autoForwardTimer),this.autoForwardTimer=null)}startAutoForwardTimer(t){var e;if(!this.enableAutoForward||!t)return;this.clearAutoForwardTimer();const n=(e=t.json.transition)===null||e===void 0?void 0:e.advTm;vi()(n)||(this.autoForwardTimer=this.clock.setTimeout(()=>{this.view&&this.mainSeqState()!=="running"&&(this.mainSeqHasNextStep()?this.emit(ze.requestNextStep):this.currentIndex<this.slideCount?this.emit(ze.requestNextSlide,!1):this.clearAutoForwardTimer())},n/(this.mainSeqLength()+1)))}renderSlide(t){var e,n,r;return gs(this,void 0,void 0,function*(){if(this.clearAutoForwardTimer(),this._isPaused)return void this.logger.info("ppt play prevent render slide with paused state",this.taskId);const o=this.currentIndex,s=Date.now();this.logger.info("render slide "+t,this.taskId),this.emit(ze.renderStart,t);const a=yield this.stagePool.getStage(t),l=`snapshot-${t}-${this.isForward?"start":"end"}`,h=yield this.localStorage.getItem(l);if(!a)return;a.ctx.isRendering=!0,this.translateEvent(a.ctx.eventHub,[ze.mainSeqStepChange,ze.mainSeqStateChange,ze.hyperlinkTrigger,ze.interactiveSeqAction,ze.mainSeqStepStart,ze.mainSeqStepEnd,ze.animateStart,ze.animateEnd,ze.mediaPlay,ze.mediaPause,ze.mediaSeek,ze.mediaStop,ze.requestGotoSlide,ze.requestOpenUrl,ze.requestNextSlide,ze.requestPrevSlide,ze.interactiveSeqStateChange,ze.userInput,ze.fullscreenChange,ze.changeLocalFullscreenState]),this.currentIndex=Number(t);const{width:u,height:p,slideCount:y}=a.json;this.slideCount=y,this.designWidth=u,this.designHeight=p,(e=this.currentStage)===null||e===void 0||e.clearOnSlideChange();const b=this.currentStage;this.currentStage=a,a.initOnReuse(),a.createTiming(),a.container.visible=!0,a.collectMainSeqStartValue(),this.isForward?a.setMainSeqStep(0,"start"):a.setMainSeqStep(-1,"end"),this.onRequestCancelFullscreenVideo(!0);const w=()=>!!this.app.renderer.gl;let M=!1;if(xn.isWebGLSupported()&&!this.config.forceCanvas&&a.json.transition&&a.json.transition.type&&this.app.stage.children.length>0&&this.view&&b&&!w()){let{transition:I}=a.json;!this.isForward&&(b==null?void 0:b.json.transition)&&(I=b.json.transition);const H=this.getTransactionTexture(b,this.view,null,null);this.initTransactionPlayer(I),(n=this.transactionPlayer)===null||n===void 0||n.setPrevTexture(H),M=!0}if(this.app.stage.addChild(a.container),this.updateResolution(this.config.resolution*this.scale),b){b.clearOnTransactionEnd();try{this.app.stage.removeChild(b.container)}catch{this.logger.error("removeChild error: PPTPlayer:622",this.taskId)}}if(a.json.transition&&a.json.transition.type&&this.app.stage.children.length>0&&this.view&&this.transactionPlayer&&M&&!w()){const I=this.getTransactionTexture(a,this.view,l,h);this.transactionPlayer.setNextTexture(I),this.tracker({name:"slidePageChangePure",reason:"",result:"",payload:{duration:Date.now()-s,from:o,to:t}}),yield this.transactionPlayer.play();const H=this.transactionPlayer.renderer.domElement;if(this.view.parentElement&&H)try{this.view.parentElement.removeChild(H)}catch{this.logger.error("removeChild error: PPTPlayer:637",this.taskId)}(r=this.transactionPlayer)===null||r===void 0||r.dispose()}this.isForward?yield a.startTiming():a.setMainSeqApplied(),a.ctx.slideScopeEventHub.emit("slide-render",a.ctx.slideIndex,this.isForward),this.emit(ze.renderEnd,t),this.emit(ze.slideChange,t),a.ctx.isRendering=!1,this.preload(t+1).catch(I=>{I instanceof Ha||this.errorChannel.emit("error",Hn.transform(I),t+1)}),this.preload(t-1).catch(I=>{I instanceof Ha||this.errorChannel.emit("error",Hn.transform(I),t-1)}),this.logger.info(`render slide ${t} done, time: ${Date.now()-s}ms`,this.taskId),this.isForward&&this.startAutoForwardTimer(a),this.tracker({name:"slidePageChange",reason:"",result:"",payload:{duration:Date.now()-s,from:o,to:t}})})}getTransactionTexture(t,e,n,r){let o=this.transitionResolution.x/t.json.width;Math.floor(t.json.height*o+1e-4)>t.json.height&&(o=this.transitionResolution.y/t.json.height),o=Math.min(1,o);const s=le.p.create({width:t.json.width*o,height:t.json.height*o,resolution:1}),a=new Ie.d;a.scale(o,o),this.app.renderer.render(t.container,{renderTexture:s,transform:a});const l=this.cachedExtract.canvas(s,this.app.renderer,r,n);return new Q(l)}renderToBase64(t,e,n){return gs(this,void 0,void 0,function*(){const r=yield this.stagePool.getStage(t);if(r){const{width:o,height:s}=r.json;this.designWidth=o,this.designHeight=s;const a=le.p.create({width:this.designWidth,height:this.designHeight,resolution:e});r.container.visible=!0,this.app.renderer.render(r.container,{renderTexture:a});const l=this.app.renderer.plugins.extract.base64(a,n);return this.stagePool.destroyStageByIndex(t),l}return"__null__"})}renderMainSeqToBase64(t,e,n){return gs(this,void 0,void 0,function*(){const r=[],o=yield this.stagePool.getStage(t);if(o.createTiming(),o){const{width:s,height:a}=o.json;this.designWidth=s,this.designHeight=a;const l=le.p.create({width:this.designWidth,height:this.designHeight,resolution:e});o.container.visible=!0;const h=o.mainSeqLength();o.setMainSeqStep(0,"start"),this.app.renderer.render(o.container,{renderTexture:l});const u=this.app.renderer.plugins.extract.base64(l,n);r.push(u);for(let p=0;p<h;p+=1){o.setMainSeqStep(p,"end"),this.app.renderer.render(o.container,{renderTexture:l});const y=this.app.renderer.plugins.extract.base64(l,n);r.push(y)}}return r})}snapshotWithTimingEnd(t){return gs(this,void 0,void 0,function*(){const e=yield this.stagePool.getStage(t);if(e){const{width:n,height:r}=e.json;this.designWidth=n,this.designHeight=r;const o=le.p.create({width:this.designWidth,height:this.designHeight,resolution:1});e.container.visible=!0,e.initOnReuse(),e.createTiming(),e.collectMainSeqStartValue(),e.setMainSeqStep(-1,"end"),this.app.renderer.render(e.container,{renderTexture:o});const s=this.app.renderer.plugins.extract.base64(o,"image/png");return t!==this.currentIndex&&this.stagePool.destroyStageByIndex(t),s}return null})}getBase64(t){if(!t.container.transform)return null;const e=le.p.create({width:this.designWidth,height:this.designHeight,resolution:1});this.app.renderer.render(t.container,{renderTexture:e});const n=this.app.renderer.plugins.extract.base64(e,"image/jpeg");return e.destroy(!0),n}initTransactionPlayer(t){var e,n,r,o,s;const a=(e=this.view)===null||e===void 0?void 0:e.parentElement;if(this.view&&a&&G0[t.type]&&this.transactionPlayer){const l=(n=this.transactionPlayer)===null||n===void 0?void 0:n.renderer.domElement;this.transactionPlayer.initPlayer({reverse:!this.isForward,stageWidth:this.view.width,stageHeight:this.view.height,presetType:G0[t.type],duration:(o=(r=this.currentStage)===null||r===void 0?void 0:r.json.transition)===null||o===void 0?void 0:o.dur,delay:0,clearColor:this.config.transactionBgColor,maxFPS:Math.ceil((s=this.config.maxFPS)!==null&&s!==void 0?s:60),options:t.options}),l&&(l.style.position="absolute",l.style.zIndex="9",l.style.left="0",l.style.top="0",l.style.width=this.view.style.width,l.style.height=this.view.style.height),a.appendChild(l)}}scaleView(t,e,n){var r;this.view&&(this.view.style.width=Math.floor(this.designWidth*t)+"px",this.view.style.height=Math.floor(this.designHeight*t)+"px");const o=(r=this.transactionPlayer)===null||r===void 0?void 0:r.renderer.domElement;if(o&&this.view&&(o.style.width=this.view.style.width,o.style.height=this.view.style.height),e){this.scale=t;const s=this.scale*this.config.resolution;this.updateResolution(s,n)}}updateResolution(t,e){this.app.ticker.addOnce(()=>{let n=ms.isDesktop()?t:1;for(;n*this.designWidth>this.maxResolution.x||n*this.designHeight>this.maxResolution.y;)n-=.1;this.app.renderer.resolution=n,this.app.renderer.plugins.interaction.resolution=this.app.renderer.resolution,this.app.renderer.resize(this.designWidth,this.designHeight),y_()(e)&&e()})}nextStep(t,e){var n;if(this._isPaused)this.logger.info("ppt play prevent next step with paused state",this.taskId);else{this.logger.info("ppt play trigger next step",this.taskId);try{this.onRequestCancelFullscreenVideo(!0),(n=this.currentStage)===null||n===void 0||n.nextStep(t,e)}catch(r){this.errorChannel.emit("error",Hn.transform(r),this.currentIndex)}}}prevStep(t=!1){var e;if(this._isPaused)this.logger.info("ppt play prevent prev step with paused state",this.taskId);else{this.logger.info("ppt play trigger prev step",this.taskId);try{this.clearAutoForwardTimer(),this.onRequestCancelFullscreenVideo(!0),(e=this.currentStage)===null||e===void 0||e.prevStep(t)}catch(n){this.errorChannel.emit("error",Hn.transform(n),this.currentIndex)}}}mainSeqLength(){var t,e;return(e=(t=this.currentStage)===null||t===void 0?void 0:t.mainSeqLength())!==null&&e!==void 0?e:0}mainSeqStep(){var t,e;return(e=(t=this.currentStage)===null||t===void 0?void 0:t.mainSeqStep())!==null&&e!==void 0?e:0}setMainSeqStep(t,e){var n;(n=this.currentStage)===null||n===void 0||n.setMainSeqStep(t,e)}mainSeqState(){var t,e;return(e=(t=this.currentStage)===null||t===void 0?void 0:t.mainSeqState())!==null&&e!==void 0?e:null}mainSeqHasNextStep(){var t,e;return(e=(t=this.currentStage)===null||t===void 0?void 0:t.mainSeqHasNextStep())!==null&&e!==void 0&&e}mainSeqHasPrevStep(){var t,e;return(e=(t=this.currentStage)===null||t===void 0?void 0:t.mainSeqHasPrevStep())!==null&&e!==void 0&&e}nextTick(t){this.app.ticker.addOnce(()=>{t()},nr.c.LOW)}applyInteractiveAction(t){var e;(e=this.currentStage)===null||e===void 0||e.applyInteractiveAction(t)}seekInteractiveSeqToEnd(t){var e;(e=this.currentStage)===null||e===void 0||e.seekInteractiveSeqToEnd(t)}setInteractiveSeqState(t,e,n){var r;(r=this.currentStage)===null||r===void 0||r.setInteractiveSeqState(t,e,n)}setMediaState(t,e,n){var r;return gs(this,void 0,void 0,function*(){yield(r=this.currentStage)===null||r===void 0?void 0:r.setMediaState(t,e,n)})}setMediaCurrentTime(t,e){var n;(n=this.currentStage)===null||n===void 0||n.setMediaCurrentTime(t,e)}pause(){var t;this.app.ticker.stop(),(t=this.currentStage)===null||t===void 0||t.ctx.activeMedia.forEach(e=>{e.globalPause()}),this._isPaused=!0}resume(){var t;this._isPaused=!1,this.app.ticker.start(),(t=this.currentStage)===null||t===void 0||t.ctx.activeMedia.forEach(e=>{e.globalResume()})}getSnapshot(){return this.currentStage&&this.getBase64(this.currentStage)||""}clearLocalCache(){this.localStorage.dispose()}static clearLocalCache(){var t;(t=Lr.localCache)===null||t===void 0||t.clear().catch(()=>{})}clearFullscreenEventListenersWithAppView(){["mousemove","click","mouseout","mouseover","touchstart","pointerdown"].forEach(t=>{this.cacheFunctionMap.has(t)&&(this.app.view.removeEventListener(t,this.cacheFunctionMap.get(t),!1),this.cacheFunctionMap.delete(t))})}syncFullscreenVideoState(t){this.globalEventHub.emit("syncFullscreenVideoState",t)}destroy(){var t;try{this.clearAutoForwardTimer(),this.app.view.removeEventListener("webglcontextlost",this.onWebGLLost),this.app.renderer.filter.texturePool.clear(!0),lc.collectObjectByGroup(this.objPoolGroup),YS.collectObjectByGroup(this.objPoolGroup),(t=this.transactionPlayer)===null||t===void 0||t.destroy(),this.loader.destroy(),this.fps.destroy(),this.stagePool.destroyAllStage(),this.stagePool.destroy(),this.app.renderer.gl.getExtension("WEBGL_lose_context").loseContext(),this.app.destroy(!0,{children:!0,texture:!0,baseTexture:!0}),this.tracker({name:"slidePlayerDestroy",result:"",reason:"",payload:{}})}catch{}}}ur.platform=ms,ur.RtcAudioClazz=null;var Ec=new Map,Ja,JS=m(136),KS=m.n(JS),ZS=m(24),wh=m.n(ZS),$S=m(50),H0=m.n($S),vs=[],j0="ResizeObserver loop completed with undelivered notifications.";(function(i){i.BORDER_BOX="border-box",i.CONTENT_BOX="content-box",i.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Ja||(Ja={}));var Ac,ys=function(i){return Object.freeze(i)},QS=function(i,t){this.inlineSize=i,this.blockSize=t,ys(this)},z0=function(){function i(t,e,n,r){return this.x=t,this.y=e,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,ys(this)}return i.prototype.toJSON=function(){var t=this;return{x:t.x,y:t.y,top:t.top,right:t.right,bottom:t.bottom,left:t.left,width:t.width,height:t.height}},i.fromRect=function(t){return new i(t.x,t.y,t.width,t.height)},i}(),Cc=function(i){return i instanceof SVGElement&&"getBBox"in i},V0=function(i){if(Cc(i)){var t=i.getBBox(),e=t.width,n=t.height;return!e&&!n}var r=i,o=r.offsetWidth,s=r.offsetHeight;return!(o||s||i.getClientRects().length)},W0=function(i){var t;if(i instanceof Element)return!0;var e=(t=i==null?void 0:i.ownerDocument)===null||t===void 0?void 0:t.defaultView;return!!(e&&i instanceof e.Element)},Ka=typeof window!="undefined"?window:{},Eh=new WeakMap,X0=/auto|scroll/,tw=/^tb|vertical/,ew=/msie|trident/i.test(Ka.navigator&&Ka.navigator.userAgent),no=function(i){return parseFloat(i||"0")},ra=function(i,t,e){return i===void 0&&(i=0),t===void 0&&(t=0),e===void 0&&(e=!1),new QS((e?t:i)||0,(e?i:t)||0)},Y0=ys({devicePixelContentBoxSize:ra(),borderBoxSize:ra(),contentBoxSize:ra(),contentRect:new z0(0,0,0,0)}),q0=function(i,t){if(t===void 0&&(t=!1),Eh.has(i)&&!t)return Eh.get(i);if(V0(i))return Eh.set(i,Y0),Y0;var e=getComputedStyle(i),n=Cc(i)&&i.ownerSVGElement&&i.getBBox(),r=!ew&&e.boxSizing==="border-box",o=tw.test(e.writingMode||""),s=!n&&X0.test(e.overflowY||""),a=!n&&X0.test(e.overflowX||""),l=n?0:no(e.paddingTop),h=n?0:no(e.paddingRight),u=n?0:no(e.paddingBottom),p=n?0:no(e.paddingLeft),y=n?0:no(e.borderTopWidth),b=n?0:no(e.borderRightWidth),w=n?0:no(e.borderBottomWidth),M=p+h,I=l+u,H=(n?0:no(e.borderLeftWidth))+b,J=y+w,it=a?i.offsetHeight-J-i.clientHeight:0,ft=s?i.offsetWidth-H-i.clientWidth:0,et=r?M+H:0,gt=r?I+J:0,lt=n?n.width:no(e.width)-et-ft,mt=n?n.height:no(e.height)-gt-it,Ut=lt+M+ft+H,Ft=mt+I+it+J,Mt=ys({devicePixelContentBoxSize:ra(Math.round(lt*devicePixelRatio),Math.round(mt*devicePixelRatio),o),borderBoxSize:ra(Ut,Ft,o),contentBoxSize:ra(lt,mt,o),contentRect:new z0(p,l,lt,mt)});return Eh.set(i,Mt),Mt},J0=function(i,t,e){var n=q0(i,e),r=n.borderBoxSize,o=n.contentBoxSize,s=n.devicePixelContentBoxSize;switch(t){case Ja.DEVICE_PIXEL_CONTENT_BOX:return s;case Ja.BORDER_BOX:return r;default:return o}},nw=function(i){var t=q0(i);this.target=i,this.contentRect=t.contentRect,this.borderBoxSize=ys([t.borderBoxSize]),this.contentBoxSize=ys([t.contentBoxSize]),this.devicePixelContentBoxSize=ys([t.devicePixelContentBoxSize])},K0=function(i){if(V0(i))return 1/0;for(var t=0,e=i.parentNode;e;)t+=1,e=e.parentNode;return t},iw=function(){var i=1/0,t=[];vs.forEach(function(r){if(r.activeTargets.length!==0){var o=[];r.activeTargets.forEach(function(s){var a=new nw(s.target),l=K0(s.target);o.push(a),s.lastReportedSize=J0(s.target,s.observedBox),l<i&&(i=l)}),t.push(function(){r.callback.call(r.observer,o,r.observer)}),r.activeTargets.splice(0,r.activeTargets.length)}});for(var e=0,n=t;e<n.length;e++)(0,n[e])();return i},Z0=function(i){vs.forEach(function(t){t.activeTargets.splice(0,t.activeTargets.length),t.skippedTargets.splice(0,t.skippedTargets.length),t.observationTargets.forEach(function(e){e.isActive()&&(K0(e.target)>i?t.activeTargets.push(e):t.skippedTargets.push(e))})})},rw=function(){var i,t=0;for(Z0(t);vs.some(function(e){return e.activeTargets.length>0});)t=iw(),Z0(t);return vs.some(function(e){return e.skippedTargets.length>0})&&(typeof ErrorEvent=="function"?i=new ErrorEvent("error",{message:j0}):((i=document.createEvent("Event")).initEvent("error",!1,!1),i.message=j0),window.dispatchEvent(i)),t>0},$0=[],ow=function(i){if(!Ac){var t=0,e=document.createTextNode("");new MutationObserver(function(){return $0.splice(0).forEach(function(n){return n()})}).observe(e,{characterData:!0}),Ac=function(){e.textContent="".concat(t?t--:t++)}}$0.push(i),Ac()},Mc=0,sw={attributes:!0,characterData:!0,childList:!0,subtree:!0},Q0=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],tg=function(i){return i===void 0&&(i=0),Date.now()+i},Rc=!1,Ic=new(function(){function i(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return i.prototype.run=function(t){var e=this;if(t===void 0&&(t=250),!Rc){Rc=!0;var n,r=tg(t);n=function(){var o=!1;try{o=rw()}finally{if(Rc=!1,t=r-tg(),!Mc)return;o?e.run(1e3):t>0?e.run(t):e.start()}},ow(function(){requestAnimationFrame(n)})}},i.prototype.schedule=function(){this.stop(),this.run()},i.prototype.observe=function(){var t=this,e=function(){return t.observer&&t.observer.observe(document.body,sw)};document.body?e():Ka.addEventListener("DOMContentLoaded",e)},i.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Q0.forEach(function(e){return Ka.addEventListener(e,t.listener,!0)}))},i.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Q0.forEach(function(e){return Ka.removeEventListener(e,t.listener,!0)}),this.stopped=!0)},i}()),eg=function(i){!Mc&&i>0&&Ic.start(),!(Mc+=i)&&Ic.stop()},aw=function(){function i(t,e){this.target=t,this.observedBox=e||Ja.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return i.prototype.isActive=function(){var t,e=J0(this.target,this.observedBox,!0);return t=this.target,Cc(t)||function(n){switch(n.tagName){case"INPUT":if(n.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1}(t)||getComputedStyle(t).display!=="inline"||(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},i}(),lw=function(i,t){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=i,this.callback=t},Ah=new WeakMap,ng=function(i,t){for(var e=0;e<i.length;e+=1)if(i[e].target===t)return e;return-1},Ch=function(){function i(){}return i.connect=function(t,e){var n=new lw(t,e);Ah.set(t,n)},i.observe=function(t,e,n){var r=Ah.get(t),o=r.observationTargets.length===0;ng(r.observationTargets,e)<0&&(o&&vs.push(r),r.observationTargets.push(new aw(e,n&&n.box)),eg(1),Ic.schedule())},i.unobserve=function(t,e){var n=Ah.get(t),r=ng(n.observationTargets,e),o=n.observationTargets.length===1;r>=0&&(o&&vs.splice(vs.indexOf(n),1),n.observationTargets.splice(r,1),eg(-1))},i.disconnect=function(t){var e=this,n=Ah.get(t);n.observationTargets.slice().forEach(function(r){return e.unobserve(t,r.target)}),n.activeTargets.splice(0,n.activeTargets.length)},i}(),hw=function(){function i(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.");Ch.connect(this,t)}return i.prototype.observe=function(t,e){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!W0(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Ch.observe(this,t,e)},i.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(!W0(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Ch.unobserve(this,t)},i.prototype.disconnect=function(){Ch.disconnect(this)},i.toString=function(){return"function ResizeObserver () { [polyfill code] }"},i}(),uw=function(i,t,e,n){return new(e||(e=Promise))(function(r,o){function s(h){try{l(n.next(h))}catch(u){o(u)}}function a(h){try{l(n.throw(h))}catch(u){o(u)}}function l(h){var u;h.done?r(h.value):(u=h.value,u instanceof e?u:new e(function(p){p(u)})).then(s,a)}l((n=n.apply(i,t||[])).next())})},cw=function(i,t){var e,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(h){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;s;)try{if(e=1,n&&(r=2&u[0]?n.return:u[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,u[1])).done)return r;switch(n=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,n=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(r=s.trys,!((r=r.length>0&&r[r.length-1])||u[0]!==6&&u[0]!==2)){s=0;continue}if(u[0]===3&&(!r||u[1]>r[0]&&u[1]<r[3])){s.label=u[1];break}if(u[0]===6&&s.label<r[1]){s.label=r[1],r=u;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(u);break}r[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(i,s)}catch(p){u=[6,p],n=0}finally{e=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([l,h])}}},dw=function(){function i(t,e,n,r,o){this.state="idle",this.index=-1,this.slideIndex=-1,this.fn=n,this.index=t,this.slideIndex=e,this.eventHub=r,this.id=o}return i.prototype.apply=function(){return uw(this,void 0,void 0,function(){var t;return cw(this,function(e){switch(e.label){case 0:this.eventHub.emit("task-start",this),e.label=1;case 1:return e.trys.push([1,3,,4]),this.state="start",[4,this.fn()];case 2:return e.sent(),this.state="end",this.eventHub.emit("task-end",this),[3,4];case 3:return t=e.sent(),this.eventHub.emit("task-error",{task:this,error:t}),[3,4];case 4:return[2]}})})},i}(),pw=function(){function i(){var t=this;this.eventHub=new gi.a,this.tasks=[],this.index=0,this.eventHub.on("task-end",function(e){var n,r=t.tasks.findIndex(function(s){return s.index===e.index}),o=r+1;o>=0&&((n=t.tasks[o])===null||n===void 0||n.apply()),r>=0&&(t.tasks.splice(r,1),t.replaceIdleTask()),t.eventHub.emit("task-end-"+e.id)}),this.eventHub.on("task-error",function(e){var n=e.task,r=t.tasks.findIndex(function(o){return o.index===n.index});r>=0&&(t.tasks.splice(r,1),t.replaceIdleTask()),t.eventHub.emit("task-error-"+n.id)})}return i.prototype.replaceIdleTask=function(){for(var t,e=this,n=new Set,r=0,o=this.tasks.length;r<o;r++)this.tasks[r].state==="idle"&&((t=this.tasks[r+1])===null||t===void 0?void 0:t.state)==="idle"&&n.add(r);Array.from(n).forEach(function(s){e.tasks.splice(s,1)})},i.prototype.addTask=function(t,e,n){var r=new dw(this.index++,e,t,this.eventHub,n);this.tasks.push(r),this.tasks.sort(function(o,s){return o.index-s.index}),this.replaceIdleTask(),this.tasks.length===1&&r.apply()},i.prototype.hasStartTask=function(){return this.tasks.some(function(t){return t.state==="start"})},i.prototype.destroy=function(){this.eventHub.removeAllListeners()},i}();function oa(i,t){var e=i.__state.conversionName.toString(),n=Math.round(i.r),r=Math.round(i.g),o=Math.round(i.b),s=i.a,a=Math.round(i.h),l=i.s.toFixed(1),h=i.v.toFixed(1);if(t||e==="THREE_CHAR_HEX"||e==="SIX_CHAR_HEX"){for(var u=i.hex.toString(16);u.length<6;)u="0"+u;return"#"+u}return e==="CSS_RGB"?"rgb("+n+","+r+","+o+")":e==="CSS_RGBA"?"rgba("+n+","+r+","+o+","+s+")":e==="HEX"?"0x"+i.hex.toString(16):e==="RGB_ARRAY"?"["+n+","+r+","+o+"]":e==="RGBA_ARRAY"?"["+n+","+r+","+o+","+s+"]":e==="RGB_OBJ"?"{r:"+n+",g:"+r+",b:"+o+"}":e==="RGBA_OBJ"?"{r:"+n+",g:"+r+",b:"+o+",a:"+s+"}":e==="HSV_OBJ"?"{h:"+a+",s:"+l+",v:"+h+"}":e==="HSVA_OBJ"?"{h:"+a+",s:"+l+",v:"+h+",a:"+s+"}":"unknown format"}var ig=Array.prototype.forEach,Za=Array.prototype.slice,Le={BREAK:{},extend:function(i){return this.each(Za.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(e){this.isUndefined(t[e])||(i[e]=t[e])}.bind(this))},this),i},defaults:function(i){return this.each(Za.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(e){this.isUndefined(i[e])&&(i[e]=t[e])}.bind(this))},this),i},compose:function(){var i=Za.call(arguments);return function(){for(var t=Za.call(arguments),e=i.length-1;e>=0;e--)t=[i[e].apply(this,t)];return t[0]}},each:function(i,t,e){if(i){if(ig&&i.forEach&&i.forEach===ig)i.forEach(t,e);else if(i.length===i.length+0){var n,r=void 0;for(r=0,n=i.length;r<n;r++)if(r in i&&t.call(e,i[r],r)===this.BREAK)return}else for(var o in i)if(t.call(e,i[o],o)===this.BREAK)return}},defer:function(i){setTimeout(i,0)},debounce:function(i,t,e){var n=void 0;return function(){var r=this,o=arguments;function s(){n=null,e||i.apply(r,o)}var a=e||!n;clearTimeout(n),n=setTimeout(s,t),a&&i.apply(r,o)}},toArray:function(i){return i.toArray?i.toArray():Za.call(i)},isUndefined:function(i){return i===void 0},isNull:function(i){return i===null},isNaN:function(i){function t(e){return i.apply(this,arguments)}return t.toString=function(){return i.toString()},t}(function(i){return isNaN(i)}),isArray:Array.isArray||function(i){return i.constructor===Array},isObject:function(i){return i===Object(i)},isNumber:function(i){return i===i+0},isString:function(i){return i===i+""},isBoolean:function(i){return i===!1||i===!0},isFunction:function(i){return i instanceof Function}},fw=[{litmus:Le.isString,conversions:{THREE_CHAR_HEX:{read:function(i){var t=i.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return t!==null&&{space:"HEX",hex:parseInt("0x"+t[1].toString()+t[1].toString()+t[2].toString()+t[2].toString()+t[3].toString()+t[3].toString(),0)}},write:oa},SIX_CHAR_HEX:{read:function(i){var t=i.match(/^#([A-F0-9]{6})$/i);return t!==null&&{space:"HEX",hex:parseInt("0x"+t[1].toString(),0)}},write:oa},CSS_RGB:{read:function(i){var t=i.match(/^rgb\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);return t!==null&&{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3])}},write:oa},CSS_RGBA:{read:function(i){var t=i.match(/^rgba\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);return t!==null&&{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3]),a:parseFloat(t[4])}},write:oa}}},{litmus:Le.isNumber,conversions:{HEX:{read:function(i){return{space:"HEX",hex:i,conversionName:"HEX"}},write:function(i){return i.hex}}}},{litmus:Le.isArray,conversions:{RGB_ARRAY:{read:function(i){return i.length===3&&{space:"RGB",r:i[0],g:i[1],b:i[2]}},write:function(i){return[i.r,i.g,i.b]}},RGBA_ARRAY:{read:function(i){return i.length===4&&{space:"RGB",r:i[0],g:i[1],b:i[2],a:i[3]}},write:function(i){return[i.r,i.g,i.b,i.a]}}}},{litmus:Le.isObject,conversions:{RGBA_OBJ:{read:function(i){return!!(Le.isNumber(i.r)&&Le.isNumber(i.g)&&Le.isNumber(i.b)&&Le.isNumber(i.a))&&{space:"RGB",r:i.r,g:i.g,b:i.b,a:i.a}},write:function(i){return{r:i.r,g:i.g,b:i.b,a:i.a}}},RGB_OBJ:{read:function(i){return!!(Le.isNumber(i.r)&&Le.isNumber(i.g)&&Le.isNumber(i.b))&&{space:"RGB",r:i.r,g:i.g,b:i.b}},write:function(i){return{r:i.r,g:i.g,b:i.b}}},HSVA_OBJ:{read:function(i){return!!(Le.isNumber(i.h)&&Le.isNumber(i.s)&&Le.isNumber(i.v)&&Le.isNumber(i.a))&&{space:"HSV",h:i.h,s:i.s,v:i.v,a:i.a}},write:function(i){return{h:i.h,s:i.s,v:i.v,a:i.a}}},HSV_OBJ:{read:function(i){return!!(Le.isNumber(i.h)&&Le.isNumber(i.s)&&Le.isNumber(i.v))&&{space:"HSV",h:i.h,s:i.s,v:i.v}},write:function(i){return{h:i.h,s:i.s,v:i.v}}}}}],$a=void 0,Mh=void 0,Pc=function(){Mh=!1;var i=arguments.length>1?Le.toArray(arguments):arguments[0];return Le.each(fw,function(t){if(t.litmus(i))return Le.each(t.conversions,function(e,n){if($a=e.read(i),Mh===!1&&$a!==!1)return Mh=$a,$a.conversionName=n,$a.conversion=e,Le.BREAK}),Le.BREAK}),Mh},rg=void 0,Rh={hsv_to_rgb:function(i,t,e){var n=Math.floor(i/60)%6,r=i/60-Math.floor(i/60),o=e*(1-t),s=e*(1-r*t),a=e*(1-(1-r)*t),l=[[e,a,o],[s,e,o],[o,e,a],[o,s,e],[a,o,e],[e,o,s]][n];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(i,t,e){var n=Math.min(i,t,e),r=Math.max(i,t,e),o=r-n,s=void 0;return r===0?{h:NaN,s:0,v:0}:(s=i===r?(t-e)/o:t===r?2+(e-i)/o:4+(i-t)/o,(s/=6)<0&&(s+=1),{h:360*s,s:o/r,v:r/255})},rgb_to_hex:function(i,t,e){var n=this.hex_with_component(0,2,i);return n=this.hex_with_component(n,1,t),n=this.hex_with_component(n,0,e)},component_from_hex:function(i,t){return i>>8*t&255},hex_with_component:function(i,t,e){return e<<(rg=8*t)|i&~(255<<rg)}},mw=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},Vr=function(i,t){if(!(i instanceof t))throw new TypeError("Cannot call a class as a function")},Wr=function(){function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}}(),Yo=function i(t,e,n){t===null&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,e);if(r===void 0){var o=Object.getPrototypeOf(t);return o===null?void 0:i(o,e,n)}if("value"in r)return r.value;var s=r.get;return s!==void 0?s.call(n):void 0},qo=function(i,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);i.prototype=Object.create(t&&t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(i,t):i.__proto__=t)},Jo=function(i,t){if(!i)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||typeof t!="object"&&typeof t!="function"?i:t},Yi=function(){function i(){if(Vr(this,i),this.__state=Pc.apply(this,arguments),this.__state===!1)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return Wr(i,[{key:"toString",value:function(){return oa(this)}},{key:"toHexString",value:function(){return oa(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),i}();function Oc(i,t,e){Object.defineProperty(i,t,{get:function(){return this.__state.space==="RGB"||Yi.recalculateRGB(this,t,e),this.__state[t]},set:function(n){this.__state.space!=="RGB"&&(Yi.recalculateRGB(this,t,e),this.__state.space="RGB"),this.__state[t]=n}})}function Nc(i,t){Object.defineProperty(i,t,{get:function(){return this.__state.space==="HSV"||Yi.recalculateHSV(this),this.__state[t]},set:function(e){this.__state.space!=="HSV"&&(Yi.recalculateHSV(this),this.__state.space="HSV"),this.__state[t]=e}})}Yi.recalculateRGB=function(i,t,e){if(i.__state.space==="HEX")i.__state[t]=Rh.component_from_hex(i.__state.hex,e);else{if(i.__state.space!=="HSV")throw new Error("Corrupted color state");Le.extend(i.__state,Rh.hsv_to_rgb(i.__state.h,i.__state.s,i.__state.v))}},Yi.recalculateHSV=function(i){var t=Rh.rgb_to_hsv(i.r,i.g,i.b);Le.extend(i.__state,{s:t.s,v:t.v}),Le.isNaN(t.h)?Le.isUndefined(i.__state.h)&&(i.__state.h=0):i.__state.h=t.h},Yi.COMPONENTS=["r","g","b","h","s","v","hex","a"],Oc(Yi.prototype,"r",2),Oc(Yi.prototype,"g",1),Oc(Yi.prototype,"b",0),Nc(Yi.prototype,"h"),Nc(Yi.prototype,"s"),Nc(Yi.prototype,"v"),Object.defineProperty(Yi.prototype,"a",{get:function(){return this.__state.a},set:function(i){this.__state.a=i}}),Object.defineProperty(Yi.prototype,"hex",{get:function(){return this.__state.space!=="HEX"&&(this.__state.hex=Rh.rgb_to_hex(this.r,this.g,this.b),this.__state.space="HEX"),this.__state.hex},set:function(i){this.__state.space="HEX",this.__state.hex=i}});var _s=function(){function i(t,e){Vr(this,i),this.initialValue=t[e],this.domElement=document.createElement("div"),this.object=t,this.property=e,this.__onChange=void 0,this.__onFinishChange=void 0}return Wr(i,[{key:"onChange",value:function(t){return this.__onChange=t,this}},{key:"onFinishChange",value:function(t){return this.__onFinishChange=t,this}},{key:"setValue",value:function(t){return this.object[this.property]=t,this.__onChange&&this.__onChange.call(this,t),this.updateDisplay(),this}},{key:"getValue",value:function(){return this.object[this.property]}},{key:"updateDisplay",value:function(){return this}},{key:"isModified",value:function(){return this.initialValue!==this.getValue()}}]),i}(),og={};Le.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},function(i,t){Le.each(i,function(e){og[e]=t})});var gw=/(\d+(\.\d+)?)px/;function io(i){if(i==="0"||Le.isUndefined(i))return 0;var t=i.match(gw);return Le.isNull(t)?0:parseFloat(t[1])}var de={makeSelectable:function(i,t){i!==void 0&&i.style!==void 0&&(i.onselectstart=t?function(){return!1}:function(){},i.style.MozUserSelect=t?"auto":"none",i.style.KhtmlUserSelect=t?"auto":"none",i.unselectable=t?"on":"off")},makeFullscreen:function(i,t,e){var n=e,r=t;Le.isUndefined(r)&&(r=!0),Le.isUndefined(n)&&(n=!0),i.style.position="absolute",r&&(i.style.left=0,i.style.right=0),n&&(i.style.top=0,i.style.bottom=0)},fakeEvent:function(i,t,e,n){var r=e||{},o=og[t];if(!o)throw new Error("Event type "+t+" not supported.");var s=document.createEvent(o);switch(o){case"MouseEvents":var a=r.x||r.clientX||0,l=r.y||r.clientY||0;s.initMouseEvent(t,r.bubbles||!1,r.cancelable||!0,window,r.clickCount||1,0,0,a,l,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var h=s.initKeyboardEvent||s.initKeyEvent;Le.defaults(r,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),h(t,r.bubbles||!1,r.cancelable,window,r.ctrlKey,r.altKey,r.shiftKey,r.metaKey,r.keyCode,r.charCode);break;default:s.initEvent(t,r.bubbles||!1,r.cancelable||!0)}Le.defaults(s,n),i.dispatchEvent(s)},bind:function(i,t,e,n){var r=n||!1;return i.addEventListener?i.addEventListener(t,e,r):i.attachEvent&&i.attachEvent("on"+t,e),de},unbind:function(i,t,e,n){var r=n||!1;return i.removeEventListener?i.removeEventListener(t,e,r):i.detachEvent&&i.detachEvent("on"+t,e),de},addClass:function(i,t){if(i.className===void 0)i.className=t;else if(i.className!==t){var e=i.className.split(/ +/);e.indexOf(t)===-1&&(e.push(t),i.className=e.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return de},removeClass:function(i,t){if(t)if(i.className===t)i.removeAttribute("class");else{var e=i.className.split(/ +/),n=e.indexOf(t);n!==-1&&(e.splice(n,1),i.className=e.join(" "))}else i.className=void 0;return de},hasClass:function(i,t){return new RegExp("(?:^|\\s+)"+t+"(?:\\s+|$)").test(i.className)||!1},getWidth:function(i){var t=getComputedStyle(i);return io(t["border-left-width"])+io(t["border-right-width"])+io(t["padding-left"])+io(t["padding-right"])+io(t.width)},getHeight:function(i){var t=getComputedStyle(i);return io(t["border-top-width"])+io(t["border-bottom-width"])+io(t["padding-top"])+io(t["padding-bottom"])+io(t.height)},getOffset:function(i){var t=i,e={left:0,top:0};if(t.offsetParent)do e.left+=t.offsetLeft,e.top+=t.offsetTop,t=t.offsetParent;while(t);return e},isActive:function(i){return i===document.activeElement&&(i.type||i.href)}},sg=function(i){function t(e,n){Vr(this,t);var r=Jo(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),o=r;return r.__prev=r.getValue(),r.__checkbox=document.createElement("input"),r.__checkbox.setAttribute("type","checkbox"),de.bind(r.__checkbox,"change",function(){o.setValue(!o.__prev)},!1),r.domElement.appendChild(r.__checkbox),r.updateDisplay(),r}return qo(t,i),Wr(t,[{key:"setValue",value:function(e){var n=Yo(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,e);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),n}},{key:"updateDisplay",value:function(){return this.getValue()===!0?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0,this.__prev=!0):(this.__checkbox.checked=!1,this.__prev=!1),Yo(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(_s),vw=function(i){function t(e,n,r){Vr(this,t);var o=Jo(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=r,a=o;if(o.__select=document.createElement("select"),Le.isArray(s)){var l={};Le.each(s,function(h){l[h]=h}),s=l}return Le.each(s,function(h,u){var p=document.createElement("option");p.innerHTML=u,p.setAttribute("value",h),a.__select.appendChild(p)}),o.updateDisplay(),de.bind(o.__select,"change",function(){var h=this.options[this.selectedIndex].value;a.setValue(h)}),o.domElement.appendChild(o.__select),o}return qo(t,i),Wr(t,[{key:"setValue",value:function(e){var n=Yo(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,e);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),n}},{key:"updateDisplay",value:function(){return de.isActive(this.__select)?this:(this.__select.value=this.getValue(),Yo(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this))}}]),t}(_s),yw=function(i){function t(e,n){Vr(this,t);var r=Jo(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),o=r;function s(){o.setValue(o.__input.value)}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),de.bind(r.__input,"keyup",s),de.bind(r.__input,"change",s),de.bind(r.__input,"blur",function(){o.__onFinishChange&&o.__onFinishChange.call(o,o.getValue())}),de.bind(r.__input,"keydown",function(a){a.keyCode===13&&this.blur()}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return qo(t,i),Wr(t,[{key:"updateDisplay",value:function(){return de.isActive(this.__input)||(this.__input.value=this.getValue()),Yo(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(_s);function ag(i){var t=i.toString();return t.indexOf(".")>-1?t.length-t.indexOf(".")-1:0}var lg=function(i){function t(e,n,r){Vr(this,t);var o=Jo(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=r||{};return o.__min=s.min,o.__max=s.max,o.__step=s.step,Le.isUndefined(o.__step)?o.initialValue===0?o.__impliedStep=1:o.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(o.initialValue))/Math.LN10))/10:o.__impliedStep=o.__step,o.__precision=ag(o.__impliedStep),o}return qo(t,i),Wr(t,[{key:"setValue",value:function(e){var n=e;return this.__min!==void 0&&n<this.__min?n=this.__min:this.__max!==void 0&&n>this.__max&&(n=this.__max),this.__step!==void 0&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),Yo(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=ag(e),this}}]),t}(_s),Ih=function(i){function t(e,n,r){Vr(this,t);var o=Jo(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,r));o.__truncationSuspended=!1;var s=o,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function h(p){var y=a-p.clientY;s.setValue(s.getValue()+y*s.__impliedStep),a=p.clientY}function u(){de.unbind(window,"mousemove",h),de.unbind(window,"mouseup",u),l()}return o.__input=document.createElement("input"),o.__input.setAttribute("type","text"),de.bind(o.__input,"change",function(){var p=parseFloat(s.__input.value);Le.isNaN(p)||s.setValue(p)}),de.bind(o.__input,"blur",function(){l()}),de.bind(o.__input,"mousedown",function(p){de.bind(window,"mousemove",h),de.bind(window,"mouseup",u),a=p.clientY}),de.bind(o.__input,"keydown",function(p){p.keyCode===13&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())}),o.updateDisplay(),o.domElement.appendChild(o.__input),o}return qo(t,i),Wr(t,[{key:"updateDisplay",value:function(){var e,n,r;return this.__input.value=this.__truncationSuspended?this.getValue():(e=this.getValue(),n=this.__precision,r=Math.pow(10,n),Math.round(e*r)/r),Yo(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(lg);function hg(i,t,e,n,r){return n+(i-t)/(e-t)*(r-n)}var Lc=function(i){function t(e,n,r,o,s){Vr(this,t);var a=Jo(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:r,max:o,step:s})),l=a;function h(b){b.preventDefault();var w=l.__background.getBoundingClientRect();return l.setValue(hg(b.clientX,w.left,w.right,l.__min,l.__max)),!1}function u(){de.unbind(window,"mousemove",h),de.unbind(window,"mouseup",u),l.__onFinishChange&&l.__onFinishChange.call(l,l.getValue())}function p(b){var w=b.touches[0].clientX,M=l.__background.getBoundingClientRect();l.setValue(hg(w,M.left,M.right,l.__min,l.__max))}function y(){de.unbind(window,"touchmove",p),de.unbind(window,"touchend",y),l.__onFinishChange&&l.__onFinishChange.call(l,l.getValue())}return a.__background=document.createElement("div"),a.__foreground=document.createElement("div"),de.bind(a.__background,"mousedown",function(b){document.activeElement.blur(),de.bind(window,"mousemove",h),de.bind(window,"mouseup",u),h(b)}),de.bind(a.__background,"touchstart",function(b){b.touches.length===1&&(de.bind(window,"touchmove",p),de.bind(window,"touchend",y),p(b))}),de.addClass(a.__background,"slider"),de.addClass(a.__foreground,"slider-fg"),a.updateDisplay(),a.__background.appendChild(a.__foreground),a.domElement.appendChild(a.__background),a}return qo(t,i),Wr(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",Yo(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(lg),ug=function(i){function t(e,n,r){Vr(this,t);var o=Jo(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o;return o.__button=document.createElement("div"),o.__button.innerHTML=r===void 0?"Fire":r,de.bind(o.__button,"click",function(a){return a.preventDefault(),s.fire(),!1}),de.addClass(o.__button,"button"),o.domElement.appendChild(o.__button),o}return qo(t,i),Wr(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(_s),Dc=function(i){function t(e,n){Vr(this,t);var r=Jo(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));r.__color=new Yi(r.getValue()),r.__temp=new Yi(0);var o=r;r.domElement=document.createElement("div"),de.makeSelectable(r.domElement,!1),r.__selector=document.createElement("div"),r.__selector.className="selector",r.__saturation_field=document.createElement("div"),r.__saturation_field.className="saturation-field",r.__field_knob=document.createElement("div"),r.__field_knob.className="field-knob",r.__field_knob_border="2px solid ",r.__hue_knob=document.createElement("div"),r.__hue_knob.className="hue-knob",r.__hue_field=document.createElement("div"),r.__hue_field.className="hue-field",r.__input=document.createElement("input"),r.__input.type="text",r.__input_textShadow="0 1px 1px ",de.bind(r.__input,"keydown",function(I){I.keyCode===13&&y.call(this)}),de.bind(r.__input,"blur",y),de.bind(r.__selector,"mousedown",function(){de.addClass(this,"drag").bind(window,"mouseup",function(){de.removeClass(o.__selector,"drag")})}),de.bind(r.__selector,"touchstart",function(){de.addClass(this,"drag").bind(window,"touchend",function(){de.removeClass(o.__selector,"drag")})});var s,a=document.createElement("div");function l(I){w(I),de.bind(window,"mousemove",w),de.bind(window,"touchmove",w),de.bind(window,"mouseup",u),de.bind(window,"touchend",u)}function h(I){M(I),de.bind(window,"mousemove",M),de.bind(window,"touchmove",M),de.bind(window,"mouseup",p),de.bind(window,"touchend",p)}function u(){de.unbind(window,"mousemove",w),de.unbind(window,"touchmove",w),de.unbind(window,"mouseup",u),de.unbind(window,"touchend",u),b()}function p(){de.unbind(window,"mousemove",M),de.unbind(window,"touchmove",M),de.unbind(window,"mouseup",p),de.unbind(window,"touchend",p),b()}function y(){var I=Pc(this.value);I!==!1?(o.__color.__state=I,o.setValue(o.__color.toOriginal())):this.value=o.__color.toString()}function b(){o.__onFinishChange&&o.__onFinishChange.call(o,o.__color.toOriginal())}function w(I){I.type.indexOf("touch")===-1&&I.preventDefault();var H=o.__saturation_field.getBoundingClientRect(),J=I.touches&&I.touches[0]||I,it=J.clientX,ft=J.clientY,et=(it-H.left)/(H.right-H.left),gt=1-(ft-H.top)/(H.bottom-H.top);return gt>1?gt=1:gt<0&&(gt=0),et>1?et=1:et<0&&(et=0),o.__color.v=gt,o.__color.s=et,o.setValue(o.__color.toOriginal()),!1}function M(I){I.type.indexOf("touch")===-1&&I.preventDefault();var H=o.__hue_field.getBoundingClientRect(),J=1-((I.touches&&I.touches[0]||I).clientY-H.top)/(H.bottom-H.top);return J>1?J=1:J<0&&(J=0),o.__color.h=360*J,o.setValue(o.__color.toOriginal()),!1}return Le.extend(r.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),Le.extend(r.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:r.__field_knob_border+(r.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),Le.extend(r.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),Le.extend(r.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),Le.extend(a.style,{width:"100%",height:"100%",background:"none"}),cg(a,"top","rgba(0,0,0,0)","#000"),Le.extend(r.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(s=r.__hue_field).style.background="",s.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",s.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",s.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",s.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",s.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",Le.extend(r.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:r.__input_textShadow+"rgba(0,0,0,0.7)"}),de.bind(r.__saturation_field,"mousedown",l),de.bind(r.__saturation_field,"touchstart",l),de.bind(r.__field_knob,"mousedown",l),de.bind(r.__field_knob,"touchstart",l),de.bind(r.__hue_field,"mousedown",h),de.bind(r.__hue_field,"touchstart",h),r.__saturation_field.appendChild(a),r.__selector.appendChild(r.__field_knob),r.__selector.appendChild(r.__saturation_field),r.__selector.appendChild(r.__hue_field),r.__hue_field.appendChild(r.__hue_knob),r.domElement.appendChild(r.__input),r.domElement.appendChild(r.__selector),r.updateDisplay(),r}return qo(t,i),Wr(t,[{key:"updateDisplay",value:function(){var e=Pc(this.getValue());if(e!==!1){var n=!1;Le.each(Yi.COMPONENTS,function(s){if(!Le.isUndefined(e[s])&&!Le.isUndefined(this.__color.__state[s])&&e[s]!==this.__color.__state[s])return n=!0,{}},this),n&&Le.extend(this.__color.__state,e)}Le.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var r=this.__color.v<.5||this.__color.s>.5?255:0,o=255-r;Le.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+r+","+r+","+r+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,cg(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),Le.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+r+","+r+","+r+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(_s),_w=["-moz-","-o-","-webkit-","-ms-",""];function cg(i,t,e,n){i.style.background="",Le.each(_w,function(r){i.style.cssText+="background: "+r+"linear-gradient("+t+", "+e+" 0%, "+n+" 100%); "})}var xw=function(i,t){var e=t||document,n=document.createElement("style");n.type="text/css",n.innerHTML=i;var r=e.getElementsByTagName("head")[0];try{r.appendChild(n)}catch{}},bw=`<div id="dg-save" class="dg dialogue">
8005
+ `],{type:"text/javascript"});this.worker=new Worker(URL.createObjectURL(n)),this.worker.onmessage=r=>{this.outputData.set(r.data.key,{data:r.data.outputData,maxDis:r.data.maxDis})},this.outputData.set("111","222")}createSdfByWorker(t,e,n,r,o,s,a,l){const h=document.createElement("canvas");h.width=o,h.height=s;const u=h.getContext("2d");if(!u||!this.worker)return;u.drawImage(a,t,e,n,r);const{data:p}=u.getImageData(0,0,o,s);this.worker.postMessage({data:p,key:l,width:o,height:s})}createSdf(t,e,n){const r=document.createElement("canvas");r.width=t,r.height=e;const o=r.getContext("2d");if(!o)return{src:"",maxDis:1};o.drawImage(n,0,0);let s=0;const{data:a}=o.getImageData(0,0,t,e),l=[],h=[],u=function(J,it,ft){l[it*t+J]=ft},p=function(J,it){return l[it*t+J]},y=function(J,it,ft){h[it*t+J]=ft},b=function(J,it){return h[it*t+J]},w=function(J,it){return J>=0&&J<t&&it>=0&&it<e},M=function(J,it){return a[4*(it*t+J)+3]>10};for(let J=0;J<e;++J)for(let it=0;it<t;++it){const ft=M(it,J),et=!!w(it,J-1)&&M(it,J-1),gt=!!w(it,J+1)&&M(it,J+1),lt=!!w(it-1,J)&&M(it-1,J),mt=!!w(it+1,J)&&M(it+1,J);ft!==et||ft!==gt||ft!==lt||ft!==mt?(u(it,J,0),y(it,J,[it,J])):(u(it,J,Number.MAX_SAFE_INTEGER),y(it,J,[-1,-1]))}const I=function(J,it,ft){const et=Math.sqrt(2);let gt,lt,mt;switch(ft){case"TL":gt=-1,lt=-1,mt=et;break;case"T":gt=0,lt=-1,mt=1;break;case"TR":gt=1,lt=-1,mt=et;break;case"L":gt=-1,lt=0,mt=1;break;case"R":gt=1,lt=0,mt=1;break;case"BL":gt=-1,lt=1,mt=et;break;case"B":gt=0,lt=1,mt=1;break;case"BR":gt=1,lt=1,mt=et}const Ut=w(J+gt,it+lt);if((Ut?p(J+gt,it+lt):Number.MAX_SAFE_INTEGER)+mt<p(J,it)){const Ft=Ut?b(J+gt,it+lt):[-1,-1],Mt=Math.sqrt(Math.pow(J-Ft[0],2)+Math.pow(it-Ft[1],2));y(J,it,Ft),u(J,it,Mt),Mt>s&&(s=Mt)}};for(let J=0;J<e;++J)for(let it=0;it<t;++it){const ft=["TL","T","TR","L"];for(const et of ft)I(it,J,et)}for(let J=e-1;J>=0;--J)for(let it=t-1;it>=0;--it){const ft=["R","BL","B","BR"];for(const et of ft)I(it,J,et)}const H=[];for(let J=0;J<e;++J)for(let it=0;it<t;++it)H.push(0,0,0,Math.ceil(p(it,J)/s*255));return o.putImageData(new ImageData(Uint8ClampedArray.from(H),t,e),0,0),{src:r.toDataURL("image/png"),maxDis:s}}getSdf(t,e,n){return VS(this,void 0,void 0,function*(){const r=Math.ceil(e.width),o=Math.ceil(e.height),s=Math.ceil(e.width-t.width)/2,a=Math.ceil(e.height-t.height)/2;let l=yield this.localStorage.getItem(`sdf-${n}-src`),h=yield this.localStorage.getItem(`sdf-${n}-maxDis`);if(!(l&&h||this.loadingSdfKeys.has(n))){this.loadingSdfKeys.add(n);const u=this.renderer.plugins.extract.image(t,"image/png");u.addEventListener("load",()=>{this.createSdfByWorker(s,a,t.width,t.height,r,o,u,n)}),u.addEventListener("error",()=>null),yield sh(()=>!!this.outputData.has(n),5e3),this.loadingSdfKeys.delete(n);const p=this.outputData.get(n);if(p){this.outputData.delete(n);const y=document.createElement("canvas");y.width=r,y.height=o;const b=y.getContext("2d");if(!b)return null;b.putImageData(new ImageData(Uint8ClampedArray.from(p.data),r,o),0,0),l=y.toDataURL("image/png"),h=p.maxDis,this.localStorage.setItem(`sdf-${n}-src`,l).catch(()=>{}),this.localStorage.setItem(`sdf-${n}-maxDis`,h).catch(()=>{})}}return!l||!h?null:(document.createElement("img").src=l,le.t.fromURL(l).then(u=>({texture:u,maxDis:h})).catch(()=>null))})}destroy(){var t;(t=this.worker)===null||t===void 0||t.terminate(),this.worker=null}}var ia=function(i,t,e,n){return new(e||(e=Promise))(function(r,o){function s(h){try{l(n.next(h))}catch(u){o(u)}}function a(h){try{l(n.throw(h))}catch(u){o(u)}}function l(h){var u;h.done?r(h.value):(u=h.value,u instanceof e?u:new e(function(p){p(u)})).then(s,a)}l((n=n.apply(i,t||[])).next())})};class XS{constructor(t,e,n,r,o,s,a,l,h,u,p,y,b,w,M,I,H,J,it){this.loader=t,this.mode=e,this.renderer=n,this.ticker=r,this.view=o,this.clock=s,this.objPoolGroup=a,this.errorChannel=l,this.localstorage=h,this.logger=u,this.loaderDelegate=p,this.urlInterrupter=y,this.isPlayerPaused=b,this.maxResolution=w,this.volumeAdjuster=M,this.forceCanvas=I,this.globalEventHub=H,this.enableWebAudio=J,this.customLinks=it,this.currentStageIndex=0,this.cacheCount=ms.isDesktop()?2:1,this.stageStates=Object.create(null),this.stageJsons=Object.create(null),this.stageCtxs=Object.create(null),this.stageImpls=Object.create(null),this.taskId="",this.url="",this.runningAudio=new Map,this.activeMedia=new Set,this.microTaskManager=new GS(r),this.sdfManager=new WS(n,h)}setResourceData(t,e){this.taskId=t,this.url=e}createCtx(t){const{task:e}=this.stageStates[t];e.addMTask(()=>ia(this,void 0,void 0,function*(){const n=new Ob(this.loader),r=new gi.a,o={taskId:this.taskId,prefix:this.url,mode:this.mode,renderer:this.renderer,graphicsTexture:new Bb(this.maxResolution),stageWidth:0,stageHeight:0,ticker:this.ticker,timingTargets:new Ub(r),eventHub:r,view:this.view,medias:Object.create(null),lastViewedIndex:0,conflictTimeNodeManager:new kb,clock:this.clock,spriteTexture:n,slideIndex:t,objectPoolGroup:this.objPoolGroup,hasBackgroundFillShape:!1,slideScopeEventHub:new gi.a,logger:this.logger,sdfManager:this.sdfManager,loaderDelegate:this.loaderDelegate,runningAudio:this.runningAudio,activeMedia:this.activeMedia,isPlayerPaused:this.isPlayerPaused,timingEventHub:new gi.a,maxResolution:this.maxResolution,animatedIds:new Set,volumeAdjuster:this.volumeAdjuster,forceCanvas:this.forceCanvas,globalEventHub:this.globalEventHub,latestChangeFullscreenTargetId:"",isRendering:!1,urlInterrupter:this.urlInterrupter,enableWebAudio:this.enableWebAudio};this.stageCtxs[t]=o}),"@StagePool[createCtx]")}loadStageJson(t){const{task:e}=this.stageStates[t];e.addMTask(n=>ia(this,void 0,void 0,function*(){var r;const o=yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/slide-${t}.json`,n);if(((r=this.stageStates[t])===null||r===void 0?void 0:r.task)!==e)throw new Ha(t);this.stageJsons[t]=o,this.stageCtxs[t].stageWidth=o.width,this.stageCtxs[t].stageHeight=o.height,this.stageCtxs[t].featureList=o.featureList}),"@StagePool[loadStageJson]")}loadSpriteSheets(t){const{task:e}=this.stageStates[t];e.addMTask(()=>{const n=this.stageJsons[t],{coloredSheets:r,sheets:o}=n,s=r||o;return s&&s.forEach(a=>{this.addSpriteSheetLoadTask(e,t,a)}),Promise.resolve()},"@StagePool[loadSpriteSheets]")}addSpriteSheetLoadTask(t,e,n){t.addSubMTask(r=>{const{spriteTexture:o}=this.stageCtxs[e],s=this.getSpriteSheetTextureScale(e);return o.loadSpriteSheetItem(this.url,this.taskId,n,s,r)},this.getSpriteSheetTaskName(n),{timeoutMs:this.getSpriteSheetTaskTimeoutMs()})}getSpriteSheetTextureScale(t){const{stageWidth:e,stageHeight:n}=this.stageCtxs[t];return this.getTextureScale(e,n)}getTextureScale(t,e){let n=1;if(t>this.maxResolution.x||e>this.maxResolution.y){n=this.maxResolution.x/t;const r=n*e;r>this.maxResolution.y&&(n*=this.maxResolution.y/r)}return Math.min(1,n)}getSpriteSheetTaskName(t){return`@StagePool[spriteTexture.loadSpriteSheetItem:${t}]`}getSpriteSheetTaskTimeoutMs(){const t=this.loader.estimateMaxResourceLoadDurationMs()+this.loader.estimateMaxImageLoadDurationMs()+1e4;return Math.max(6e4,t)}getStageTaskTimeoutMs(){const t=this.loader.estimateMaxImageLoadDurationMs()+1e4;return Math.max(6e4,t)}insertCustomLinksFromScope(t,e){t&&t.length&&t.forEach(n=>{n&&(n.type==="Shape"||n.type==="Picture"?n.id===e.shapeId&&(n.hlinkClick&&this.logger.warn(`Custom link ${e.shapeId} already has action, will force rewrite`,this.taskId),n.hlinkClick={uuid:`customLink-${e.pageIndex}-${e.shapeId}`,action:"",target:e.link}):n.children&&this.insertCustomLinksFromScope(n.children,e))})}insertCustomLinks(t,e){return e&&e.length&&e.forEach(n=>{let r;r=n.shapeId.startsWith("master")?t.children[1]:n.shapeId.startsWith("layout")?t.children[2]:t.children[3],r?this.insertCustomLinksFromScope(r.children,n):this.logger.error("Cannot find scope for custom link "+n.shapeId,this.taskId)}),t}createStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>{var n;let r=this.stageJsons[t];const o=this.stageCtxs[t],s=(n=this.customLinks)===null||n===void 0?void 0:n.filter(l=>l.pageIndex===t);r=this.insertCustomLinks(r,s);const a=new US(r,o,{x:0,y:0},e);return this.stageImpls[t]=a,Promise.resolve()},"@StagePool[createStage]")}preRenderStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>(this.stageImpls[t].preRender(e),Promise.resolve()),"@StagePool[preRenderStage]")}createGraphicsTexture(t){const{task:e}=this.stageStates[t];e.addMTask(()=>ia(this,void 0,void 0,function*(){const n=this.stageCtxs[t];n.graphicsTexture.pack().forEach((r,o)=>{e.addSubMTask(s=>n.graphicsTexture.render(r,o,this.objPoolGroup,1,s),"@StagePool[graphicsTexture.render]")})}),"@StagePool[createGraphicsTexture]")}renderStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>ia(this,void 0,void 0,function*(){yield this.stageImpls[t].render(e)}),"@StagePool[renderStage]")}destroyStageByIndex(t){this.detachAndDisposeStage(t)}destroyStage(){this.getTrackedStageIndexes().forEach(t=>{Math.abs(this.currentStageIndex-t)>this.cacheCount&&this.destroyStageByIndex(t)})}destroyAllStage(){this.getTrackedStageIndexes().forEach(t=>{this.destroyStageByIndex(t)})}preloadResource(t){return ia(this,void 0,void 0,function*(){const e=yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/slide-${t}.json`),{coloredSheets:n,sheets:r}=e,o=n||r;for(const s of o){yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/${s}.json`);const a=this.getTextureScale(e.width,e.height);yield this.loader.fetchPng(`${this.url}/${this.taskId}/jsonOutput/${s}.png`,a)}})}preload(t,e=!1){const n=this.stageStates[t];if(n)return n.preloadPromise;if(this.stageImpls[t])return Promise.resolve();let r,o;const s=new Promise((l,h)=>{r=l,o=h});let a;try{a=new zS(t,this.taskId,this.logger,this.getStageTaskTimeoutMs())}catch(l){return o(l),s}a.on("task-error",(l,h)=>{o(l),this.detachAndDisposeStage(h,a),this.errorChannel.emit("error",l,h)}),a.once("task-cancel",l=>o(l)),a.once("task-finish",()=>{const l=this.stageStates[t];(l==null?void 0:l.task)===a&&(l.state="finish",Object.keys(this.stageStates).length>2*this.cacheCount+1&&this.destroyStage(),r())});try{this.stageStates[t]={state:"load",task:a,preloadPromise:s},this.createCtx(t),this.loadStageJson(t),this.loadSpriteSheets(t),this.createStage(t),this.preRenderStage(t),this.createGraphicsTexture(t),this.renderStage(t),this.microTaskManager.addTask(a),e&&a.applyAll().catch(l=>{o(l)})}catch(l){o(l),this.detachAndDisposeStage(t,a)}return s}getTrackedStageIndexes(){const t=new Set([...Object.keys(this.stageStates),...Object.keys(this.stageJsons),...Object.keys(this.stageImpls),...Object.keys(this.stageCtxs)]);return Array.from(t).map(e=>parseInt(e,10))}detachAndDisposeStage(t,e){const n=this.stageStates[t];if(e&&(n==null?void 0:n.task)!==e)return;const r=this.stageImpls[t],o=this.stageCtxs[t];delete this.stageStates[t],delete this.stageJsons[t],delete this.stageImpls[t],delete this.stageCtxs[t],(n==null?void 0:n.state)==="load"?(n.task.cancel(),this.disposeDetachedStage(t,r,o),n.task.whenIdle(1e4).then(s=>{s||this.logger.warn(`stage ${t} tasks did not stop within 10000ms after cleanup`,this.taskId)}).catch(s=>{this.logger.warn(`wait for stage ${t} tasks to stop error: ${s}`,this.taskId)})):this.disposeDetachedStage(t,r,o)}disposeDetachedStage(t,e,n){var r;try{n==null||n.slideScopeEventHub.removeAllListeners(),e?e.destroy():(n==null||n.eventHub.removeAllListeners(),n==null||n.timingEventHub.removeAllListeners(),n==null||n.graphicsTexture.destroy(),(r=n==null?void 0:n.bgTexture)===null||r===void 0||r.destroy(!0),n==null||n.spriteTexture.destroy())}catch(o){this.logger.warn(`cleanup failed stage ${t} error: ${o}`,this.taskId)}}getStageJson(t){return this.stageJsons[t]||null}getStage(t){return ia(this,void 0,void 0,function*(){this.currentStageIndex=t;const e=this.stageStates[t];return(e==null?void 0:e.state)==="finish"&&this.stageImpls[t]?this.stageImpls[t]:(e==null?void 0:e.state)==="load"?(yield e.task.applyAll(),this.stageImpls[t]):(yield this.preload(t,!0),this.stageImpls[t])})}destroy(){this.microTaskManager.destroy(),this.runningAudio.clear(),this.sdfManager.destroy()}}const YS=new class extends o0{createObject(){return document.createElement("img")}resetObject(i){i.removeAttribute("src")}};var k0=function(i,t,e,n){return new(e||(e=Promise))(function(r,o){function s(h){try{l(n.next(h))}catch(u){o(u)}}function a(h){try{l(n.throw(h))}catch(u){o(u)}}function l(h){var u;h.done?r(h.value):(u=h.value,u instanceof e?u:new e(function(p){p(u)})).then(s,a)}l((n=n.apply(i,t||[])).next())})};class Lr{constructor(t){var e;this.logger=t,this.taskId="",this.isIndexDBReady=!1,this.memoryCache=new Map,(e=Lr.localCache)===null||e===void 0||e.ready(n=>{n||(this.isIndexDBReady=!0)}).catch(()=>{t.warn("local storage not ready",this.taskId)})}get couldUseIndexDBCache(){return this.isIndexDBReady&&this.taskId.length>0}attachTaskId(t){this.taskId=t}getItem(t){return k0(this,void 0,void 0,function*(){let e=null;if(this.couldUseIndexDBCache&&Lr.localCache)try{e=yield Ga(()=>Lr.localCache.getItem(`${this.taskId}/${t}`),500)}catch{}return e=e===zo?null:e,e||this.memoryCache.get(t)||null})}setItem(t,e,n=!1){return k0(this,void 0,void 0,function*(){if(!this.couldUseIndexDBCache)return n&&this.memoryCache.set(t,e),Promise.resolve();if(Lr.localCache){let r=null;try{r=yield Ga(()=>Lr.localCache.setItem(`${this.taskId}/${t}`,e).catch(()=>{n&&this.memoryCache.set(t,e)}),500)}catch{}r!==zo&&r!==null||!n||this.memoryCache.set(t,e)}})}dispose(){var t;this.memoryCache=new Map,this.couldUseIndexDBCache&&((t=Lr.localCache)===null||t===void 0||t.keys().then(e=>{e.filter(n=>n.indexOf(this.taskId)>=0).forEach(n=>{var r;(r=Lr.localCache)===null||r===void 0||r.removeItem(n).catch(()=>{})})}).catch(()=>{}))}}Lr.localCache=null;try{Lr.localCache=P.createInstance({name:"slide_local_cache",driver:P.INDEXEDDB,version:1})}catch{}const qS=new Ie.j;class wc{constructor(t){this.localStorage=t}canvas(t,e,n,r){let o,s,a,l=!1,h=!1;t&&(t instanceof le.p?a=t:(a=e.generateTexture(t),h=!0)),a?(o=a.baseTexture.resolution,s=a.frame,l=!1):(o=e.resolution,l=!0,s=qS,s.width=e.width,s.height=e.height,e.renderTexture.bind(null));const u=Math.floor(s.width*o+1e-4),p=Math.floor(s.height*o+1e-4);let y=document.createElement("canvas");y.width=u,y.height=p;const b=y.getContext("2d");if(!b)throw new Error("ctx");if(n)b.putImageData(n,0,0);else{const w=b.getImageData(0,0,u,p),M=new Uint8Array(4*u*p),{gl:I}=e;I.readPixels(s.x*o,s.y*o,u,p,I.RGBA,I.UNSIGNED_BYTE,M),wc.arrayPostDivide(M,w.data),b.putImageData(w,0,0),r&&this.localStorage.setItem(r,w).catch(()=>{})}if(l){const w=document.createElement("canvas");w.width=u,w.height=p;const M=w.getContext("2d");M.scale(1,-1),M.drawImage(y,0,-p),y=w}return h&&(a==null||a.destroy(!0)),y}static arrayPostDivide(t,e){for(let n=0;n<t.length;n+=4){const r=e[n+3]=t[n+3];r!==0?(e[n]=Math.round(Math.min(255*t[n]/r,255)),e[n+1]=Math.round(Math.min(255*t[n+1]/r,255)),e[n+2]=Math.round(Math.min(255*t[n+2]/r,255))):(e[n]=t[n],e[n+1]=t[n+1],e[n+2]=t[n+2])}}}class U0 extends gi.a{constructor(){super(...arguments),this._volume=.5}get volume(){return this._volume}set volume(t){t<0&&(t=0),t>1&&(t=1),this._volume=t,this.emit("update",this._volume)}}var gs=function(i,t,e,n){return new(e||(e=Promise))(function(r,o){function s(h){try{l(n.next(h))}catch(u){o(u)}}function a(h){try{l(n.throw(h))}catch(u){o(u)}}function l(h){var u;h.done?r(h.value):(u=h.value,u instanceof e?u:new e(function(p){p(u)})).then(s,a)}l((n=n.apply(i,t||[])).next())})};xn.skipHello();const G0={randomBar:"RandomLines",circle:"Shape",ripple:"Ripples",wipe:"Erase",dissolve:"Dissolve",morph:"Smooth",fade:"FadeInOut",push:"Push",split:"Separation",reveal:"Display",pull:"Uncover",cover:"Cover",flash:"Flash",checker:"Checkerboard",blinds:"WindowShades",curtains:"Curtain",fallOver:"Fall",drape:"Suspension",wheel:"Clock",comb:"Combing",warp:"Scale",peelOff:"PeelOff",flip:"Flip",gallery:"Gallery",switch:"Switch",prism:"Prism",doors:"Doors"},ze={mainSeqStepChange:"mainSeqStepChange",mainSeqStateChange:"mainSeqStateChange",interactiveSeqStateChange:"interactiveSeqStateChange",interactiveSeqAction:"interactiveSeqAction",mainSeqStepStart:"mainSeqStepStart",mainSeqStepEnd:"mainSeqStepEnd",slideChange:"slideChange",renderStart:"renderStart",renderEnd:"renderEnd",hyperlinkTrigger:"hyperlinkTrigger",animateStart:"animateStart",animateEnd:"animateEnd",mediaSeek:"mediaSeek",mediaPlay:"mediaPlay",mediaPause:"mediaPause",mediaStop:"mediaStop",requestNextStep:"requestNextStep",requestNextSlide:"requestNextSlide",requestPrevSlide:"requestPrevSlide",requestGotoSlide:"requestGotoSlide",requestOpenUrl:"requestOpenUrl",userInput:"userInput",fullscreenChange:"fullscreenChange",changeLocalFullscreenState:"changeLocalFullscreenState",useraddLink:"useraddLink"};class ur extends gi.a{constructor(t,e={}){super(),this.errorChannel=new gi.a,this.transactionPlayer=null,this.isForward=!0,this.drawCall=0,this.scale=1,this._isPaused=!1,this.maxResolution=new Ie.g(0,0),this.transitionResolution=new Ie.g(0,0),this.isNVIDIA=!1,this.fps=new Eb,this.designWidth=0,this.designHeight=0,this.currentIndex=0,this.slideCount=0,this.runtime={drawCall:0,fps:0},this.globalEventHub=new gi.a,this.globalVideoBackground=new Zi,this.globalVideoSprite=new pi,this.onMousemoveTimeout=null,this.cacheFunctionMap=new Map,this.enableAutoForward=!1,this.isPlayerPaused=()=>this._isPaused,this.onWebGLLost=()=>{this.errorChannel.emit("error",new Hn(Yn.CanvasCrash,"webgl context lost."))},this.fullscreenOnMousemove=({index:o,targetId:s})=>{this.globalEventHub.emit("controllerShowStatusChange",{slideIndex:o,targetId:s,status:!0}),this.onMousemoveTimeout&&clearTimeout(this.onMousemoveTimeout),this.onMousemoveTimeout=setTimeout(()=>{this.globalEventHub.emit("controllerShowStatusChange",{slideIndex:o,targetId:s,status:!1})},Wo.hoverHiddeDelay)},this.fullscreenOnMouseleave=({index:o,targetId:s})=>{this.globalEventHub.emit("controllerShowStatusChange",{slideIndex:o,targetId:s,status:!1})},this.calculateFullscreenVideoPosition=o=>{const{width:s,height:a}=o,{designWidth:l,designHeight:h}=this,u=Math.min(l/s,h/a);return{x:(l-s*u)/2,y:(h-a*u)/2,width:s*u,height:a*u}},this.onRequestFullscreenVideo=o=>{const{texture:s,index:a,targetId:l}=o;if(a!==this.currentIndex)return void s.destroy(!1);this.onRequestCancelFullscreenVideo(),this.globalVideoBackground.width=this.designWidth,this.globalVideoBackground.height=this.designHeight,this.globalVideoBackground.beginFill(0,1),this.globalVideoBackground.drawRect(0,0,this.designWidth,this.designHeight),this.globalVideoBackground.endFill(),this.globalVideoBackground.interactive=!0,this.app.stage.addChild(this.globalVideoBackground);const{x:h,y:u,width:p,height:y}=this.calculateFullscreenVideoPosition(s);this.globalVideoSprite.texture=s,this.globalVideoSprite.width=p,this.globalVideoSprite.height=y,this.globalVideoSprite.position.x=h,this.globalVideoSprite.position.y=u,this.globalVideoBackground.addChild(this.globalVideoSprite),this.globalEventHub.emit("onFullscreenChange",{status:!0,targetId:l,slideIndex:this.currentIndex}),this.clearFullscreenEventListenersWithAppView();const b={handleEvent:()=>{var w;(w=this.currentStage)===null||w===void 0||w.ctx.eventHub.emit(ze.userInput)}};if(this.app.view.addEventListener("pointerdown",b,!1),this.cacheFunctionMap.set("pointerdown",b),ms.isDesktop()){const w={handleEvent:()=>{this.fullscreenOnMouseleave({index:a,targetId:l})}};this.app.view.addEventListener("mouseout",w,!1);const M={handleEvent:()=>{this.globalEventHub.emit("controllerShowStatusChange",{slideIndex:a,targetId:l,status:!0})}};this.app.view.addEventListener("mouseover",M,!1);const I={handleEvent:()=>{this.fullscreenOnMousemove({index:a,targetId:l})}},H={handleEvent:()=>{var J;(J=this.currentStage)===null||J===void 0||J.ctx.globalEventHub.emit("togglePlayStatus",l)}};this.app.view.addEventListener("mousemove",I,!1),this.app.view.addEventListener("click",H,!1),this.cacheFunctionMap.set("click",H),this.cacheFunctionMap.set("mouseover",M),this.cacheFunctionMap.set("mousemove",I),this.cacheFunctionMap.set("mouseout",w)}else{const w={handleEvent:()=>{var M;this.fullscreenOnMousemove({index:a,targetId:l}),(M=this.currentStage)===null||M===void 0||M.ctx.globalEventHub.emit("togglePlayStatus",l)}};this.app.view.addEventListener("touchstart",w,!1),this.cacheFunctionMap.set("touchstart",w)}},this.onRequestCancelFullscreenVideo=(o=!1)=>{var s,a;this.globalVideoSprite.texture.destroy(!1);try{this.globalVideoBackground.removeChild(this.globalVideoSprite)}catch{this.logger.error("removeChild error: PPTPlayer:1057",this.taskId)}try{this.app.stage.removeChild(this.globalVideoBackground)}catch{this.logger.error("removeChild error: PPTPlayer:1062",this.taskId)}this.globalEventHub.emit("onFullscreenChange",{status:!1,slideIndex:this.currentIndex,targetId:(s=this.currentStage)===null||s===void 0?void 0:s.ctx.latestChangeFullscreenTargetId}),this.clearFullscreenEventListenersWithAppView(),o&&this.emit(ze.changeLocalFullscreenState,{status:!1,slideIndex:this.currentIndex,targetId:(a=this.currentStage)===null||a===void 0?void 0:a.ctx.latestChangeFullscreenTargetId})},this.logger=t.logger,this.tracker=t.tracker,this.mode=t.mode,this.volumeAdjuster=t.volumeAdjuster,this.localStorage=new Lr(this.logger),this.cachedExtract=new wc(this.localStorage),this.enableWebAudio=!!vi()(t.enableWebAudio)||t.enableWebAudio,this.enableAutoForward=!vi()(t.enableAutoForward)&&t.enableAutoForward,this.config={minFPS:vi()(e.minFPS)?30:e.minFPS,maxFPS:vi()(e.maxFPS)?40:e.maxFPS,resolution:vi()(e.resolution)?1:e.resolution,autoFPS:!vi()(e.autoFPS)&&e.autoFPS,autoResolution:!vi()(e.autoResolution)&&e.autoResolution,transactionBgColor:vi()(e.transactionBgColor)?0:e.transactionBgColor,maxResolutionLevel:this.getMaxResolution(e.maxResolutionLevel),forceCanvas:!vi()(e.forceCanvas)&&e.forceCanvas,enableNvidiaDetect:!vi()(e.enableNvidiaDetect)&&e.enableNvidiaDetect,transitionResolutionLevel:this.getMaxResolution(e.transitionResolutionLevel),antialias:!!vi()(e.antialias)||e.antialias},this.updateMaxResolutionLevel(this.config.maxResolutionLevel),this.updateTransitionResolutionLevel(this.config.transitionResolutionLevel),this.loader=new Cb(this.localStorage,t.useLocalCache,this.logger,this.tracker,t.resourceTimeout,t.loadDelegate,t.urlInterrupter,t.resourceMaxRetries,t.onResourceMaxRetries);const n=xn.isWebGLSupported();this.app=new Vl({antialias:this.config.antialias,autoDensity:!1,backgroundColor:16777215,forceCanvas:this.config.forceCanvas||!n}),globalThis.__PIXI_APP__=this.app,this.tracker({name:"slidePlayerCreate",result:"",reason:"",payload:{webgl:n,resolution:this.config.resolution,minFPS:this.config.minFPS,maxFPS:this.config.maxFPS,maxResolutionLevel:this.config.maxResolutionLevel,forceCanvas:this.config.forceCanvas}}),this.updateConfig(this.config),this.app.ticker.maxFPS=60,this.app.ticker.minFPS=this.config.minFPS,this.app.ticker.maxFPS=this.config.maxFPS,this.app.view.style.zIndex="1",this.app.stage.sortableChildren=!0;const r=this.app.renderer;if(r.gl){const{drawElements:o}=r.gl,s=r.gl.getExtension("WEBGL_debug_renderer_info"),a=r.gl.getParameter(s.UNMASKED_RENDERER_WEBGL);/nvidia/i.test(a)&&this.config.enableNvidiaDetect&&(this.isNVIDIA=!0),r.gl.drawElements=(...l)=>{o.call(r.gl,...l),this.drawCall+=1}}this.fps.on("update",o=>{if(o<this.config.minFPS){if(this.config.autoResolution){const s=.7*this.scale,a=this.app.renderer.resolution,l=Math.max(s,a-.1);l>=s&&this.updateResolution(l)}}else if(o>this.config.maxFPS&&this.config.autoResolution){const s=this.scale*this.config.resolution,a=this.app.renderer.resolution,l=Math.min(s,a+.1);l<=this.config.resolution&&this.updateResolution(l)}}),this.app.ticker.add(()=>{this.runtime.drawCall=this.drawCall,this.runtime.fps=Math.floor(this.app.ticker.minFPS),this.drawCall=0},null,nr.c.LOW),this.clock=new Rb(this.app.ticker),this.objPoolGroup=Zs(),this.stagePool=new XS(this.loader,this.mode,this.app.renderer,this.app.ticker,this.app.view,this.clock,this.objPoolGroup,this.errorChannel,this.localStorage,this.logger,t.loadDelegate,t.urlInterrupter,this.isPlayerPaused,this.maxResolution,this.volumeAdjuster,this.config.forceCanvas,this.globalEventHub,this.enableWebAudio,t.customLinks),this.app.view.addEventListener("webglcontextlost",this.onWebGLLost);try{this.config.forceCanvas||(this.transactionPlayer=new jx)}catch(o){/Error creating WebGL context/.test(o.message)?this.errorChannel.emit("error",new Hn(Yn.CanvasCrash,"webgl context lost.")):this.errorChannel.emit("error",new Hn(Yn.RuntimeWarn,o.message))}this.globalEventHub.on("requestFullscreen",this.onRequestFullscreenVideo),this.globalEventHub.on("requestCancelFullscreen",this.onRequestCancelFullscreenVideo),this.mode==="addLink"&&this.globalEventHub.on("user-add-click",o=>{this.emit(ze.useraddLink,o)}),this.enableAutoForward&&this.on(ze.mainSeqStepEnd,()=>{this.startAutoForwardTimer(this.currentStage)})}get view(){return this.app.renderer?this.app.view:null}get nextSlideIndex(){var t;return!((t=this.currentStage)===null||t===void 0)&&t.json.nextIndex?this.currentStage.json.nextIndex:this.currentIndex+1}get prevSlideIndex(){var t;return!((t=this.currentStage)===null||t===void 0)&&t.json.prevIndex?this.currentStage.json.prevIndex:this.currentIndex-1}getMaxResolution(t){return!vi()(t)&&Number.isInteger(t)?(t<1&&(t=1),t>4&&(t=4),t):ur.platform.isAndroid()||ur.platform.isIOS()?2:4}updateMaxResolutionLevel(t){t<0&&(t=0),t>4&&(t=4);const e=[640,960,1280,1920,3200][t],n=[360,540,720,1080,1800][t];this.maxResolution.set(e,n)}updateTransitionResolutionLevel(t){t<0&&(t=0),t>4&&(t=4);const e=[640,960,1280,1920,3200][t],n=[360,540,720,1080,1800][t];this.transitionResolution.set(e,n)}updateConfig(t){vi()(t.maxFPS)||vi()(t.minFPS)||(this.config.maxFPS=t.maxFPS,this.app.ticker.maxFPS=t.maxFPS,this.config.minFPS=t.minFPS,this.app.ticker.minFPS=t.minFPS),vi()(t.resolution)||(this.config.resolution=t.resolution,this.updateResolution(this.scale*this.config.resolution)),vi()(t.autoFPS)||(this.config.autoFPS=t.autoFPS),vi()(t.autoResolution)||(this.config.autoResolution=t.autoResolution),vi()(t.transactionBgColor)||(this.config.transactionBgColor=t.transactionBgColor),this.taskId&&this.logger.info("ppt player update config: "+JSON.stringify(this.config),this.taskId),vi()(t.maxResolutionLevel)||(this.config.maxResolutionLevel=t.maxResolutionLevel,this.updateMaxResolutionLevel(this.config.maxResolutionLevel)),vi()(t.transitionResolutionLevel)||(this.config.transitionResolutionLevel=t.transitionResolutionLevel,this.updateTransitionResolutionLevel(this.config.transitionResolutionLevel))}preload(t){return gs(this,void 0,void 0,function*(){if(t<1||t>this.slideCount)return;const e=Date.now();this.logger.info(`preload slide ${t} begin`,this.taskId),yield this.stagePool.preload(t),this.logger.info(`preload slide ${t} end`,this.taskId),this.tracker({name:"slidePreload",reason:"",result:"",payload:{duration:Date.now()-e,index:t}})})}preloadResource(t){return gs(this,void 0,void 0,function*(){if(t<1||t>this.slideCount)return;const e=Date.now();this.logger.info(`preload slide resource ${t} begin`,this.taskId),yield this.stagePool.preloadResource(t),this.logger.info(`preload slide resource ${t} end`,this.taskId),this.tracker({name:"slidePreloadResource",reason:"",result:"",payload:{duration:Date.now()-e,index:t}})})}setResourceData(t,e){this.logger.info("ppt player init config: "+JSON.stringify(this.config),t),this.logger.info("set resource to "+e,t),this.taskId=t,this.url=e,this.stagePool.setResourceData(t,e),this.localStorage.attachTaskId(t),this.loader.attachTaskId(t)}setInteractive(t){this.app.stage.interactive=t,this.app.stage.interactiveChildren=t}translateEvent(t,e){e.forEach(n=>{t.on(n,(...r)=>{var o,s,a,l;n===ze.requestGotoSlide&&r[0]!==this.currentIndex&&((s=(o=this.currentStage)===null||o===void 0?void 0:o.timing)===null||s===void 0||s.setMainSeqStep(0,"start"),(l=(a=this.currentStage)===null||a===void 0?void 0:a.timing)===null||l===void 0||l.destroy()),this.emit(n,...r)})})}clearAutoForwardTimer(){this.enableAutoForward&&this.autoForwardTimer&&(this.clock.clearTimeout(this.autoForwardTimer),this.autoForwardTimer=null)}startAutoForwardTimer(t){var e;if(!this.enableAutoForward||!t)return;this.clearAutoForwardTimer();const n=(e=t.json.transition)===null||e===void 0?void 0:e.advTm;vi()(n)||(this.autoForwardTimer=this.clock.setTimeout(()=>{this.view&&this.mainSeqState()!=="running"&&(this.mainSeqHasNextStep()?this.emit(ze.requestNextStep):this.currentIndex<this.slideCount?this.emit(ze.requestNextSlide,!1):this.clearAutoForwardTimer())},n/(this.mainSeqLength()+1)))}renderSlide(t){var e,n,r;return gs(this,void 0,void 0,function*(){if(this.clearAutoForwardTimer(),this._isPaused)return void this.logger.info("ppt play prevent render slide with paused state",this.taskId);const o=this.currentIndex,s=Date.now();this.logger.info("render slide "+t,this.taskId),this.emit(ze.renderStart,t);const a=yield this.stagePool.getStage(t),l=`snapshot-${t}-${this.isForward?"start":"end"}`,h=yield this.localStorage.getItem(l);if(!a)return;a.ctx.isRendering=!0,this.translateEvent(a.ctx.eventHub,[ze.mainSeqStepChange,ze.mainSeqStateChange,ze.hyperlinkTrigger,ze.interactiveSeqAction,ze.mainSeqStepStart,ze.mainSeqStepEnd,ze.animateStart,ze.animateEnd,ze.mediaPlay,ze.mediaPause,ze.mediaSeek,ze.mediaStop,ze.requestGotoSlide,ze.requestOpenUrl,ze.requestNextSlide,ze.requestPrevSlide,ze.interactiveSeqStateChange,ze.userInput,ze.fullscreenChange,ze.changeLocalFullscreenState]),this.currentIndex=Number(t);const{width:u,height:p,slideCount:y}=a.json;this.slideCount=y,this.designWidth=u,this.designHeight=p,(e=this.currentStage)===null||e===void 0||e.clearOnSlideChange();const b=this.currentStage;this.currentStage=a,a.initOnReuse(),a.createTiming(),a.container.visible=!0,a.collectMainSeqStartValue(),this.isForward?a.setMainSeqStep(0,"start"):a.setMainSeqStep(-1,"end"),this.onRequestCancelFullscreenVideo(!0);const w=()=>!!this.app.renderer.gl;let M=!1;if(xn.isWebGLSupported()&&!this.config.forceCanvas&&a.json.transition&&a.json.transition.type&&this.app.stage.children.length>0&&this.view&&b&&!w()){let{transition:I}=a.json;!this.isForward&&(b==null?void 0:b.json.transition)&&(I=b.json.transition);const H=this.getTransactionTexture(b,this.view,null,null);this.initTransactionPlayer(I),(n=this.transactionPlayer)===null||n===void 0||n.setPrevTexture(H),M=!0}if(this.app.stage.addChild(a.container),this.updateResolution(this.config.resolution*this.scale),b){b.clearOnTransactionEnd();try{this.app.stage.removeChild(b.container)}catch{this.logger.error("removeChild error: PPTPlayer:622",this.taskId)}}if(a.json.transition&&a.json.transition.type&&this.app.stage.children.length>0&&this.view&&this.transactionPlayer&&M&&!w()){const I=this.getTransactionTexture(a,this.view,l,h);this.transactionPlayer.setNextTexture(I),this.tracker({name:"slidePageChangePure",reason:"",result:"",payload:{duration:Date.now()-s,from:o,to:t}}),yield this.transactionPlayer.play();const H=this.transactionPlayer.renderer.domElement;if(this.view.parentElement&&H)try{this.view.parentElement.removeChild(H)}catch{this.logger.error("removeChild error: PPTPlayer:637",this.taskId)}(r=this.transactionPlayer)===null||r===void 0||r.dispose()}this.isForward?yield a.startTiming():a.setMainSeqApplied(),a.ctx.slideScopeEventHub.emit("slide-render",a.ctx.slideIndex,this.isForward),this.emit(ze.renderEnd,t),this.emit(ze.slideChange,t),a.ctx.isRendering=!1,this.preload(t+1).catch(I=>{I instanceof Ha||this.errorChannel.emit("error",Hn.transform(I),t+1)}),this.preload(t-1).catch(I=>{I instanceof Ha||this.errorChannel.emit("error",Hn.transform(I),t-1)}),this.logger.info(`render slide ${t} done, time: ${Date.now()-s}ms`,this.taskId),this.isForward&&this.startAutoForwardTimer(a),this.tracker({name:"slidePageChange",reason:"",result:"",payload:{duration:Date.now()-s,from:o,to:t}})})}getTransactionTexture(t,e,n,r){let o=this.transitionResolution.x/t.json.width;Math.floor(t.json.height*o+1e-4)>t.json.height&&(o=this.transitionResolution.y/t.json.height),o=Math.min(1,o);const s=le.p.create({width:t.json.width*o,height:t.json.height*o,resolution:1}),a=new Ie.d;a.scale(o,o),this.app.renderer.render(t.container,{renderTexture:s,transform:a});const l=this.cachedExtract.canvas(s,this.app.renderer,r,n);return new Q(l)}renderToBase64(t,e,n){return gs(this,void 0,void 0,function*(){const r=yield this.stagePool.getStage(t);if(r){const{width:o,height:s}=r.json;this.designWidth=o,this.designHeight=s;const a=le.p.create({width:this.designWidth,height:this.designHeight,resolution:e});r.container.visible=!0,this.app.renderer.render(r.container,{renderTexture:a});const l=this.app.renderer.plugins.extract.base64(a,n);return this.stagePool.destroyStageByIndex(t),l}return"__null__"})}renderMainSeqToBase64(t,e,n){return gs(this,void 0,void 0,function*(){const r=[],o=yield this.stagePool.getStage(t);if(o.createTiming(),o){const{width:s,height:a}=o.json;this.designWidth=s,this.designHeight=a;const l=le.p.create({width:this.designWidth,height:this.designHeight,resolution:e});o.container.visible=!0;const h=o.mainSeqLength();o.setMainSeqStep(0,"start"),this.app.renderer.render(o.container,{renderTexture:l});const u=this.app.renderer.plugins.extract.base64(l,n);r.push(u);for(let p=0;p<h;p+=1){o.setMainSeqStep(p,"end"),this.app.renderer.render(o.container,{renderTexture:l});const y=this.app.renderer.plugins.extract.base64(l,n);r.push(y)}}return r})}snapshotWithTimingEnd(t){return gs(this,void 0,void 0,function*(){const e=yield this.stagePool.getStage(t);if(e){const{width:n,height:r}=e.json;this.designWidth=n,this.designHeight=r;const o=le.p.create({width:this.designWidth,height:this.designHeight,resolution:1});e.container.visible=!0,e.initOnReuse(),e.createTiming(),e.collectMainSeqStartValue(),e.setMainSeqStep(-1,"end"),this.app.renderer.render(e.container,{renderTexture:o});const s=this.app.renderer.plugins.extract.base64(o,"image/png");return t!==this.currentIndex&&this.stagePool.destroyStageByIndex(t),s}return null})}getBase64(t){if(!t.container.transform)return null;const e=le.p.create({width:this.designWidth,height:this.designHeight,resolution:1});this.app.renderer.render(t.container,{renderTexture:e});const n=this.app.renderer.plugins.extract.base64(e,"image/jpeg");return e.destroy(!0),n}initTransactionPlayer(t){var e,n,r,o,s;const a=(e=this.view)===null||e===void 0?void 0:e.parentElement;if(this.view&&a&&G0[t.type]&&this.transactionPlayer){const l=(n=this.transactionPlayer)===null||n===void 0?void 0:n.renderer.domElement;this.transactionPlayer.initPlayer({reverse:!this.isForward,stageWidth:this.view.width,stageHeight:this.view.height,presetType:G0[t.type],duration:(o=(r=this.currentStage)===null||r===void 0?void 0:r.json.transition)===null||o===void 0?void 0:o.dur,delay:0,clearColor:this.config.transactionBgColor,maxFPS:Math.ceil((s=this.config.maxFPS)!==null&&s!==void 0?s:60),options:t.options}),l&&(l.style.position="absolute",l.style.zIndex="9",l.style.left="0",l.style.top="0",l.style.width=this.view.style.width,l.style.height=this.view.style.height),a.appendChild(l)}}scaleView(t,e,n){var r;this.view&&(this.view.style.width=Math.floor(this.designWidth*t)+"px",this.view.style.height=Math.floor(this.designHeight*t)+"px");const o=(r=this.transactionPlayer)===null||r===void 0?void 0:r.renderer.domElement;if(o&&this.view&&(o.style.width=this.view.style.width,o.style.height=this.view.style.height),e){this.scale=t;const s=this.scale*this.config.resolution;this.updateResolution(s,n)}}updateResolution(t,e){this.app.ticker.addOnce(()=>{let n=ms.isDesktop()?t:1;for(;n*this.designWidth>this.maxResolution.x||n*this.designHeight>this.maxResolution.y;)n-=.1;this.app.renderer.resolution=n,this.app.renderer.plugins.interaction.resolution=this.app.renderer.resolution,this.app.renderer.resize(this.designWidth,this.designHeight),y_()(e)&&e()})}nextStep(t,e){var n;if(this._isPaused)this.logger.info("ppt play prevent next step with paused state",this.taskId);else{this.logger.info("ppt play trigger next step",this.taskId);try{this.onRequestCancelFullscreenVideo(!0),(n=this.currentStage)===null||n===void 0||n.nextStep(t,e)}catch(r){this.errorChannel.emit("error",Hn.transform(r),this.currentIndex)}}}prevStep(t=!1){var e;if(this._isPaused)this.logger.info("ppt play prevent prev step with paused state",this.taskId);else{this.logger.info("ppt play trigger prev step",this.taskId);try{this.clearAutoForwardTimer(),this.onRequestCancelFullscreenVideo(!0),(e=this.currentStage)===null||e===void 0||e.prevStep(t)}catch(n){this.errorChannel.emit("error",Hn.transform(n),this.currentIndex)}}}mainSeqLength(){var t,e;return(e=(t=this.currentStage)===null||t===void 0?void 0:t.mainSeqLength())!==null&&e!==void 0?e:0}mainSeqStep(){var t,e;return(e=(t=this.currentStage)===null||t===void 0?void 0:t.mainSeqStep())!==null&&e!==void 0?e:0}setMainSeqStep(t,e){var n;(n=this.currentStage)===null||n===void 0||n.setMainSeqStep(t,e)}mainSeqState(){var t,e;return(e=(t=this.currentStage)===null||t===void 0?void 0:t.mainSeqState())!==null&&e!==void 0?e:null}mainSeqHasNextStep(){var t,e;return(e=(t=this.currentStage)===null||t===void 0?void 0:t.mainSeqHasNextStep())!==null&&e!==void 0&&e}mainSeqHasPrevStep(){var t,e;return(e=(t=this.currentStage)===null||t===void 0?void 0:t.mainSeqHasPrevStep())!==null&&e!==void 0&&e}nextTick(t){this.app.ticker.addOnce(()=>{t()},nr.c.LOW)}applyInteractiveAction(t){var e;(e=this.currentStage)===null||e===void 0||e.applyInteractiveAction(t)}seekInteractiveSeqToEnd(t){var e;(e=this.currentStage)===null||e===void 0||e.seekInteractiveSeqToEnd(t)}setInteractiveSeqState(t,e,n){var r;(r=this.currentStage)===null||r===void 0||r.setInteractiveSeqState(t,e,n)}setMediaState(t,e,n){var r;return gs(this,void 0,void 0,function*(){yield(r=this.currentStage)===null||r===void 0?void 0:r.setMediaState(t,e,n)})}setMediaCurrentTime(t,e){var n;(n=this.currentStage)===null||n===void 0||n.setMediaCurrentTime(t,e)}pause(){var t;this.app.ticker.stop(),(t=this.currentStage)===null||t===void 0||t.ctx.activeMedia.forEach(e=>{e.globalPause()}),this._isPaused=!0}resume(){var t;this._isPaused=!1,this.app.ticker.start(),(t=this.currentStage)===null||t===void 0||t.ctx.activeMedia.forEach(e=>{e.globalResume()})}getSnapshot(){return this.currentStage&&this.getBase64(this.currentStage)||""}clearLocalCache(){this.localStorage.dispose()}static clearLocalCache(){var t;(t=Lr.localCache)===null||t===void 0||t.clear().catch(()=>{})}clearFullscreenEventListenersWithAppView(){["mousemove","click","mouseout","mouseover","touchstart","pointerdown"].forEach(t=>{this.cacheFunctionMap.has(t)&&(this.app.view.removeEventListener(t,this.cacheFunctionMap.get(t),!1),this.cacheFunctionMap.delete(t))})}syncFullscreenVideoState(t){this.globalEventHub.emit("syncFullscreenVideoState",t)}destroy(){var t;try{this.clearAutoForwardTimer(),this.app.view.removeEventListener("webglcontextlost",this.onWebGLLost),lc.collectObjectByGroup(this.objPoolGroup),YS.collectObjectByGroup(this.objPoolGroup),(t=this.transactionPlayer)===null||t===void 0||t.destroy(),this.loader.destroy(),this.fps.destroy(),this.stagePool.destroyAllStage(),this.stagePool.destroy()}catch{}(function(e){var n,r,o,s,a,l,h;let u=null,p=null;try{u=e.view}catch{}try{p=e.renderer}catch{}try{(o=(r=(n=p==null?void 0:p.filter)===null||n===void 0?void 0:n.texturePool)===null||r===void 0?void 0:r.clear)===null||o===void 0||o.call(r,!0)}catch{}try{(h=(l=(a=(s=p==null?void 0:p.gl)===null||s===void 0?void 0:s.getExtension)===null||a===void 0?void 0:a.call(s,"WEBGL_lose_context"))===null||l===void 0?void 0:l.loseContext)===null||h===void 0||h.call(l)}catch{}try{e.destroy(!0,{children:!0,texture:!0,baseTexture:!0})}catch{}finally{u!=null&&u.parentNode&&u.parentNode.removeChild(u)}})(this.app);try{this.tracker({name:"slidePlayerDestroy",result:"",reason:"",payload:{}})}catch{}}}ur.platform=ms,ur.RtcAudioClazz=null;var Ec=new Map,Ja,JS=m(136),KS=m.n(JS),ZS=m(24),wh=m.n(ZS),$S=m(50),H0=m.n($S),vs=[],j0="ResizeObserver loop completed with undelivered notifications.";(function(i){i.BORDER_BOX="border-box",i.CONTENT_BOX="content-box",i.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Ja||(Ja={}));var Ac,ys=function(i){return Object.freeze(i)},QS=function(i,t){this.inlineSize=i,this.blockSize=t,ys(this)},z0=function(){function i(t,e,n,r){return this.x=t,this.y=e,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,ys(this)}return i.prototype.toJSON=function(){var t=this;return{x:t.x,y:t.y,top:t.top,right:t.right,bottom:t.bottom,left:t.left,width:t.width,height:t.height}},i.fromRect=function(t){return new i(t.x,t.y,t.width,t.height)},i}(),Cc=function(i){return i instanceof SVGElement&&"getBBox"in i},V0=function(i){if(Cc(i)){var t=i.getBBox(),e=t.width,n=t.height;return!e&&!n}var r=i,o=r.offsetWidth,s=r.offsetHeight;return!(o||s||i.getClientRects().length)},W0=function(i){var t;if(i instanceof Element)return!0;var e=(t=i==null?void 0:i.ownerDocument)===null||t===void 0?void 0:t.defaultView;return!!(e&&i instanceof e.Element)},Ka=typeof window!="undefined"?window:{},Eh=new WeakMap,X0=/auto|scroll/,tw=/^tb|vertical/,ew=/msie|trident/i.test(Ka.navigator&&Ka.navigator.userAgent),no=function(i){return parseFloat(i||"0")},ra=function(i,t,e){return i===void 0&&(i=0),t===void 0&&(t=0),e===void 0&&(e=!1),new QS((e?t:i)||0,(e?i:t)||0)},Y0=ys({devicePixelContentBoxSize:ra(),borderBoxSize:ra(),contentBoxSize:ra(),contentRect:new z0(0,0,0,0)}),q0=function(i,t){if(t===void 0&&(t=!1),Eh.has(i)&&!t)return Eh.get(i);if(V0(i))return Eh.set(i,Y0),Y0;var e=getComputedStyle(i),n=Cc(i)&&i.ownerSVGElement&&i.getBBox(),r=!ew&&e.boxSizing==="border-box",o=tw.test(e.writingMode||""),s=!n&&X0.test(e.overflowY||""),a=!n&&X0.test(e.overflowX||""),l=n?0:no(e.paddingTop),h=n?0:no(e.paddingRight),u=n?0:no(e.paddingBottom),p=n?0:no(e.paddingLeft),y=n?0:no(e.borderTopWidth),b=n?0:no(e.borderRightWidth),w=n?0:no(e.borderBottomWidth),M=p+h,I=l+u,H=(n?0:no(e.borderLeftWidth))+b,J=y+w,it=a?i.offsetHeight-J-i.clientHeight:0,ft=s?i.offsetWidth-H-i.clientWidth:0,et=r?M+H:0,gt=r?I+J:0,lt=n?n.width:no(e.width)-et-ft,mt=n?n.height:no(e.height)-gt-it,Ut=lt+M+ft+H,Ft=mt+I+it+J,Mt=ys({devicePixelContentBoxSize:ra(Math.round(lt*devicePixelRatio),Math.round(mt*devicePixelRatio),o),borderBoxSize:ra(Ut,Ft,o),contentBoxSize:ra(lt,mt,o),contentRect:new z0(p,l,lt,mt)});return Eh.set(i,Mt),Mt},J0=function(i,t,e){var n=q0(i,e),r=n.borderBoxSize,o=n.contentBoxSize,s=n.devicePixelContentBoxSize;switch(t){case Ja.DEVICE_PIXEL_CONTENT_BOX:return s;case Ja.BORDER_BOX:return r;default:return o}},nw=function(i){var t=q0(i);this.target=i,this.contentRect=t.contentRect,this.borderBoxSize=ys([t.borderBoxSize]),this.contentBoxSize=ys([t.contentBoxSize]),this.devicePixelContentBoxSize=ys([t.devicePixelContentBoxSize])},K0=function(i){if(V0(i))return 1/0;for(var t=0,e=i.parentNode;e;)t+=1,e=e.parentNode;return t},iw=function(){var i=1/0,t=[];vs.forEach(function(r){if(r.activeTargets.length!==0){var o=[];r.activeTargets.forEach(function(s){var a=new nw(s.target),l=K0(s.target);o.push(a),s.lastReportedSize=J0(s.target,s.observedBox),l<i&&(i=l)}),t.push(function(){r.callback.call(r.observer,o,r.observer)}),r.activeTargets.splice(0,r.activeTargets.length)}});for(var e=0,n=t;e<n.length;e++)(0,n[e])();return i},Z0=function(i){vs.forEach(function(t){t.activeTargets.splice(0,t.activeTargets.length),t.skippedTargets.splice(0,t.skippedTargets.length),t.observationTargets.forEach(function(e){e.isActive()&&(K0(e.target)>i?t.activeTargets.push(e):t.skippedTargets.push(e))})})},rw=function(){var i,t=0;for(Z0(t);vs.some(function(e){return e.activeTargets.length>0});)t=iw(),Z0(t);return vs.some(function(e){return e.skippedTargets.length>0})&&(typeof ErrorEvent=="function"?i=new ErrorEvent("error",{message:j0}):((i=document.createEvent("Event")).initEvent("error",!1,!1),i.message=j0),window.dispatchEvent(i)),t>0},$0=[],ow=function(i){if(!Ac){var t=0,e=document.createTextNode("");new MutationObserver(function(){return $0.splice(0).forEach(function(n){return n()})}).observe(e,{characterData:!0}),Ac=function(){e.textContent="".concat(t?t--:t++)}}$0.push(i),Ac()},Mc=0,sw={attributes:!0,characterData:!0,childList:!0,subtree:!0},Q0=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],tg=function(i){return i===void 0&&(i=0),Date.now()+i},Rc=!1,Ic=new(function(){function i(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return i.prototype.run=function(t){var e=this;if(t===void 0&&(t=250),!Rc){Rc=!0;var n,r=tg(t);n=function(){var o=!1;try{o=rw()}finally{if(Rc=!1,t=r-tg(),!Mc)return;o?e.run(1e3):t>0?e.run(t):e.start()}},ow(function(){requestAnimationFrame(n)})}},i.prototype.schedule=function(){this.stop(),this.run()},i.prototype.observe=function(){var t=this,e=function(){return t.observer&&t.observer.observe(document.body,sw)};document.body?e():Ka.addEventListener("DOMContentLoaded",e)},i.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Q0.forEach(function(e){return Ka.addEventListener(e,t.listener,!0)}))},i.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Q0.forEach(function(e){return Ka.removeEventListener(e,t.listener,!0)}),this.stopped=!0)},i}()),eg=function(i){!Mc&&i>0&&Ic.start(),!(Mc+=i)&&Ic.stop()},aw=function(){function i(t,e){this.target=t,this.observedBox=e||Ja.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return i.prototype.isActive=function(){var t,e=J0(this.target,this.observedBox,!0);return t=this.target,Cc(t)||function(n){switch(n.tagName){case"INPUT":if(n.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1}(t)||getComputedStyle(t).display!=="inline"||(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},i}(),lw=function(i,t){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=i,this.callback=t},Ah=new WeakMap,ng=function(i,t){for(var e=0;e<i.length;e+=1)if(i[e].target===t)return e;return-1},Ch=function(){function i(){}return i.connect=function(t,e){var n=new lw(t,e);Ah.set(t,n)},i.observe=function(t,e,n){var r=Ah.get(t),o=r.observationTargets.length===0;ng(r.observationTargets,e)<0&&(o&&vs.push(r),r.observationTargets.push(new aw(e,n&&n.box)),eg(1),Ic.schedule())},i.unobserve=function(t,e){var n=Ah.get(t),r=ng(n.observationTargets,e),o=n.observationTargets.length===1;r>=0&&(o&&vs.splice(vs.indexOf(n),1),n.observationTargets.splice(r,1),eg(-1))},i.disconnect=function(t){var e=this,n=Ah.get(t);n.observationTargets.slice().forEach(function(r){return e.unobserve(t,r.target)}),n.activeTargets.splice(0,n.activeTargets.length)},i}(),hw=function(){function i(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.");Ch.connect(this,t)}return i.prototype.observe=function(t,e){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!W0(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Ch.observe(this,t,e)},i.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(!W0(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Ch.unobserve(this,t)},i.prototype.disconnect=function(){Ch.disconnect(this)},i.toString=function(){return"function ResizeObserver () { [polyfill code] }"},i}(),uw=function(i,t,e,n){return new(e||(e=Promise))(function(r,o){function s(h){try{l(n.next(h))}catch(u){o(u)}}function a(h){try{l(n.throw(h))}catch(u){o(u)}}function l(h){var u;h.done?r(h.value):(u=h.value,u instanceof e?u:new e(function(p){p(u)})).then(s,a)}l((n=n.apply(i,t||[])).next())})},cw=function(i,t){var e,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(h){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;s;)try{if(e=1,n&&(r=2&u[0]?n.return:u[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,u[1])).done)return r;switch(n=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,n=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(r=s.trys,!((r=r.length>0&&r[r.length-1])||u[0]!==6&&u[0]!==2)){s=0;continue}if(u[0]===3&&(!r||u[1]>r[0]&&u[1]<r[3])){s.label=u[1];break}if(u[0]===6&&s.label<r[1]){s.label=r[1],r=u;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(u);break}r[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(i,s)}catch(p){u=[6,p],n=0}finally{e=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([l,h])}}},dw=function(){function i(t,e,n,r,o){this.state="idle",this.index=-1,this.slideIndex=-1,this.fn=n,this.index=t,this.slideIndex=e,this.eventHub=r,this.id=o}return i.prototype.apply=function(){return uw(this,void 0,void 0,function(){var t;return cw(this,function(e){switch(e.label){case 0:this.eventHub.emit("task-start",this),e.label=1;case 1:return e.trys.push([1,3,,4]),this.state="start",[4,this.fn()];case 2:return e.sent(),this.state="end",this.eventHub.emit("task-end",this),[3,4];case 3:return t=e.sent(),this.eventHub.emit("task-error",{task:this,error:t}),[3,4];case 4:return[2]}})})},i}(),pw=function(){function i(){var t=this;this.eventHub=new gi.a,this.tasks=[],this.index=0,this.eventHub.on("task-end",function(e){var n,r=t.tasks.findIndex(function(s){return s.index===e.index}),o=r+1;o>=0&&((n=t.tasks[o])===null||n===void 0||n.apply()),r>=0&&(t.tasks.splice(r,1),t.replaceIdleTask()),t.eventHub.emit("task-end-"+e.id)}),this.eventHub.on("task-error",function(e){var n=e.task,r=t.tasks.findIndex(function(o){return o.index===n.index});r>=0&&(t.tasks.splice(r,1),t.replaceIdleTask()),t.eventHub.emit("task-error-"+n.id)})}return i.prototype.replaceIdleTask=function(){for(var t,e=this,n=new Set,r=0,o=this.tasks.length;r<o;r++)this.tasks[r].state==="idle"&&((t=this.tasks[r+1])===null||t===void 0?void 0:t.state)==="idle"&&n.add(r);Array.from(n).forEach(function(s){e.tasks.splice(s,1)})},i.prototype.addTask=function(t,e,n){var r=new dw(this.index++,e,t,this.eventHub,n);this.tasks.push(r),this.tasks.sort(function(o,s){return o.index-s.index}),this.replaceIdleTask(),this.tasks.length===1&&r.apply()},i.prototype.hasStartTask=function(){return this.tasks.some(function(t){return t.state==="start"})},i.prototype.destroy=function(){this.eventHub.removeAllListeners()},i}();function oa(i,t){var e=i.__state.conversionName.toString(),n=Math.round(i.r),r=Math.round(i.g),o=Math.round(i.b),s=i.a,a=Math.round(i.h),l=i.s.toFixed(1),h=i.v.toFixed(1);if(t||e==="THREE_CHAR_HEX"||e==="SIX_CHAR_HEX"){for(var u=i.hex.toString(16);u.length<6;)u="0"+u;return"#"+u}return e==="CSS_RGB"?"rgb("+n+","+r+","+o+")":e==="CSS_RGBA"?"rgba("+n+","+r+","+o+","+s+")":e==="HEX"?"0x"+i.hex.toString(16):e==="RGB_ARRAY"?"["+n+","+r+","+o+"]":e==="RGBA_ARRAY"?"["+n+","+r+","+o+","+s+"]":e==="RGB_OBJ"?"{r:"+n+",g:"+r+",b:"+o+"}":e==="RGBA_OBJ"?"{r:"+n+",g:"+r+",b:"+o+",a:"+s+"}":e==="HSV_OBJ"?"{h:"+a+",s:"+l+",v:"+h+"}":e==="HSVA_OBJ"?"{h:"+a+",s:"+l+",v:"+h+",a:"+s+"}":"unknown format"}var ig=Array.prototype.forEach,Za=Array.prototype.slice,Le={BREAK:{},extend:function(i){return this.each(Za.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(e){this.isUndefined(t[e])||(i[e]=t[e])}.bind(this))},this),i},defaults:function(i){return this.each(Za.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(e){this.isUndefined(i[e])&&(i[e]=t[e])}.bind(this))},this),i},compose:function(){var i=Za.call(arguments);return function(){for(var t=Za.call(arguments),e=i.length-1;e>=0;e--)t=[i[e].apply(this,t)];return t[0]}},each:function(i,t,e){if(i){if(ig&&i.forEach&&i.forEach===ig)i.forEach(t,e);else if(i.length===i.length+0){var n,r=void 0;for(r=0,n=i.length;r<n;r++)if(r in i&&t.call(e,i[r],r)===this.BREAK)return}else for(var o in i)if(t.call(e,i[o],o)===this.BREAK)return}},defer:function(i){setTimeout(i,0)},debounce:function(i,t,e){var n=void 0;return function(){var r=this,o=arguments;function s(){n=null,e||i.apply(r,o)}var a=e||!n;clearTimeout(n),n=setTimeout(s,t),a&&i.apply(r,o)}},toArray:function(i){return i.toArray?i.toArray():Za.call(i)},isUndefined:function(i){return i===void 0},isNull:function(i){return i===null},isNaN:function(i){function t(e){return i.apply(this,arguments)}return t.toString=function(){return i.toString()},t}(function(i){return isNaN(i)}),isArray:Array.isArray||function(i){return i.constructor===Array},isObject:function(i){return i===Object(i)},isNumber:function(i){return i===i+0},isString:function(i){return i===i+""},isBoolean:function(i){return i===!1||i===!0},isFunction:function(i){return i instanceof Function}},fw=[{litmus:Le.isString,conversions:{THREE_CHAR_HEX:{read:function(i){var t=i.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return t!==null&&{space:"HEX",hex:parseInt("0x"+t[1].toString()+t[1].toString()+t[2].toString()+t[2].toString()+t[3].toString()+t[3].toString(),0)}},write:oa},SIX_CHAR_HEX:{read:function(i){var t=i.match(/^#([A-F0-9]{6})$/i);return t!==null&&{space:"HEX",hex:parseInt("0x"+t[1].toString(),0)}},write:oa},CSS_RGB:{read:function(i){var t=i.match(/^rgb\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);return t!==null&&{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3])}},write:oa},CSS_RGBA:{read:function(i){var t=i.match(/^rgba\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);return t!==null&&{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3]),a:parseFloat(t[4])}},write:oa}}},{litmus:Le.isNumber,conversions:{HEX:{read:function(i){return{space:"HEX",hex:i,conversionName:"HEX"}},write:function(i){return i.hex}}}},{litmus:Le.isArray,conversions:{RGB_ARRAY:{read:function(i){return i.length===3&&{space:"RGB",r:i[0],g:i[1],b:i[2]}},write:function(i){return[i.r,i.g,i.b]}},RGBA_ARRAY:{read:function(i){return i.length===4&&{space:"RGB",r:i[0],g:i[1],b:i[2],a:i[3]}},write:function(i){return[i.r,i.g,i.b,i.a]}}}},{litmus:Le.isObject,conversions:{RGBA_OBJ:{read:function(i){return!!(Le.isNumber(i.r)&&Le.isNumber(i.g)&&Le.isNumber(i.b)&&Le.isNumber(i.a))&&{space:"RGB",r:i.r,g:i.g,b:i.b,a:i.a}},write:function(i){return{r:i.r,g:i.g,b:i.b,a:i.a}}},RGB_OBJ:{read:function(i){return!!(Le.isNumber(i.r)&&Le.isNumber(i.g)&&Le.isNumber(i.b))&&{space:"RGB",r:i.r,g:i.g,b:i.b}},write:function(i){return{r:i.r,g:i.g,b:i.b}}},HSVA_OBJ:{read:function(i){return!!(Le.isNumber(i.h)&&Le.isNumber(i.s)&&Le.isNumber(i.v)&&Le.isNumber(i.a))&&{space:"HSV",h:i.h,s:i.s,v:i.v,a:i.a}},write:function(i){return{h:i.h,s:i.s,v:i.v,a:i.a}}},HSV_OBJ:{read:function(i){return!!(Le.isNumber(i.h)&&Le.isNumber(i.s)&&Le.isNumber(i.v))&&{space:"HSV",h:i.h,s:i.s,v:i.v}},write:function(i){return{h:i.h,s:i.s,v:i.v}}}}}],$a=void 0,Mh=void 0,Pc=function(){Mh=!1;var i=arguments.length>1?Le.toArray(arguments):arguments[0];return Le.each(fw,function(t){if(t.litmus(i))return Le.each(t.conversions,function(e,n){if($a=e.read(i),Mh===!1&&$a!==!1)return Mh=$a,$a.conversionName=n,$a.conversion=e,Le.BREAK}),Le.BREAK}),Mh},rg=void 0,Rh={hsv_to_rgb:function(i,t,e){var n=Math.floor(i/60)%6,r=i/60-Math.floor(i/60),o=e*(1-t),s=e*(1-r*t),a=e*(1-(1-r)*t),l=[[e,a,o],[s,e,o],[o,e,a],[o,s,e],[a,o,e],[e,o,s]][n];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(i,t,e){var n=Math.min(i,t,e),r=Math.max(i,t,e),o=r-n,s=void 0;return r===0?{h:NaN,s:0,v:0}:(s=i===r?(t-e)/o:t===r?2+(e-i)/o:4+(i-t)/o,(s/=6)<0&&(s+=1),{h:360*s,s:o/r,v:r/255})},rgb_to_hex:function(i,t,e){var n=this.hex_with_component(0,2,i);return n=this.hex_with_component(n,1,t),n=this.hex_with_component(n,0,e)},component_from_hex:function(i,t){return i>>8*t&255},hex_with_component:function(i,t,e){return e<<(rg=8*t)|i&~(255<<rg)}},mw=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},Vr=function(i,t){if(!(i instanceof t))throw new TypeError("Cannot call a class as a function")},Wr=function(){function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}}(),Yo=function i(t,e,n){t===null&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,e);if(r===void 0){var o=Object.getPrototypeOf(t);return o===null?void 0:i(o,e,n)}if("value"in r)return r.value;var s=r.get;return s!==void 0?s.call(n):void 0},qo=function(i,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);i.prototype=Object.create(t&&t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(i,t):i.__proto__=t)},Jo=function(i,t){if(!i)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||typeof t!="object"&&typeof t!="function"?i:t},Yi=function(){function i(){if(Vr(this,i),this.__state=Pc.apply(this,arguments),this.__state===!1)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return Wr(i,[{key:"toString",value:function(){return oa(this)}},{key:"toHexString",value:function(){return oa(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),i}();function Oc(i,t,e){Object.defineProperty(i,t,{get:function(){return this.__state.space==="RGB"||Yi.recalculateRGB(this,t,e),this.__state[t]},set:function(n){this.__state.space!=="RGB"&&(Yi.recalculateRGB(this,t,e),this.__state.space="RGB"),this.__state[t]=n}})}function Nc(i,t){Object.defineProperty(i,t,{get:function(){return this.__state.space==="HSV"||Yi.recalculateHSV(this),this.__state[t]},set:function(e){this.__state.space!=="HSV"&&(Yi.recalculateHSV(this),this.__state.space="HSV"),this.__state[t]=e}})}Yi.recalculateRGB=function(i,t,e){if(i.__state.space==="HEX")i.__state[t]=Rh.component_from_hex(i.__state.hex,e);else{if(i.__state.space!=="HSV")throw new Error("Corrupted color state");Le.extend(i.__state,Rh.hsv_to_rgb(i.__state.h,i.__state.s,i.__state.v))}},Yi.recalculateHSV=function(i){var t=Rh.rgb_to_hsv(i.r,i.g,i.b);Le.extend(i.__state,{s:t.s,v:t.v}),Le.isNaN(t.h)?Le.isUndefined(i.__state.h)&&(i.__state.h=0):i.__state.h=t.h},Yi.COMPONENTS=["r","g","b","h","s","v","hex","a"],Oc(Yi.prototype,"r",2),Oc(Yi.prototype,"g",1),Oc(Yi.prototype,"b",0),Nc(Yi.prototype,"h"),Nc(Yi.prototype,"s"),Nc(Yi.prototype,"v"),Object.defineProperty(Yi.prototype,"a",{get:function(){return this.__state.a},set:function(i){this.__state.a=i}}),Object.defineProperty(Yi.prototype,"hex",{get:function(){return this.__state.space!=="HEX"&&(this.__state.hex=Rh.rgb_to_hex(this.r,this.g,this.b),this.__state.space="HEX"),this.__state.hex},set:function(i){this.__state.space="HEX",this.__state.hex=i}});var _s=function(){function i(t,e){Vr(this,i),this.initialValue=t[e],this.domElement=document.createElement("div"),this.object=t,this.property=e,this.__onChange=void 0,this.__onFinishChange=void 0}return Wr(i,[{key:"onChange",value:function(t){return this.__onChange=t,this}},{key:"onFinishChange",value:function(t){return this.__onFinishChange=t,this}},{key:"setValue",value:function(t){return this.object[this.property]=t,this.__onChange&&this.__onChange.call(this,t),this.updateDisplay(),this}},{key:"getValue",value:function(){return this.object[this.property]}},{key:"updateDisplay",value:function(){return this}},{key:"isModified",value:function(){return this.initialValue!==this.getValue()}}]),i}(),og={};Le.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},function(i,t){Le.each(i,function(e){og[e]=t})});var gw=/(\d+(\.\d+)?)px/;function io(i){if(i==="0"||Le.isUndefined(i))return 0;var t=i.match(gw);return Le.isNull(t)?0:parseFloat(t[1])}var de={makeSelectable:function(i,t){i!==void 0&&i.style!==void 0&&(i.onselectstart=t?function(){return!1}:function(){},i.style.MozUserSelect=t?"auto":"none",i.style.KhtmlUserSelect=t?"auto":"none",i.unselectable=t?"on":"off")},makeFullscreen:function(i,t,e){var n=e,r=t;Le.isUndefined(r)&&(r=!0),Le.isUndefined(n)&&(n=!0),i.style.position="absolute",r&&(i.style.left=0,i.style.right=0),n&&(i.style.top=0,i.style.bottom=0)},fakeEvent:function(i,t,e,n){var r=e||{},o=og[t];if(!o)throw new Error("Event type "+t+" not supported.");var s=document.createEvent(o);switch(o){case"MouseEvents":var a=r.x||r.clientX||0,l=r.y||r.clientY||0;s.initMouseEvent(t,r.bubbles||!1,r.cancelable||!0,window,r.clickCount||1,0,0,a,l,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var h=s.initKeyboardEvent||s.initKeyEvent;Le.defaults(r,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),h(t,r.bubbles||!1,r.cancelable,window,r.ctrlKey,r.altKey,r.shiftKey,r.metaKey,r.keyCode,r.charCode);break;default:s.initEvent(t,r.bubbles||!1,r.cancelable||!0)}Le.defaults(s,n),i.dispatchEvent(s)},bind:function(i,t,e,n){var r=n||!1;return i.addEventListener?i.addEventListener(t,e,r):i.attachEvent&&i.attachEvent("on"+t,e),de},unbind:function(i,t,e,n){var r=n||!1;return i.removeEventListener?i.removeEventListener(t,e,r):i.detachEvent&&i.detachEvent("on"+t,e),de},addClass:function(i,t){if(i.className===void 0)i.className=t;else if(i.className!==t){var e=i.className.split(/ +/);e.indexOf(t)===-1&&(e.push(t),i.className=e.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return de},removeClass:function(i,t){if(t)if(i.className===t)i.removeAttribute("class");else{var e=i.className.split(/ +/),n=e.indexOf(t);n!==-1&&(e.splice(n,1),i.className=e.join(" "))}else i.className=void 0;return de},hasClass:function(i,t){return new RegExp("(?:^|\\s+)"+t+"(?:\\s+|$)").test(i.className)||!1},getWidth:function(i){var t=getComputedStyle(i);return io(t["border-left-width"])+io(t["border-right-width"])+io(t["padding-left"])+io(t["padding-right"])+io(t.width)},getHeight:function(i){var t=getComputedStyle(i);return io(t["border-top-width"])+io(t["border-bottom-width"])+io(t["padding-top"])+io(t["padding-bottom"])+io(t.height)},getOffset:function(i){var t=i,e={left:0,top:0};if(t.offsetParent)do e.left+=t.offsetLeft,e.top+=t.offsetTop,t=t.offsetParent;while(t);return e},isActive:function(i){return i===document.activeElement&&(i.type||i.href)}},sg=function(i){function t(e,n){Vr(this,t);var r=Jo(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),o=r;return r.__prev=r.getValue(),r.__checkbox=document.createElement("input"),r.__checkbox.setAttribute("type","checkbox"),de.bind(r.__checkbox,"change",function(){o.setValue(!o.__prev)},!1),r.domElement.appendChild(r.__checkbox),r.updateDisplay(),r}return qo(t,i),Wr(t,[{key:"setValue",value:function(e){var n=Yo(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,e);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),n}},{key:"updateDisplay",value:function(){return this.getValue()===!0?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0,this.__prev=!0):(this.__checkbox.checked=!1,this.__prev=!1),Yo(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(_s),vw=function(i){function t(e,n,r){Vr(this,t);var o=Jo(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=r,a=o;if(o.__select=document.createElement("select"),Le.isArray(s)){var l={};Le.each(s,function(h){l[h]=h}),s=l}return Le.each(s,function(h,u){var p=document.createElement("option");p.innerHTML=u,p.setAttribute("value",h),a.__select.appendChild(p)}),o.updateDisplay(),de.bind(o.__select,"change",function(){var h=this.options[this.selectedIndex].value;a.setValue(h)}),o.domElement.appendChild(o.__select),o}return qo(t,i),Wr(t,[{key:"setValue",value:function(e){var n=Yo(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,e);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),n}},{key:"updateDisplay",value:function(){return de.isActive(this.__select)?this:(this.__select.value=this.getValue(),Yo(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this))}}]),t}(_s),yw=function(i){function t(e,n){Vr(this,t);var r=Jo(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),o=r;function s(){o.setValue(o.__input.value)}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),de.bind(r.__input,"keyup",s),de.bind(r.__input,"change",s),de.bind(r.__input,"blur",function(){o.__onFinishChange&&o.__onFinishChange.call(o,o.getValue())}),de.bind(r.__input,"keydown",function(a){a.keyCode===13&&this.blur()}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return qo(t,i),Wr(t,[{key:"updateDisplay",value:function(){return de.isActive(this.__input)||(this.__input.value=this.getValue()),Yo(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(_s);function ag(i){var t=i.toString();return t.indexOf(".")>-1?t.length-t.indexOf(".")-1:0}var lg=function(i){function t(e,n,r){Vr(this,t);var o=Jo(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=r||{};return o.__min=s.min,o.__max=s.max,o.__step=s.step,Le.isUndefined(o.__step)?o.initialValue===0?o.__impliedStep=1:o.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(o.initialValue))/Math.LN10))/10:o.__impliedStep=o.__step,o.__precision=ag(o.__impliedStep),o}return qo(t,i),Wr(t,[{key:"setValue",value:function(e){var n=e;return this.__min!==void 0&&n<this.__min?n=this.__min:this.__max!==void 0&&n>this.__max&&(n=this.__max),this.__step!==void 0&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),Yo(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=ag(e),this}}]),t}(_s),Ih=function(i){function t(e,n,r){Vr(this,t);var o=Jo(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,r));o.__truncationSuspended=!1;var s=o,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function h(p){var y=a-p.clientY;s.setValue(s.getValue()+y*s.__impliedStep),a=p.clientY}function u(){de.unbind(window,"mousemove",h),de.unbind(window,"mouseup",u),l()}return o.__input=document.createElement("input"),o.__input.setAttribute("type","text"),de.bind(o.__input,"change",function(){var p=parseFloat(s.__input.value);Le.isNaN(p)||s.setValue(p)}),de.bind(o.__input,"blur",function(){l()}),de.bind(o.__input,"mousedown",function(p){de.bind(window,"mousemove",h),de.bind(window,"mouseup",u),a=p.clientY}),de.bind(o.__input,"keydown",function(p){p.keyCode===13&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())}),o.updateDisplay(),o.domElement.appendChild(o.__input),o}return qo(t,i),Wr(t,[{key:"updateDisplay",value:function(){var e,n,r;return this.__input.value=this.__truncationSuspended?this.getValue():(e=this.getValue(),n=this.__precision,r=Math.pow(10,n),Math.round(e*r)/r),Yo(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(lg);function hg(i,t,e,n,r){return n+(i-t)/(e-t)*(r-n)}var Lc=function(i){function t(e,n,r,o,s){Vr(this,t);var a=Jo(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:r,max:o,step:s})),l=a;function h(b){b.preventDefault();var w=l.__background.getBoundingClientRect();return l.setValue(hg(b.clientX,w.left,w.right,l.__min,l.__max)),!1}function u(){de.unbind(window,"mousemove",h),de.unbind(window,"mouseup",u),l.__onFinishChange&&l.__onFinishChange.call(l,l.getValue())}function p(b){var w=b.touches[0].clientX,M=l.__background.getBoundingClientRect();l.setValue(hg(w,M.left,M.right,l.__min,l.__max))}function y(){de.unbind(window,"touchmove",p),de.unbind(window,"touchend",y),l.__onFinishChange&&l.__onFinishChange.call(l,l.getValue())}return a.__background=document.createElement("div"),a.__foreground=document.createElement("div"),de.bind(a.__background,"mousedown",function(b){document.activeElement.blur(),de.bind(window,"mousemove",h),de.bind(window,"mouseup",u),h(b)}),de.bind(a.__background,"touchstart",function(b){b.touches.length===1&&(de.bind(window,"touchmove",p),de.bind(window,"touchend",y),p(b))}),de.addClass(a.__background,"slider"),de.addClass(a.__foreground,"slider-fg"),a.updateDisplay(),a.__background.appendChild(a.__foreground),a.domElement.appendChild(a.__background),a}return qo(t,i),Wr(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",Yo(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(lg),ug=function(i){function t(e,n,r){Vr(this,t);var o=Jo(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o;return o.__button=document.createElement("div"),o.__button.innerHTML=r===void 0?"Fire":r,de.bind(o.__button,"click",function(a){return a.preventDefault(),s.fire(),!1}),de.addClass(o.__button,"button"),o.domElement.appendChild(o.__button),o}return qo(t,i),Wr(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(_s),Dc=function(i){function t(e,n){Vr(this,t);var r=Jo(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));r.__color=new Yi(r.getValue()),r.__temp=new Yi(0);var o=r;r.domElement=document.createElement("div"),de.makeSelectable(r.domElement,!1),r.__selector=document.createElement("div"),r.__selector.className="selector",r.__saturation_field=document.createElement("div"),r.__saturation_field.className="saturation-field",r.__field_knob=document.createElement("div"),r.__field_knob.className="field-knob",r.__field_knob_border="2px solid ",r.__hue_knob=document.createElement("div"),r.__hue_knob.className="hue-knob",r.__hue_field=document.createElement("div"),r.__hue_field.className="hue-field",r.__input=document.createElement("input"),r.__input.type="text",r.__input_textShadow="0 1px 1px ",de.bind(r.__input,"keydown",function(I){I.keyCode===13&&y.call(this)}),de.bind(r.__input,"blur",y),de.bind(r.__selector,"mousedown",function(){de.addClass(this,"drag").bind(window,"mouseup",function(){de.removeClass(o.__selector,"drag")})}),de.bind(r.__selector,"touchstart",function(){de.addClass(this,"drag").bind(window,"touchend",function(){de.removeClass(o.__selector,"drag")})});var s,a=document.createElement("div");function l(I){w(I),de.bind(window,"mousemove",w),de.bind(window,"touchmove",w),de.bind(window,"mouseup",u),de.bind(window,"touchend",u)}function h(I){M(I),de.bind(window,"mousemove",M),de.bind(window,"touchmove",M),de.bind(window,"mouseup",p),de.bind(window,"touchend",p)}function u(){de.unbind(window,"mousemove",w),de.unbind(window,"touchmove",w),de.unbind(window,"mouseup",u),de.unbind(window,"touchend",u),b()}function p(){de.unbind(window,"mousemove",M),de.unbind(window,"touchmove",M),de.unbind(window,"mouseup",p),de.unbind(window,"touchend",p),b()}function y(){var I=Pc(this.value);I!==!1?(o.__color.__state=I,o.setValue(o.__color.toOriginal())):this.value=o.__color.toString()}function b(){o.__onFinishChange&&o.__onFinishChange.call(o,o.__color.toOriginal())}function w(I){I.type.indexOf("touch")===-1&&I.preventDefault();var H=o.__saturation_field.getBoundingClientRect(),J=I.touches&&I.touches[0]||I,it=J.clientX,ft=J.clientY,et=(it-H.left)/(H.right-H.left),gt=1-(ft-H.top)/(H.bottom-H.top);return gt>1?gt=1:gt<0&&(gt=0),et>1?et=1:et<0&&(et=0),o.__color.v=gt,o.__color.s=et,o.setValue(o.__color.toOriginal()),!1}function M(I){I.type.indexOf("touch")===-1&&I.preventDefault();var H=o.__hue_field.getBoundingClientRect(),J=1-((I.touches&&I.touches[0]||I).clientY-H.top)/(H.bottom-H.top);return J>1?J=1:J<0&&(J=0),o.__color.h=360*J,o.setValue(o.__color.toOriginal()),!1}return Le.extend(r.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),Le.extend(r.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:r.__field_knob_border+(r.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),Le.extend(r.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),Le.extend(r.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),Le.extend(a.style,{width:"100%",height:"100%",background:"none"}),cg(a,"top","rgba(0,0,0,0)","#000"),Le.extend(r.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(s=r.__hue_field).style.background="",s.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",s.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",s.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",s.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",s.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",Le.extend(r.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:r.__input_textShadow+"rgba(0,0,0,0.7)"}),de.bind(r.__saturation_field,"mousedown",l),de.bind(r.__saturation_field,"touchstart",l),de.bind(r.__field_knob,"mousedown",l),de.bind(r.__field_knob,"touchstart",l),de.bind(r.__hue_field,"mousedown",h),de.bind(r.__hue_field,"touchstart",h),r.__saturation_field.appendChild(a),r.__selector.appendChild(r.__field_knob),r.__selector.appendChild(r.__saturation_field),r.__selector.appendChild(r.__hue_field),r.__hue_field.appendChild(r.__hue_knob),r.domElement.appendChild(r.__input),r.domElement.appendChild(r.__selector),r.updateDisplay(),r}return qo(t,i),Wr(t,[{key:"updateDisplay",value:function(){var e=Pc(this.getValue());if(e!==!1){var n=!1;Le.each(Yi.COMPONENTS,function(s){if(!Le.isUndefined(e[s])&&!Le.isUndefined(this.__color.__state[s])&&e[s]!==this.__color.__state[s])return n=!0,{}},this),n&&Le.extend(this.__color.__state,e)}Le.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var r=this.__color.v<.5||this.__color.s>.5?255:0,o=255-r;Le.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+r+","+r+","+r+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,cg(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),Le.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+r+","+r+","+r+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(_s),_w=["-moz-","-o-","-webkit-","-ms-",""];function cg(i,t,e,n){i.style.background="",Le.each(_w,function(r){i.style.cssText+="background: "+r+"linear-gradient("+t+", "+e+" 0%, "+n+" 100%); "})}var xw=function(i,t){var e=t||document,n=document.createElement("style");n.type="text/css",n.innerHTML=i;var r=e.getElementsByTagName("head")[0];try{r.appendChild(n)}catch{}},bw=`<div id="dg-save" class="dg dialogue">
8006
8006
 
8007
8007
  Here's the new load parameter for your <code>GUI</code>'s constructor:
8008
8008
 
@@ -8023,10 +8023,10 @@ self.onmessage = function(e) {
8023
8023
  </div>
8024
8024
 
8025
8025
  </div>`,Tw=function(i,t){var e=i[t];return Le.isArray(arguments[2])||Le.isObject(arguments[2])?new vw(i,t,arguments[2]):Le.isNumber(e)?Le.isNumber(arguments[2])&&Le.isNumber(arguments[3])?Le.isNumber(arguments[4])?new Lc(i,t,arguments[2],arguments[3],arguments[4]):new Lc(i,t,arguments[2],arguments[3]):Le.isNumber(arguments[4])?new Ih(i,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new Ih(i,t,{min:arguments[2],max:arguments[3]}):Le.isString(e)?new yw(i,t):Le.isFunction(e)?new ug(i,t,""):Le.isBoolean(e)?new sg(i,t):null},Sw=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(i){setTimeout(i,1e3/60)},ww=function(){function i(){Vr(this,i),this.backgroundElement=document.createElement("div"),Le.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),de.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),Le.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;de.bind(this.backgroundElement,"click",function(){t.hide()})}return Wr(i,[{key:"show",value:function(){var t=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),Le.defer(function(){t.backgroundElement.style.opacity=1,t.domElement.style.opacity=1,t.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var t=this,e=function n(){t.domElement.style.display="none",t.backgroundElement.style.display="none",de.unbind(t.domElement,"webkitTransitionEnd",n),de.unbind(t.domElement,"transitionend",n),de.unbind(t.domElement,"oTransitionEnd",n)};de.bind(this.domElement,"webkitTransitionEnd",e),de.bind(this.domElement,"transitionend",e),de.bind(this.domElement,"oTransitionEnd",e),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-de.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-de.getHeight(this.domElement)/2+"px"}}]),i}();xw(function(i){if(i&&typeof window!="undefined"){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=i,document.head.appendChild(t),i}}(`.dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .cr.function .property-name{width:100%}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}
8026
- `));var Qa=function(){try{return!!window.localStorage}catch{return!1}}(),Ph=void 0,dg=!0,sa=void 0,Fc=!1,pg=[],hi=function i(t){var e=this,n=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),de.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],n=Le.defaults(n,{closeOnTop:!1,autoPlace:!0,width:i.DEFAULT_WIDTH}),n=Le.defaults(n,{resizable:n.autoPlace,hideable:n.autoPlace}),Le.isUndefined(n.load)?n.load={preset:"Default"}:n.preset&&(n.load.preset=n.preset),Le.isUndefined(n.parent)&&n.hideable&&pg.push(this),n.resizable=Le.isUndefined(n.parent)&&n.resizable,n.autoPlace&&Le.isUndefined(n.scrollable)&&(n.scrollable=!0);var r,o=Qa&&localStorage.getItem(aa(this,"isLocal"))==="true",s=void 0,a=void 0;if(Object.defineProperties(this,{parent:{get:function(){return n.parent}},scrollable:{get:function(){return n.scrollable}},autoPlace:{get:function(){return n.autoPlace}},closeOnTop:{get:function(){return n.closeOnTop}},preset:{get:function(){return e.parent?e.getRoot().preset:n.load.preset},set:function(u){e.parent?e.getRoot().preset=u:n.load.preset=u,function(p){for(var y=0;y<p.__preset_select.length;y++)p.__preset_select[y].value===p.preset&&(p.__preset_select.selectedIndex=y)}(this),e.revert()}},width:{get:function(){return n.width},set:function(u){n.width=u,Gc(e,u)}},name:{get:function(){return n.name},set:function(u){n.name=u,a&&(a.innerHTML=n.name)}},closed:{get:function(){return n.closed},set:function(u){n.closed=u,n.closed?de.addClass(e.__ul,i.CLASS_CLOSED):de.removeClass(e.__ul,i.CLASS_CLOSED),this.onResize(),e.__closeButton&&(e.__closeButton.innerHTML=u?i.TEXT_OPEN:i.TEXT_CLOSED)}},load:{get:function(){return n.load}},useLocalStorage:{get:function(){return o},set:function(u){Qa&&(o=u,u?de.bind(window,"unload",s):de.unbind(window,"unload",s),localStorage.setItem(aa(e,"isLocal"),u))}}}),Le.isUndefined(n.parent)){if(this.closed=n.closed||!1,de.addClass(this.domElement,i.CLASS_MAIN),de.makeSelectable(this.domElement,!1),Qa&&o){e.useLocalStorage=!0;var l=localStorage.getItem(aa(this,"gui"));l&&(n.load=JSON.parse(l))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=i.TEXT_CLOSED,de.addClass(this.__closeButton,i.CLASS_CLOSE_BUTTON),n.closeOnTop?(de.addClass(this.__closeButton,i.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(de.addClass(this.__closeButton,i.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),de.bind(this.__closeButton,"click",function(){e.closed=!e.closed})}else{n.closed===void 0&&(n.closed=!0);var h=document.createTextNode(n.name);de.addClass(h,"controller-name"),a=Bc(e,h),de.addClass(this.__ul,i.CLASS_CLOSED),de.addClass(a,"title"),de.bind(a,"click",function(u){return u.preventDefault(),e.closed=!e.closed,!1}),n.closed||(this.closed=!1)}n.autoPlace&&(Le.isUndefined(n.parent)&&(dg&&(sa=document.createElement("div"),de.addClass(sa,"dg"),de.addClass(sa,i.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(sa),dg=!1),sa.appendChild(this.domElement),de.addClass(this.domElement,i.CLASS_AUTO_PLACE)),this.parent||Gc(e,n.width)),this.__resizeHandler=function(){e.onResizeDebounced()},de.bind(window,"resize",this.__resizeHandler),de.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),de.bind(this.__ul,"transitionend",this.__resizeHandler),de.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),n.resizable&&Aw(this),s=function(){Qa&&localStorage.getItem(aa(e,"isLocal"))==="true"&&localStorage.setItem(aa(e,"gui"),JSON.stringify(e.getSaveObject()))},this.saveToLocalStorageIfPossible=s,n.parent||((r=e.getRoot()).width+=1,Le.defer(function(){r.width-=1}))};function Bc(i,t,e){var n=document.createElement("li");return t&&n.appendChild(t),e?i.__ul.insertBefore(n,e):i.__ul.appendChild(n),i.onResize(),n}function fg(i){de.unbind(window,"resize",i.__resizeHandler),i.saveToLocalStorageIfPossible&&de.unbind(window,"unload",i.saveToLocalStorageIfPossible)}function kc(i,t){var e=i.__preset_select[i.__preset_select.selectedIndex];e.innerHTML=t?e.value+"*":e.value}function mg(i,t){var e=i.getRoot(),n=e.__rememberedObjects.indexOf(t.object);if(n!==-1){var r=e.__rememberedObjectIndecesToControllers[n];if(r===void 0&&(r={},e.__rememberedObjectIndecesToControllers[n]=r),r[t.property]=t,e.load&&e.load.remembered){var o=e.load.remembered,s=void 0;if(o[i.preset])s=o[i.preset];else{if(!o.Default)return;s=o.Default}if(s[n]&&s[n][t.property]!==void 0){var a=s[n][t.property];t.initialValue=a,t.setValue(a)}}}}function tl(i,t,e,n){if(t[e]===void 0)throw new Error('Object "'+t+'" has no property "'+e+'"');var r=void 0;if(n.color)r=new Dc(t,e);else{var o=[t,e].concat(n.factoryArgs);r=Tw.apply(i,o)}n.before instanceof _s&&(n.before=n.before.__li),mg(i,r),de.addClass(r.domElement,"c");var s=document.createElement("span");de.addClass(s,"property-name"),s.innerHTML=r.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(r.domElement);var l=Bc(i,a,n.before);return de.addClass(l,hi.CLASS_CONTROLLER_ROW),r instanceof Dc?de.addClass(l,"color"):de.addClass(l,mw(r.getValue())),function(h,u,p){if(p.__li=u,p.__gui=h,Le.extend(p,{options:function(w){if(arguments.length>1){var M=p.__li.nextElementSibling;return p.remove(),tl(h,p.object,p.property,{before:M,factoryArgs:[Le.toArray(arguments)]})}if(Le.isArray(w)||Le.isObject(w)){var I=p.__li.nextElementSibling;return p.remove(),tl(h,p.object,p.property,{before:I,factoryArgs:[w]})}},name:function(w){return p.__li.firstElementChild.firstElementChild.innerHTML=w,p},listen:function(){return p.__gui.listen(p),p},remove:function(){return p.__gui.remove(p),p}}),p instanceof Lc){var y=new Ih(p.object,p.property,{min:p.__min,max:p.__max,step:p.__step});Le.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(w){var M=p[w],I=y[w];p[w]=y[w]=function(){var H=Array.prototype.slice.call(arguments);return I.apply(y,H),M.apply(p,H)}}),de.addClass(u,"has-slider"),p.domElement.insertBefore(y.domElement,p.domElement.firstElementChild)}else if(p instanceof Ih){var b=function(w){if(Le.isNumber(p.__min)&&Le.isNumber(p.__max)){var M=p.__li.firstElementChild.firstElementChild.innerHTML,I=p.__gui.__listening.indexOf(p)>-1;p.remove();var H=tl(h,p.object,p.property,{before:p.__li.nextElementSibling,factoryArgs:[p.__min,p.__max,p.__step]});return H.name(M),I&&H.listen(),H}return w};p.min=Le.compose(b,p.min),p.max=Le.compose(b,p.max)}else p instanceof sg?(de.bind(u,"click",function(){de.fakeEvent(p.__checkbox,"click")}),de.bind(p.__checkbox,"click",function(w){w.stopPropagation()})):p instanceof ug?(de.bind(u,"click",function(){de.fakeEvent(p.__button,"click")}),de.bind(u,"mouseover",function(){de.addClass(p.__button,"hover")}),de.bind(u,"mouseout",function(){de.removeClass(p.__button,"hover")})):p instanceof Dc&&(de.addClass(u,"color"),p.updateDisplay=Le.compose(function(w){return u.style.borderLeftColor=p.__color.toString(),w},p.updateDisplay),p.updateDisplay());p.setValue=Le.compose(function(w){return h.getRoot().__preset_select&&p.isModified()&&kc(h.getRoot(),!0),w},p.setValue)}(i,l,r),i.__controllers.push(r),r}function aa(i,t){return document.location.href+"."+t}function Uc(i,t,e){var n=document.createElement("option");n.innerHTML=t,n.value=t,i.__preset_select.appendChild(n),e&&(i.__preset_select.selectedIndex=i.__preset_select.length-1)}function gg(i,t){t.style.display=i.useLocalStorage?"block":"none"}function Ew(i){var t=i.__save_row=document.createElement("li");de.addClass(i.domElement,"has-save"),i.__ul.insertBefore(t,i.__ul.firstChild),de.addClass(t,"save-row");var e=document.createElement("span");e.innerHTML="&nbsp;",de.addClass(e,"button gears");var n=document.createElement("span");n.innerHTML="Save",de.addClass(n,"button"),de.addClass(n,"save");var r=document.createElement("span");r.innerHTML="New",de.addClass(r,"button"),de.addClass(r,"save-as");var o=document.createElement("span");o.innerHTML="Revert",de.addClass(o,"button"),de.addClass(o,"revert");var s=i.__preset_select=document.createElement("select");if(i.load&&i.load.remembered?Le.each(i.load.remembered,function(u,p){Uc(i,p,p===i.preset)}):Uc(i,"Default",!1),de.bind(s,"change",function(){for(var u=0;u<i.__preset_select.length;u++)i.__preset_select[u].innerHTML=i.__preset_select[u].value;i.preset=this.value}),t.appendChild(s),t.appendChild(e),t.appendChild(n),t.appendChild(r),t.appendChild(o),Qa){var a=document.getElementById("dg-local-explain"),l=document.getElementById("dg-local-storage");document.getElementById("dg-save-locally").style.display="block",localStorage.getItem(aa(0,"isLocal"))==="true"&&l.setAttribute("checked","checked"),gg(i,a),de.bind(l,"change",function(){i.useLocalStorage=!i.useLocalStorage,gg(i,a)})}var h=document.getElementById("dg-new-constructor");de.bind(h,"keydown",function(u){!u.metaKey||u.which!==67&&u.keyCode!==67||Ph.hide()}),de.bind(e,"click",function(){h.innerHTML=JSON.stringify(i.getSaveObject(),void 0,2),Ph.show(),h.focus(),h.select()}),de.bind(n,"click",function(){i.save()}),de.bind(r,"click",function(){var u=prompt("Enter a new preset name.");u&&i.saveAs(u)}),de.bind(o,"click",function(){i.revert()})}function Aw(i){var t=void 0;function e(o){return o.preventDefault(),i.width+=t-o.clientX,i.onResize(),t=o.clientX,!1}function n(){de.removeClass(i.__closeButton,hi.CLASS_DRAG),de.unbind(window,"mousemove",e),de.unbind(window,"mouseup",n)}function r(o){return o.preventDefault(),t=o.clientX,de.addClass(i.__closeButton,hi.CLASS_DRAG),de.bind(window,"mousemove",e),de.bind(window,"mouseup",n),!1}i.__resize_handle=document.createElement("div"),Le.extend(i.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),de.bind(i.__resize_handle,"mousedown",r),de.bind(i.__closeButton,"mousedown",r),i.domElement.insertBefore(i.__resize_handle,i.domElement.firstElementChild)}function Gc(i,t){i.domElement.style.width=t+"px",i.__save_row&&i.autoPlace&&(i.__save_row.style.width=t+"px"),i.__closeButton&&(i.__closeButton.style.width=t+"px")}function Oh(i,t){var e={};return Le.each(i.__rememberedObjects,function(n,r){var o={},s=i.__rememberedObjectIndecesToControllers[r];Le.each(s,function(a,l){o[l]=t?a.initialValue:a.getValue()}),e[r]=o}),e}hi.toggleHide=function(){Fc=!Fc,Le.each(pg,function(i){i.domElement.style.display=Fc?"none":""})},hi.CLASS_AUTO_PLACE="a",hi.CLASS_AUTO_PLACE_CONTAINER="ac",hi.CLASS_MAIN="main",hi.CLASS_CONTROLLER_ROW="cr",hi.CLASS_TOO_TALL="taller-than-window",hi.CLASS_CLOSED="closed",hi.CLASS_CLOSE_BUTTON="close-button",hi.CLASS_CLOSE_TOP="close-top",hi.CLASS_CLOSE_BOTTOM="close-bottom",hi.CLASS_DRAG="drag",hi.DEFAULT_WIDTH=245,hi.TEXT_CLOSED="Close Controls",hi.TEXT_OPEN="Open Controls",hi._keydownHandler=function(i){document.activeElement.type==="text"||i.which!==72&&i.keyCode!==72||hi.toggleHide()},de.bind(window,"keydown",hi._keydownHandler,!1),Le.extend(hi.prototype,{add:function(i,t){return tl(this,i,t,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(i,t){return tl(this,i,t,{color:!0})},remove:function(i){this.__ul.removeChild(i.__li),this.__controllers.splice(this.__controllers.indexOf(i),1);var t=this;Le.defer(function(){t.onResize()})},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&sa.removeChild(this.domElement);var i=this;Le.each(this.__folders,function(t){i.removeFolder(t)}),de.unbind(window,"keydown",hi._keydownHandler,!1),fg(this)},addFolder:function(i){if(this.__folders[i]!==void 0)throw new Error('You already have a folder in this GUI by the name "'+i+'"');var t={name:i,parent:this};t.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[i]&&(t.closed=this.load.folders[i].closed,t.load=this.load.folders[i]);var e=new hi(t);this.__folders[i]=e;var n=Bc(this,e.domElement);return de.addClass(n,"folder"),e},removeFolder:function(i){this.__ul.removeChild(i.domElement.parentElement),delete this.__folders[i.name],this.load&&this.load.folders&&this.load.folders[i.name]&&delete this.load.folders[i.name],fg(i);var t=this;Le.each(i.__folders,function(e){i.removeFolder(e)}),Le.defer(function(){t.onResize()})},open:function(){this.closed=!1},close:function(){this.closed=!0},hide:function(){this.domElement.style.display="none"},show:function(){this.domElement.style.display=""},onResize:function(){var i=this.getRoot();if(i.scrollable){var t=de.getOffset(i.__ul).top,e=0;Le.each(i.__ul.childNodes,function(n){i.autoPlace&&n===i.__save_row||(e+=de.getHeight(n))}),window.innerHeight-t-20<e?(de.addClass(i.domElement,hi.CLASS_TOO_TALL),i.__ul.style.height=window.innerHeight-t-20+"px"):(de.removeClass(i.domElement,hi.CLASS_TOO_TALL),i.__ul.style.height="auto")}i.__resize_handle&&Le.defer(function(){i.__resize_handle.style.height=i.__ul.offsetHeight+"px"}),i.__closeButton&&(i.__closeButton.style.width=i.width+"px")},onResizeDebounced:Le.debounce(function(){this.onResize()},50),remember:function(){if(Le.isUndefined(Ph)&&((Ph=new ww).domElement.innerHTML=bw),this.parent)throw new Error("You can only call remember on a top level GUI.");var i=this;Le.each(Array.prototype.slice.call(arguments),function(t){i.__rememberedObjects.length===0&&Ew(i),i.__rememberedObjects.indexOf(t)===-1&&i.__rememberedObjects.push(t)}),this.autoPlace&&Gc(this,this.width)},getRoot:function(){for(var i=this;i.parent;)i=i.parent;return i},getSaveObject:function(){var i=this.load;return i.closed=this.closed,this.__rememberedObjects.length>0&&(i.preset=this.preset,i.remembered||(i.remembered={}),i.remembered[this.preset]=Oh(this)),i.folders={},Le.each(this.__folders,function(t,e){i.folders[e]=t.getSaveObject()}),i},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=Oh(this),kc(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(i){this.load.remembered||(this.load.remembered={},this.load.remembered.Default=Oh(this,!0)),this.load.remembered[i]=Oh(this),this.preset=i,Uc(this,i,!0),this.saveToLocalStorageIfPossible()},revert:function(i){Le.each(this.__controllers,function(t){this.getRoot().load.remembered?mg(i||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),Le.each(this.__folders,function(t){t.revert(t)}),i||kc(this.getRoot(),!1)},listen:function(i){var t=this.__listening.length===0;this.__listening.push(i),t&&function e(n){n.length!==0&&Sw.call(window,function(){e(n)}),Le.each(n,function(r){r.updateDisplay()})}(this.__listening)},updateDisplay:function(){Le.each(this.__controllers,function(i){i.updateDisplay()}),Le.each(this.__folders,function(i){i.updateDisplay()})}});var Cw=hi,Mw=function(){function i(t){this.player=t}return Object.defineProperty(i.prototype,"frameRate",{get:function(){return this.player.fps.value},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"drawFrames",{get:function(){return this.player.runtime.fps},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"drawCall",{get:function(){return this.player.runtime.drawCall},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"resolution",{get:function(){return this.player.config.resolution},set:function(t){this.player.updateConfig({resolution:t})},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"size",{get:function(){var t,e;return((t=this.player.view)===null||t===void 0?void 0:t.width)+"*"+((e=this.player.view)===null||e===void 0?void 0:e.height)},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"minFPS",{get:function(){return this.player.config.minFPS},set:function(t){this.player.updateConfig({minFPS:t,maxFPS:this.player.config.maxFPS})},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"maxFPS",{get:function(){return this.player.config.maxFPS},set:function(t){this.player.updateConfig({maxFPS:t,minFPS:this.player.config.minFPS})},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"autoResolution",{get:function(){return this.player.config.autoResolution},set:function(t){this.player.updateConfig({autoResolution:t})},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"autoFPS",{get:function(){return this.player.config.autoFPS},set:function(t){this.player.updateConfig({autoFPS:t})},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"backgroundColor",{get:function(){return this.player.config.transactionBgColor},set:function(t){this.player.updateConfig({transactionBgColor:t})},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"maxResolutionLevel",{get:function(){return this.player.config.maxResolutionLevel},set:function(t){this.player.updateConfig({maxResolutionLevel:t})},enumerable:!1,configurable:!0}),i}(),Rw=function(){function i(t,e){var n;this.config=new Mw(t),this.anchor=e,n=this.createControllerGUI(),this.gui=n[0],this.controller=n[1],this.createStats()}return i.prototype.createStats=function(){var t=this;this.stateId=setInterval(function(){t.controller.frameRate.updateDisplay(),t.controller.size.updateDisplay(),t.controller.minFPS.updateDisplay(),t.controller.drawFrames.updateDisplay(),t.controller.maxFPS.updateDisplay(),t.controller.resolution.updateDisplay(),t.controller.autoFps.updateDisplay(),t.controller.autoResolution.updateDisplay(),t.controller.drawCall.updateDisplay()},16)},i.prototype.createControllerGUI=function(){var t=new Cw({autoPlace:!0,closed:!0});t.domElement.style.opacity=".6",t.domElement.style.transformOrigin="100% 0",t.domElement.style.transform="scale(1)",this.anchor.appendChild(t.domElement),t.domElement.style.position="absolute",t.domElement.style.right="0",t.domElement.style.top="0",t.domElement.style.zIndex="2";var e={frameRate:t.add(this.config,"frameRate"),drawFrames:t.add(this.config,"drawFrames"),drawCall:t.add(this.config,"drawCall"),size:t.add(this.config,"size"),minFPS:t.add(this.config,"minFPS",0,60),maxFPS:t.add(this.config,"maxFPS",0,60),resolution:t.add(this.config,"resolution",.5,8,.5),autoResolution:t.add(this.config,"autoResolution"),autoFps:t.add(this.config,"autoFPS"),maxResolutionLevel:t.add(this.config,"maxResolutionLevel",0,4,1),transactionBgColor:t.addColor(this.config,"backgroundColor")};return[t,e]},i.prototype.destroy=function(){try{window.clearInterval(this.stateId),this.anchor.removeChild(this.gui.domElement),this.gui.destroy()}catch{}},i}();function Hc(i){if(i!=="fifo"&&i!=="latest-pending-render")throw new Error("Invalid sync event queue policy: "+i)}function vg(i,t){return t===void 0&&(t="fifo"),Hc(t),i==="interactive"?t:"fifo"}function Iw(i){switch(i.type){case"renderSlide":case"nextStep":case"prevStep":case"interactiveAnim":case"mediaPlay":case"mediaPause":case"mediaSeek":case"mediaFullscreen":return!0;default:return!1}}var Pw=function(){function i(t,e){var n=this;e===void 0&&(e={}),this.tasks=[],this.isDestroy=!1,this.isScheduling=!1,this.isTaskRunning=!1,this.isCatchingUp=!1,this.compactedTasks=new WeakMap,this.finishTask=function(){n.isTaskRunning=!1,n.runningTask=void 0,n.isDestroy?(n.tasks.length=0,n.isScheduling=!1):n.tasks.length>0?window.requestAnimationFrame(n.schedule):(n.isScheduling=!1,n.setCatchUpState(!1))},this.schedule=function(){if(n.isDestroy)return n.tasks.length=0,void(n.isScheduling=!1);n.isScheduling=!0;var r=n.tasks.shift();if(r){n.isTaskRunning=!0,n.runningTask=r;var o=n.compactedTasks.get(r);try{n.fn(r).then(function(){var s;if(n.compactedTasks.delete(r),o&&!n.isDestroy)try{(s=n.onCompactedRenderComplete)===null||s===void 0||s.call(n,o,Date.now())}catch{}n.finishTask()},function(){n.compactedTasks.delete(r),n.finishTask()})}catch{n.compactedTasks.delete(r),n.finishTask()}}else n.isScheduling=!1},this.fn=t,this.policy=e.policy||"fifo",this.onCompact=e.onCompact,this.onCompactedRenderComplete=e.onCompactedRenderComplete,this.onCatchUpStateChange=e.onCatchUpStateChange,this.shouldTrackCatchUpEvent=e.shouldTrackCatchUpEvent,Hc(this.policy)}return i.prototype.destroy=function(){this.isDestroy=!0,this.isCatchingUp=!1,this.runningTask=void 0,this.tasks.length=0},i.prototype.setPolicy=function(t){Hc(t),this.policy=t},i.prototype.setCatchUpState=function(t){var e;if(this.isCatchingUp!==t){this.isCatchingUp=t;try{(e=this.onCatchUpStateChange)===null||e===void 0||e.call(this,t)}catch{}}},i.prototype.isCatchUpEvent=function(t){var e,n;try{return(n=(e=this.shouldTrackCatchUpEvent)===null||e===void 0?void 0:e.call(this,t))===null||n===void 0||n}catch{return!0}},i.prototype.compactForRender=function(t){for(var e={},n=0,r=0,o=0,s=0,a=0;this.tasks.length>0;){var l=this.tasks[this.tasks.length-1];if(!Iw(l))break;this.tasks.pop(),this.compactedTasks.delete(l),n+=1,e[l.type]=(e[l.type]||0)+1,l.type==="renderSlide"?r+=1:l.type==="nextStep"||l.type==="prevStep"?o+=1:l.type==="interactiveAnim"?s+=1:a+=1}if(n!==0){var h=this.tasks[this.tasks.length-1];return{policy:"latest-pending-render",droppedEventCount:n,droppedRenderCount:r,droppedStepCount:o,droppedAnimationCount:s,droppedMediaCount:a,droppedOperationCount:n-r,droppedEventTypes:e,retainedSlideIndex:t.index,retainedRenderReceivedAt:Date.now(),hasRunningTask:this.isTaskRunning,hardBoundaryType:h==null?void 0:h.type}}},i.prototype.addTask=function(t){var e,n=this;if(!this.isDestroy){var r=this.isTaskRunning||this.tasks.length>0,o=this.policy==="latest-pending-render"&&this.isCatchUpEvent(t),s=this.policy==="latest-pending-render"&&(o||!!this.runningTask&&this.isCatchUpEvent(this.runningTask)||this.tasks.some(function(l){return n.isCatchUpEvent(l)})),a=this.policy==="latest-pending-render"&&t.type==="renderSlide"?this.compactForRender(t):void 0;if(this.tasks.push(t),s&&(r||o&&t.type==="renderSlide")&&this.setCatchUpState(!0),a){this.compactedTasks.set(t,a);try{(e=this.onCompact)===null||e===void 0||e.call(this,a)}catch{}}return this.isScheduling||this.schedule(),a}},i}(),Ow=function(){function i(t){this.autoUnlock=Object.create(null),this.localKeyAutoRemove=Object.create(null),this.localKeys=Object.create(null),this.locks=Object.create(null),this.available=!1,this.available=t}return i.prototype.addLock=function(t,e){var n=this;this.available&&(this.locks[t]=e,this.localKeys[e]=!0,this.localKeyAutoRemove[e]=window.setTimeout(function(){delete n.localKeys[e],delete n.localKeyAutoRemove[e]},6e4),this.autoUnlock[t]=window.setTimeout(function(){delete n.locks[t],delete n.autoUnlock[t]},3e3))},i.prototype.unlock=function(t,e){if(!this.available)return!1;var n=!!e&&!!this.localKeys[e];return e&&n&&(window.clearTimeout(this.localKeyAutoRemove[e]),delete this.localKeys[e],delete this.localKeyAutoRemove[e]),e&&this.locks[t]&&this.locks[t]===e&&(window.clearTimeout(this.autoUnlock[t]),delete this.locks[t],delete this.autoUnlock[t]),n},i.prototype.isLocked=function(t){return!!this.available&&!!this.locks[t]},i}(),Nw=function(){function i(){var t=this;this.tasks=[],this.isDestroy=!1,this.isScheduling=!1,this.schedule=function(){t.isScheduling=!0;var e=t.tasks.shift();e&&!t.isDestroy&&(e.status="running",e.fn.apply(null).then(function(){t.tasks.length>0?setTimeout(t.schedule):t.isScheduling=!1}).catch(function(){t.tasks.length>0?setTimeout(t.schedule):t.isScheduling=!1}))}}return i.prototype.getRunningTask=function(){return this.tasks[0]&&this.tasks[0].status==="running"?this.tasks[0]:null},i.prototype.addTask=function(t,e){var n={type:t,status:"wait",fn:e},r=this.getRunningTask();r&&t===r.type||(this.tasks=this.tasks.filter(function(o){return o.type!==t}),this.tasks.push(n),this.isScheduling||this.schedule())},i.prototype.destroy=function(){this.isDestroy=!0},i}(),jc=function(){return(jc=Object.assign||function(i){for(var t,e=1,n=arguments.length;e<n;e++)for(var r in t=arguments[e])Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r]);return i}).apply(this,arguments)},yo=function(i,t,e,n){return new(e||(e=Promise))(function(r,o){function s(h){try{l(n.next(h))}catch(u){o(u)}}function a(h){try{l(n.throw(h))}catch(u){o(u)}}function l(h){var u;h.done?r(h.value):(u=h.value,u instanceof e?u:new e(function(p){p(u)})).then(s,a)}l((n=n.apply(i,t||[])).next())})},_o=function(i,t){var e,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(h){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;s;)try{if(e=1,n&&(r=2&u[0]?n.return:u[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,u[1])).done)return r;switch(n=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,n=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(r=s.trys,!((r=r.length>0&&r[r.length-1])||u[0]!==6&&u[0]!==2)){s=0;continue}if(u[0]===3&&(!r||u[1]>r[0]&&u[1]<r[3])){s.label=u[1];break}if(u[0]===6&&s.label<r[1]){s.label=r[1],r=u;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(u);break}r[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(i,s)}catch(p){u=[6,p],n=0}finally{e=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([l,h])}}},Lw=function(){function i(){var t=this;this.logList=[],this.checkTimer=null,this.retryTimes=0,this.enable=!1,this.db=null,this.useIndexedDB=!1,this.DB_NAME="__slide_logs_report__",this.STORE_NAME="logs",this.BATCH_SIZE=1e3,this.uploadLoggerGlobalEvent=function(e){e.data.type==="@slide/_upload_log_"&&t.start()},this.config={checkTime:5e3,buffer:300},window.addEventListener("message",this.uploadLoggerGlobalEvent),this.initIndexedDB()}return i.prototype.initIndexedDB=function(){return yo(this,void 0,void 0,function(){var t,e=this;return _o(this,function(n){if(!("indexedDB"in window))return this.useIndexedDB=!1,this.start(),[2];try{(t=indexedDB.open(this.DB_NAME,1)).onerror=function(){e.useIndexedDB=!1},t.onsuccess=function(){e.start(),e.db=t.result,e.useIndexedDB=!0},t.onupgradeneeded=function(r){var o=r.target.result;o.objectStoreNames.contains(e.STORE_NAME)||o.createObjectStore(e.STORE_NAME,{keyPath:"id",autoIncrement:!0}).createIndex("timestamp","timestamp")}}catch{this.useIndexedDB=!1}return[2]})})},i.prototype.storeLogInIndexedDB=function(t){return yo(this,void 0,void 0,function(){var e,n=this;return _o(this,function(r){switch(r.label){case 0:if(!this.useIndexedDB)return[2];r.label=1;case 1:return r.trys.push([1,4,,5]),this.db&&this.isDatabaseHealthy()?[3,3]:[4,this.recreateDatabase()];case 2:if(r.sent(),!this.db||!this.useIndexedDB)throw new Error("Database not available after recreation attempt");r.label=3;case 3:return[2,new Promise(function(o,s){var a=n.db.transaction([n.STORE_NAME],"readwrite"),l=a.objectStore(n.STORE_NAME).add(t);a.onerror=function(){n.recreateDatabase().then(function(){if(n.db&&n.useIndexedDB){var h=n.db.transaction([n.STORE_NAME],"readwrite").objectStore(n.STORE_NAME).add(t);h.onsuccess=function(){return o()},h.onerror=function(){return s(h.error)}}else s(new Error("Database recreation failed"))}).catch(function(h){console.warn("Database recreation failed:",h),n.useIndexedDB=!1,s(h)})},l.onsuccess=function(){return o()},l.onerror=function(){var h,u;((h=l.error)===null||h===void 0?void 0:h.name)==="UnknownError"||((u=l.error)===null||u===void 0?void 0:u.name)==="NotFoundError"?n.recreateDatabase().catch(function(p){console.warn("Database recreation failed:",p),n.useIndexedDB=!1}).finally(function(){return s(l.error)}):s(l.error)}})];case 4:throw e=r.sent(),this.useIndexedDB=!1,e;case 5:return[2]}})})},i.prototype.getLogsFromIndexedDB=function(t){return yo(this,void 0,void 0,function(){var e=this;return _o(this,function(n){switch(n.label){case 0:if(!this.useIndexedDB)return[2,[]];n.label=1;case 1:return n.trys.push([1,4,,5]),this.db&&this.isDatabaseHealthy()?[3,3]:[4,this.recreateDatabase()];case 2:if(n.sent(),!this.db||!this.useIndexedDB)return[2,[]];n.label=3;case 3:return[2,new Promise(function(r,o){var s=e.db.transaction([e.STORE_NAME],"readonly"),a=s.objectStore(e.STORE_NAME).index("timestamp").openCursor(null,"next"),l=[];s.onerror=function(){var h,u;((h=s.error)===null||h===void 0?void 0:h.name)==="UnknownError"||((u=s.error)===null||u===void 0?void 0:u.name)==="NotFoundError"?e.recreateDatabase().catch(function(p){console.warn("Database recreation failed:",p),e.useIndexedDB=!1}).finally(function(){return r([])}):o(s.error)},a.onsuccess=function(h){var u=h.target.result;u&&l.length<t?(l.push(u.value),u.continue()):r(l.map(function(p){var y;return jc(jc({},p),{id:(y=p.id)===null||y===void 0?void 0:y.toString()})}))},a.onerror=function(){var h,u;((h=a.error)===null||h===void 0?void 0:h.name)==="UnknownError"||((u=a.error)===null||u===void 0?void 0:u.name)==="NotFoundError"?e.recreateDatabase().catch(function(p){console.warn("Database recreation failed:",p),e.useIndexedDB=!1}).finally(function(){return r([])}):o(a.error)}})];case 4:return n.sent(),this.useIndexedDB=!1,[2,[]];case 5:return[2]}})})},i.prototype.deleteLogsFromIndexedDB=function(t){return yo(this,void 0,void 0,function(){var e=this;return _o(this,function(n){switch(n.label){case 0:if(!this.useIndexedDB||t.length===0)return[2];n.label=1;case 1:return n.trys.push([1,4,,5]),this.db&&this.isDatabaseHealthy()?[3,3]:[4,this.recreateDatabase()];case 2:if(n.sent(),!this.db||!this.useIndexedDB)return[2];n.label=3;case 3:return[2,new Promise(function(r,o){var s=e.db.transaction([e.STORE_NAME],"readwrite"),a=s.objectStore(e.STORE_NAME),l=t.map(function(h){return new Promise(function(u,p){var y=Number(h.id);if(y){var b=a.delete(y);b.onsuccess=function(){return u()},b.onerror=function(){var w,M;((w=b.error)===null||w===void 0?void 0:w.name)==="UnknownError"||((M=b.error)===null||M===void 0?void 0:M.name)==="NotFoundError"?u():p(b.error)}}else u()})});s.onerror=function(){var h,u;((h=s.error)===null||h===void 0?void 0:h.name)==="UnknownError"||((u=s.error)===null||u===void 0?void 0:u.name)==="NotFoundError"?e.recreateDatabase().catch(function(p){console.warn("Database recreation failed:",p),e.useIndexedDB=!1}).finally(function(){return r()}):o(s.error)},Promise.all(l).then(function(){return r()}).catch(o)})];case 4:return n.sent(),this.useIndexedDB=!1,[3,5];case 5:return[2]}})})},i.prototype.start=function(){return yo(this,void 0,void 0,function(){var t=this;return _o(this,function(e){return clearInterval(this.checkTimer),this.checkTimer=setInterval(function(){return yo(t,void 0,void 0,function(){return _o(this,function(n){switch(n.label){case 0:return[4,this.uploadLog()];case 1:return n.sent(),[2]}})})},this.config.checkTime),[2]})})},i.prototype.pause=function(){clearInterval(this.checkTimer)},i.prototype.addLog=function(t,e,n,r){return yo(this,void 0,void 0,function(){var o;return _o(this,function(s){switch(s.label){case 0:if(o={level:e,taskId:n,message:t,randomId:r,timestamp:Date.now().toString()},!this.useIndexedDB)return[3,5];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.storeLogInIndexedDB(o)];case 2:return s.sent(),[3,4];case 3:return s.sent(),this.logList.push(o),[3,4];case 4:return[3,6];case 5:this.logList.push(o),s.label=6;case 6:return[2]}})})},i.prototype.isDatabaseHealthy=function(){if(!this.db)return!1;try{return this.db.transaction([this.STORE_NAME],"readonly").objectStore(this.STORE_NAME).index("timestamp"),!0}catch(t){return console.warn("Database health check failed:",t),!1}},i.prototype.recreateDatabase=function(){return yo(this,void 0,void 0,function(){var t=this;return _o(this,function(e){return[2,new Promise(function(n,r){try{t.db&&(t.db.close(),t.db=null);var o=indexedDB.open(t.DB_NAME,1);o.onerror=function(){t.useIndexedDB=!1,r(o.error)},o.onsuccess=function(){t.db=o.result,t.useIndexedDB=!0,n()},o.onupgradeneeded=function(s){var a=s.target.result;a.objectStoreNames.contains(t.STORE_NAME)||a.createObjectStore(t.STORE_NAME,{keyPath:"id",autoIncrement:!0}).createIndex("timestamp","timestamp")}}catch(s){t.useIndexedDB=!1,r(s)}})]})})},i.prototype.destroy=function(){clearInterval(this.checkTimer),window.removeEventListener("message",this.uploadLoggerGlobalEvent),this.db&&(this.db.close(),this.db=null)},i.prototype.uploadLog=function(t){return t===void 0&&(t=!1),yo(this,void 0,void 0,function(){var e,n,r,o=this;return _o(this,function(s){switch(s.label){case 0:return e=[],this.useIndexedDB?[4,this.getLogsFromIndexedDB(this.BATCH_SIZE)]:[3,2];case 1:return(e=s.sent()).length===0?[2]:[3,3];case 2:if(!(this.logList.length>=this.config.buffer||t))return[2];e=this.logList.splice(0),s.label=3;case 3:n=function(){o.useIndexedDB||(o.logList=e.concat(o.logList)),o.retryTimes>3&&o.pause(),o.retryTimes+=1},s.label=4;case 4:return s.trys.push([4,10,,11]),[4,fetch("https://netless-ppt-plugin-dev.cn-hangzhou.log.aliyuncs.com/logstores/netless-ppt-plugin-dev/track",{method:"POST",headers:{"x-log-apiversion":"0.6.0","Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify({__topic__:"netless-ppt-plugin-dev",__source__:"netless-ppt-plugin-dev",__logs__:e})})];case 5:return s.sent().ok?(this.retryTimes=0,this.useIndexedDB?[4,this.deleteLogsFromIndexedDB(e)]:[3,7]):[3,8];case 6:s.sent(),s.label=7;case 7:return[3,9];case 8:n(),s.label=9;case 9:return[3,11];case 10:return r=s.sent(),console.warn(r),n(),[3,11];case 11:return[2]}})})},i.prototype.setEnable=function(t){this.enable!==t&&(t?this.start():this.pause())},i}(),Dw=function(i,t,e,n){return new(e||(e=Promise))(function(r,o){function s(h){try{l(n.next(h))}catch(u){o(u)}}function a(h){try{l(n.throw(h))}catch(u){o(u)}}function l(h){var u;h.done?r(h.value):(u=h.value,u instanceof e?u:new e(function(p){p(u)})).then(s,a)}l((n=n.apply(i,t||[])).next())})},Fw=function(i,t){var e,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(h){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;s;)try{if(e=1,n&&(r=2&u[0]?n.return:u[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,u[1])).done)return r;switch(n=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,n=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(r=s.trys,!((r=r.length>0&&r[r.length-1])||u[0]!==6&&u[0]!==2)){s=0;continue}if(u[0]===3&&(!r||u[1]>r[0]&&u[1]<r[3])){s.label=u[1];break}if(u[0]===6&&s.label<r[1]){s.label=r[1],r=u;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(u);break}r[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(i,s)}catch(p){u=[6,p],n=0}finally{e=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([l,h])}}};function Bw(i,t,e,n,r){return Dw(this,void 0,void 0,function(){var o,s,a,l,h,u;return Fw(this,function(p){switch(p.label){case 0:return o=document.createElement("div"),(s=new ro({anchor:o,renderOptions:{minFPS:1,maxFPS:1,resolution:1,maxResolutionLevel:e,forceCanvas:!0},mode:"local",interactive:!1,useLocalCache:!0})).setResource(i,t),[4,s.getSlideCountAsync()];case 1:a=p.sent(),p.label=2;case 2:if(p.trys.push([2,12,13,14]),!(r&&r.length>0))return[3,7];l=r.filter(function(y,b){return r.indexOf(y)===b}),u=0,p.label=3;case 3:return u<l.length?(h=l[u])>0&&h<=a?[4,s.player.stagePool.preload(h,!0)]:[3,5]:[3,6];case 4:p.sent(),n(Math.round((u+1)/l.length*100)/100),p.label=5;case 5:return u++,[3,3];case 6:return[3,11];case 7:u=1,p.label=8;case 8:return u<=a?[4,s.player.stagePool.preload(u,!0)]:[3,11];case 9:p.sent(),n(Math.round(u/a*100)/100),p.label=10;case 10:return u++,[3,8];case 11:return[3,14];case 12:throw p.sent();case 13:return s.destroy(),[7];case 14:return[2]}})})}var kw=function(){var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])})(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}i(t,e),t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),xs=function(){return(xs=Object.assign||function(i){for(var t,e=1,n=arguments.length;e<n;e++)for(var r in t=arguments[e])Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r]);return i}).apply(this,arguments)},Uw=function(i,t,e,n){var r,o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(i,t,e,n);else for(var a=i.length-1;a>=0;a--)(r=i[a])&&(s=(o<3?r(s):o>3?r(t,e,s):r(t,e))||s);return o>3&&s&&Object.defineProperty(t,e,s),s},zi=function(i,t,e,n){return new(e||(e=Promise))(function(r,o){function s(h){try{l(n.next(h))}catch(u){o(u)}}function a(h){try{l(n.throw(h))}catch(u){o(u)}}function l(h){var u;h.done?r(h.value):(u=h.value,u instanceof e?u:new e(function(p){p(u)})).then(s,a)}l((n=n.apply(i,t||[])).next())})},Vi=function(i,t){var e,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(h){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;s;)try{if(e=1,n&&(r=2&u[0]?n.return:u[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,u[1])).done)return r;switch(n=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,n=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(r=s.trys,!((r=r.length>0&&r[r.length-1])||u[0]!==6&&u[0]!==2)){s=0;continue}if(u[0]===3&&(!r||u[1]>r[0]&&u[1]<r[3])){s.label=u[1];break}if(u[0]===6&&s.label<r[1]){s.label=r[1],r=u;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(u);break}r[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(i,s)}catch(p){u=[6,p],n=0}finally{e=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([l,h])}}},Gw=window.ResizeObserver||hw,Nh=function(i){return new Promise(function(t){return setTimeout(t,i)})};function Hw(i,t){return zi(this,void 0,void 0,function(){var e;return Vi(this,function(n){switch(n.label){case 0:e=Date.now(),n.label=1;case 1:return!i()&&Date.now()-e<t?[4,Nh(50)]:[3,3];case 2:return n.sent(),e=Date.now(),[3,1];case 3:return[2]}})})}var or={syncDispatch:"syncDispatch",syncReceive:"syncReceive",syncEventLag:"syncEventLag",renderStart:"renderStart",renderEnd:"renderEnd",renderError:"renderError",slideChange:"slideChange",mainSeqStepStart:"mainSeqStepStart",mainSeqStepEnd:"mainSeqStepEnd",animateStart:"animateStart",animateEnd:"animateEnd",stateChange:"stateChange",slideStepEnd:"slideEnd",slideStepStart:"slideStart",useraddLink:"useraddLink"},yg={taskId:"",url:"",currentSlideIndex:-1,mainSeqStep:-1,mainSeqState:null,mediaState:Object.create(null),interactiveSeqState:Object.create(null)},zc="";try{zc="1.4.55-alpha.5"}catch{zc="-dev-"}var fr=null;try{(fr=P.createInstance({name:"__slide_local_log__",driver:P.INDEXEDDB,version:1})).ready(function(i){}).catch(function(i){})}catch{}navigator.userAgent.toUpperCase().includes("HUAWEI")&&document.createElement("canvas").getContext("2d").fillText("\u9065\u9065\u9886\u5148",0,10);var ro=function(i){function t(r){var o=i.call(this)||this;o.iosResetCache=[],o.version=zc,o.__slideState=H0()(yg),o.userInputTime=0,o.isSyncingSlideState=!1,o.frozenTaskManager=new Nw,o.randomId=E(),o.resize=!1,o.isAnimating=!1,o.renderingTaskManager=new pw,o.isLoading=!1,o.interactive=!0,o.syncCatchUpInputBlocked=!1,o.renderingIndex=0,o.frameWidth=1,o.frameHeight=1,o.frame=document.createElement("div"),o.canvasContainer=document.createElement("div"),o.medianController=document.createElement("div"),o.frameResizeObserver=new Gw(function(){return o.frameResizeHandler()}),o.timestamp=function(){return Date.now()},o.mode="local",o.enableGlobalClick=!1,o.lastEmitedState=null,o.selfSyncEvents=new WeakSet,o.playerController=null,o.isInitResized=!1,o.cacheImage=document.createElement("img"),o.isTouchStart=!1,o.touchStartId=void 0,o.taskId="",o.volumeAdjuster=new U0,o.designWidth=0,o.designHeight=0,o._slideCount=0,o._dispatchIncrId=0,o._receiveIncrId=0,o.resizeView=wh()(o._resizeView.bind(o),50),o.handleViewClick=wh()(o._handleViewClick.bind(o),300,{leading:!0}),o.slideNots=null,o.resourceList=[],o._updateVolumeByStaticAdjuster=function(a){o.volumeAdjuster.volume=a},o.handleSyncQueueCompact=function(a){var l={policy:a.policy,droppedEventCount:a.droppedEventCount,droppedRenderCount:a.droppedRenderCount,droppedStepCount:a.droppedStepCount,droppedAnimationCount:a.droppedAnimationCount,droppedMediaCount:a.droppedMediaCount,droppedOperationCount:a.droppedOperationCount,droppedEventTypes:a.droppedEventTypes,retainedSlideIndex:a.retainedSlideIndex,retainedRenderReceivedAt:a.retainedRenderReceivedAt,hasRunningTask:a.hasRunningTask,resourceBoundaryHit:a.hardBoundaryType==="setResource",unknownBoundaryHit:!!a.hardBoundaryType&&a.hardBoundaryType!=="setResource"};o.logger.info("sync event queue compact "+JSON.stringify(l),o.taskId),o.tracker({name:"syncEventQueueCompact",reason:"",result:"",payload:l})},o.handleSyncQueueCompactRenderComplete=function(a,l){var h={policy:a.policy,retainedSlideIndex:a.retainedSlideIndex,retainedRenderReceivedAt:a.retainedRenderReceivedAt,renderEndAt:l,catchUpDurationMs:Math.max(0,l-a.retainedRenderReceivedAt)};o.logger.info("sync event queue compact render end "+JSON.stringify(h),o.taskId),o.tracker({name:"syncEventQueueCompactRenderEnd",reason:"",result:"",payload:h})},o.handleSyncQueueCatchUpStateChange=function(a){o.syncCatchUpInputBlocked=a,o.updatePlayerInteractive();var l={policy:o.config.syncEventQueuePolicy,isCatchingUp:a,inputBlocked:o.syncCatchUpInputBlocked};o.logger.info("sync event queue catch-up state "+JSON.stringify(l),o.taskId),o.tracker({name:"syncEventQueueCatchUpStateChange",reason:"",result:"",payload:l})},o.recoverHandler=function(a){if(a.data.type==="@slide/_recover_"&&a.data.slideId===o.randomId){var l=a.data,h=l.recoverBy,u=l.payload;if(!u)return;h==="renderOtherPage"&&u.slideIndex?o.enqueueRenderSlide(u.slideIndex).catch(function(p){o.logger.error(p,o.taskId)}):h==="reloadCurrentPage"&&o.enqueueRenderSlide(o.renderingIndex).catch(function(p){o.logger.error(p,o.taskId)})}},o.urlInterrupter=function(a){return zi(o,void 0,void 0,function(){var l,h;return Vi(this,function(u){return l=a,this.resourceList.length>0&&(h=a.replace(/^.*__internal__/,""),l=this.resourceList.find(function(p){return p.indexOf(h)>=0})||a),this.config.urlInterrupter?[2,this.config.urlInterrupter(l)]:[2,Promise.resolve(l)]})})},o.userInputHandle=function(){o.userInputTime=Date.now()},o.handleViewTouchStart=function(){window.clearTimeout(o.touchStartId),o.isTouchStart=!0,o.touchStartId=setTimeout(function(){o.isTouchStart=!1},350)},o.handleViewTouchEnd=function(){o.isTouchStart&&(o.isTouchStart=!1,o.handleViewClick())},o.handleSlideRef=function(){console.log(o),window.__slide=o},o.updateStageCountLimit=function(a){var l=Number(a.detail.value);l>0&&Number.isInteger(l)&&(t.__stageCountLimit=l)},o.receiveSyncHandler=function(a){return zi(o,void 0,void 0,function(){var l,h,u,p,y,b,w,M=this;return Vi(this,function(I){switch(I.label){case 0:return go()(a.incrId)&&(a.incrId&&a.incrId-this._receiveIncrId!=1&&this.emit(or.syncEventLag),this._receiveIncrId=a.incrId||0),this.logger.info("sync receive "+JSON.stringify(a),this.taskId),a.type!=="nextStep"?[3,1]:(this.mainSeqStep!==a.next-1&&this.mainSeqStep+1!==this.mainSeqLength&&this.player?(this.setMainSeqStep(a.next,"start"),this.player.nextTick(function(){M.doNextStep(!0,a.clientId||"")})):this.doNextStep(!0,a.clientId||""),[3,6]);case 1:return a.type!=="prevStep"?[3,2]:(this.mainSeqStep===0&&this.mainSeqState==="idle"||this.mainSeqStep===a.next+1||this.mainSeqStep+1===this.mainSeqLength?this.doPrevStep(!0):(this.setMainSeqStep(a.next+1,"start"),(h=this.player)===null||h===void 0||h.nextTick(function(){M.doPrevStep(!0)})),[3,6]);case 2:return a.type!=="interactiveAnim"?[3,3]:(this.player?this.player.applyInteractiveAction(a.action):this.__slideState.interactiveSeqState[a.seqId]?this.__slideState.interactiveSeqState[a.seqId].step+=1:this.__slideState.interactiveSeqState[a.seqId]={step:0,state:"end"},[3,6]);case 3:return a.type!=="renderSlide"?[3,5]:[4,this.enqueueRenderSlide(a.index,a.isForward)];case 4:return I.sent(),[3,6];case 5:a.type==="mediaPlay"?(l=void 0,a.state.time&&(l=(this.timestamp()-a.state.time)/1e3),(u=this.player)===null||u===void 0||u.setMediaState(a.id,!0,l),this.__slideState.mediaState[a.id]=a.state):a.type==="mediaPause"?((p=this.player)===null||p===void 0||p.setMediaState(a.id,!1,(y=a.state)===null||y===void 0?void 0:y.time),this.__slideState.mediaState[a.id]=a.state):a.type==="mediaSeek"?((b=this.player)===null||b===void 0||b.setMediaCurrentTime(a.id,a.time),this.__slideState.mediaState[a.id]=a.state):a.type==="mediaFullscreen"&&(a.targetId&&this.__slideState.mediaState[a.targetId]?this.__slideState.mediaState[a.targetId].fullscreen=a.state:this.__slideState.mediaState[a.targetId]={fullscreen:a.state,type:"pause",time:0},(w=this.player)===null||w===void 0||w.syncFullscreenVideoState({targetId:a.targetId,state:a.state,slideIndex:a.slideIndex})),I.label=6;case 6:return[2]}})})},o.flushDebounce=function(){o.resizeView.flush(),o.config.disableClickDebounce||o.handleViewClick.flush()},o.handlePrevSlide=function(a){return a===void 0&&(a=!1),zi(o,void 0,void 0,function(){var l,h;return Vi(this,function(u){return!a&&this.syncCatchUpInputBlocked?[2]:this.player?((l=this.player.prevSlideIndex)>=1&&(!((h=this.config.navigatorDelegate)===null||h===void 0)&&h.gotoPage?this.config.navigatorDelegate.gotoPage(l):a?this.enqueueRenderSlide(l,!1):this.renderSlide(l,!1)),[2]):[2]})})},o.handleNextSlide=function(a){return a===void 0&&(a=!1),zi(o,void 0,void 0,function(){var l,h;return Vi(this,function(u){return!a&&this.syncCatchUpInputBlocked?[2]:this.player?((l=this.player.nextSlideIndex)<=this.slideCount&&(!((h=this.config.navigatorDelegate)===null||h===void 0)&&h.gotoPage?this.config.navigatorDelegate.gotoPage(l):a?this.enqueueRenderSlide(l,!0):this.renderSlide(l,!0)),[2]):[2]})})},o.handleGotoSlide=function(a){if(!o.syncCatchUpInputBlocked)if(a<=o.slideCount&&a>=1){var l=o.slideState.currentSlideIndex<=a;o.renderSlide(a,l)}else a===-1&&o.renderSlide(o.slideCount,!0)},t.instances.push(o),o.config=o.initSlideConfig(r),o.config.disableClickDebounce&&(o.handleViewClick=o._handleViewClick.bind(o)),o.tracker=function(a){r.whiteTracker&&r.whiteTracker.commit({name:a.name,reason:a.reason,result:a.result,payload:xs(xs({},a.payload),{slideId:o.randomId,taskId:o.taskId})},{slideVersion:o.version||""})},t.trackLogger.setEnable(!!o.config.enableTracking),o.logger={info:function(a,l){var h;t.appendLogString("INFO - "+new Date().toISOString()+" - {"+o.randomId+"}["+l+"] "+a+`
8026
+ `));var Qa=function(){try{return!!window.localStorage}catch{return!1}}(),Ph=void 0,dg=!0,sa=void 0,Fc=!1,pg=[],hi=function i(t){var e=this,n=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),de.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],n=Le.defaults(n,{closeOnTop:!1,autoPlace:!0,width:i.DEFAULT_WIDTH}),n=Le.defaults(n,{resizable:n.autoPlace,hideable:n.autoPlace}),Le.isUndefined(n.load)?n.load={preset:"Default"}:n.preset&&(n.load.preset=n.preset),Le.isUndefined(n.parent)&&n.hideable&&pg.push(this),n.resizable=Le.isUndefined(n.parent)&&n.resizable,n.autoPlace&&Le.isUndefined(n.scrollable)&&(n.scrollable=!0);var r,o=Qa&&localStorage.getItem(aa(this,"isLocal"))==="true",s=void 0,a=void 0;if(Object.defineProperties(this,{parent:{get:function(){return n.parent}},scrollable:{get:function(){return n.scrollable}},autoPlace:{get:function(){return n.autoPlace}},closeOnTop:{get:function(){return n.closeOnTop}},preset:{get:function(){return e.parent?e.getRoot().preset:n.load.preset},set:function(u){e.parent?e.getRoot().preset=u:n.load.preset=u,function(p){for(var y=0;y<p.__preset_select.length;y++)p.__preset_select[y].value===p.preset&&(p.__preset_select.selectedIndex=y)}(this),e.revert()}},width:{get:function(){return n.width},set:function(u){n.width=u,Gc(e,u)}},name:{get:function(){return n.name},set:function(u){n.name=u,a&&(a.innerHTML=n.name)}},closed:{get:function(){return n.closed},set:function(u){n.closed=u,n.closed?de.addClass(e.__ul,i.CLASS_CLOSED):de.removeClass(e.__ul,i.CLASS_CLOSED),this.onResize(),e.__closeButton&&(e.__closeButton.innerHTML=u?i.TEXT_OPEN:i.TEXT_CLOSED)}},load:{get:function(){return n.load}},useLocalStorage:{get:function(){return o},set:function(u){Qa&&(o=u,u?de.bind(window,"unload",s):de.unbind(window,"unload",s),localStorage.setItem(aa(e,"isLocal"),u))}}}),Le.isUndefined(n.parent)){if(this.closed=n.closed||!1,de.addClass(this.domElement,i.CLASS_MAIN),de.makeSelectable(this.domElement,!1),Qa&&o){e.useLocalStorage=!0;var l=localStorage.getItem(aa(this,"gui"));l&&(n.load=JSON.parse(l))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=i.TEXT_CLOSED,de.addClass(this.__closeButton,i.CLASS_CLOSE_BUTTON),n.closeOnTop?(de.addClass(this.__closeButton,i.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(de.addClass(this.__closeButton,i.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),de.bind(this.__closeButton,"click",function(){e.closed=!e.closed})}else{n.closed===void 0&&(n.closed=!0);var h=document.createTextNode(n.name);de.addClass(h,"controller-name"),a=Bc(e,h),de.addClass(this.__ul,i.CLASS_CLOSED),de.addClass(a,"title"),de.bind(a,"click",function(u){return u.preventDefault(),e.closed=!e.closed,!1}),n.closed||(this.closed=!1)}n.autoPlace&&(Le.isUndefined(n.parent)&&(dg&&(sa=document.createElement("div"),de.addClass(sa,"dg"),de.addClass(sa,i.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(sa),dg=!1),sa.appendChild(this.domElement),de.addClass(this.domElement,i.CLASS_AUTO_PLACE)),this.parent||Gc(e,n.width)),this.__resizeHandler=function(){e.onResizeDebounced()},de.bind(window,"resize",this.__resizeHandler),de.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),de.bind(this.__ul,"transitionend",this.__resizeHandler),de.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),n.resizable&&Aw(this),s=function(){Qa&&localStorage.getItem(aa(e,"isLocal"))==="true"&&localStorage.setItem(aa(e,"gui"),JSON.stringify(e.getSaveObject()))},this.saveToLocalStorageIfPossible=s,n.parent||((r=e.getRoot()).width+=1,Le.defer(function(){r.width-=1}))};function Bc(i,t,e){var n=document.createElement("li");return t&&n.appendChild(t),e?i.__ul.insertBefore(n,e):i.__ul.appendChild(n),i.onResize(),n}function fg(i){de.unbind(window,"resize",i.__resizeHandler),i.saveToLocalStorageIfPossible&&de.unbind(window,"unload",i.saveToLocalStorageIfPossible)}function kc(i,t){var e=i.__preset_select[i.__preset_select.selectedIndex];e.innerHTML=t?e.value+"*":e.value}function mg(i,t){var e=i.getRoot(),n=e.__rememberedObjects.indexOf(t.object);if(n!==-1){var r=e.__rememberedObjectIndecesToControllers[n];if(r===void 0&&(r={},e.__rememberedObjectIndecesToControllers[n]=r),r[t.property]=t,e.load&&e.load.remembered){var o=e.load.remembered,s=void 0;if(o[i.preset])s=o[i.preset];else{if(!o.Default)return;s=o.Default}if(s[n]&&s[n][t.property]!==void 0){var a=s[n][t.property];t.initialValue=a,t.setValue(a)}}}}function tl(i,t,e,n){if(t[e]===void 0)throw new Error('Object "'+t+'" has no property "'+e+'"');var r=void 0;if(n.color)r=new Dc(t,e);else{var o=[t,e].concat(n.factoryArgs);r=Tw.apply(i,o)}n.before instanceof _s&&(n.before=n.before.__li),mg(i,r),de.addClass(r.domElement,"c");var s=document.createElement("span");de.addClass(s,"property-name"),s.innerHTML=r.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(r.domElement);var l=Bc(i,a,n.before);return de.addClass(l,hi.CLASS_CONTROLLER_ROW),r instanceof Dc?de.addClass(l,"color"):de.addClass(l,mw(r.getValue())),function(h,u,p){if(p.__li=u,p.__gui=h,Le.extend(p,{options:function(w){if(arguments.length>1){var M=p.__li.nextElementSibling;return p.remove(),tl(h,p.object,p.property,{before:M,factoryArgs:[Le.toArray(arguments)]})}if(Le.isArray(w)||Le.isObject(w)){var I=p.__li.nextElementSibling;return p.remove(),tl(h,p.object,p.property,{before:I,factoryArgs:[w]})}},name:function(w){return p.__li.firstElementChild.firstElementChild.innerHTML=w,p},listen:function(){return p.__gui.listen(p),p},remove:function(){return p.__gui.remove(p),p}}),p instanceof Lc){var y=new Ih(p.object,p.property,{min:p.__min,max:p.__max,step:p.__step});Le.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(w){var M=p[w],I=y[w];p[w]=y[w]=function(){var H=Array.prototype.slice.call(arguments);return I.apply(y,H),M.apply(p,H)}}),de.addClass(u,"has-slider"),p.domElement.insertBefore(y.domElement,p.domElement.firstElementChild)}else if(p instanceof Ih){var b=function(w){if(Le.isNumber(p.__min)&&Le.isNumber(p.__max)){var M=p.__li.firstElementChild.firstElementChild.innerHTML,I=p.__gui.__listening.indexOf(p)>-1;p.remove();var H=tl(h,p.object,p.property,{before:p.__li.nextElementSibling,factoryArgs:[p.__min,p.__max,p.__step]});return H.name(M),I&&H.listen(),H}return w};p.min=Le.compose(b,p.min),p.max=Le.compose(b,p.max)}else p instanceof sg?(de.bind(u,"click",function(){de.fakeEvent(p.__checkbox,"click")}),de.bind(p.__checkbox,"click",function(w){w.stopPropagation()})):p instanceof ug?(de.bind(u,"click",function(){de.fakeEvent(p.__button,"click")}),de.bind(u,"mouseover",function(){de.addClass(p.__button,"hover")}),de.bind(u,"mouseout",function(){de.removeClass(p.__button,"hover")})):p instanceof Dc&&(de.addClass(u,"color"),p.updateDisplay=Le.compose(function(w){return u.style.borderLeftColor=p.__color.toString(),w},p.updateDisplay),p.updateDisplay());p.setValue=Le.compose(function(w){return h.getRoot().__preset_select&&p.isModified()&&kc(h.getRoot(),!0),w},p.setValue)}(i,l,r),i.__controllers.push(r),r}function aa(i,t){return document.location.href+"."+t}function Uc(i,t,e){var n=document.createElement("option");n.innerHTML=t,n.value=t,i.__preset_select.appendChild(n),e&&(i.__preset_select.selectedIndex=i.__preset_select.length-1)}function gg(i,t){t.style.display=i.useLocalStorage?"block":"none"}function Ew(i){var t=i.__save_row=document.createElement("li");de.addClass(i.domElement,"has-save"),i.__ul.insertBefore(t,i.__ul.firstChild),de.addClass(t,"save-row");var e=document.createElement("span");e.innerHTML="&nbsp;",de.addClass(e,"button gears");var n=document.createElement("span");n.innerHTML="Save",de.addClass(n,"button"),de.addClass(n,"save");var r=document.createElement("span");r.innerHTML="New",de.addClass(r,"button"),de.addClass(r,"save-as");var o=document.createElement("span");o.innerHTML="Revert",de.addClass(o,"button"),de.addClass(o,"revert");var s=i.__preset_select=document.createElement("select");if(i.load&&i.load.remembered?Le.each(i.load.remembered,function(u,p){Uc(i,p,p===i.preset)}):Uc(i,"Default",!1),de.bind(s,"change",function(){for(var u=0;u<i.__preset_select.length;u++)i.__preset_select[u].innerHTML=i.__preset_select[u].value;i.preset=this.value}),t.appendChild(s),t.appendChild(e),t.appendChild(n),t.appendChild(r),t.appendChild(o),Qa){var a=document.getElementById("dg-local-explain"),l=document.getElementById("dg-local-storage");document.getElementById("dg-save-locally").style.display="block",localStorage.getItem(aa(0,"isLocal"))==="true"&&l.setAttribute("checked","checked"),gg(i,a),de.bind(l,"change",function(){i.useLocalStorage=!i.useLocalStorage,gg(i,a)})}var h=document.getElementById("dg-new-constructor");de.bind(h,"keydown",function(u){!u.metaKey||u.which!==67&&u.keyCode!==67||Ph.hide()}),de.bind(e,"click",function(){h.innerHTML=JSON.stringify(i.getSaveObject(),void 0,2),Ph.show(),h.focus(),h.select()}),de.bind(n,"click",function(){i.save()}),de.bind(r,"click",function(){var u=prompt("Enter a new preset name.");u&&i.saveAs(u)}),de.bind(o,"click",function(){i.revert()})}function Aw(i){var t=void 0;function e(o){return o.preventDefault(),i.width+=t-o.clientX,i.onResize(),t=o.clientX,!1}function n(){de.removeClass(i.__closeButton,hi.CLASS_DRAG),de.unbind(window,"mousemove",e),de.unbind(window,"mouseup",n)}function r(o){return o.preventDefault(),t=o.clientX,de.addClass(i.__closeButton,hi.CLASS_DRAG),de.bind(window,"mousemove",e),de.bind(window,"mouseup",n),!1}i.__resize_handle=document.createElement("div"),Le.extend(i.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),de.bind(i.__resize_handle,"mousedown",r),de.bind(i.__closeButton,"mousedown",r),i.domElement.insertBefore(i.__resize_handle,i.domElement.firstElementChild)}function Gc(i,t){i.domElement.style.width=t+"px",i.__save_row&&i.autoPlace&&(i.__save_row.style.width=t+"px"),i.__closeButton&&(i.__closeButton.style.width=t+"px")}function Oh(i,t){var e={};return Le.each(i.__rememberedObjects,function(n,r){var o={},s=i.__rememberedObjectIndecesToControllers[r];Le.each(s,function(a,l){o[l]=t?a.initialValue:a.getValue()}),e[r]=o}),e}hi.toggleHide=function(){Fc=!Fc,Le.each(pg,function(i){i.domElement.style.display=Fc?"none":""})},hi.CLASS_AUTO_PLACE="a",hi.CLASS_AUTO_PLACE_CONTAINER="ac",hi.CLASS_MAIN="main",hi.CLASS_CONTROLLER_ROW="cr",hi.CLASS_TOO_TALL="taller-than-window",hi.CLASS_CLOSED="closed",hi.CLASS_CLOSE_BUTTON="close-button",hi.CLASS_CLOSE_TOP="close-top",hi.CLASS_CLOSE_BOTTOM="close-bottom",hi.CLASS_DRAG="drag",hi.DEFAULT_WIDTH=245,hi.TEXT_CLOSED="Close Controls",hi.TEXT_OPEN="Open Controls",hi._keydownHandler=function(i){document.activeElement.type==="text"||i.which!==72&&i.keyCode!==72||hi.toggleHide()},de.bind(window,"keydown",hi._keydownHandler,!1),Le.extend(hi.prototype,{add:function(i,t){return tl(this,i,t,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(i,t){return tl(this,i,t,{color:!0})},remove:function(i){this.__ul.removeChild(i.__li),this.__controllers.splice(this.__controllers.indexOf(i),1);var t=this;Le.defer(function(){t.onResize()})},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&sa.removeChild(this.domElement);var i=this;Le.each(this.__folders,function(t){i.removeFolder(t)}),de.unbind(window,"keydown",hi._keydownHandler,!1),fg(this)},addFolder:function(i){if(this.__folders[i]!==void 0)throw new Error('You already have a folder in this GUI by the name "'+i+'"');var t={name:i,parent:this};t.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[i]&&(t.closed=this.load.folders[i].closed,t.load=this.load.folders[i]);var e=new hi(t);this.__folders[i]=e;var n=Bc(this,e.domElement);return de.addClass(n,"folder"),e},removeFolder:function(i){this.__ul.removeChild(i.domElement.parentElement),delete this.__folders[i.name],this.load&&this.load.folders&&this.load.folders[i.name]&&delete this.load.folders[i.name],fg(i);var t=this;Le.each(i.__folders,function(e){i.removeFolder(e)}),Le.defer(function(){t.onResize()})},open:function(){this.closed=!1},close:function(){this.closed=!0},hide:function(){this.domElement.style.display="none"},show:function(){this.domElement.style.display=""},onResize:function(){var i=this.getRoot();if(i.scrollable){var t=de.getOffset(i.__ul).top,e=0;Le.each(i.__ul.childNodes,function(n){i.autoPlace&&n===i.__save_row||(e+=de.getHeight(n))}),window.innerHeight-t-20<e?(de.addClass(i.domElement,hi.CLASS_TOO_TALL),i.__ul.style.height=window.innerHeight-t-20+"px"):(de.removeClass(i.domElement,hi.CLASS_TOO_TALL),i.__ul.style.height="auto")}i.__resize_handle&&Le.defer(function(){i.__resize_handle.style.height=i.__ul.offsetHeight+"px"}),i.__closeButton&&(i.__closeButton.style.width=i.width+"px")},onResizeDebounced:Le.debounce(function(){this.onResize()},50),remember:function(){if(Le.isUndefined(Ph)&&((Ph=new ww).domElement.innerHTML=bw),this.parent)throw new Error("You can only call remember on a top level GUI.");var i=this;Le.each(Array.prototype.slice.call(arguments),function(t){i.__rememberedObjects.length===0&&Ew(i),i.__rememberedObjects.indexOf(t)===-1&&i.__rememberedObjects.push(t)}),this.autoPlace&&Gc(this,this.width)},getRoot:function(){for(var i=this;i.parent;)i=i.parent;return i},getSaveObject:function(){var i=this.load;return i.closed=this.closed,this.__rememberedObjects.length>0&&(i.preset=this.preset,i.remembered||(i.remembered={}),i.remembered[this.preset]=Oh(this)),i.folders={},Le.each(this.__folders,function(t,e){i.folders[e]=t.getSaveObject()}),i},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=Oh(this),kc(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(i){this.load.remembered||(this.load.remembered={},this.load.remembered.Default=Oh(this,!0)),this.load.remembered[i]=Oh(this),this.preset=i,Uc(this,i,!0),this.saveToLocalStorageIfPossible()},revert:function(i){Le.each(this.__controllers,function(t){this.getRoot().load.remembered?mg(i||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),Le.each(this.__folders,function(t){t.revert(t)}),i||kc(this.getRoot(),!1)},listen:function(i){var t=this.__listening.length===0;this.__listening.push(i),t&&function e(n){n.length!==0&&Sw.call(window,function(){e(n)}),Le.each(n,function(r){r.updateDisplay()})}(this.__listening)},updateDisplay:function(){Le.each(this.__controllers,function(i){i.updateDisplay()}),Le.each(this.__folders,function(i){i.updateDisplay()})}});var Cw=hi,Mw=function(){function i(t){this.player=t}return Object.defineProperty(i.prototype,"frameRate",{get:function(){return this.player.fps.value},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"drawFrames",{get:function(){return this.player.runtime.fps},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"drawCall",{get:function(){return this.player.runtime.drawCall},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"resolution",{get:function(){return this.player.config.resolution},set:function(t){this.player.updateConfig({resolution:t})},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"size",{get:function(){var t,e;return((t=this.player.view)===null||t===void 0?void 0:t.width)+"*"+((e=this.player.view)===null||e===void 0?void 0:e.height)},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"minFPS",{get:function(){return this.player.config.minFPS},set:function(t){this.player.updateConfig({minFPS:t,maxFPS:this.player.config.maxFPS})},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"maxFPS",{get:function(){return this.player.config.maxFPS},set:function(t){this.player.updateConfig({maxFPS:t,minFPS:this.player.config.minFPS})},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"autoResolution",{get:function(){return this.player.config.autoResolution},set:function(t){this.player.updateConfig({autoResolution:t})},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"autoFPS",{get:function(){return this.player.config.autoFPS},set:function(t){this.player.updateConfig({autoFPS:t})},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"backgroundColor",{get:function(){return this.player.config.transactionBgColor},set:function(t){this.player.updateConfig({transactionBgColor:t})},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"maxResolutionLevel",{get:function(){return this.player.config.maxResolutionLevel},set:function(t){this.player.updateConfig({maxResolutionLevel:t})},enumerable:!1,configurable:!0}),i}(),Rw=function(){function i(t,e){var n;this.config=new Mw(t),this.anchor=e,n=this.createControllerGUI(),this.gui=n[0],this.controller=n[1],this.createStats()}return i.prototype.createStats=function(){var t=this;this.stateId=setInterval(function(){t.controller.frameRate.updateDisplay(),t.controller.size.updateDisplay(),t.controller.minFPS.updateDisplay(),t.controller.drawFrames.updateDisplay(),t.controller.maxFPS.updateDisplay(),t.controller.resolution.updateDisplay(),t.controller.autoFps.updateDisplay(),t.controller.autoResolution.updateDisplay(),t.controller.drawCall.updateDisplay()},16)},i.prototype.createControllerGUI=function(){var t=new Cw({autoPlace:!0,closed:!0});t.domElement.style.opacity=".6",t.domElement.style.transformOrigin="100% 0",t.domElement.style.transform="scale(1)",this.anchor.appendChild(t.domElement),t.domElement.style.position="absolute",t.domElement.style.right="0",t.domElement.style.top="0",t.domElement.style.zIndex="2";var e={frameRate:t.add(this.config,"frameRate"),drawFrames:t.add(this.config,"drawFrames"),drawCall:t.add(this.config,"drawCall"),size:t.add(this.config,"size"),minFPS:t.add(this.config,"minFPS",0,60),maxFPS:t.add(this.config,"maxFPS",0,60),resolution:t.add(this.config,"resolution",.5,8,.5),autoResolution:t.add(this.config,"autoResolution"),autoFps:t.add(this.config,"autoFPS"),maxResolutionLevel:t.add(this.config,"maxResolutionLevel",0,4,1),transactionBgColor:t.addColor(this.config,"backgroundColor")};return[t,e]},i.prototype.destroy=function(){try{window.clearInterval(this.stateId),this.anchor.removeChild(this.gui.domElement),this.gui.destroy()}catch{}},i}();function Hc(i){if(i!=="fifo"&&i!=="latest-pending-render")throw new Error("Invalid sync event queue policy: "+i)}function vg(i,t){return t===void 0&&(t="fifo"),Hc(t),i==="interactive"?t:"fifo"}function Iw(i){switch(i.type){case"renderSlide":case"nextStep":case"prevStep":case"interactiveAnim":case"mediaPlay":case"mediaPause":case"mediaSeek":case"mediaFullscreen":return!0;default:return!1}}var Pw=function(){function i(t,e){var n=this;e===void 0&&(e={}),this.tasks=[],this.isDestroy=!1,this.isScheduling=!1,this.isTaskRunning=!1,this.isCatchingUp=!1,this.compactedTasks=new WeakMap,this.finishTask=function(){n.isTaskRunning=!1,n.runningTask=void 0,n.isDestroy?(n.tasks.length=0,n.isScheduling=!1):n.tasks.length>0?window.requestAnimationFrame(n.schedule):(n.isScheduling=!1,n.setCatchUpState(!1))},this.schedule=function(){if(n.isDestroy)return n.tasks.length=0,void(n.isScheduling=!1);n.isScheduling=!0;var r=n.tasks.shift();if(r){n.isTaskRunning=!0,n.runningTask=r;var o=n.compactedTasks.get(r);try{n.fn(r).then(function(){var s;if(n.compactedTasks.delete(r),o&&!n.isDestroy)try{(s=n.onCompactedRenderComplete)===null||s===void 0||s.call(n,o,Date.now())}catch{}n.finishTask()},function(){n.compactedTasks.delete(r),n.finishTask()})}catch{n.compactedTasks.delete(r),n.finishTask()}}else n.isScheduling=!1},this.fn=t,this.policy=e.policy||"fifo",this.onCompact=e.onCompact,this.onCompactedRenderComplete=e.onCompactedRenderComplete,this.onCatchUpStateChange=e.onCatchUpStateChange,this.shouldTrackCatchUpEvent=e.shouldTrackCatchUpEvent,Hc(this.policy)}return i.prototype.destroy=function(){this.isDestroy=!0,this.isCatchingUp=!1,this.runningTask=void 0,this.tasks.length=0},i.prototype.setPolicy=function(t){Hc(t),this.policy=t},i.prototype.setCatchUpState=function(t){var e;if(this.isCatchingUp!==t){this.isCatchingUp=t;try{(e=this.onCatchUpStateChange)===null||e===void 0||e.call(this,t)}catch{}}},i.prototype.isCatchUpEvent=function(t){var e,n;try{return(n=(e=this.shouldTrackCatchUpEvent)===null||e===void 0?void 0:e.call(this,t))===null||n===void 0||n}catch{return!0}},i.prototype.compactForRender=function(t){for(var e={},n=0,r=0,o=0,s=0,a=0;this.tasks.length>0;){var l=this.tasks[this.tasks.length-1];if(!Iw(l))break;this.tasks.pop(),this.compactedTasks.delete(l),n+=1,e[l.type]=(e[l.type]||0)+1,l.type==="renderSlide"?r+=1:l.type==="nextStep"||l.type==="prevStep"?o+=1:l.type==="interactiveAnim"?s+=1:a+=1}if(n!==0){var h=this.tasks[this.tasks.length-1];return{policy:"latest-pending-render",droppedEventCount:n,droppedRenderCount:r,droppedStepCount:o,droppedAnimationCount:s,droppedMediaCount:a,droppedOperationCount:n-r,droppedEventTypes:e,retainedSlideIndex:t.index,retainedRenderReceivedAt:Date.now(),hasRunningTask:this.isTaskRunning,hardBoundaryType:h==null?void 0:h.type}}},i.prototype.addTask=function(t){var e,n=this;if(!this.isDestroy){var r=this.isTaskRunning||this.tasks.length>0,o=this.policy==="latest-pending-render"&&this.isCatchUpEvent(t),s=this.policy==="latest-pending-render"&&(o||!!this.runningTask&&this.isCatchUpEvent(this.runningTask)||this.tasks.some(function(l){return n.isCatchUpEvent(l)})),a=this.policy==="latest-pending-render"&&t.type==="renderSlide"?this.compactForRender(t):void 0;if(this.tasks.push(t),s&&(r||o&&t.type==="renderSlide")&&this.setCatchUpState(!0),a){this.compactedTasks.set(t,a);try{(e=this.onCompact)===null||e===void 0||e.call(this,a)}catch{}}return this.isScheduling||this.schedule(),a}},i}(),Ow=function(){function i(t){this.autoUnlock=Object.create(null),this.localKeyAutoRemove=Object.create(null),this.localKeys=Object.create(null),this.locks=Object.create(null),this.available=!1,this.available=t}return i.prototype.addLock=function(t,e){var n=this;this.available&&(this.locks[t]=e,this.localKeys[e]=!0,this.localKeyAutoRemove[e]=window.setTimeout(function(){delete n.localKeys[e],delete n.localKeyAutoRemove[e]},6e4),this.autoUnlock[t]=window.setTimeout(function(){delete n.locks[t],delete n.autoUnlock[t]},3e3))},i.prototype.unlock=function(t,e){if(!this.available)return!1;var n=!!e&&!!this.localKeys[e];return e&&n&&(window.clearTimeout(this.localKeyAutoRemove[e]),delete this.localKeys[e],delete this.localKeyAutoRemove[e]),e&&this.locks[t]&&this.locks[t]===e&&(window.clearTimeout(this.autoUnlock[t]),delete this.locks[t],delete this.autoUnlock[t]),n},i.prototype.isLocked=function(t){return!!this.available&&!!this.locks[t]},i}(),Nw=function(){function i(){var t=this;this.tasks=[],this.isDestroy=!1,this.isScheduling=!1,this.schedule=function(){t.isScheduling=!0;var e=t.tasks.shift();e&&!t.isDestroy&&(e.status="running",e.fn.apply(null).then(function(){t.tasks.length>0?setTimeout(t.schedule):t.isScheduling=!1}).catch(function(){t.tasks.length>0?setTimeout(t.schedule):t.isScheduling=!1}))}}return i.prototype.getRunningTask=function(){return this.tasks[0]&&this.tasks[0].status==="running"?this.tasks[0]:null},i.prototype.addTask=function(t,e){var n={type:t,status:"wait",fn:e},r=this.getRunningTask();r&&t===r.type||(this.tasks=this.tasks.filter(function(o){return o.type!==t}),this.tasks.push(n),this.isScheduling||this.schedule())},i.prototype.destroy=function(){this.isDestroy=!0},i}(),jc=function(){return(jc=Object.assign||function(i){for(var t,e=1,n=arguments.length;e<n;e++)for(var r in t=arguments[e])Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r]);return i}).apply(this,arguments)},yo=function(i,t,e,n){return new(e||(e=Promise))(function(r,o){function s(h){try{l(n.next(h))}catch(u){o(u)}}function a(h){try{l(n.throw(h))}catch(u){o(u)}}function l(h){var u;h.done?r(h.value):(u=h.value,u instanceof e?u:new e(function(p){p(u)})).then(s,a)}l((n=n.apply(i,t||[])).next())})},_o=function(i,t){var e,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(h){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;s;)try{if(e=1,n&&(r=2&u[0]?n.return:u[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,u[1])).done)return r;switch(n=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,n=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(r=s.trys,!((r=r.length>0&&r[r.length-1])||u[0]!==6&&u[0]!==2)){s=0;continue}if(u[0]===3&&(!r||u[1]>r[0]&&u[1]<r[3])){s.label=u[1];break}if(u[0]===6&&s.label<r[1]){s.label=r[1],r=u;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(u);break}r[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(i,s)}catch(p){u=[6,p],n=0}finally{e=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([l,h])}}},Lw=function(){function i(){var t=this;this.logList=[],this.checkTimer=null,this.retryTimes=0,this.enable=!1,this.db=null,this.useIndexedDB=!1,this.DB_NAME="__slide_logs_report__",this.STORE_NAME="logs",this.BATCH_SIZE=1e3,this.uploadLoggerGlobalEvent=function(e){e.data.type==="@slide/_upload_log_"&&t.start()},this.config={checkTime:5e3,buffer:300},window.addEventListener("message",this.uploadLoggerGlobalEvent),this.initIndexedDB()}return i.prototype.initIndexedDB=function(){return yo(this,void 0,void 0,function(){var t,e=this;return _o(this,function(n){if(!("indexedDB"in window))return this.useIndexedDB=!1,this.start(),[2];try{(t=indexedDB.open(this.DB_NAME,1)).onerror=function(){e.useIndexedDB=!1},t.onsuccess=function(){e.start(),e.db=t.result,e.useIndexedDB=!0},t.onupgradeneeded=function(r){var o=r.target.result;o.objectStoreNames.contains(e.STORE_NAME)||o.createObjectStore(e.STORE_NAME,{keyPath:"id",autoIncrement:!0}).createIndex("timestamp","timestamp")}}catch{this.useIndexedDB=!1}return[2]})})},i.prototype.storeLogInIndexedDB=function(t){return yo(this,void 0,void 0,function(){var e,n=this;return _o(this,function(r){switch(r.label){case 0:if(!this.useIndexedDB)return[2];r.label=1;case 1:return r.trys.push([1,4,,5]),this.db&&this.isDatabaseHealthy()?[3,3]:[4,this.recreateDatabase()];case 2:if(r.sent(),!this.db||!this.useIndexedDB)throw new Error("Database not available after recreation attempt");r.label=3;case 3:return[2,new Promise(function(o,s){var a=n.db.transaction([n.STORE_NAME],"readwrite"),l=a.objectStore(n.STORE_NAME).add(t);a.onerror=function(){n.recreateDatabase().then(function(){if(n.db&&n.useIndexedDB){var h=n.db.transaction([n.STORE_NAME],"readwrite").objectStore(n.STORE_NAME).add(t);h.onsuccess=function(){return o()},h.onerror=function(){return s(h.error)}}else s(new Error("Database recreation failed"))}).catch(function(h){console.warn("Database recreation failed:",h),n.useIndexedDB=!1,s(h)})},l.onsuccess=function(){return o()},l.onerror=function(){var h,u;((h=l.error)===null||h===void 0?void 0:h.name)==="UnknownError"||((u=l.error)===null||u===void 0?void 0:u.name)==="NotFoundError"?n.recreateDatabase().catch(function(p){console.warn("Database recreation failed:",p),n.useIndexedDB=!1}).finally(function(){return s(l.error)}):s(l.error)}})];case 4:throw e=r.sent(),this.useIndexedDB=!1,e;case 5:return[2]}})})},i.prototype.getLogsFromIndexedDB=function(t){return yo(this,void 0,void 0,function(){var e=this;return _o(this,function(n){switch(n.label){case 0:if(!this.useIndexedDB)return[2,[]];n.label=1;case 1:return n.trys.push([1,4,,5]),this.db&&this.isDatabaseHealthy()?[3,3]:[4,this.recreateDatabase()];case 2:if(n.sent(),!this.db||!this.useIndexedDB)return[2,[]];n.label=3;case 3:return[2,new Promise(function(r,o){var s=e.db.transaction([e.STORE_NAME],"readonly"),a=s.objectStore(e.STORE_NAME).index("timestamp").openCursor(null,"next"),l=[];s.onerror=function(){var h,u;((h=s.error)===null||h===void 0?void 0:h.name)==="UnknownError"||((u=s.error)===null||u===void 0?void 0:u.name)==="NotFoundError"?e.recreateDatabase().catch(function(p){console.warn("Database recreation failed:",p),e.useIndexedDB=!1}).finally(function(){return r([])}):o(s.error)},a.onsuccess=function(h){var u=h.target.result;u&&l.length<t?(l.push(u.value),u.continue()):r(l.map(function(p){var y;return jc(jc({},p),{id:(y=p.id)===null||y===void 0?void 0:y.toString()})}))},a.onerror=function(){var h,u;((h=a.error)===null||h===void 0?void 0:h.name)==="UnknownError"||((u=a.error)===null||u===void 0?void 0:u.name)==="NotFoundError"?e.recreateDatabase().catch(function(p){console.warn("Database recreation failed:",p),e.useIndexedDB=!1}).finally(function(){return r([])}):o(a.error)}})];case 4:return n.sent(),this.useIndexedDB=!1,[2,[]];case 5:return[2]}})})},i.prototype.deleteLogsFromIndexedDB=function(t){return yo(this,void 0,void 0,function(){var e=this;return _o(this,function(n){switch(n.label){case 0:if(!this.useIndexedDB||t.length===0)return[2];n.label=1;case 1:return n.trys.push([1,4,,5]),this.db&&this.isDatabaseHealthy()?[3,3]:[4,this.recreateDatabase()];case 2:if(n.sent(),!this.db||!this.useIndexedDB)return[2];n.label=3;case 3:return[2,new Promise(function(r,o){var s=e.db.transaction([e.STORE_NAME],"readwrite"),a=s.objectStore(e.STORE_NAME),l=t.map(function(h){return new Promise(function(u,p){var y=Number(h.id);if(y){var b=a.delete(y);b.onsuccess=function(){return u()},b.onerror=function(){var w,M;((w=b.error)===null||w===void 0?void 0:w.name)==="UnknownError"||((M=b.error)===null||M===void 0?void 0:M.name)==="NotFoundError"?u():p(b.error)}}else u()})});s.onerror=function(){var h,u;((h=s.error)===null||h===void 0?void 0:h.name)==="UnknownError"||((u=s.error)===null||u===void 0?void 0:u.name)==="NotFoundError"?e.recreateDatabase().catch(function(p){console.warn("Database recreation failed:",p),e.useIndexedDB=!1}).finally(function(){return r()}):o(s.error)},Promise.all(l).then(function(){return r()}).catch(o)})];case 4:return n.sent(),this.useIndexedDB=!1,[3,5];case 5:return[2]}})})},i.prototype.start=function(){return yo(this,void 0,void 0,function(){var t=this;return _o(this,function(e){return clearInterval(this.checkTimer),this.checkTimer=setInterval(function(){return yo(t,void 0,void 0,function(){return _o(this,function(n){switch(n.label){case 0:return[4,this.uploadLog()];case 1:return n.sent(),[2]}})})},this.config.checkTime),[2]})})},i.prototype.pause=function(){clearInterval(this.checkTimer)},i.prototype.addLog=function(t,e,n,r){return yo(this,void 0,void 0,function(){var o;return _o(this,function(s){switch(s.label){case 0:if(o={level:e,taskId:n,message:t,randomId:r,timestamp:Date.now().toString()},!this.useIndexedDB)return[3,5];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.storeLogInIndexedDB(o)];case 2:return s.sent(),[3,4];case 3:return s.sent(),this.logList.push(o),[3,4];case 4:return[3,6];case 5:this.logList.push(o),s.label=6;case 6:return[2]}})})},i.prototype.isDatabaseHealthy=function(){if(!this.db)return!1;try{return this.db.transaction([this.STORE_NAME],"readonly").objectStore(this.STORE_NAME).index("timestamp"),!0}catch(t){return console.warn("Database health check failed:",t),!1}},i.prototype.recreateDatabase=function(){return yo(this,void 0,void 0,function(){var t=this;return _o(this,function(e){return[2,new Promise(function(n,r){try{t.db&&(t.db.close(),t.db=null);var o=indexedDB.open(t.DB_NAME,1);o.onerror=function(){t.useIndexedDB=!1,r(o.error)},o.onsuccess=function(){t.db=o.result,t.useIndexedDB=!0,n()},o.onupgradeneeded=function(s){var a=s.target.result;a.objectStoreNames.contains(t.STORE_NAME)||a.createObjectStore(t.STORE_NAME,{keyPath:"id",autoIncrement:!0}).createIndex("timestamp","timestamp")}}catch(s){t.useIndexedDB=!1,r(s)}})]})})},i.prototype.destroy=function(){clearInterval(this.checkTimer),window.removeEventListener("message",this.uploadLoggerGlobalEvent),this.db&&(this.db.close(),this.db=null)},i.prototype.uploadLog=function(t){return t===void 0&&(t=!1),yo(this,void 0,void 0,function(){var e,n,r,o=this;return _o(this,function(s){switch(s.label){case 0:return e=[],this.useIndexedDB?[4,this.getLogsFromIndexedDB(this.BATCH_SIZE)]:[3,2];case 1:return(e=s.sent()).length===0?[2]:[3,3];case 2:if(!(this.logList.length>=this.config.buffer||t))return[2];e=this.logList.splice(0),s.label=3;case 3:n=function(){o.useIndexedDB||(o.logList=e.concat(o.logList)),o.retryTimes>3&&o.pause(),o.retryTimes+=1},s.label=4;case 4:return s.trys.push([4,10,,11]),[4,fetch("https://netless-ppt-plugin-dev.cn-hangzhou.log.aliyuncs.com/logstores/netless-ppt-plugin-dev/track",{method:"POST",headers:{"x-log-apiversion":"0.6.0","Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify({__topic__:"netless-ppt-plugin-dev",__source__:"netless-ppt-plugin-dev",__logs__:e})})];case 5:return s.sent().ok?(this.retryTimes=0,this.useIndexedDB?[4,this.deleteLogsFromIndexedDB(e)]:[3,7]):[3,8];case 6:s.sent(),s.label=7;case 7:return[3,9];case 8:n(),s.label=9;case 9:return[3,11];case 10:return r=s.sent(),console.warn(r),n(),[3,11];case 11:return[2]}})})},i.prototype.setEnable=function(t){this.enable!==t&&(t?this.start():this.pause())},i}(),Dw=function(i,t,e,n){return new(e||(e=Promise))(function(r,o){function s(h){try{l(n.next(h))}catch(u){o(u)}}function a(h){try{l(n.throw(h))}catch(u){o(u)}}function l(h){var u;h.done?r(h.value):(u=h.value,u instanceof e?u:new e(function(p){p(u)})).then(s,a)}l((n=n.apply(i,t||[])).next())})},Fw=function(i,t){var e,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(h){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;s;)try{if(e=1,n&&(r=2&u[0]?n.return:u[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,u[1])).done)return r;switch(n=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,n=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(r=s.trys,!((r=r.length>0&&r[r.length-1])||u[0]!==6&&u[0]!==2)){s=0;continue}if(u[0]===3&&(!r||u[1]>r[0]&&u[1]<r[3])){s.label=u[1];break}if(u[0]===6&&s.label<r[1]){s.label=r[1],r=u;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(u);break}r[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(i,s)}catch(p){u=[6,p],n=0}finally{e=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([l,h])}}};function Bw(i,t,e,n,r){return Dw(this,void 0,void 0,function(){var o,s,a,l,h,u;return Fw(this,function(p){switch(p.label){case 0:return o=document.createElement("div"),(s=new ro({anchor:o,renderOptions:{minFPS:1,maxFPS:1,resolution:1,maxResolutionLevel:e,forceCanvas:!0},mode:"local",interactive:!1,useLocalCache:!0})).setResource(i,t),[4,s.getSlideCountAsync()];case 1:a=p.sent(),p.label=2;case 2:if(p.trys.push([2,12,13,14]),!(r&&r.length>0))return[3,7];l=r.filter(function(y,b){return r.indexOf(y)===b}),u=0,p.label=3;case 3:return u<l.length?(h=l[u])>0&&h<=a?[4,s.player.stagePool.preload(h,!0)]:[3,5]:[3,6];case 4:p.sent(),n(Math.round((u+1)/l.length*100)/100),p.label=5;case 5:return u++,[3,3];case 6:return[3,11];case 7:u=1,p.label=8;case 8:return u<=a?[4,s.player.stagePool.preload(u,!0)]:[3,11];case 9:p.sent(),n(Math.round(u/a*100)/100),p.label=10;case 10:return u++,[3,8];case 11:return[3,14];case 12:throw p.sent();case 13:return s.destroy(),[7];case 14:return[2]}})})}var kw=function(){var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])})(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}i(t,e),t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),xs=function(){return(xs=Object.assign||function(i){for(var t,e=1,n=arguments.length;e<n;e++)for(var r in t=arguments[e])Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r]);return i}).apply(this,arguments)},Uw=function(i,t,e,n){var r,o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(i,t,e,n);else for(var a=i.length-1;a>=0;a--)(r=i[a])&&(s=(o<3?r(s):o>3?r(t,e,s):r(t,e))||s);return o>3&&s&&Object.defineProperty(t,e,s),s},zi=function(i,t,e,n){return new(e||(e=Promise))(function(r,o){function s(h){try{l(n.next(h))}catch(u){o(u)}}function a(h){try{l(n.throw(h))}catch(u){o(u)}}function l(h){var u;h.done?r(h.value):(u=h.value,u instanceof e?u:new e(function(p){p(u)})).then(s,a)}l((n=n.apply(i,t||[])).next())})},Vi=function(i,t){var e,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(h){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;s;)try{if(e=1,n&&(r=2&u[0]?n.return:u[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,u[1])).done)return r;switch(n=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,n=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(r=s.trys,!((r=r.length>0&&r[r.length-1])||u[0]!==6&&u[0]!==2)){s=0;continue}if(u[0]===3&&(!r||u[1]>r[0]&&u[1]<r[3])){s.label=u[1];break}if(u[0]===6&&s.label<r[1]){s.label=r[1],r=u;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(u);break}r[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(i,s)}catch(p){u=[6,p],n=0}finally{e=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([l,h])}}},Gw=window.ResizeObserver||hw,Nh=function(i){return new Promise(function(t){return setTimeout(t,i)})};function Hw(i,t){return zi(this,void 0,void 0,function(){var e;return Vi(this,function(n){switch(n.label){case 0:e=Date.now(),n.label=1;case 1:return!i()&&Date.now()-e<t?[4,Nh(50)]:[3,3];case 2:return n.sent(),e=Date.now(),[3,1];case 3:return[2]}})})}var or={syncDispatch:"syncDispatch",syncReceive:"syncReceive",syncEventLag:"syncEventLag",renderStart:"renderStart",renderEnd:"renderEnd",renderError:"renderError",slideChange:"slideChange",mainSeqStepStart:"mainSeqStepStart",mainSeqStepEnd:"mainSeqStepEnd",animateStart:"animateStart",animateEnd:"animateEnd",stateChange:"stateChange",slideStepEnd:"slideEnd",slideStepStart:"slideStart",useraddLink:"useraddLink"},yg={taskId:"",url:"",currentSlideIndex:-1,mainSeqStep:-1,mainSeqState:null,mediaState:Object.create(null),interactiveSeqState:Object.create(null)},zc="";try{zc="1.4.56"}catch{zc="-dev-"}var fr=null;try{(fr=P.createInstance({name:"__slide_local_log__",driver:P.INDEXEDDB,version:1})).ready(function(i){}).catch(function(i){})}catch{}navigator.userAgent.toUpperCase().includes("HUAWEI")&&document.createElement("canvas").getContext("2d").fillText("\u9065\u9065\u9886\u5148",0,10);var ro=function(i){function t(r){var o=i.call(this)||this;o.iosResetCache=[],o.version=zc,o.__slideState=H0()(yg),o.userInputTime=0,o.isSyncingSlideState=!1,o.frozenTaskManager=new Nw,o.randomId=E(),o.resize=!1,o.isAnimating=!1,o.renderingTaskManager=new pw,o.isLoading=!1,o.isReleasing=!1,o.interactive=!0,o.syncCatchUpInputBlocked=!1,o.renderingIndex=0,o.frameWidth=1,o.frameHeight=1,o.frame=document.createElement("div"),o.canvasContainer=document.createElement("div"),o.medianController=document.createElement("div"),o.frameResizeObserver=new Gw(function(){return o.frameResizeHandler()}),o.timestamp=function(){return Date.now()},o.mode="local",o.enableGlobalClick=!1,o.lastEmitedState=null,o.selfSyncEvents=new WeakSet,o.playerController=null,o.isInitResized=!1,o.cacheImage=document.createElement("img"),o.isTouchStart=!1,o.touchStartId=void 0,o.taskId="",o.volumeAdjuster=new U0,o.designWidth=0,o.designHeight=0,o._slideCount=0,o._dispatchIncrId=0,o._receiveIncrId=0,o.resizeView=wh()(o._resizeView.bind(o),50),o.handleViewClick=wh()(o._handleViewClick.bind(o),300,{leading:!0}),o.slideNots=null,o.resourceList=[],o._updateVolumeByStaticAdjuster=function(a){o.volumeAdjuster.volume=a},o.handleSyncQueueCompact=function(a){var l={policy:a.policy,droppedEventCount:a.droppedEventCount,droppedRenderCount:a.droppedRenderCount,droppedStepCount:a.droppedStepCount,droppedAnimationCount:a.droppedAnimationCount,droppedMediaCount:a.droppedMediaCount,droppedOperationCount:a.droppedOperationCount,droppedEventTypes:a.droppedEventTypes,retainedSlideIndex:a.retainedSlideIndex,retainedRenderReceivedAt:a.retainedRenderReceivedAt,hasRunningTask:a.hasRunningTask,resourceBoundaryHit:a.hardBoundaryType==="setResource",unknownBoundaryHit:!!a.hardBoundaryType&&a.hardBoundaryType!=="setResource"};o.logger.info("sync event queue compact "+JSON.stringify(l),o.taskId),o.tracker({name:"syncEventQueueCompact",reason:"",result:"",payload:l})},o.handleSyncQueueCompactRenderComplete=function(a,l){var h={policy:a.policy,retainedSlideIndex:a.retainedSlideIndex,retainedRenderReceivedAt:a.retainedRenderReceivedAt,renderEndAt:l,catchUpDurationMs:Math.max(0,l-a.retainedRenderReceivedAt)};o.logger.info("sync event queue compact render end "+JSON.stringify(h),o.taskId),o.tracker({name:"syncEventQueueCompactRenderEnd",reason:"",result:"",payload:h})},o.handleSyncQueueCatchUpStateChange=function(a){o.syncCatchUpInputBlocked=a,o.updatePlayerInteractive();var l={policy:o.config.syncEventQueuePolicy,isCatchingUp:a,inputBlocked:o.syncCatchUpInputBlocked};o.logger.info("sync event queue catch-up state "+JSON.stringify(l),o.taskId),o.tracker({name:"syncEventQueueCatchUpStateChange",reason:"",result:"",payload:l})},o.recoverHandler=function(a){if(a.data.type==="@slide/_recover_"&&a.data.slideId===o.randomId){var l=a.data,h=l.recoverBy,u=l.payload;if(!u)return;h==="renderOtherPage"&&u.slideIndex?o.enqueueRenderSlide(u.slideIndex).catch(function(p){o.logger.error(p,o.taskId)}):h==="reloadCurrentPage"&&o.enqueueRenderSlide(o.renderingIndex).catch(function(p){o.logger.error(p,o.taskId)})}},o.urlInterrupter=function(a){return zi(o,void 0,void 0,function(){var l,h;return Vi(this,function(u){return l=a,this.resourceList.length>0&&(h=a.replace(/^.*__internal__/,""),l=this.resourceList.find(function(p){return p.indexOf(h)>=0})||a),this.config.urlInterrupter?[2,this.config.urlInterrupter(l)]:[2,Promise.resolve(l)]})})},o.userInputHandle=function(){o.userInputTime=Date.now()},o.handleViewTouchStart=function(){window.clearTimeout(o.touchStartId),o.isTouchStart=!0,o.touchStartId=setTimeout(function(){o.isTouchStart=!1},350)},o.handleViewTouchEnd=function(){o.isTouchStart&&(o.isTouchStart=!1,o.handleViewClick())},o.handleSlideRef=function(){console.log(o),window.__slide=o},o.updateStageCountLimit=function(a){var l=Number(a.detail.value);l>0&&Number.isInteger(l)&&(t.__stageCountLimit=l)},o.receiveSyncHandler=function(a){return zi(o,void 0,void 0,function(){var l,h,u,p,y,b,w,M=this;return Vi(this,function(I){switch(I.label){case 0:return go()(a.incrId)&&(a.incrId&&a.incrId-this._receiveIncrId!=1&&this.emit(or.syncEventLag),this._receiveIncrId=a.incrId||0),this.logger.info("sync receive "+JSON.stringify(a),this.taskId),a.type!=="nextStep"?[3,1]:(this.mainSeqStep!==a.next-1&&this.mainSeqStep+1!==this.mainSeqLength&&this.player?(this.setMainSeqStep(a.next,"start"),this.player.nextTick(function(){M.doNextStep(!0,a.clientId||"")})):this.doNextStep(!0,a.clientId||""),[3,6]);case 1:return a.type!=="prevStep"?[3,2]:(this.mainSeqStep===0&&this.mainSeqState==="idle"||this.mainSeqStep===a.next+1||this.mainSeqStep+1===this.mainSeqLength?this.doPrevStep(!0):(this.setMainSeqStep(a.next+1,"start"),(h=this.player)===null||h===void 0||h.nextTick(function(){M.doPrevStep(!0)})),[3,6]);case 2:return a.type!=="interactiveAnim"?[3,3]:(this.player?this.player.applyInteractiveAction(a.action):this.__slideState.interactiveSeqState[a.seqId]?this.__slideState.interactiveSeqState[a.seqId].step+=1:this.__slideState.interactiveSeqState[a.seqId]={step:0,state:"end"},[3,6]);case 3:return a.type!=="renderSlide"?[3,5]:[4,this.enqueueRenderSlide(a.index,a.isForward)];case 4:return I.sent(),[3,6];case 5:a.type==="mediaPlay"?(l=void 0,a.state.time&&(l=(this.timestamp()-a.state.time)/1e3),(u=this.player)===null||u===void 0||u.setMediaState(a.id,!0,l),this.__slideState.mediaState[a.id]=a.state):a.type==="mediaPause"?((p=this.player)===null||p===void 0||p.setMediaState(a.id,!1,(y=a.state)===null||y===void 0?void 0:y.time),this.__slideState.mediaState[a.id]=a.state):a.type==="mediaSeek"?((b=this.player)===null||b===void 0||b.setMediaCurrentTime(a.id,a.time),this.__slideState.mediaState[a.id]=a.state):a.type==="mediaFullscreen"&&(a.targetId&&this.__slideState.mediaState[a.targetId]?this.__slideState.mediaState[a.targetId].fullscreen=a.state:this.__slideState.mediaState[a.targetId]={fullscreen:a.state,type:"pause",time:0},(w=this.player)===null||w===void 0||w.syncFullscreenVideoState({targetId:a.targetId,state:a.state,slideIndex:a.slideIndex})),I.label=6;case 6:return[2]}})})},o.flushDebounce=function(){o.resizeView.flush(),o.config.disableClickDebounce||o.handleViewClick.flush()},o.handlePrevSlide=function(a){return a===void 0&&(a=!1),zi(o,void 0,void 0,function(){var l,h;return Vi(this,function(u){return!a&&this.syncCatchUpInputBlocked?[2]:this.player?((l=this.player.prevSlideIndex)>=1&&(!((h=this.config.navigatorDelegate)===null||h===void 0)&&h.gotoPage?this.config.navigatorDelegate.gotoPage(l):a?this.enqueueRenderSlide(l,!1):this.renderSlide(l,!1)),[2]):[2]})})},o.handleNextSlide=function(a){return a===void 0&&(a=!1),zi(o,void 0,void 0,function(){var l,h;return Vi(this,function(u){return!a&&this.syncCatchUpInputBlocked?[2]:this.player?((l=this.player.nextSlideIndex)<=this.slideCount&&(!((h=this.config.navigatorDelegate)===null||h===void 0)&&h.gotoPage?this.config.navigatorDelegate.gotoPage(l):a?this.enqueueRenderSlide(l,!0):this.renderSlide(l,!0)),[2]):[2]})})},o.handleGotoSlide=function(a){if(!o.syncCatchUpInputBlocked)if(a<=o.slideCount&&a>=1){var l=o.slideState.currentSlideIndex<=a;o.renderSlide(a,l)}else a===-1&&o.renderSlide(o.slideCount,!0)},t.instances.push(o),o.config=o.initSlideConfig(r),o.config.disableClickDebounce&&(o.handleViewClick=o._handleViewClick.bind(o)),o.tracker=function(a){r.whiteTracker&&r.whiteTracker.commit({name:a.name,reason:a.reason,result:a.result,payload:xs(xs({},a.payload),{slideId:o.randomId,taskId:o.taskId})},{slideVersion:o.version||""})},t.trackLogger.setEnable(!!o.config.enableTracking),o.logger={info:function(a,l){var h;t.appendLogString("INFO - "+new Date().toISOString()+" - {"+o.randomId+"}["+l+"] "+a+`
8027
8027
  `),t.trackLogger.addLog(a,"info",l,o.randomId);var u=(h=o.config.logger)===null||h===void 0?void 0:h.info;u&&u("["+l+"] "+a)},warn:function(a,l){var h;t.appendLogString("WARN - "+new Date().toISOString()+" - {"+o.randomId+"}["+l+"] "+a+`
8028
8028
  `),t.trackLogger.addLog(a,"warn",l,o.randomId);var u=(h=o.config.logger)===null||h===void 0?void 0:h.warn;u&&u("["+l+"] "+a)},error:function(a,l){var h;t.appendLogString("ERROR - "+new Date().toISOString()+" - {"+o.randomId+"}["+l+"] "+a+`
8029
- `),t.trackLogger.addLog(a,"error",l,o.randomId);var u=(h=o.config.logger)===null||h===void 0?void 0:h.error;u&&u("["+l+"] "+a)}},o.logger.info("new slide with clientId: "+o.config.clientId+", version: "+o.version,o.taskId),o.tracker({name:"initSlide",result:"",reason:"",payload:{taskId:o.taskId}}),o.anchor=o.config.anchor;var s=vg(o.mode,o.config.syncEventQueuePolicy);return o.config.syncEventQueuePolicy=s,o.syncQueue=new Pw(o.receiveSyncHandler,{policy:s,onCompact:o.handleSyncQueueCompact,onCompactedRenderComplete:o.handleSyncQueueCompactRenderComplete,onCatchUpStateChange:o.handleSyncQueueCatchUpStateChange,shouldTrackCatchUpEvent:function(a){return!o.selfSyncEvents.has(a)}}),o.lock=new Ow(o.mode==="interactive"),o.cacheImage.style.position="absolute",o.cacheImage.style.display="block",o.cacheImage.style.zIndex="100",o.setMedianControllerAttribute(),o.canvasContainer.style.position="relative",o.canvasContainer.style.fontSize="0",o.canvasContainer.appendChild(o.medianController),o.frame.appendChild(o.canvasContainer),o.frame.appendChild(o.cacheImage),o.config.disableFrameResizeObserver||o.frameResizeObserver.observe(o.frame),o.on(or.syncReceive,function(a){(o.lock.unlock(a.type,a.uuid)||!!o.config.clientId&&a.clientId===o.config.clientId)&&o.selfSyncEvents.add(a),!o.player&&o.config.skipActionWhenFrozen||o.mode==="sync"&&o.config.clientId===a.clientId||o.syncQueue.addTask(a)}),o.renderingTaskManager.eventHub.on("task-error",function(a){var l=a.error,h=a.task,u=Hn.transform(l);u.errorType===Yn.RuntimeWarn?o.logger.warn(u.message,o.taskId):o.logger.error(u.message,o.taskId),o.isLoading=!1,o.reportError(u,h.slideIndex)}),window.addEventListener("__slide_ref__",o.handleSlideRef),window.addEventListener("__slide_updateStageCountLimit",o.updateStageCountLimit),o.resizeView=wh()(o.resizeView.bind(o),50),o.player=o.initPlayer(o.config),o.config.controller&&o.createController(),o.player.view&&o.canvasContainer.appendChild(o.player.view),o.config.disableClickDebounce||(o.handleViewClick=wh()(o.handleViewClick,300)),o.player.errorChannel.on("error",function(a,l){var h=Hn.transform(a);h.errorType===Yn.RuntimeWarn?o.logger.warn(h.message,o.taskId):o.logger.error(h.message,o.taskId),o.isLoading=!1,o.reportError(a,l),o.tracker({name:"slideError",reason:h.errorMsg,result:"",payload:{code:h.errorType}})}),window.addEventListener("message",o.recoverHandler),t.volumeAdjuster.on("update",o._updateVolumeByStaticAdjuster),o.volumeAdjuster.volume=t.volumeAdjuster.volume,o}var e,n;return kw(t,i),t.flushLog=function(r){return r===void 0&&(r=!1),zi(this,void 0,void 0,function(){return Vi(this,function(o){switch(o.label){case 0:if(!(t._tempLog.length>131072||r&&t._tempLog.length>0))return[3,5];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,fr==null?void 0:fr.setItem("run_time_log_"+t._tempLogIndex,t._tempLog)];case 2:return o.sent(),[3,4];case 3:return o.sent(),[3,4];case 4:t._tempLog="",t._tempLogIndex+=1,o.label=5;case 5:return[2]}})})},t.stopRemoteLog=function(){t.remoteLogAddress=null},t.startRemoteLog=function(r){return zi(this,void 0,void 0,function(){var o,s,a,l,h;return Vi(this,function(u){switch(u.label){case 0:return t.remoteLogAddress=r,[4,t.flushLog(!0)];case 1:if(u.sent(),!fr)return[3,13];o=[],u.label=2;case 2:return u.trys.push([2,4,,5]),[4,fr.keys()];case 3:return o=(u.sent()||[]).sort(function(p,y){return parseInt(p.replace("run_time_log_",""))-parseInt(y.replace("run_time_log_",""))}),[3,5];case 4:return u.sent(),[3,5];case 5:s=0,a=o,u.label=6;case 6:if(!(s<a.length))return[3,13];l=a[s],l.replace("run_time_log_",""),h="",u.label=7;case 7:return u.trys.push([7,9,,10]),[4,fr.getItem(l)];case 8:return h=u.sent()||"",[3,10];case 9:return u.sent(),[3,10];case 10:return[4,fetch(t.remoteLogAddress+"/logs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log:h})})];case 11:u.sent(),u.label=12;case 12:return s++,[3,6];case 13:return[2]}})})},t.appendLogString=function(r){t._tempLog+=r,t.remoteLogAddress&&fetch(t.remoteLogAddress+"/logs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log:r})}).catch(function(){})},t.setStageCountLimit=function(r){if(!go()(r)||!Number.isInteger(r))throw new Error("Invalid stage count limit");t.__stageCountLimit=r},Object.defineProperty(t.prototype,"dispatchIncrId",{get:function(){return this._dispatchIncrId++},enumerable:!1,configurable:!0}),t.prototype.updatePlayerInteractive=function(){var r;(r=this.player)===null||r===void 0||r.setInteractive(this.interactive&&!this.syncCatchUpInputBlocked)},t.prototype.reportError=function(r,o){this.emit(or.renderError,{error:r,index:o}),window.postMessage({type:"@slide/_error_",errorType:r.errorType,errorMsg:r.errorMsg,slideId:this.randomId,slideIndex:o||-1,customMessage:"@slide/_error_"},"*"),t.trackLogger.uploadLog(!0)},t.prototype.initSlideConfig=function(r){return r.timestamp&&(this.timestamp=r.timestamp),r.rtcAudio&&(ur.RtcAudioClazz=r.rtcAudio),r.enableWebAudio!==!1&&(r.enableWebAudio=!0),this.mode=r.mode,this.anchor=r.anchor,this.anchor.appendChild(this.frame),this.enableGlobalClick=!vi()(r.enableGlobalClick)&&r.enableGlobalClick,this.resize=r.resize||!1,this.interactive=r.interactive,this.frame.style.cssText=r.fixedFrameSize?"width:"+r.fixedFrameSize.width+"px;height:"+r.fixedFrameSize.height+"px;":"width:100%;height:100%",this.frame.style.cssText+="display:flex;justify-content:center;align-items:center;visibility:hidden;position:relative;z-index:1;",r.fixedFrameSize&&(this.frameWidth=r.fixedFrameSize.width,this.frameHeight=r.fixedFrameSize.height),r.disableClickDebounce=r.disableClickDebounce||!1,r},t.prototype.initPlayer=function(r){var o,s,a,l=this,h=new ur({mode:this.mode,useLocalCache:!!vi()(this.config.useLocalCache)||this.config.useLocalCache,logger:this.logger,resourceTimeout:vi()(this.config.resourceTimeout)?15e3:this.config.resourceTimeout,loadDelegate:this.config.loaderDelegate,volumeAdjuster:this.volumeAdjuster,urlInterrupter:this.urlInterrupter,tracker:this.tracker,enableWebAudio:this.config.enableWebAudio,enableAutoForward:this.config.enableAutoForward,customLinks:this.config.customLinks,resourceMaxRetries:this.config.resourceMaxRetries,onResourceMaxRetries:this.config.onResourceMaxRetries},r.renderOptions);return h.setInteractive(this.interactive&&!this.syncCatchUpInputBlocked),h.updateConfig(r.renderOptions||{}),h.on(ze.renderStart,function(u){l.isLoading=!0,l.emit(or.renderStart,u),window.postMessage({type:"@slide/_render_start_",taskId:l.taskId,index:u},"*")}),h.on(ze.renderEnd,function(u){l.isLoading=!1,l.player&&(l.designHeight=l.player.designHeight,l.designWidth=l.player.designWidth,l.cacheImage.style.width=l.player.designWidth+"px",l.cacheImage.style.height=l.player.designHeight+"px",l.cacheImage.style.maxWidth=l.player.designWidth+"px",l.cacheImage.style.minWidth=l.player.designHeight+"px",l._slideCount=l.player.slideCount),l.emit(or.renderEnd,u),window.postMessage({type:"@slide/_render_end_",taskId:l.taskId,index:u},"*")}),h.on(ze.slideChange,function(u){l.__slideState.currentSlideIndex=u,l.emitStateChange(),l.emit(or.slideChange,u)}),h.on(ze.mainSeqStateChange,function(u){l.__slideState.mainSeqState=u,l.emitStateChange()}),h.on(ze.mainSeqStepChange,function(u){l.__slideState.mainSeqStep=u,l.emitStateChange()}),h.on(ze.interactiveSeqStateChange,function(u){var p=u.id,y=u.state;l.__slideState.interactiveSeqState[p]=y,l.emitStateChange()}),h.on(ze.animateStart,function(){l.isAnimating!==!0&&(l.isAnimating=!0,l.emit(or.animateStart))}),h.on(ze.animateEnd,function(){l.isAnimating!==!1&&(l.isAnimating=!1,l.emit(or.animateEnd))}),h.on(ze.interactiveSeqAction,function(u){var p=u.action,y=u.seqId;l.emitSyncDispatch({slideIndex:l.__slideState.currentSlideIndex,type:"interactiveAnim",action:p,seqId:y}),l.emitStateChange()}),h.on(ze.mainSeqStepStart,function(u){l.emit(or.mainSeqStepStart,u)}),h.on(ze.mainSeqStepEnd,function(u){l.emit(or.mainSeqStepEnd,u)}),h.on(ze.mediaPlay,function(u){var p,y=(p=l.__slideState.mediaState[u.id])!==null&&p!==void 0?p:{};y.type="play",y.time=l.timestamp()-1e3*u.time,l.__slideState.mediaState[u.id]=y,u._stateOnly?l.config.mode==="interactive"&&l.receiveSyncHandler({slideIndex:l.__slideState.currentSlideIndex,type:"mediaPlay",id:u.id,state:y}).catch(function(b){l.logger.error(b==null?void 0:b.message,l.taskId)}):l.emitSyncDispatch({slideIndex:l.__slideState.currentSlideIndex,type:"mediaPlay",id:u.id,state:y}),l.emitStateChange()}),h.on(ze.mediaStop,function(u){delete l.__slideState.mediaState[u.id],l.emitStateChange()}),h.on(ze.mediaPause,function(u){var p,y=(p=l.__slideState.mediaState[u.id])!==null&&p!==void 0?p:{};y.type="pause",y.time=u.time,l.__slideState.mediaState[u.id]=y,u._stateOnly?l.config.mode==="interactive"&&l.receiveSyncHandler({slideIndex:l.__slideState.currentSlideIndex,type:"mediaPause",id:u.id,state:y}).catch(function(b){l.logger.error(b==null?void 0:b.message,l.taskId)}):l.emitSyncDispatch({slideIndex:l.__slideState.currentSlideIndex,type:"mediaPause",id:u.id,state:y}),l.emitStateChange()}),h.on(ze.mediaSeek,function(u){var p,y=(p=l.__slideState.mediaState[u.id])!==null&&p!==void 0?p:{};u.isPlaying?(y.type="play",y.time=l.timestamp()-1e3*u.time):(y.type="pause",y.time=u.time),l.__slideState.mediaState[u.id]=y,l.emitSyncDispatch({slideIndex:l.__slideState.currentSlideIndex,type:"mediaSeek",id:u.id,time:u.time,state:y}),l.emitStateChange()}),h.on(ze.requestNextStep,function(){l.nextStep()}),h.on(ze.requestPrevSlide,function(u){l.handlePrevSlide(u)}),h.on(ze.requestNextSlide,function(u){l.handleNextSlide(u)}),h.on(ze.useraddLink,function(u){l.emit(or.useraddLink,l.taskId,l.renderingIndex,u)}),h.on(ze.requestGotoSlide,function(u){var p;l.syncCatchUpInputBlocked||(!((p=l.config.navigatorDelegate)===null||p===void 0)&&p.gotoPage?l.config.navigatorDelegate.gotoPage(u):l.handleGotoSlide(u))}),h.on(ze.requestOpenUrl,function(u){var p;!((p=l.config.navigatorDelegate)===null||p===void 0)&&p.openUrl&&l.config.navigatorDelegate.openUrl(u)}),h.on(ze.fullscreenChange,function(u){var p,y=u.targetId,b=u.state;l.emitSyncDispatch({slideIndex:l.__slideState.currentSlideIndex,type:"mediaFullscreen",targetId:y,state:b});var w=(p=l.__slideState.mediaState[y])!==null&&p!==void 0?p:{};w.fullscreen=b,l.__slideState.mediaState[y]=w,l.emitStateChange()}),h.on(ze.changeLocalFullscreenState,function(u){u.slideIndex===l.__slideState.currentSlideIndex?(u.targetId&&l.__slideState.mediaState[u.targetId]&&(l.__slideState.mediaState[u.targetId].fullscreen=u.status),l.emitStateChange()):l.logger.info("event slideIndex: "+u.slideIndex+", current slideIndex: "+l.__slideState.currentSlideIndex,l.taskId)}),(o=h.view)===null||o===void 0||o.addEventListener("touchend",this.handleViewTouchEnd),(s=h.view)===null||s===void 0||s.addEventListener("touchstart",this.handleViewTouchStart),(a=h.view)===null||a===void 0||a.addEventListener("click",this.handleViewClick),h.on(ze.userInput,this.userInputHandle),h},t.prototype._handleViewClick=function(){var r=this;setTimeout(function(){var o=Date.now();Math.abs(o-r.userInputTime)>500&&r.enableGlobalClick&&r.nextStep()})},t.prototype.createController=function(){this.player&&(this.playerController=new Rw(this.player,this.frame))},t.prototype.setMedianControllerAttribute=function(){this.medianController.className="median-container",this.medianController.style.position="absolute",this.medianController.style.left="0",this.medianController.style.top="0",this.medianController.style.zIndex="2",this.medianController.style.fontSize="16px"},t.prototype.frameResizeHandler=function(){if(!this.config.fixedFrameSize){var r=this.frame.getBoundingClientRect(),o=r.width,s=r.height;this.frameWidth=o,this.frameHeight=s,this.resizeView()}},t.prototype.notifyFrameResize=function(){this.frameResizeHandler()},t.prototype.updateFixedFrameSize=function(r,o,s){this.config.fixedFrameSize&&(this.frameWidth=r,this.frameHeight=o,this.frame.style.width=r+"px",this.frame.style.height=o+"px",this.resizeView(s))},t.prototype._resizeView=function(r){var o,s,a=this,l=this.width,h=this.height;if(l>0&&h>0){var u=this.frameWidth/l,p=u*h;p>this.frameHeight&&(u*=this.frameHeight/p),(o=this.player)===null||o===void 0||o.scaleView(u,this.resize,r),this.cacheImage.style.transform="scale("+u+")",this.medianController.style.transform="scale("+u+")",this.medianController.setAttribute("data-scale",u.toString()),this.isInitResized||(this.isInitResized=!0,(s=this.player)===null||s===void 0||s.clock.setTimeout(function(){a.frame.style.visibility="visible"},32))}},t.prototype.setSlideState=function(r){var o,s,a;return zi(this,void 0,void 0,function(){var l,h=this;return Vi(this,function(u){switch(u.label){case 0:return this.isSyncingSlideState=!0,this.logger.info("stateChange receive "+JSON.stringify(r),this.taskId),r.taskId&&r.taskId!==this.__slideState.taskId&&(this.__slideState.taskId=r.taskId,(o=this.player)===null||o===void 0||o.setResourceData(r.taskId,this.__slideState.url)),r.url&&r.url!==this.__slideState.url&&(this.__slideState.url=r.url,(s=this.player)===null||s===void 0||s.setResourceData(this.__slideState.taskId,r.url)),Number.isInteger(r.currentSlideIndex)&&r.currentSlideIndex!==this.__slideState.currentSlideIndex?(this.__slideState.currentSlideIndex=r.currentSlideIndex,[4,this.enqueueRenderSlide(r.currentSlideIndex)]):[3,2];case 1:u.sent(),u.label=2;case 2:return[4,(a=this.player)===null||a===void 0?void 0:a.clock.waitUntil(function(){var p,y;return((p=h.player)===null||p===void 0?void 0:p.currentIndex)===r.currentSlideIndex&&((y=h.player)===null||y===void 0?void 0:y.currentStage)},3e3)];case 3:return u.sent(),l=!1,Number.isInteger(r.mainSeqStep)&&r.mainSeqStep!==this.__slideState.mainSeqStep&&(l=!0,this.__slideState.mainSeqStep=r.mainSeqStep),r.mainSeqState&&r.mainSeqState!==this.__slideState.mainSeqState&&(l=!0,this.__slideState.mainSeqState=r.mainSeqState),l&&this.setMainSeqStep(this.__slideState.mainSeqStep,this.__slideState.mainSeqState==="idle"?"start":"end"),r.interactiveSeqState&&(this.initInteractiveSeq(r),this.__slideState.interactiveSeqState=r.interactiveSeqState),[4,Nh(1500)];case 4:return u.sent(),r.mediaState&&(this.initMedia(r),this.__slideState.mediaState=r.mediaState),this.isSyncingSlideState=!1,[2]}})})},t.prototype.initInteractiveSeq=function(r){var o;for(var s in r.interactiveSeqState){var a=r.interactiveSeqState[s];(o=this.player)===null||o===void 0||o.setInteractiveSeqState(s,a.step,a.state==="idle"?"start":"end")}},t.prototype.initMedia=function(r){var o,s,a;for(var l in r.mediaState){var h=r.mediaState[l],u=this.__slideState.mediaState[l];if((o=this.player)===null||o===void 0||o.syncFullscreenVideoState({targetId:l,state:!!h.fullscreen,slideIndex:this.slideState.currentSlideIndex}),!u||h.type!==u.type||h.time!==u.time)if(h.type==="play"){var p=(this.timestamp()-h.time)/1e3;(s=this.player)===null||s===void 0||s.setMediaState(l,!0,p)}else(a=this.player)===null||a===void 0||a.setMediaState(l,!1,h.time)}},Object.defineProperty(t.prototype,"slideCount",{get:function(){return this._slideCount},enumerable:!1,configurable:!0}),t.prototype.getSizeAsync=function(){return zi(this,void 0,void 0,function(){var r;return Vi(this,function(o){switch(o.label){case 0:if(this.width>0&&this.height>0)return[2,[this.width,this.height]];o.label=1;case 1:return o.trys.push([1,4,,5]),[4,fetch(this.__slideState.url+"/"+this.__slideState.taskId+"/jsonOutput/slide-1.json")];case 2:return[4,o.sent().json()];case 3:return[2,[(r=o.sent()).width,r.height]];case 4:return o.sent(),[2,[0,0]];case 5:return[2]}})})},t.prototype.getSlideCountAsync=function(){return zi(this,void 0,void 0,function(){return Vi(this,function(r){switch(r.label){case 0:if(this._slideCount>0)return[2,this._slideCount];r.label=1;case 1:return r.trys.push([1,4,,5]),[4,fetch(this.__slideState.url+"/"+this.__slideState.taskId+"/jsonOutput/slide-1.json")];case 2:return[4,r.sent().json()];case 3:return[2,r.sent().slideCount];case 4:return r.sent(),[2,0];case 5:return[2]}})})},Object.defineProperty(t.prototype,"slideState",{get:function(){return this.__slideState.mainSeqState=this.mainSeqState,this.__slideState.mainSeqStep=this.mainSeqStep,JSON.parse(JSON.stringify(this.__slideState))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mainSeqLength",{get:function(){var r;return((r=this.player)===null||r===void 0?void 0:r.mainSeqLength())||0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mainSeqStep",{get:function(){var r;return((r=this.player)===null||r===void 0?void 0:r.mainSeqStep())||0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mainSeqState",{get:function(){var r;return((r=this.player)===null||r===void 0?void 0:r.mainSeqState())||null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderOptions",{get:function(){var r;return((r=this.player)===null||r===void 0?void 0:r.config)||null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"drawCall",{get:function(){var r;return((r=this.player)===null||r===void 0?void 0:r.runtime.drawCall)||0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderFps",{get:function(){var r;return((r=this.player)===null||r===void 0?void 0:r.runtime.fps)||0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"runtimeFps",{get:function(){var r;return((r=this.player)===null||r===void 0?void 0:r.fps.value)||0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"view",{get:function(){var r;return((r=this.player)===null||r===void 0?void 0:r.view)||null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.designWidth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.designHeight},enumerable:!1,configurable:!0}),t.prototype.updateRenderOption=function(r){this.player&&(this.player.updateConfig(r),this.renderOptions&&(this.config.renderOptions=this.renderOptions))},t.prototype.setResource=function(r,o){var s;this.taskId=r,(s=this.player)===null||s===void 0||s.setResourceData(r,o),this.__slideState.taskId=r,this.__slideState.url=o,this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"setResource",taskId:r,url:o})},t.prototype.setResourceList=function(r,o){var s;this.taskId=r,this.resourceList=o,(s=this.player)===null||s===void 0||s.setResourceData(r,"__internal__"),this.__slideState.taskId=r,this.__slideState.url="__internal__"},t.prototype._renderSlide=function(r){var o;return zi(this,void 0,void 0,function(){var s=this;return Vi(this,function(a){switch(a.label){case 0:return this.renderingIndex=r,this.player&&r===this.player.currentIndex?[2]:((ur.platform.isIOS()||ur.platform.isAndroid())&&this.iosResetCache.indexOf(r)<0&&this.iosResetCache.push(r),this.flushDebounce(),[4,(o=this.player)===null||o===void 0?void 0:o.renderSlide(r)]);case 1:return a.sent(),this.__slideState.currentSlideIndex=r,this._resizeView(),this.__slideState.interactiveSeqState={},this.__slideState.mediaState={},this.emitStateChange(),setTimeout(function(){var l,h;((h=(l=s.player)===null||l===void 0?void 0:l.view)===null||h===void 0?void 0:h.style.visibility)==="hidden"&&(s.player.view.style.visibility="visible"),s.frame.style.visibility==="hidden"&&(s.frame.style.visibility="visible"),s.cacheImage.style.display="none"},100),[2]}})})},t.prototype.renderSlide=function(r,o){if(o===void 0&&(o=!0),this.syncCatchUpInputBlocked)this.logger.info("prevent renderSlide while sync event queue is catching up",this.taskId);else if(this.player){var s=Number(r);(s!==this.player.currentIndex||this.renderingTaskManager.hasStartTask())&&(s>this.slideCount&&this.slideCount>0||this.poseRenderSlide(s,o))}},t.prototype.needCreateNewPlayer=function(){var r=t.__stageCountLimit;return r<=0&&(r=ur.platform.isLowGpuMemory()?15:30),(ur.platform.isIOS()||ur.platform.isAndroid())&&this.iosResetCache.length>r},t.prototype.poseRenderSlide=function(r,o){this.mode==="interactive"?this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:r,isForward:o}):this.mode==="sync"?(this.doRenderSlide(r,o),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:r,isForward:o})):this.doRenderSlide(r,o)},t.prototype.doRenderSlide=function(r,o){return o===void 0&&(o=!0),this.syncCatchUpInputBlocked?(this.logger.info("prevent doRenderSlide while sync event queue is catching up",this.taskId),Promise.resolve()):this.enqueueRenderSlide(r,o)},t.prototype.enqueueRenderSlide=function(r,o){var s,a,l,h=this;if(o===void 0&&(o=!0),!this.player)return Promise.resolve();if(this.needCreateNewPlayer()&&(this.iosResetCache=[],this.iosNewPlayer=this.initPlayer(this.config),this.iosNewPlayer.setResourceData(this.__slideState.taskId,this.__slideState.url)),this.iosNewPlayer){var u=this.player.getSnapshot();this.cacheImage.src=u,this.player.destroy(),(s=this.playerController)===null||s===void 0||s.destroy(),this.player=this.iosNewPlayer,this.iosNewPlayer=void 0,!((a=this.config)===null||a===void 0)&&a.controller&&this.createController(),!((l=this==null?void 0:this.player)===null||l===void 0)&&l.view&&(this.player.view.style.visibility="hidden",this.canvasContainer.appendChild(this.player.view))}var p=Math.random().toString(32).substr(2);return this.player.isForward=o,this.renderingTaskManager.addTask(function(){return h._renderSlide(r)},r,p),new Promise(function(y,b){h.renderingTaskManager.eventHub.once("task-end-"+p,y),h.renderingTaskManager.eventHub.once("task-error-"+p,b)})},t.prototype.getSnapshot=function(){var r,o;return(o=(r=this.player)===null||r===void 0?void 0:r.getSnapshot())!==null&&o!==void 0?o:null},t.prototype.nextStep=function(){!this.isLoading&&this.player&&this.interactive&&!this.syncCatchUpInputBlocked?(this.hasNextStep()||this.emit(or.slideStepEnd),this.player.mainSeqHasNextStep()?this.mode==="interactive"?this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"nextStep",next:this.player.mainSeqStep()+1}):this.mode==="sync"?(this.doNextStep(!1,""),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"nextStep",next:this.player.mainSeqStep()})):this.doNextStep(!1,""):this.handleNextSlide()):this.logger.info("prevent nextStep. isLoading: "+this.isLoading+", player: "+!!this.player+", interactive: "+this.interactive+", syncCatchUpInputBlocked: "+this.syncCatchUpInputBlocked,this.taskId)},t.prototype.doNextStep=function(r,o){if(this.player){var s=!this.config.clientId||o===this.config.clientId;this.player.nextStep(r,s);var a=this.player.mainSeqStep();this.__slideState.mainSeqStep=a,this.emitStateChange()}},t.prototype.prevStep=function(){!this.isLoading&&this.player&&this.interactive&&!this.syncCatchUpInputBlocked?(this.hasPrevStep()||this.emit(or.slideStepStart),this.player.mainSeqHasPrevStep()?this.mode==="interactive"?this.emitSyncDispatch({type:"prevStep",slideIndex:this.__slideState.currentSlideIndex,next:this.player.mainSeqStep()-1}):this.mode==="sync"?(this.doPrevStep(),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"prevStep",next:this.player.mainSeqStep()})):this.doPrevStep():this.handlePrevSlide()):this.logger.info("prevent prevStep. isLoading: "+this.isLoading+", player: "+!!this.player+", interactive: "+this.interactive+", syncCatchUpInputBlocked: "+this.syncCatchUpInputBlocked,this.taskId)},t.prototype.doPrevStep=function(r){if(r===void 0&&(r=!1),this.player){this.player.prevStep(r);var o=this.player.mainSeqStep();this.__slideState.mainSeqStep=o,this.emitStateChange()}},t.prototype.isSlideStateReady=function(r){return r.taskId.length>0&&r.url.length>0&&r.currentSlideIndex>0},t.prototype.emitStateChange=function(){if(this.mode!=="local"&&!this.isSyncingSlideState){var r=this.slideState;!KS()(this.lastEmitedState,r)&&this.isSlideStateReady(r)&&(this.lastEmitedState=r,this.emit(or.stateChange,r),this.logger.info("stateChange dispatch "+JSON.stringify(this.slideState),this.taskId))}},t.prototype.emitSyncDispatch=function(r){if(!this.lock.isLocked(r.type)){var o=Math.random().toString(32).substr(2);this.lock.addLock(r.type,o);var s=xs(xs({},r),{uuid:o,clientId:this.config.clientId});this.config.mode==="sync"&&(s.incrId=this.dispatchIncrId),this.emit(or.syncDispatch,s),this.logger.info("sync dispatch "+JSON.stringify(s),this.taskId)}},t.prototype.setMainSeqStep=function(r,o){var s;(s=this.player)===null||s===void 0||s.setMainSeqStep(r,o)},t.prototype.setInteractive=function(r){this.interactive=r,this.updatePlayerInteractive()},t.prototype.setSyncEventQueuePolicy=function(r){var o=vg(this.mode,r);this.syncQueue.setPolicy(o),this.config.syncEventQueuePolicy=o},t.prototype.pause=function(){var r;(r=this.player)===null||r===void 0||r.pause()},t.prototype.resume=function(){var r;(r=this.player)===null||r===void 0||r.resume()},t.prototype._doFrozen=function(r){var o;return zi(this,void 0,void 0,function(){var s,a,l,h=this;return Vi(this,function(u){switch(u.label){case 0:return this.logger.info("do frozen with player["+!!this.player+"]",this.taskId),this.tracker({name:"frozenSlide",reason:"",result:"",payload:{taskId:this.taskId}}),this.view&&this.player?[4,this.player.clock.waitUntil(function(){return!h.isLoading},6e4)]:[3,2];case 1:for(a in u.sent(),s=this.player.getSnapshot()||"",this.cacheImage.src=s,this.cacheImage.style.display="block",this.player.destroy(),(o=this.playerController)===null||o===void 0||o.destroy(),this.player=void 0,this.__slideState.mediaState)l=this.__slideState.mediaState[a],this.__slideState.mediaState[a]=xs(xs({},l),{frozenTime:this.timestamp()});u.label=2;case 2:return r&&r(),[2]}})})},t.prototype.frozen=function(r){var o=this;this.frozenTaskManager.addTask("frozen",function(){return o._doFrozen(r)})},t.prototype._doRelease=function(r){var o,s;return zi(this,void 0,void 0,function(){var a,l,h,u;return Vi(this,function(p){switch(p.label){case 0:if(this.logger.info("do release slide",this.taskId),this.tracker({name:"releaseSlide",reason:"",result:"",payload:{taskId:this.taskId}}),this.player)return[2];for(l in this.player=this.initPlayer(this.config),!((o=this.config)===null||o===void 0)&&o.controller&&this.createController(),this.player.view&&(this.canvasContainer.appendChild(this.player.view),this.player.view.style.visibility="hidden"),a=this.__slideState,this.__slideState=H0()(yg),a.mediaState)(h=a.mediaState[l]).type==="play"&&(u=Math.max((s=h.frozenTime)!==null&&s!==void 0?s:0,h.time),h.time=this.timestamp()-(u-h.time),h.frozenTime=void 0);return[4,this.setSlideState(a)];case 1:return p.sent(),[4,this.player.clock.delay(333)];case 2:return p.sent(),this.player.view&&(this.player.view.style.visibility="visible"),this.cacheImage.style.display="none",r&&r(),[2]}})})},t.prototype.release=function(r){var o=this;this.frozenTaskManager.addTask("release",function(){return o._doRelease(r)})},t.prototype._doDestroy=function(){var r,o,s,a,l=this;this.logger.info("do destroy slide",this.taskId),this.tracker({name:"destroySlide",reason:"",result:"",payload:{taskId:this.taskId}});var h=t.instances.findIndex(function(u){return u.randomId===l.randomId});if(h>=0&&t.instances.splice(h,1),this.playerController&&this.playerController.destroy(),this.config.disableFrameResizeObserver||this.frameResizeObserver.disconnect(),(r=this.player)===null||r===void 0||r.removeAllListeners(),(o=this.player)===null||o===void 0||o.destroy(),(s=this.player)===null||s===void 0||s.removeAllListeners(),this.logger={warn:function(){return{}},info:function(){return{}},error:function(){return{}}},this.syncQueue.destroy(),this.renderingTaskManager.destroy(),this.frozenTaskManager.destroy(),window.removeEventListener("__slide_ref__",this.handleSlideRef),window.removeEventListener("__slide_updateStageCountLimit",this.updateStageCountLimit),window.removeEventListener("message",this.recoverHandler),this.removeAllListeners(),(a=this.player)===null||a===void 0?void 0:a.view)try{this.anchor.removeChild(this.player.view)}catch{this.logger.error("removeChild error Slide.ts:1982",this.taskId)}try{this.anchor.removeChild(this.frame)}catch{this.logger.error("removeChild error Slide.ts:1988",this.taskId)}t.volumeAdjuster.off("update",this._updateVolumeByStaticAdjuster)},t.prototype.waitLoadEnd=function(){return zi(this,void 0,void 0,function(){var r;return Vi(this,function(o){switch(o.label){case 0:r=0,o.label=1;case 1:return this.isLoading&&r<10?[4,Nh(100)]:[3,3];case 2:return o.sent(),r+=1,[3,1];case 3:return[2]}})})},t.prototype.preload=function(r){return this.player?this.player.preload(r):Promise.resolve()},t.prototype.preloadResource=function(r){return this.player?this.player.preloadResource(r):Promise.resolve()},t.prototype.destroy=function(){var r=this;this.logger.info("pre destroy slide",""),this.isLoading?this.waitLoadEnd().then(function(){r._doDestroy()}):this._doDestroy()},t.prototype.clearSlideCache=function(){var r;(r=this.player)===null||r===void 0||r.clearLocalCache()},t.prototype.hasNextStep=function(){if(!this.player)return!1;var r=this.player.currentIndex===this.slideCount,o=this.mainSeqLength===0||this.mainSeqStep>=this.mainSeqLength-1,s=this.mainSeqState==="end"||this.mainSeqState==="running"||this.mainSeqState==null;return!(r&&o&&s)},t.prototype.hasPrevStep=function(){if(!this.player)return!1;var r=this.player.currentIndex===1,o=this.mainSeqLength===0||this.mainSeqStep===0,s=this.mainSeqState==="idle"||this.mainSeqState===null;return!(r&&o&&s)},t.prototype.snapshot=function(){return zi(this,void 0,void 0,function(){return Vi(this,function(r){return this.player?[2,this.player.getSnapshot()]:[2,null]})})},t.prototype.snapshotWithTimingEnd=function(r){return zi(this,void 0,void 0,function(){return Vi(this,function(o){return this.player?[2,this.player.snapshotWithTimingEnd(r)]:[2,null]})})},t.prototype.updateGlobalVolume=function(r){this.volumeAdjuster.volume=r},t.prototype.getGlobalVolume=function(){return this.volumeAdjuster.volume},t.clearLocalCache=function(){ur.clearLocalCache()},t.disposeLocalCache=function(){},t.prototype.getNoteForCurrentSlide=function(r){return zi(this,void 0,void 0,function(){var o,s;return Vi(this,function(a){switch(a.label){case 0:if(!this.player)return[2,null];if(this.slideNots)return[2,this.slideNots[r]];a.label=1;case 1:return a.trys.push([1,4,,5]),[4,fetch(this.__slideState.url+"/"+this.__slideState.taskId+"/jsonOutput/note.json")];case 2:return[4,a.sent().json()];case 3:return o=a.sent(),this.slideNots=o,[2,o[r]];case 4:return s=a.sent(),this.logger.error("getNotesForCurrentSlide error: "+String(s),this.taskId),[2,null];case 5:return[2]}})})},e=t,t.preloadResource=Bw,t.instances=[],t._tempFrozenIds=[],t._tempLog="",t._tempLogIndex=1,t.remoteLogAddress=null,t.usePlugin=function(r){r.context({logger:{info:function(o){t.appendLogString("INFO - "+new Date().toISOString()+" - "+o+`
8029
+ `),t.trackLogger.addLog(a,"error",l,o.randomId);var u=(h=o.config.logger)===null||h===void 0?void 0:h.error;u&&u("["+l+"] "+a)}},o.logger.info("new slide with clientId: "+o.config.clientId+", version: "+o.version,o.taskId),o.tracker({name:"initSlide",result:"",reason:"",payload:{taskId:o.taskId}}),o.anchor=o.config.anchor;var s=vg(o.mode,o.config.syncEventQueuePolicy);return o.config.syncEventQueuePolicy=s,o.syncQueue=new Pw(o.receiveSyncHandler,{policy:s,onCompact:o.handleSyncQueueCompact,onCompactedRenderComplete:o.handleSyncQueueCompactRenderComplete,onCatchUpStateChange:o.handleSyncQueueCatchUpStateChange,shouldTrackCatchUpEvent:function(a){return!o.selfSyncEvents.has(a)}}),o.lock=new Ow(o.mode==="interactive"),o.cacheImage.style.position="absolute",o.cacheImage.style.display="block",o.cacheImage.style.zIndex="100",o.setMedianControllerAttribute(),o.canvasContainer.style.position="relative",o.canvasContainer.style.fontSize="0",o.canvasContainer.appendChild(o.medianController),o.frame.appendChild(o.canvasContainer),o.frame.appendChild(o.cacheImage),o.config.disableFrameResizeObserver||o.frameResizeObserver.observe(o.frame),o.on(or.syncReceive,function(a){(o.lock.unlock(a.type,a.uuid)||!!o.config.clientId&&a.clientId===o.config.clientId)&&o.selfSyncEvents.add(a),!o.player&&o.config.skipActionWhenFrozen||o.mode==="sync"&&o.config.clientId===a.clientId||o.syncQueue.addTask(a)}),o.renderingTaskManager.eventHub.on("task-error",function(a){var l=a.error,h=a.task,u=Hn.transform(l);u.errorType===Yn.RuntimeWarn?o.logger.warn(u.message,o.taskId):o.logger.error(u.message,o.taskId),o.isLoading=!1,o.reportError(u,h.slideIndex)}),window.addEventListener("__slide_ref__",o.handleSlideRef),window.addEventListener("__slide_updateStageCountLimit",o.updateStageCountLimit),o.resizeView=wh()(o.resizeView.bind(o),50),o.player=o.initPlayer(o.config),o.config.controller&&o.createController(),o.player.view&&o.canvasContainer.appendChild(o.player.view),o.config.disableClickDebounce||(o.handleViewClick=wh()(o.handleViewClick,300)),o.player.errorChannel.on("error",function(a,l){var h=Hn.transform(a);h.errorType===Yn.RuntimeWarn?o.logger.warn(h.message,o.taskId):o.logger.error(h.message,o.taskId),o.isLoading=!1,o.reportError(a,l),o.tracker({name:"slideError",reason:h.errorMsg,result:"",payload:{code:h.errorType}})}),window.addEventListener("message",o.recoverHandler),t.volumeAdjuster.on("update",o._updateVolumeByStaticAdjuster),o.volumeAdjuster.volume=t.volumeAdjuster.volume,o}var e,n;return kw(t,i),t.flushLog=function(r){return r===void 0&&(r=!1),zi(this,void 0,void 0,function(){return Vi(this,function(o){switch(o.label){case 0:if(!(t._tempLog.length>131072||r&&t._tempLog.length>0))return[3,5];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,fr==null?void 0:fr.setItem("run_time_log_"+t._tempLogIndex,t._tempLog)];case 2:return o.sent(),[3,4];case 3:return o.sent(),[3,4];case 4:t._tempLog="",t._tempLogIndex+=1,o.label=5;case 5:return[2]}})})},t.stopRemoteLog=function(){t.remoteLogAddress=null},t.startRemoteLog=function(r){return zi(this,void 0,void 0,function(){var o,s,a,l,h;return Vi(this,function(u){switch(u.label){case 0:return t.remoteLogAddress=r,[4,t.flushLog(!0)];case 1:if(u.sent(),!fr)return[3,13];o=[],u.label=2;case 2:return u.trys.push([2,4,,5]),[4,fr.keys()];case 3:return o=(u.sent()||[]).sort(function(p,y){return parseInt(p.replace("run_time_log_",""))-parseInt(y.replace("run_time_log_",""))}),[3,5];case 4:return u.sent(),[3,5];case 5:s=0,a=o,u.label=6;case 6:if(!(s<a.length))return[3,13];l=a[s],l.replace("run_time_log_",""),h="",u.label=7;case 7:return u.trys.push([7,9,,10]),[4,fr.getItem(l)];case 8:return h=u.sent()||"",[3,10];case 9:return u.sent(),[3,10];case 10:return[4,fetch(t.remoteLogAddress+"/logs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log:h})})];case 11:u.sent(),u.label=12;case 12:return s++,[3,6];case 13:return[2]}})})},t.appendLogString=function(r){t._tempLog+=r,t.remoteLogAddress&&fetch(t.remoteLogAddress+"/logs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log:r})}).catch(function(){})},t.setStageCountLimit=function(r){if(!go()(r)||!Number.isInteger(r))throw new Error("Invalid stage count limit");t.__stageCountLimit=r},Object.defineProperty(t.prototype,"dispatchIncrId",{get:function(){return this._dispatchIncrId++},enumerable:!1,configurable:!0}),t.prototype.updatePlayerInteractive=function(){var r;(r=this.player)===null||r===void 0||r.setInteractive(this.interactive&&!this.syncCatchUpInputBlocked)},t.prototype.reportError=function(r,o){this.emit(or.renderError,{error:r,index:o}),window.postMessage({type:"@slide/_error_",errorType:r.errorType,errorMsg:r.errorMsg,slideId:this.randomId,slideIndex:o||-1,customMessage:"@slide/_error_"},"*"),t.trackLogger.uploadLog(!0)},t.prototype.initSlideConfig=function(r){return r.timestamp&&(this.timestamp=r.timestamp),r.rtcAudio&&(ur.RtcAudioClazz=r.rtcAudio),r.enableWebAudio!==!1&&(r.enableWebAudio=!0),this.mode=r.mode,this.anchor=r.anchor,this.anchor.appendChild(this.frame),this.enableGlobalClick=!vi()(r.enableGlobalClick)&&r.enableGlobalClick,this.resize=r.resize||!1,this.interactive=r.interactive,this.frame.style.cssText=r.fixedFrameSize?"width:"+r.fixedFrameSize.width+"px;height:"+r.fixedFrameSize.height+"px;":"width:100%;height:100%",this.frame.style.cssText+="display:flex;justify-content:center;align-items:center;visibility:hidden;position:relative;z-index:1;",r.fixedFrameSize&&(this.frameWidth=r.fixedFrameSize.width,this.frameHeight=r.fixedFrameSize.height),r.disableClickDebounce=r.disableClickDebounce||!1,r},t.prototype.initPlayer=function(r){var o,s,a,l=this,h=new ur({mode:this.mode,useLocalCache:!!vi()(this.config.useLocalCache)||this.config.useLocalCache,logger:this.logger,resourceTimeout:vi()(this.config.resourceTimeout)?15e3:this.config.resourceTimeout,loadDelegate:this.config.loaderDelegate,volumeAdjuster:this.volumeAdjuster,urlInterrupter:this.urlInterrupter,tracker:this.tracker,enableWebAudio:this.config.enableWebAudio,enableAutoForward:this.config.enableAutoForward,customLinks:this.config.customLinks,resourceMaxRetries:this.config.resourceMaxRetries,onResourceMaxRetries:this.config.onResourceMaxRetries},r.renderOptions);return h.setInteractive(this.interactive&&!this.syncCatchUpInputBlocked),h.updateConfig(r.renderOptions||{}),h.on(ze.renderStart,function(u){l.isLoading=!0,l.emit(or.renderStart,u),window.postMessage({type:"@slide/_render_start_",taskId:l.taskId,index:u},"*")}),h.on(ze.renderEnd,function(u){l.isLoading=!1,l.player&&(l.designHeight=l.player.designHeight,l.designWidth=l.player.designWidth,l.cacheImage.style.width=l.player.designWidth+"px",l.cacheImage.style.height=l.player.designHeight+"px",l.cacheImage.style.maxWidth=l.player.designWidth+"px",l.cacheImage.style.minWidth=l.player.designHeight+"px",l._slideCount=l.player.slideCount),l.emit(or.renderEnd,u),window.postMessage({type:"@slide/_render_end_",taskId:l.taskId,index:u},"*")}),h.on(ze.slideChange,function(u){l.__slideState.currentSlideIndex=u,l.emitStateChange(),l.emit(or.slideChange,u)}),h.on(ze.mainSeqStateChange,function(u){l.__slideState.mainSeqState=u,l.emitStateChange()}),h.on(ze.mainSeqStepChange,function(u){l.__slideState.mainSeqStep=u,l.emitStateChange()}),h.on(ze.interactiveSeqStateChange,function(u){var p=u.id,y=u.state;l.__slideState.interactiveSeqState[p]=y,l.emitStateChange()}),h.on(ze.animateStart,function(){l.isAnimating!==!0&&(l.isAnimating=!0,l.emit(or.animateStart))}),h.on(ze.animateEnd,function(){l.isAnimating!==!1&&(l.isAnimating=!1,l.emit(or.animateEnd))}),h.on(ze.interactiveSeqAction,function(u){var p=u.action,y=u.seqId;l.emitSyncDispatch({slideIndex:l.__slideState.currentSlideIndex,type:"interactiveAnim",action:p,seqId:y}),l.emitStateChange()}),h.on(ze.mainSeqStepStart,function(u){l.emit(or.mainSeqStepStart,u)}),h.on(ze.mainSeqStepEnd,function(u){l.emit(or.mainSeqStepEnd,u)}),h.on(ze.mediaPlay,function(u){var p,y=(p=l.__slideState.mediaState[u.id])!==null&&p!==void 0?p:{};y.type="play",y.time=l.timestamp()-1e3*u.time,l.__slideState.mediaState[u.id]=y,u._stateOnly?l.config.mode==="interactive"&&l.receiveSyncHandler({slideIndex:l.__slideState.currentSlideIndex,type:"mediaPlay",id:u.id,state:y}).catch(function(b){l.logger.error(b==null?void 0:b.message,l.taskId)}):l.emitSyncDispatch({slideIndex:l.__slideState.currentSlideIndex,type:"mediaPlay",id:u.id,state:y}),l.emitStateChange()}),h.on(ze.mediaStop,function(u){delete l.__slideState.mediaState[u.id],l.emitStateChange()}),h.on(ze.mediaPause,function(u){var p,y=(p=l.__slideState.mediaState[u.id])!==null&&p!==void 0?p:{};y.type="pause",y.time=u.time,l.__slideState.mediaState[u.id]=y,u._stateOnly?l.config.mode==="interactive"&&l.receiveSyncHandler({slideIndex:l.__slideState.currentSlideIndex,type:"mediaPause",id:u.id,state:y}).catch(function(b){l.logger.error(b==null?void 0:b.message,l.taskId)}):l.emitSyncDispatch({slideIndex:l.__slideState.currentSlideIndex,type:"mediaPause",id:u.id,state:y}),l.emitStateChange()}),h.on(ze.mediaSeek,function(u){var p,y=(p=l.__slideState.mediaState[u.id])!==null&&p!==void 0?p:{};u.isPlaying?(y.type="play",y.time=l.timestamp()-1e3*u.time):(y.type="pause",y.time=u.time),l.__slideState.mediaState[u.id]=y,l.emitSyncDispatch({slideIndex:l.__slideState.currentSlideIndex,type:"mediaSeek",id:u.id,time:u.time,state:y}),l.emitStateChange()}),h.on(ze.requestNextStep,function(){l.nextStep()}),h.on(ze.requestPrevSlide,function(u){l.handlePrevSlide(u)}),h.on(ze.requestNextSlide,function(u){l.handleNextSlide(u)}),h.on(ze.useraddLink,function(u){l.emit(or.useraddLink,l.taskId,l.renderingIndex,u)}),h.on(ze.requestGotoSlide,function(u){var p;l.syncCatchUpInputBlocked||(!((p=l.config.navigatorDelegate)===null||p===void 0)&&p.gotoPage?l.config.navigatorDelegate.gotoPage(u):l.handleGotoSlide(u))}),h.on(ze.requestOpenUrl,function(u){var p;!((p=l.config.navigatorDelegate)===null||p===void 0)&&p.openUrl&&l.config.navigatorDelegate.openUrl(u)}),h.on(ze.fullscreenChange,function(u){var p,y=u.targetId,b=u.state;l.emitSyncDispatch({slideIndex:l.__slideState.currentSlideIndex,type:"mediaFullscreen",targetId:y,state:b});var w=(p=l.__slideState.mediaState[y])!==null&&p!==void 0?p:{};w.fullscreen=b,l.__slideState.mediaState[y]=w,l.emitStateChange()}),h.on(ze.changeLocalFullscreenState,function(u){u.slideIndex===l.__slideState.currentSlideIndex?(u.targetId&&l.__slideState.mediaState[u.targetId]&&(l.__slideState.mediaState[u.targetId].fullscreen=u.status),l.emitStateChange()):l.logger.info("event slideIndex: "+u.slideIndex+", current slideIndex: "+l.__slideState.currentSlideIndex,l.taskId)}),(o=h.view)===null||o===void 0||o.addEventListener("touchend",this.handleViewTouchEnd),(s=h.view)===null||s===void 0||s.addEventListener("touchstart",this.handleViewTouchStart),(a=h.view)===null||a===void 0||a.addEventListener("click",this.handleViewClick),h.on(ze.userInput,this.userInputHandle),h},t.prototype._handleViewClick=function(){var r=this;setTimeout(function(){var o=Date.now();Math.abs(o-r.userInputTime)>500&&r.enableGlobalClick&&r.nextStep()})},t.prototype.createController=function(){this.player&&(this.playerController=new Rw(this.player,this.frame))},t.prototype.setMedianControllerAttribute=function(){this.medianController.className="median-container",this.medianController.style.position="absolute",this.medianController.style.left="0",this.medianController.style.top="0",this.medianController.style.zIndex="2",this.medianController.style.fontSize="16px"},t.prototype.frameResizeHandler=function(){if(!this.config.fixedFrameSize){var r=this.frame.getBoundingClientRect(),o=r.width,s=r.height;this.frameWidth=o,this.frameHeight=s,this.resizeView()}},t.prototype.notifyFrameResize=function(){this.frameResizeHandler()},t.prototype.updateFixedFrameSize=function(r,o,s){this.config.fixedFrameSize&&(this.frameWidth=r,this.frameHeight=o,this.frame.style.width=r+"px",this.frame.style.height=o+"px",this.resizeView(s))},t.prototype._resizeView=function(r){var o,s,a=this,l=this.width,h=this.height;if(l>0&&h>0){var u=this.frameWidth/l,p=u*h;p>this.frameHeight&&(u*=this.frameHeight/p),(o=this.player)===null||o===void 0||o.scaleView(u,this.resize,r),this.cacheImage.style.transform="scale("+u+")",this.medianController.style.transform="scale("+u+")",this.medianController.setAttribute("data-scale",u.toString()),this.isInitResized||(this.isInitResized=!0,(s=this.player)===null||s===void 0||s.clock.setTimeout(function(){a.frame.style.visibility="visible"},32))}},t.prototype.setSlideState=function(r){var o,s,a;return zi(this,void 0,void 0,function(){var l,h=this;return Vi(this,function(u){switch(u.label){case 0:return this.isSyncingSlideState=!0,this.logger.info("stateChange receive "+JSON.stringify(r),this.taskId),r.taskId&&r.taskId!==this.__slideState.taskId&&(this.__slideState.taskId=r.taskId,(o=this.player)===null||o===void 0||o.setResourceData(r.taskId,this.__slideState.url)),r.url&&r.url!==this.__slideState.url&&(this.__slideState.url=r.url,(s=this.player)===null||s===void 0||s.setResourceData(this.__slideState.taskId,r.url)),Number.isInteger(r.currentSlideIndex)&&r.currentSlideIndex!==this.__slideState.currentSlideIndex?(this.__slideState.currentSlideIndex=r.currentSlideIndex,[4,this.enqueueRenderSlide(r.currentSlideIndex)]):[3,2];case 1:u.sent(),u.label=2;case 2:return[4,(a=this.player)===null||a===void 0?void 0:a.clock.waitUntil(function(){var p,y;return((p=h.player)===null||p===void 0?void 0:p.currentIndex)===r.currentSlideIndex&&((y=h.player)===null||y===void 0?void 0:y.currentStage)},3e3)];case 3:return u.sent(),l=!1,Number.isInteger(r.mainSeqStep)&&r.mainSeqStep!==this.__slideState.mainSeqStep&&(l=!0,this.__slideState.mainSeqStep=r.mainSeqStep),r.mainSeqState&&r.mainSeqState!==this.__slideState.mainSeqState&&(l=!0,this.__slideState.mainSeqState=r.mainSeqState),l&&this.setMainSeqStep(this.__slideState.mainSeqStep,this.__slideState.mainSeqState==="idle"?"start":"end"),r.interactiveSeqState&&(this.initInteractiveSeq(r),this.__slideState.interactiveSeqState=r.interactiveSeqState),[4,Nh(1500)];case 4:return u.sent(),r.mediaState&&(this.initMedia(r),this.__slideState.mediaState=r.mediaState),this.isSyncingSlideState=!1,[2]}})})},t.prototype.initInteractiveSeq=function(r){var o;for(var s in r.interactiveSeqState){var a=r.interactiveSeqState[s];(o=this.player)===null||o===void 0||o.setInteractiveSeqState(s,a.step,a.state==="idle"?"start":"end")}},t.prototype.initMedia=function(r){var o,s,a;for(var l in r.mediaState){var h=r.mediaState[l],u=this.__slideState.mediaState[l];if((o=this.player)===null||o===void 0||o.syncFullscreenVideoState({targetId:l,state:!!h.fullscreen,slideIndex:this.slideState.currentSlideIndex}),!u||h.type!==u.type||h.time!==u.time)if(h.type==="play"){var p=(this.timestamp()-h.time)/1e3;(s=this.player)===null||s===void 0||s.setMediaState(l,!0,p)}else(a=this.player)===null||a===void 0||a.setMediaState(l,!1,h.time)}},Object.defineProperty(t.prototype,"slideCount",{get:function(){return this._slideCount},enumerable:!1,configurable:!0}),t.prototype.getSizeAsync=function(){return zi(this,void 0,void 0,function(){var r;return Vi(this,function(o){switch(o.label){case 0:if(this.width>0&&this.height>0)return[2,[this.width,this.height]];o.label=1;case 1:return o.trys.push([1,4,,5]),[4,fetch(this.__slideState.url+"/"+this.__slideState.taskId+"/jsonOutput/slide-1.json")];case 2:return[4,o.sent().json()];case 3:return[2,[(r=o.sent()).width,r.height]];case 4:return o.sent(),[2,[0,0]];case 5:return[2]}})})},t.prototype.getSlideCountAsync=function(){return zi(this,void 0,void 0,function(){return Vi(this,function(r){switch(r.label){case 0:if(this._slideCount>0)return[2,this._slideCount];r.label=1;case 1:return r.trys.push([1,4,,5]),[4,fetch(this.__slideState.url+"/"+this.__slideState.taskId+"/jsonOutput/slide-1.json")];case 2:return[4,r.sent().json()];case 3:return[2,r.sent().slideCount];case 4:return r.sent(),[2,0];case 5:return[2]}})})},Object.defineProperty(t.prototype,"slideState",{get:function(){return this.__slideState.mainSeqState=this.mainSeqState,this.__slideState.mainSeqStep=this.mainSeqStep,JSON.parse(JSON.stringify(this.__slideState))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mainSeqLength",{get:function(){var r;return((r=this.player)===null||r===void 0?void 0:r.mainSeqLength())||0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mainSeqStep",{get:function(){var r;return((r=this.player)===null||r===void 0?void 0:r.mainSeqStep())||0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mainSeqState",{get:function(){var r;return((r=this.player)===null||r===void 0?void 0:r.mainSeqState())||null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderOptions",{get:function(){var r;return((r=this.player)===null||r===void 0?void 0:r.config)||null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"drawCall",{get:function(){var r;return((r=this.player)===null||r===void 0?void 0:r.runtime.drawCall)||0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderFps",{get:function(){var r;return((r=this.player)===null||r===void 0?void 0:r.runtime.fps)||0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"runtimeFps",{get:function(){var r;return((r=this.player)===null||r===void 0?void 0:r.fps.value)||0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"view",{get:function(){var r;return((r=this.player)===null||r===void 0?void 0:r.view)||null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.designWidth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.designHeight},enumerable:!1,configurable:!0}),t.prototype.updateRenderOption=function(r){this.player&&(this.player.updateConfig(r),this.renderOptions&&(this.config.renderOptions=this.renderOptions))},t.prototype.setResource=function(r,o){var s;this.taskId=r,(s=this.player)===null||s===void 0||s.setResourceData(r,o),this.__slideState.taskId=r,this.__slideState.url=o,this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"setResource",taskId:r,url:o})},t.prototype.setResourceList=function(r,o){var s;this.taskId=r,this.resourceList=o,(s=this.player)===null||s===void 0||s.setResourceData(r,"__internal__"),this.__slideState.taskId=r,this.__slideState.url="__internal__"},t.prototype._renderSlide=function(r){var o;return zi(this,void 0,void 0,function(){var s=this;return Vi(this,function(a){switch(a.label){case 0:return this.renderingIndex=r,this.player&&r===this.player.currentIndex?[2]:((ur.platform.isIOS()||ur.platform.isAndroid())&&this.iosResetCache.indexOf(r)<0&&this.iosResetCache.push(r),this.flushDebounce(),[4,(o=this.player)===null||o===void 0?void 0:o.renderSlide(r)]);case 1:return a.sent(),this.__slideState.currentSlideIndex=r,this._resizeView(),this.__slideState.interactiveSeqState={},this.__slideState.mediaState={},this.emitStateChange(),setTimeout(function(){var l,h,u,p;l=s.isReleasing,h=s.player,u=s.frame,p=s.cacheImage,!l&&(h==null?void 0:h.view)&&(h.view.style.visibility==="hidden"&&(h.view.style.visibility="visible"),u.style.visibility==="hidden"&&(u.style.visibility="visible"),p.style.display="none")},100),[2]}})})},t.prototype.renderSlide=function(r,o){if(o===void 0&&(o=!0),this.syncCatchUpInputBlocked)this.logger.info("prevent renderSlide while sync event queue is catching up",this.taskId);else if(this.player){var s=Number(r);(s!==this.player.currentIndex||this.renderingTaskManager.hasStartTask())&&(s>this.slideCount&&this.slideCount>0||this.poseRenderSlide(s,o))}},t.prototype.needCreateNewPlayer=function(){var r=t.__stageCountLimit;return r<=0&&(r=ur.platform.isLowGpuMemory()?15:30),(ur.platform.isIOS()||ur.platform.isAndroid())&&this.iosResetCache.length>r},t.prototype.poseRenderSlide=function(r,o){this.mode==="interactive"?this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:r,isForward:o}):this.mode==="sync"?(this.doRenderSlide(r,o),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:r,isForward:o})):this.doRenderSlide(r,o)},t.prototype.doRenderSlide=function(r,o){return o===void 0&&(o=!0),this.syncCatchUpInputBlocked?(this.logger.info("prevent doRenderSlide while sync event queue is catching up",this.taskId),Promise.resolve()):this.enqueueRenderSlide(r,o)},t.prototype.enqueueRenderSlide=function(r,o){var s,a,l,h=this;if(o===void 0&&(o=!0),!this.player)return Promise.resolve();if(this.needCreateNewPlayer()&&(this.iosResetCache=[],this.iosNewPlayer=this.initPlayer(this.config),this.iosNewPlayer.setResourceData(this.__slideState.taskId,this.__slideState.url)),this.iosNewPlayer){var u=this.player.getSnapshot();this.cacheImage.src=u,this.player.destroy(),(s=this.playerController)===null||s===void 0||s.destroy(),this.player=this.iosNewPlayer,this.iosNewPlayer=void 0,!((a=this.config)===null||a===void 0)&&a.controller&&this.createController(),!((l=this==null?void 0:this.player)===null||l===void 0)&&l.view&&(this.player.view.style.visibility="hidden",this.canvasContainer.appendChild(this.player.view))}var p=Math.random().toString(32).substr(2);return this.player.isForward=o,this.renderingTaskManager.addTask(function(){return h._renderSlide(r)},r,p),new Promise(function(y,b){h.renderingTaskManager.eventHub.once("task-end-"+p,y),h.renderingTaskManager.eventHub.once("task-error-"+p,b)})},t.prototype.getSnapshot=function(){var r,o;return(o=(r=this.player)===null||r===void 0?void 0:r.getSnapshot())!==null&&o!==void 0?o:null},t.prototype.nextStep=function(){!this.isLoading&&this.player&&this.interactive&&!this.syncCatchUpInputBlocked?(this.hasNextStep()||this.emit(or.slideStepEnd),this.player.mainSeqHasNextStep()?this.mode==="interactive"?this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"nextStep",next:this.player.mainSeqStep()+1}):this.mode==="sync"?(this.doNextStep(!1,""),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"nextStep",next:this.player.mainSeqStep()})):this.doNextStep(!1,""):this.handleNextSlide()):this.logger.info("prevent nextStep. isLoading: "+this.isLoading+", player: "+!!this.player+", interactive: "+this.interactive+", syncCatchUpInputBlocked: "+this.syncCatchUpInputBlocked,this.taskId)},t.prototype.doNextStep=function(r,o){if(this.player){var s=!this.config.clientId||o===this.config.clientId;this.player.nextStep(r,s);var a=this.player.mainSeqStep();this.__slideState.mainSeqStep=a,this.emitStateChange()}},t.prototype.prevStep=function(){!this.isLoading&&this.player&&this.interactive&&!this.syncCatchUpInputBlocked?(this.hasPrevStep()||this.emit(or.slideStepStart),this.player.mainSeqHasPrevStep()?this.mode==="interactive"?this.emitSyncDispatch({type:"prevStep",slideIndex:this.__slideState.currentSlideIndex,next:this.player.mainSeqStep()-1}):this.mode==="sync"?(this.doPrevStep(),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"prevStep",next:this.player.mainSeqStep()})):this.doPrevStep():this.handlePrevSlide()):this.logger.info("prevent prevStep. isLoading: "+this.isLoading+", player: "+!!this.player+", interactive: "+this.interactive+", syncCatchUpInputBlocked: "+this.syncCatchUpInputBlocked,this.taskId)},t.prototype.doPrevStep=function(r){if(r===void 0&&(r=!1),this.player){this.player.prevStep(r);var o=this.player.mainSeqStep();this.__slideState.mainSeqStep=o,this.emitStateChange()}},t.prototype.isSlideStateReady=function(r){return r.taskId.length>0&&r.url.length>0&&r.currentSlideIndex>0},t.prototype.emitStateChange=function(){if(this.mode!=="local"&&!this.isSyncingSlideState){var r=this.slideState;!KS()(this.lastEmitedState,r)&&this.isSlideStateReady(r)&&(this.lastEmitedState=r,this.emit(or.stateChange,r),this.logger.info("stateChange dispatch "+JSON.stringify(this.slideState),this.taskId))}},t.prototype.emitSyncDispatch=function(r){if(!this.lock.isLocked(r.type)){var o=Math.random().toString(32).substr(2);this.lock.addLock(r.type,o);var s=xs(xs({},r),{uuid:o,clientId:this.config.clientId});this.config.mode==="sync"&&(s.incrId=this.dispatchIncrId),this.emit(or.syncDispatch,s),this.logger.info("sync dispatch "+JSON.stringify(s),this.taskId)}},t.prototype.setMainSeqStep=function(r,o){var s;(s=this.player)===null||s===void 0||s.setMainSeqStep(r,o)},t.prototype.setInteractive=function(r){this.interactive=r,this.updatePlayerInteractive()},t.prototype.setSyncEventQueuePolicy=function(r){var o=vg(this.mode,r);this.syncQueue.setPolicy(o),this.config.syncEventQueuePolicy=o},t.prototype.pause=function(){var r;(r=this.player)===null||r===void 0||r.pause()},t.prototype.resume=function(){var r;(r=this.player)===null||r===void 0||r.resume()},t.prototype._doFrozen=function(r){var o;return zi(this,void 0,void 0,function(){var s,a,l,h=this;return Vi(this,function(u){switch(u.label){case 0:return this.logger.info("do frozen with player["+!!this.player+"]",this.taskId),this.tracker({name:"frozenSlide",reason:"",result:"",payload:{taskId:this.taskId}}),this.view&&this.player?[4,this.player.clock.waitUntil(function(){return!h.isLoading},6e4)]:[3,2];case 1:for(a in u.sent(),s=this.player.getSnapshot()||"",this.cacheImage.src=s,this.cacheImage.style.display="block",this.frame.style.visibility==="hidden"&&(this.frame.style.visibility="visible"),this.player.destroy(),(o=this.playerController)===null||o===void 0||o.destroy(),this.player=void 0,this.__slideState.mediaState)l=this.__slideState.mediaState[a],this.__slideState.mediaState[a]=xs(xs({},l),{frozenTime:this.timestamp()});u.label=2;case 2:return r&&r(),[2]}})})},t.prototype.frozen=function(r){var o=this;this.frozenTaskManager.addTask("frozen",function(){return o._doFrozen(r)})},t.prototype._doRelease=function(r){var o,s;return zi(this,void 0,void 0,function(){var a,l,h,u;return Vi(this,function(p){switch(p.label){case 0:if(this.logger.info("do release slide",this.taskId),this.tracker({name:"releaseSlide",reason:"",result:"",payload:{taskId:this.taskId}}),this.player)return[2];this.isReleasing=!0,p.label=1;case 1:for(l in p.trys.push([1,,4,5]),this.player=this.initPlayer(this.config),!((o=this.config)===null||o===void 0)&&o.controller&&this.createController(),this.player.view&&(this.canvasContainer.appendChild(this.player.view),this.player.view.style.visibility="hidden"),a=this.__slideState,this.__slideState=H0()(yg),a.mediaState)(h=a.mediaState[l]).type==="play"&&(u=Math.max((s=h.frozenTime)!==null&&s!==void 0?s:0,h.time),h.time=this.timestamp()-(u-h.time),h.frozenTime=void 0);return[4,this.setSlideState(a)];case 2:return p.sent(),[4,this.player.clock.delay(333)];case 3:return p.sent(),this.player.view&&(this.player.view.style.visibility="visible"),this.frame.style.visibility==="hidden"&&(this.frame.style.visibility="visible"),this.cacheImage.style.display="none",r&&r(),[3,5];case 4:return this.isReleasing=!1,[7];case 5:return[2]}})})},t.prototype.release=function(r){var o=this;this.frozenTaskManager.addTask("release",function(){return o._doRelease(r)})},t.prototype._doDestroy=function(){var r,o,s,a,l=this;this.logger.info("do destroy slide",this.taskId),this.tracker({name:"destroySlide",reason:"",result:"",payload:{taskId:this.taskId}});var h=t.instances.findIndex(function(u){return u.randomId===l.randomId});if(h>=0&&t.instances.splice(h,1),this.playerController&&this.playerController.destroy(),this.config.disableFrameResizeObserver||this.frameResizeObserver.disconnect(),(r=this.player)===null||r===void 0||r.removeAllListeners(),(o=this.player)===null||o===void 0||o.destroy(),(s=this.player)===null||s===void 0||s.removeAllListeners(),this.logger={warn:function(){return{}},info:function(){return{}},error:function(){return{}}},this.syncQueue.destroy(),this.renderingTaskManager.destroy(),this.frozenTaskManager.destroy(),window.removeEventListener("__slide_ref__",this.handleSlideRef),window.removeEventListener("__slide_updateStageCountLimit",this.updateStageCountLimit),window.removeEventListener("message",this.recoverHandler),this.removeAllListeners(),(a=this.player)===null||a===void 0?void 0:a.view)try{this.anchor.removeChild(this.player.view)}catch{this.logger.error("removeChild error Slide.ts:1982",this.taskId)}try{this.anchor.removeChild(this.frame)}catch{this.logger.error("removeChild error Slide.ts:1988",this.taskId)}t.volumeAdjuster.off("update",this._updateVolumeByStaticAdjuster)},t.prototype.waitLoadEnd=function(){return zi(this,void 0,void 0,function(){var r;return Vi(this,function(o){switch(o.label){case 0:r=0,o.label=1;case 1:return this.isLoading&&r<10?[4,Nh(100)]:[3,3];case 2:return o.sent(),r+=1,[3,1];case 3:return[2]}})})},t.prototype.preload=function(r){return this.player?this.player.preload(r):Promise.resolve()},t.prototype.preloadResource=function(r){return this.player?this.player.preloadResource(r):Promise.resolve()},t.prototype.destroy=function(){var r=this;this.logger.info("pre destroy slide",""),this.isLoading?this.waitLoadEnd().then(function(){r._doDestroy()}):this._doDestroy()},t.prototype.clearSlideCache=function(){var r;(r=this.player)===null||r===void 0||r.clearLocalCache()},t.prototype.hasNextStep=function(){if(!this.player)return!1;var r=this.player.currentIndex===this.slideCount,o=this.mainSeqLength===0||this.mainSeqStep>=this.mainSeqLength-1,s=this.mainSeqState==="end"||this.mainSeqState==="running"||this.mainSeqState==null;return!(r&&o&&s)},t.prototype.hasPrevStep=function(){if(!this.player)return!1;var r=this.player.currentIndex===1,o=this.mainSeqLength===0||this.mainSeqStep===0,s=this.mainSeqState==="idle"||this.mainSeqState===null;return!(r&&o&&s)},t.prototype.snapshot=function(){return zi(this,void 0,void 0,function(){return Vi(this,function(r){return this.player?[2,this.player.getSnapshot()]:[2,null]})})},t.prototype.snapshotWithTimingEnd=function(r){return zi(this,void 0,void 0,function(){return Vi(this,function(o){return this.player?[2,this.player.snapshotWithTimingEnd(r)]:[2,null]})})},t.prototype.updateGlobalVolume=function(r){this.volumeAdjuster.volume=r},t.prototype.getGlobalVolume=function(){return this.volumeAdjuster.volume},t.clearLocalCache=function(){ur.clearLocalCache()},t.disposeLocalCache=function(){},t.prototype.getNoteForCurrentSlide=function(r){return zi(this,void 0,void 0,function(){var o,s;return Vi(this,function(a){switch(a.label){case 0:if(!this.player)return[2,null];if(this.slideNots)return[2,this.slideNots[r]];a.label=1;case 1:return a.trys.push([1,4,,5]),[4,fetch(this.__slideState.url+"/"+this.__slideState.taskId+"/jsonOutput/note.json")];case 2:return[4,a.sent().json()];case 3:return o=a.sent(),this.slideNots=o,[2,o[r]];case 4:return s=a.sent(),this.logger.error("getNotesForCurrentSlide error: "+String(s),this.taskId),[2,null];case 5:return[2]}})})},e=t,t.preloadResource=Bw,t.instances=[],t._tempFrozenIds=[],t._tempLog="",t._tempLogIndex=1,t.remoteLogAddress=null,t.usePlugin=function(r){r.context({logger:{info:function(o){t.appendLogString("INFO - "+new Date().toISOString()+" - "+o+`
8030
8030
  `)},warn:function(o){t.appendLogString("WARN - "+new Date().toISOString()+" - "+o+`
8031
8031
  `)},error:function(o){t.appendLogString("ERROR - "+new Date().toISOString()+" - "+o+`
8032
8032
  `)}}}),function(o){var s=Ec.get(o.hookPoint)||[];s.push(o),Ec.set(o.hookPoint,s)}(r)},t.volumeAdjuster=new U0,t.__stageCountLimit=-1,t.trackLogger=new Lw,t.handleFrozenAllSlide=function(){t.instances.forEach(function(r){r.player&&(t._tempFrozenIds.push(r.randomId),r.frozen())})},t.handleReleaseAllSlide=function(){t._tempFrozenIds.forEach(function(r){var o=t.instances.find(function(s){return s.randomId===r});o&&o.release()}),t._tempFrozenIds=[]},t.handleLogReport=function(r){return zi(void 0,void 0,void 0,function(){var o,s,a,l,h,u;return Vi(e,function(p){switch(p.label){case 0:return[4,t.flushLog(!0)];case 1:if(p.sent(),!fr)return[3,12];o=[],p.label=2;case 2:return p.trys.push([2,4,,5]),[4,fr.keys()];case 3:return o=(p.sent()||[]).sort(function(y,b){return parseInt(y.replace("run_time_log_",""))-parseInt(b.replace("run_time_log_",""))}),[3,5];case 4:return p.sent(),[3,5];case 5:if(o.length===0)return window.postMessage({type:"@slide/_report_log_",log:"",index:1,total:1,customMessage:"@slide/_report_log_",sessionId:r},"*"),[2];s=0,a=o,p.label=6;case 6:if(!(s<a.length))return[3,12];l=a[s],h=l.replace("run_time_log_",""),u="",p.label=7;case 7:return p.trys.push([7,9,,10]),[4,fr.getItem(l)];case 8:return u=p.sent()||"",[3,10];case 9:return p.sent(),[3,10];case 10:window.postMessage({type:"@slide/_report_log_",log:u,index:parseInt(h,10),total:o.length,customMessage:"@slide/_report_log_",sessionId:r},"*"),p.label=11;case 11:return s++,[3,6];case 12:return[2]}})})},t.handleLogDownload=function(){return zi(void 0,void 0,void 0,function(){var r,o,s,a,l,h,u;return Vi(e,function(p){switch(p.label){case 0:return p.trys.push([0,7,,8]),[4,t.flushLog(!0)];case 1:return p.sent(),r="",fr?[4,fr.keys()]:[3,6];case 2:o=(p.sent()||[]).sort(function(y,b){return parseInt(y.replace("run_time_log_",""))-parseInt(b.replace("run_time_log_",""))}),s=0,a=o,p.label=3;case 3:return s<a.length?(l=a[s],h=r,[4,fr.getItem(l)]):[3,6];case 4:r=h+(p.sent()||""),p.label=5;case 5:return s++,[3,3];case 6:return(u=document.createElement("a")).setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(r)),u.setAttribute("download","slide_log"),u.style.display="none",document.body.appendChild(u),u.click(),document.body.removeChild(u),[3,8];case 7:return p.sent(),[3,8];case 8:return[2]}})})},Uw([(n="Slide.initConfig",function(r,o,s){var a=s.value;s.value=function(){for(var l=[],h=0;h<arguments.length;h++)l[h]=arguments[h];for(var u=Ec.get(n)||[],p=l,y=0,b=u;y<b.length;y++){var w=b[y];try{p=w.before(p)}catch{}if(!Array.isArray(p)||p.length!==l.length)throw new Error("plugin before hook return invalid args")}for(var M=a.bind(this).apply(void 0,p),I=0,H=u.reverse();I<H.length;I++){w=H[I];try{M=w.after(M)}catch{}if(!M)throw new Error("plugin after hook return undefined result")}return M}})],t.prototype,"initSlideConfig",null),t}(gi.a);fr==null||fr.clear().catch(function(){}),window.addEventListener("__slide_log__",ro.handleLogDownload),window.addEventListener("message",function(i){var t;if(i.data.type==="@slide/_request_log_")ro.handleLogReport(i.data.sessionId).catch(function(){});else if(i.data.type==="@slide/_request_frozen_")ro.handleFrozenAllSlide();else if(i.data.type==="@slide/_request_release_")ro.handleReleaseAllSlide();else if(i.data.type==="@slide/_update_volume_"){var e=.5;try{e=parseFloat(i.data.volume.toString())}catch{}ro.volumeAdjuster.volume=e}else if(i.data.type==="@slide/_get_volume_")window.postMessage({type:"@slide/_report_volume_",volume:ro.volumeAdjuster.volume,customMessage:"@slide/_report_volume_"},"*");else if(i.data.type==="@slide/_preload_slide_"){var n=(t=i.data.sessionId)!==null&&t!==void 0?t:Math.random().toString(32).substr(2);ro.preloadResource(i.data.taskId,i.data.prefix,i.data.maxResolutionLevel,function(r){window.postMessage({type:"@slide/_preload_slide_progress_",sessionId:n,taskId:i.data.taskId,progress:r},"*")},i.data.pages).catch(function(r){window.postMessage({type:"@slide/_preload_slide_error_",sessionId:n,taskId:i.data.taskId,error:r},"*")})}}),window.setInterval(function(){ro.flushLog().catch(function(){})},2e3)}]),zw="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Vw=87,Ww=20,Rg=[],Xw=()=>{for(let _=0;_<Ww;_++)Rg[_]=zw.charAt(Math.random()*Vw);return Rg.join("")};function Xg(_){try{return _()}catch(T){console.error(T)}}var ua=class{constructor(){this.push=this.addDisposer,this.disposers=new Map}addDisposer(_,T=this.genUID()){return this.flush(T),this.disposers.set(T,Array.isArray(_)?Yw(_):_),T}add(_,T=this.genUID()){const m=_();return m?this.addDisposer(m,T):T}addEventListener(_,T,m,A,E=this.genUID()){return _.addEventListener(T,m,A),this.addDisposer(()=>_.removeEventListener(T,m,A),E),E}setTimeout(_,T,m=this.genUID()){const A=window.setTimeout(()=>{this.remove(m),_()},T);return this.addDisposer(()=>window.clearTimeout(A),m)}setInterval(_,T,m=this.genUID()){const A=window.setInterval(_,T);return this.addDisposer(()=>window.clearInterval(A),m)}remove(_){const T=this.disposers.get(_);return this.disposers.delete(_),T}flush(_){const T=this.remove(_);T&&T()}flushAll(){this.disposers.forEach(Xg),this.disposers.clear()}genUID(){let _;do _=Xw();while(this.disposers.has(_));return _}};function Yw(_){return()=>_.forEach(Xg)}function Yg(_,T,m){return Math.min(Math.max(_,T),m)}function qw(_){return typeof _=="object"&&_!==null}function Jw(_){if(!_)return!1;const T=_.tagName;return T==="INPUT"||T==="TEXTAREA"||T==="SELECT"}var qg={exports:{}},Kw={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Jg={exports:{}},Zw=function(T){return!T||typeof T=="string"?!1:T instanceof Array||Array.isArray(T)||T.length>=0&&(T.splice instanceof Function||Object.getOwnPropertyDescriptor(T,T.length-1)&&T.constructor.name!=="String")},$w=Zw,Qw=Array.prototype.concat,tE=Array.prototype.slice,Ig=Jg.exports=function(T){for(var m=[],A=0,E=T.length;A<E;A++){var P=T[A];$w(P)?m=Qw.call(m,tE.call(P)):m.push(P)}return m};Ig.wrap=function(_){return function(){return _(Ig(arguments))}};var sl=Kw,ul=Jg.exports,Kg=Object.hasOwnProperty,Zg=Object.create(null);for(var Xc in sl)Kg.call(sl,Xc)&&(Zg[sl[Xc]]=Xc);var Ar=qg.exports={to:{},get:{}};Ar.get=function(_){var T=_.substring(0,3).toLowerCase(),m,A;switch(T){case"hsl":m=Ar.get.hsl(_),A="hsl";break;case"hwb":m=Ar.get.hwb(_),A="hwb";break;default:m=Ar.get.rgb(_),A="rgb";break}return m?{model:A,value:m}:null};Ar.get.rgb=function(_){if(!_)return null;var T=/^#([a-f0-9]{3,4})$/i,m=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,A=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,E=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,P=/^(\w+)$/,D=[0,0,0,1],B,z,X;if(B=_.match(m)){for(X=B[2],B=B[1],z=0;z<3;z++){var Z=z*2;D[z]=parseInt(B.slice(Z,Z+2),16)}X&&(D[3]=parseInt(X,16)/255)}else if(B=_.match(T)){for(B=B[1],X=B[3],z=0;z<3;z++)D[z]=parseInt(B[z]+B[z],16);X&&(D[3]=parseInt(X+X,16)/255)}else if(B=_.match(A)){for(z=0;z<3;z++)D[z]=parseInt(B[z+1],0);B[4]&&(B[5]?D[3]=parseFloat(B[4])*.01:D[3]=parseFloat(B[4]))}else if(B=_.match(E)){for(z=0;z<3;z++)D[z]=Math.round(parseFloat(B[z+1])*2.55);B[4]&&(B[5]?D[3]=parseFloat(B[4])*.01:D[3]=parseFloat(B[4]))}else return(B=_.match(P))?B[1]==="transparent"?[0,0,0,0]:Kg.call(sl,B[1])?(D=sl[B[1]],D[3]=1,D):null:null;for(z=0;z<3;z++)D[z]=Ko(D[z],0,255);return D[3]=Ko(D[3],0,1),D};Ar.get.hsl=function(_){if(!_)return null;var T=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,m=_.match(T);if(m){var A=parseFloat(m[4]),E=(parseFloat(m[1])%360+360)%360,P=Ko(parseFloat(m[2]),0,100),D=Ko(parseFloat(m[3]),0,100),B=Ko(isNaN(A)?1:A,0,1);return[E,P,D,B]}return null};Ar.get.hwb=function(_){if(!_)return null;var T=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,m=_.match(T);if(m){var A=parseFloat(m[4]),E=(parseFloat(m[1])%360+360)%360,P=Ko(parseFloat(m[2]),0,100),D=Ko(parseFloat(m[3]),0,100),B=Ko(isNaN(A)?1:A,0,1);return[E,P,D,B]}return null};Ar.to.hex=function(){var _=ul(arguments);return"#"+Dh(_[0])+Dh(_[1])+Dh(_[2])+(_[3]<1?Dh(Math.round(_[3]*255)):"")};Ar.to.rgb=function(){var _=ul(arguments);return _.length<4||_[3]===1?"rgb("+Math.round(_[0])+", "+Math.round(_[1])+", "+Math.round(_[2])+")":"rgba("+Math.round(_[0])+", "+Math.round(_[1])+", "+Math.round(_[2])+", "+_[3]+")"};Ar.to.rgb.percent=function(){var _=ul(arguments),T=Math.round(_[0]/255*100),m=Math.round(_[1]/255*100),A=Math.round(_[2]/255*100);return _.length<4||_[3]===1?"rgb("+T+"%, "+m+"%, "+A+"%)":"rgba("+T+"%, "+m+"%, "+A+"%, "+_[3]+")"};Ar.to.hsl=function(){var _=ul(arguments);return _.length<4||_[3]===1?"hsl("+_[0]+", "+_[1]+"%, "+_[2]+"%)":"hsla("+_[0]+", "+_[1]+"%, "+_[2]+"%, "+_[3]+")"};Ar.to.hwb=function(){var _=ul(arguments),T="";return _.length>=4&&_[3]!==1&&(T=", "+_[3]),"hwb("+_[0]+", "+_[1]+"%, "+_[2]+"%"+T+")"};Ar.to.keyword=function(_){return Zg[_.slice(0,3)]};function Ko(_,T,m){return Math.min(Math.max(T,_),m)}function Dh(_){var T=Math.round(_).toString(16).toUpperCase();return T.length<2?"0"+T:T}var eE=qg.exports;class nE{constructor(T){this.enable=T,this.apps={},this.level="debug",this.roomLogger=null,this._onMessage=m=>{let A;m instanceof CustomEvent?A=m.detail:qw(m.data)&&(A=m.data),A&&(typeof A.slide=="boolean"?this.enable=A.slide:A.slide==="__instance"?console.log(this):A.slide==="__debug"&&Object.values(this.apps).forEach(E=>{var P,D;(D=(P=E.controller)==null?void 0:P.slide)==null||D.createController()}))},this.initialize()}setAppContext(T,m){var A;((A=this.apps)[T]||(A[T]={})).context=m,this.log(`[Slide] new ${T}`)}setAppController(T,m){var A;((A=this.apps)[T]||(A[T]={})).controller=m}deleteApp(T){delete this.apps[T],this.log(`[Slide] delete ${T}`)}initialize(){window.addEventListener("message",this._onMessage)}dispose(){window.removeEventListener("message",this._onMessage)}log(...T){this.roomLogger?this.roomLogger.info(...T):this.enable&&console.log(...T)}verbose(...T){this.roomLogger?this.roomLogger.debug(...T):this.enable&&this.level==="verbose"&&console.log(...T)}warn(...T){this.roomLogger?this.roomLogger.warn(...T):console.warn(...T)}}const Dr=new nE(!1),li=Dr.log.bind(Dr),Yc=Dr.verbose.bind(Dr),iE=_=>{Dr.roomLogger=_.logger};function $g(_){try{const T=window.getComputedStyle(_).backgroundColor;if(T!=="rgba(0, 0, 0, 0)"&&T!=="transparent")return T;if(_.parentElement)return $g(_.parentElement)}catch{}return"#ffffff"}function rE(_){const T=eE.get(_);if(T&&T.model==="rgb"){const m=T.value,E=(((Math.round(m[0])&255)<<16)+((Math.round(m[1])&255)<<8)+(Math.round(m[2])&255)).toString(16);return"#"+"000000".substring(E.length)+E}else return _}let Fh="";function Qg(_){return Fh||(Fh=rE($g(_)),li("[Slide] guess bg color",Fh)),Fh}const oE=_=>_.tracker;function tv(_,T=[]){const{width:m,height:A,slideCount:E,slideState:P}=_,{taskId:D,url:B}=P,z=[];for(let X=1;X<=E;++X){const Z=T.find(nt=>nt.indexOf(`preview/${X}.png`)>=0);Z?z.push({width:m,height:A,thumbnail:Z,src:"ppt"}):z.push({width:m,height:A,thumbnail:`${B}/${D}/preview/${X}.png`,src:"ppt"})}return z}function $c(_,T,m,A){var B;const E=m.slideState.currentSlideIndex;if(!(E>0)||!T.getIsWritable())return;const P=[A,E].join("/");if(T.isAddApp&&_.scenePathType(P)!=="page"){_.removeScenes(A);const z=m.slideCount,X=[];for(let Z=1;Z<=z;++Z)X.push({name:`${Z}`});_.putScenes(A,X)}let D;T.getBox().focus?D=_.state.sceneState.scenePath:D=((B=T.getView())==null?void 0:B.focusScenePath)||"",D!==P&&_.scenePathType(P)==="page"&&T.setScenePath(P)}const od="https://convertcdn.netless.link/dynamicConvert",sE=40,Qc={taskId:"",url:"",state:null,resourceList:[],previewList:[],customLinks:[],slideScale:1,translateX:.5,translateY:.5},aE=function(){};class ev{constructor(T){this.sideEffect=new ua,this.previewList=[],this.ready=!1,this.readyPromise=new Promise(at=>{this.resolveReady=Tt=>{this.ready?li("[Slide] render end",Tt):setTimeout(()=>{this.ready=!0,at()},1e3)}}),this.onSyncDispatch=at=>{if(this.context.getIsWritable()&&this.room){const Tt={type:ci.SLIDE_EVENTS.syncDispatch,payload:at};Yc("[Slide] dispatch",JSON.stringify(at)),this.context.dispatchMagixEvent(ci.SLIDE_EVENTS.syncDispatch,Tt)}},this.magixEventListener=at=>{const{type:Tt,payload:bt}=at.payload;Tt===ci.SLIDE_EVENTS.syncDispatch&&(this.syncStateOnce(),Yc("[Slide] receive",JSON.stringify(bt)),this.slide.emit(ci.SLIDE_EVENTS.syncReceive,bt))},this.onStateChange=at=>{this.context.getIsWritable()&&(Yc("[Slide] state change",JSON.stringify(at,null,2)),this.context.storage.setState({state:at}))},this.pollCount=0,this.pollReadyState=()=>{this.ready?this._toFreeze===1?this.freeze():this._toFreeze===-1&&this.unfreeze():this.pollCount<sE?(this.pollCount++,setTimeout(this.pollReadyState,500)):(this.pollCount=0,li("[Slide] init timeout"))},this._pageCount=0,this.destroyed=!1,this.timestamp=()=>this.room&&this.room.calibrationTimestamp?this.room.calibrationTimestamp:this.player?this.player.beginTimestamp+this.player.progressTime:Date.now(),this.isFrozen=!1,this._toFreeze=0,this.freeze=()=>{this.isFrozen=!0,this.ready?(li("[Slide] freeze",this.context.appId),this.invisibleBehavior==="frozen"?this.slide.frozen():this.slide.pause()):this._toFreeze=1},this.unfreeze=async()=>{if(!!this.visible)if(this.isFrozen=!1,this.ready){let at=!1;if(li("[Slide] unfreeze",this.context.appId),this.invisibleBehavior==="frozen"?(this.slide.release(),at=!0):this.slide.resume(),at){const Tt=this.context.storage.state.state;Tt&&(li("[Slide] sync storage",JSON.stringify(Tt)),this.slide.setSlideState(Tt))}}else this._toFreeze=-1},this.bindAppStateChangeEvent=()=>{try{if(this.context.getBoxStatus())this.context.getAppProxy()&&this.context.emitter.on("boxStatusChange",this.onAppStatusChangeHandler);else{const Tt=this.context.getWindowManager();Tt&&Tt.emitter.on("boxStateChange",this.onAppStateChangeHandler)}}catch{li("[Slide] bind app state change event failed, because should update window manager to latest version")}},this.onAppStateChangeHandler=at=>{at==="minimized"&&(li("[Slide] freeze because app state is minimized"),this.freeze())},this.onAppStatusChangeHandler=at=>{const{appId:Tt,status:bt}=at;Tt===this.context.appId&&bt==="minimized"&&(li("[Slide] freeze because app status is minimized"),this.freeze())},this.getAppStatus=()=>{try{const at=this.context.getBoxStatus();return at||this.context.getWindowManager().boxState}catch{return}},this.onVisibilityChange=async()=>{if(this.getAppStatus()==="minimized"){li("[Slide] do nothing because app state is minimized");return}(this.visible=document.visibilityState==="visible")?this.savedIsFrozen||(li("[Slide] unfreeze because tab becomes visible",{savedIsFrozen:this.savedIsFrozen}),this.unfreeze()):(this.savedIsFrozen=this.isFrozen,li("[Slide] freeze because tab becomes invisible"),this.freeze())};const{context:m,onRenderStart:A,onPageChanged:E,onTransitionStart:P,onTransitionEnd:D,onNavigate:B,onError:z,onRenderError:X,showRenderError:Z,invisibleBehavior:nt}=T;this.invisibleBehavior=nt!=null?nt:"frozen",this.onRenderStart=A,this.onPageChanged=E,this.onTransitionStart=P,this.onTransitionEnd=D,this.onNavigate=B||aE,this.onError=z,this.onRenderError=X,this.showRenderError=Z!=null?Z:!0,this.context=m,this.room=m.getRoom(),this.player=this.room?void 0:m.getDisplayer(),iE(this.room||this.player),this.syncStateOnceFlag=!this.context.isAddApp,this.visible=document.visibilityState==="visible",this.savedIsFrozen=!1}jumpToPage(T,m){this.ready&&(T=Yg(T,1,this.pageCount),this.onNavigate(T,m),this.slide.renderSlide(T))}initialize(){this.registerEventListeners(),this.kickStart()}kickStart(){const{context:T,slide:m}=this;T.getIsWritable()&&T.storage.ensureState(Qc);const{taskId:A,url:E,resourceList:P,previewList:D,state:B}=T.storage.state;this.previewList=D,P&&P.length>0?m.setResourceList(A,P):m.setResource(A,E||od),B?(li("[Slide] init with state",JSON.stringify(B)),this.syncStateOnceFlag=!1,m.setSlideState(B)):T.isAddApp&&(li("[Slide] init by renderSlide",1),m.renderSlide(1)),this.pollReadyState()}registerEventListeners(){const{context:T,slide:m}=this,A=this.sideEffect.addDisposer(T.storage.addStateChangedListener(()=>{T.storage.state.state&&(this.syncStateOnce(),this.sideEffect.flush(A))}));this.sideEffect.add(()=>T.addMagixEventListener(ci.SLIDE_EVENTS.syncDispatch,this.magixEventListener,{fireSelfEventAfterCommit:!0})),m.on(ci.SLIDE_EVENTS.renderStart,this.onRenderStart),m.on(ci.SLIDE_EVENTS.slideChange,this.onPageChanged),m.on(ci.SLIDE_EVENTS.renderEnd,this.onTransitionEnd),m.on(ci.SLIDE_EVENTS.mainSeqStepStart,this.onTransitionStart),m.on(ci.SLIDE_EVENTS.mainSeqStepEnd,this.onTransitionEnd),m.on(ci.SLIDE_EVENTS.renderError,this.onError),m.on(ci.SLIDE_EVENTS.stateChange,this.onStateChange),m.on(ci.SLIDE_EVENTS.syncDispatch,this.onSyncDispatch),m.on(ci.SLIDE_EVENTS.renderEnd,this.resolveReady),this.sideEffect.add(()=>(document.addEventListener("visibilitychange",this.onVisibilityChange),this.bindAppStateChangeEvent(),()=>{document.removeEventListener("visibilitychange",this.onVisibilityChange);try{this.context.emitter.off("boxStatusChange",this.onAppStatusChangeHandler),this.context.getWindowManager().emitter.off("boxStateChange",this.onAppStateChangeHandler)}catch{li("[Slide] unbind app state change event failed, because should update window manager to latest version")}}))}syncStateOnce(){if(this.syncStateOnceFlag){this.context.getIsWritable()&&this.context.storage.ensureState(Qc);const{state:T}=this.context.storage.state;T&&(li("[Slide] sync with state (once)",JSON.stringify(T)),this.slide.setSlideState(T),this.syncStateOnceFlag=!1)}}get pageCount(){return this._pageCount>0?this._pageCount:(this._pageCount=this.slide.slideCount,this._pageCount)}get page(){return this.slide.slideState.currentSlideIndex}createSlide(T,m={}){var D,B,z,X,Z;const A=this.context.getAppOptions()||{},E=this.context.storage.state;return new ci.Slide({anchor:T,interactive:!0,mode:"interactive",syncEventQueuePolicy:(D=A.syncEventQueuePolicy)!=null?D:"fifo",controller:!1,enableGlobalClick:(B=A.enableGlobalClick)!=null?B:!0,renderOptions:{minFPS:A.minFPS||25,maxFPS:A.maxFPS||30,autoFPS:(z=A.autoFPS)!=null?z:!0,autoResolution:(X=A.autoResolution)!=null?X:!0,resolution:A.resolution,transactionBgColor:A.bgColor||Qg(T),maxResolutionLevel:A.maxResolutionLevel,forceCanvas:A.forceCanvas,enableNvidiaDetect:A.enableNvidiaDetect},fixedFrameSize:A.fixedFrameSize,loaderDelegate:A.loaderDelegate,navigatorDelegate:A.navigatorDelegate,urlInterrupter:A.urlInterrupter,resourceTimeout:A.resourceTimeout,rtcAudio:A.rtcAudio,useLocalCache:A.useLocalCache,logger:A.logger,whiteTracker:m.whiteTracker,timestamp:this.timestamp,customLinks:E.customLinks,skipActionWhenFrozen:(Z=A.skipActionWhenFrozen)!=null?Z:!0,resourceMaxRetries:A.resourceMaxRetries,onResourceMaxRetries:A.onResourceMaxRetries,disableFrameResizeObserver:!0})}destroy(){this.sideEffect.flushAll(),this.destroyed||(li("[Slide] destroy slide (once)"),this.slide.destroy(),this.destroyed=!0)}}class nv extends ev{constructor(T){super(T),this.slide=this.createSlide(T.anchor,{whiteTracker:oE(T.context.getDisplayer())}),this.initialize()}}function lE(_){const T="http://www.w3.org/2000/svg",m=document.createElementNS(T,"svg");m.setAttribute("class",`${_}-footer-icon-sidebar`),m.setAttribute("viewBox","0 0 64 64");const A=document.createElementNS(T,"path");return A.setAttribute("fill","currentColor"),A.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"),m.appendChild(A),m}function hE(_){const T="http://www.w3.org/2000/svg",m=document.createElementNS(T,"svg");m.setAttribute("class",`${_}-footer-icon-arrow-left`),m.setAttribute("viewBox","0 0 500 500");const A=document.createElementNS(T,"path");return A.setAttribute("fill","currentColor"),A.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"),m.appendChild(A),m}function uE(_){const T="http://www.w3.org/2000/svg",m=document.createElementNS(T,"svg");m.setAttribute("class",`${_}-footer-icon-arrow-right`),m.setAttribute("viewBox","0 0 500 500");const A=document.createElementNS(T,"path");return A.setAttribute("fill","currentColor"),A.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"),m.appendChild(A),m}function cE(_){const T="http://www.w3.org/2000/svg",m=document.createElementNS(T,"svg");m.setAttribute("class",`${_}-footer-icon-play`),m.setAttribute("viewBox","0 0 500 500");const A=document.createElementNS(T,"path");return A.setAttribute("fill","currentColor"),A.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"),m.appendChild(A),m}function dE(_){const T="http://www.w3.org/2000/svg",m=document.createElementNS(T,"svg");m.setAttribute("class",`${_}-footer-icon-pause`),m.setAttribute("viewBox","0 0 500 500");const A=document.createElementNS(T,"path");return A.setAttribute("fill","currentColor"),A.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"),m.appendChild(A),m}const $o=typeof window!="undefined",iv=$o&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),rv=$o&&"IntersectionObserver"in window,ov=$o&&"classList"in document.createElement("p"),sv=$o&&window.devicePixelRatio>1,pE={elements_selector:".lazy",container:iv||$o?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},av=_=>Object.assign({},pE,_),Pg=function(_,T){let m;const A="LazyLoad::Initialized",E=new _(T);try{m=new CustomEvent(A,{detail:{instance:E}})}catch{m=document.createEvent("CustomEvent"),m.initCustomEvent(A,!1,!1,{instance:E})}window.dispatchEvent(m)},fE=(_,T)=>{if(!!T)if(!T.length)Pg(_,T);else for(let m=0,A;A=T[m];m+=1)Pg(_,A)},xo="src",sd="srcset",ad="sizes",lv="poster",cl="llOriginalAttrs",hv="data",ld="loading",uv="loaded",cv="applied",mE="entered",hd="error",dv="native",pv="data-",fv="ll-status",vr=(_,T)=>_.getAttribute(pv+T),gE=(_,T,m)=>{const A=pv+T;if(m===null){_.removeAttribute(A);return}_.setAttribute(A,m)},dl=_=>vr(_,fv),Es=(_,T)=>gE(_,fv,T),zh=_=>Es(_,null),ud=_=>dl(_)===null,vE=_=>dl(_)===ld,yE=_=>dl(_)===hd,cd=_=>dl(_)===dv,_E=[ld,uv,cv,hd],xE=_=>_E.indexOf(dl(_))>=0,Qo=(_,T,m,A)=>{if(!(!_||typeof _!="function")){if(A!==void 0){_(T,m,A);return}if(m!==void 0){_(T,m);return}_(T)}},ca=(_,T)=>{if(T!==""){if(ov){_.classList.add(T);return}_.className+=(_.className?" ":"")+T}},ao=(_,T)=>{if(T!==""){if(ov){_.classList.remove(T);return}_.className=_.className.replace(new RegExp("(^|\\s+)"+T+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")}},bE=_=>{_.llTempImage=document.createElement("IMG")},TE=_=>{delete _.llTempImage},mv=_=>_.llTempImage,Vh=(_,T)=>{if(!T)return;const m=T._observer;!m||m.unobserve(_)},SE=_=>{_.disconnect()},wE=(_,T,m)=>{T.unobserve_entered&&Vh(_,m)},dd=(_,T)=>{!_||(_.loadingCount+=T)},EE=_=>{!_||(_.toLoadCount-=1)},gv=(_,T)=>{!_||(_.toLoadCount=T)},AE=_=>_.loadingCount>0,CE=_=>_.toLoadCount>0,vv=_=>{let T=[];for(let m=0,A;A=_.children[m];m+=1)A.tagName==="SOURCE"&&T.push(A);return T},pd=(_,T)=>{const m=_.parentNode;if(!m||m.tagName!=="PICTURE")return;vv(m).forEach(T)},yv=(_,T)=>{vv(_).forEach(T)},Wh=[xo],_v=[xo,lv],ll=[xo,sd,ad],xv=[hv],Xh=_=>!!_[cl],bv=_=>_[cl],Tv=_=>delete _[cl],ha=(_,T)=>{if(Xh(_))return;const m={};T.forEach(A=>{m[A]=_.getAttribute(A)}),_[cl]=m},ME=_=>{Xh(_)||(_[cl]={backgroundImage:_.style.backgroundImage})},RE=(_,T,m)=>{if(!m){_.removeAttribute(T);return}_.setAttribute(T,m)},ws=(_,T)=>{if(!Xh(_))return;const m=bv(_);T.forEach(A=>{RE(_,A,m[A])})},IE=_=>{if(!Xh(_))return;const T=bv(_);_.style.backgroundImage=T.backgroundImage},Sv=(_,T,m)=>{ca(_,T.class_applied),Es(_,cv),m&&(T.unobserve_completed&&Vh(_,T),Qo(T.callback_applied,_,m))},wv=(_,T,m)=>{ca(_,T.class_loading),Es(_,ld),m&&(dd(m,1),Qo(T.callback_loading,_,m))},Zo=(_,T,m)=>{!m||_.setAttribute(T,m)},Og=(_,T)=>{Zo(_,ad,vr(_,T.data_sizes)),Zo(_,sd,vr(_,T.data_srcset)),Zo(_,xo,vr(_,T.data_src))},PE=(_,T)=>{pd(_,m=>{ha(m,ll),Og(m,T)}),ha(_,ll),Og(_,T)},OE=(_,T)=>{ha(_,Wh),Zo(_,xo,vr(_,T.data_src))},NE=(_,T)=>{yv(_,m=>{ha(m,Wh),Zo(m,xo,vr(m,T.data_src))}),ha(_,_v),Zo(_,lv,vr(_,T.data_poster)),Zo(_,xo,vr(_,T.data_src)),_.load()},LE=(_,T)=>{ha(_,xv),Zo(_,hv,vr(_,T.data_src))},DE=(_,T,m)=>{const A=vr(_,T.data_bg),E=vr(_,T.data_bg_hidpi),P=sv&&E?E:A;!P||(_.style.backgroundImage=`url("${P}")`,mv(_).setAttribute(xo,P),wv(_,T,m))},FE=(_,T,m)=>{const A=vr(_,T.data_bg_multi),E=vr(_,T.data_bg_multi_hidpi),P=sv&&E?E:A;!P||(_.style.backgroundImage=P,Sv(_,T,m))},BE=(_,T,m)=>{const A=vr(_,T.data_bg_set);if(!A)return;const E=A.split("|");let P=E.map(D=>`image-set(${D})`);_.style.backgroundImage=P.join(),_.style.backgroundImage===""&&(P=E.map(D=>`-webkit-image-set(${D})`),_.style.backgroundImage=P.join()),Sv(_,T,m)},Ev={IMG:PE,IFRAME:OE,VIDEO:NE,OBJECT:LE},kE=(_,T)=>{const m=Ev[_.tagName];!m||m(_,T)},UE=(_,T,m)=>{const A=Ev[_.tagName];!A||(A(_,T),wv(_,T,m))},GE=["IMG","IFRAME","VIDEO","OBJECT"],HE=_=>GE.indexOf(_.tagName)>-1,Av=(_,T)=>{T&&!AE(T)&&!CE(T)&&Qo(_.callback_finish,T)},Ng=(_,T,m)=>{_.addEventListener(T,m),_.llEvLisnrs[T]=m},jE=(_,T,m)=>{_.removeEventListener(T,m)},fd=_=>!!_.llEvLisnrs,zE=(_,T,m)=>{fd(_)||(_.llEvLisnrs={});const A=_.tagName==="VIDEO"?"loadeddata":"load";Ng(_,A,T),Ng(_,"error",m)},td=_=>{if(!fd(_))return;const T=_.llEvLisnrs;for(let m in T){const A=T[m];jE(_,m,A)}delete _.llEvLisnrs},Cv=(_,T,m)=>{TE(_),dd(m,-1),EE(m),ao(_,T.class_loading),T.unobserve_completed&&Vh(_,m)},VE=(_,T,m,A)=>{const E=cd(T);Cv(T,m,A),ca(T,m.class_loaded),Es(T,uv),Qo(m.callback_loaded,T,A),E||Av(m,A)},WE=(_,T,m,A)=>{const E=cd(T);Cv(T,m,A),ca(T,m.class_error),Es(T,hd),Qo(m.callback_error,T,A),m.restore_on_error&&ws(T,ll),E||Av(m,A)},md=(_,T,m)=>{const A=mv(_)||_;if(fd(A))return;zE(A,D=>{VE(D,_,T,m),td(A)},D=>{WE(D,_,T,m),td(A)})},XE=(_,T,m)=>{bE(_),md(_,T,m),ME(_),DE(_,T,m),FE(_,T,m),BE(_,T,m)},YE=(_,T,m)=>{md(_,T,m),UE(_,T,m)},gd=(_,T,m)=>{HE(_)?YE(_,T,m):XE(_,T,m)},qE=(_,T,m)=>{_.setAttribute("loading","lazy"),md(_,T,m),kE(_,T),Es(_,dv)},Lg=_=>{_.removeAttribute(xo),_.removeAttribute(sd),_.removeAttribute(ad)},JE=_=>{pd(_,T=>{Lg(T)}),Lg(_)},Mv=_=>{pd(_,T=>{ws(T,ll)}),ws(_,ll)},KE=_=>{yv(_,T=>{ws(T,Wh)}),ws(_,_v),_.load()},ZE=_=>{ws(_,Wh)},$E=_=>{ws(_,xv)},QE={IMG:Mv,IFRAME:ZE,VIDEO:KE,OBJECT:$E},t2=_=>{const T=QE[_.tagName];if(!T){IE(_);return}T(_)},e2=(_,T)=>{ud(_)||cd(_)||(ao(_,T.class_entered),ao(_,T.class_exited),ao(_,T.class_applied),ao(_,T.class_loading),ao(_,T.class_loaded),ao(_,T.class_error))},n2=(_,T)=>{t2(_),e2(_,T),zh(_),Tv(_)},i2=(_,T,m,A)=>{!m.cancel_on_exit||!vE(_)||_.tagName==="IMG"&&(td(_),JE(_),Mv(_),ao(_,m.class_loading),dd(A,-1),zh(_),Qo(m.callback_cancel,_,T,A))},r2=(_,T,m,A)=>{const E=xE(_);Es(_,mE),ca(_,m.class_entered),ao(_,m.class_exited),wE(_,m,A),Qo(m.callback_enter,_,T,A),!E&&gd(_,m,A)},o2=(_,T,m,A)=>{ud(_)||(ca(_,m.class_exited),i2(_,T,m,A),Qo(m.callback_exit,_,T,A))},s2=["IMG","IFRAME","VIDEO"],Rv=_=>_.use_native&&"loading"in HTMLImageElement.prototype,a2=(_,T,m)=>{_.forEach(A=>{s2.indexOf(A.tagName)!==-1&&qE(A,T,m)}),gv(m,0)},l2=_=>_.isIntersecting||_.intersectionRatio>0,h2=_=>({root:_.container===document?null:_.container,rootMargin:_.thresholds||_.threshold+"px"}),u2=(_,T,m)=>{_.forEach(A=>l2(A)?r2(A.target,A,T,m):o2(A.target,A,T,m))},c2=(_,T)=>{T.forEach(m=>{_.observe(m)})},d2=(_,T)=>{SE(_),c2(_,T)},p2=(_,T)=>{!rv||Rv(_)||(T._observer=new IntersectionObserver(m=>{u2(m,_,T)},h2(_)))},Iv=_=>Array.prototype.slice.call(_),Hh=_=>_.container.querySelectorAll(_.elements_selector),f2=_=>Iv(_).filter(ud),m2=_=>yE(_),g2=_=>Iv(_).filter(m2),Dg=(_,T)=>f2(_||Hh(T)),v2=(_,T)=>{g2(Hh(_)).forEach(A=>{ao(A,_.class_error),zh(A)}),T.update()},y2=(_,T)=>{!$o||(T._onlineHandler=()=>{v2(_,T)},window.addEventListener("online",T._onlineHandler))},_2=_=>{!$o||window.removeEventListener("online",_._onlineHandler)},pl=function(_,T){const m=av(_);this._settings=m,this.loadingCount=0,p2(m,this),y2(m,this),this.update(T)};pl.prototype={update:function(_){const T=this._settings,m=Dg(_,T);if(gv(this,m.length),iv||!rv){this.loadAll(m);return}if(Rv(T)){a2(m,T,this);return}d2(this._observer,m)},destroy:function(){this._observer&&this._observer.disconnect(),_2(this),Hh(this._settings).forEach(_=>{Tv(_)}),delete this._observer,delete this._settings,delete this._onlineHandler,delete this.loadingCount,delete this.toLoadCount},loadAll:function(_){const T=this._settings;Dg(_,T).forEach(A=>{Vh(A,this),gd(A,T,this)})},restoreAll:function(){const _=this._settings;Hh(_).forEach(T=>{n2(T,_)})}};pl.load=(_,T)=>{const m=av(T);gd(_,m)};pl.resetStatus=_=>{zh(_)};$o&&fE(pl,window.lazyLoadOptions);class vd{constructor({readonly:T,onNewPageIndex:m,onPlay:A,onPagesReady:E,urlInterrupter:P}){this._pages=[],this.pageIndex=0,this.setPaused=()=>{this.$btnPlay.classList.toggle(this.wrapClassName("footer-btn-playing"),!1)},this.setPlaying=()=>{this.$btnPlay.classList.toggle(this.wrapClassName("footer-btn-playing"),!0)},this.namespace="netless-app-slide",this.isShowPreview=!1,this.isSmallBox=!1,this.sideEffect=new ua,this.readonly=T,this.onNewPageIndex=m,this.onPlay=A,this.onPagesReady=E,this.urlInterrupter=P||(D=>D),this.render()}set pages(T){this._pages=T,this.refreshPreview().then(this.refreshBtnSidebar.bind(this)),this.refreshTotalPage(),this.onPagesReady&&this.onPagesReady(T)}get pages(){return this._pages}unmount(){this.$content.remove(),this.$footer.remove()}setReadonly(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(){var T;(T=this.previewLazyLoad)==null||T.destroy(),this.sideEffect.flushAll(),this.unmount()}setPageIndex(T){Number.isNaN(T)||(this.pageIndex=T,this.$pageNumberInput.value=String(T+1))}refreshTotalPage(){this.pages.length?this.$totalPage.textContent=" / "+this.pages.length:this.$totalPage.textContent=""}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,this.refreshPreview(),this.sideEffect.addEventListener(T,"click",m=>{var E;if(this.readonly)return;const A=(E=m.target.dataset)==null?void 0:E.pageIndex;A&&(m.preventDefault(),m.stopPropagation(),m.stopImmediatePropagation(),this.onNewPageIndex(Number(A),"preview"),this.togglePreview(!1))})}return this.$preview}async refreshPreview(){var P,D;const{$preview:T}=this,m=this.wrapClassName("preview-page"),A=this.wrapClassName("preview-page-name");for(;T.firstChild;)T.firstChild.remove();const E=[];for(let B=0,z=this.pages.length;B<z;B++){const X=this.pages[B],Z=(P=X.thumbnail)!=null?P:X.src.startsWith("ppt")?void 0:X.src;Z&&(E[B]=this.urlInterrupter(Z))}for(let B=0,z=this.pages.length;B<z;B++)E[B]=await E[B];this.pages.forEach((B,z)=>{const X=E[z];if(!X)return;const Z=String(z),nt=document.createElement("a");nt.className=m+" "+this.wrapClassName(`preview-page-${z}`),nt.setAttribute("href","#"),nt.dataset.pageIndex=Z;const at=document.createElement("span");at.className=A,at.textContent=String(z+1),at.dataset.pageIndex=Z;const Tt=document.createElement("img");Tt.width=B.width,Tt.height=B.height,Tt.dataset.src=X,Tt.dataset.pageIndex=Z,nt.appendChild(Tt),nt.appendChild(at),T.appendChild(nt)}),(D=this.previewLazyLoad)==null||D.update()}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}refreshBtnSidebar(){this.$btnSidebar.style.display=this.pages.length>0?"":"none"}renderFooter(){if(!this.$footer){const T=document.createElement("div");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"));const m=this.renderFooterBtn("btn-sidebar",lE(this.namespace));this.sideEffect.addEventListener(m,"click",()=>{this.readonly||this.togglePreview()}),this.$btnSidebar=m,this.$btnSidebar.style.display="none",this.$footer.appendChild(m);const A=document.createElement("div");A.className=this.wrapClassName("page-jumps");const E=this.renderFooterBtn("btn-page-back",hE(this.namespace));if(this.sideEffect.addEventListener(E,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex-1,"navigation")}),A.appendChild(E),this.onPlay){const X=this.renderFooterBtn("btn-page-play",cE(this.namespace),dE(this.namespace));this.$btnPlay=X,this.sideEffect.addEventListener(X,"click",()=>{this.readonly||(this.setPlaying(),this.onPlay&&this.onPlay())}),A.appendChild(X)}const P=this.renderFooterBtn("btn-page-next",uE(this.namespace));this.sideEffect.addEventListener(P,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex+1,"navigation")}),A.appendChild(P);const D=document.createElement("div");D.className=this.wrapClassName("page-number");const B=document.createElement("input");B.className=this.wrapClassName("page-number-input"),B.value=String(this.pageIndex+1),this.readonly&&(B.disabled=!0),this.$pageNumberInput=B,this.sideEffect.addEventListener(B,"focus",()=>{B.select()}),this.sideEffect.addEventListener(B,"change",()=>{this.readonly||B.value&&this.onNewPageIndex(Number(B.value)-1,"input")});const z=document.createElement("span");this.$totalPage=z,D.appendChild(B),D.appendChild(z),this.$footer.appendChild(A),this.$footer.appendChild(D)}return this.$footer}renderFooterBtn(T,m,A){const E=document.createElement("button");return E.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(T),E.appendChild(m),A&&E.appendChild(A),E}togglePreview(T){if(this.isShowPreview=T!=null?T:!this.isShowPreview,this.$content.classList.toggle(this.wrapClassName("preview-active"),this.isShowPreview),this.isShowPreview){const m=this.$preview.querySelector("."+this.wrapClassName(`preview-page-${this.pageIndex}`));m&&(this.previewLazyLoad||(this.previewLazyLoad=new pl({container:this.$preview,elements_selector:`.${this.wrapClassName("preview-page>img")}`})),this.$preview.scrollTo({top:m.offsetTop-16}))}}wrapClassName(T){return`${this.namespace}-${T}`}}class x2{constructor(T,m){this.horizontalScrollBar=null,this.verticalScrollBar=null,this.isDraggingHorizontal=!1,this.isDraggingVertical=!1,this.eventListeners=[],this.container=T,this.resizableContainer=m}addTrackedListener(T,m,A){T.addEventListener(m,A),this.eventListeners.push({element:T,type:m,listener:A})}removeAllListeners(){this.eventListeners.forEach(({element:T,type:m,listener:A})=>{T.removeEventListener(m,A)}),this.eventListeners=[]}render(T,m,A,E){this.clearScrollBars(),A>T&&this.createHorizontalScrollBar(T,A),E>m&&this.createVerticalScrollBar(m,E)}handleNormalizeTranslate(T,m){const A=Math.max(0,Math.min(1,T)),E=Math.max(0,Math.min(1,m));if(this.horizontalScrollBar){const P=this.horizontalScrollBar.querySelector(".horizontal-thumb");if(P){const D=this.horizontalScrollBar.offsetWidth,B=P.offsetWidth,z=D-B-2;if(z>0){const X=1+A*z;P.style.left=`${X}px`}}}if(this.verticalScrollBar){const P=this.verticalScrollBar.querySelector(".vertical-thumb");if(P){const D=this.verticalScrollBar.offsetHeight,B=P.offsetHeight,z=D-B-2;if(z>0){const X=1+E*z;P.style.top=`${X}px`}}}}clearScrollBars(){this.removeAllListeners(),this.horizontalScrollBar&&(this.horizontalScrollBar.remove(),this.horizontalScrollBar=null),this.verticalScrollBar&&(this.verticalScrollBar.remove(),this.verticalScrollBar=null)}createHorizontalScrollBar(T,m){const A=document.createElement("div");A.className="scroll-bar horizontal";const E=T,P=E,D=Math.max(30,Math.min(P,P*E/m));A.style.cssText=`
@@ -8070,5 +8070,5 @@ self.onmessage = function(e) {
8070
8070
  box-shadow: 1px 0 2px rgba(0, 0, 0, 0.2);
8071
8071
  cursor: grab;
8072
8072
  `,this.addThumbDragListener(B,"vertical",D,P),A.appendChild(B),this.container.appendChild(A),this.verticalScrollBar=A}addThumbDragListener(T,m,A,E){let P=0,D=0;const B=(Tt,bt)=>{m==="horizontal"?this.isDraggingHorizontal=!0:this.isDraggingVertical=!0,P=m==="horizontal"?Tt:bt,D=m==="horizontal"?parseFloat(T.style.left)||0:parseFloat(T.style.top)||0,T.style.cursor="grabbing"},z=(Tt,bt)=>{var Q,G;if(!(m==="horizontal"?this.isDraggingHorizontal:this.isDraggingVertical))return;const F=(m==="horizontal"?Tt:bt)-P;let W=D+F;W=Math.max(1,Math.min(E-A-1,W)),m==="horizontal"?T.style.left=`${W}px`:T.style.top=`${W}px`;const O=E-A-2;let j=0;O>0&&(j=(W-1)/O,j=Math.max(0,Math.min(1,j))),m==="horizontal"?this.resizableContainer.handleNormalizeTranslate(j,(Q=this.resizableContainer.translateY)!=null?Q:.5,{triggerScrollBar:!1,triggerSync:!0}):this.resizableContainer.handleNormalizeTranslate((G=this.resizableContainer.translateX)!=null?G:.5,j,{triggerScrollBar:!1,triggerSync:!0})},X=()=>{m==="horizontal"?this.isDraggingHorizontal=!1:this.isDraggingVertical=!1,T.style.cursor="grab"},Z=Tt=>{B(Tt.clientX,Tt.clientY),Tt.preventDefault()},nt=Tt=>{z(Tt.clientX,Tt.clientY)},at=()=>{X()};this.addTrackedListener(T,"mousedown",Z),this.addTrackedListener(document,"mousemove",nt),this.addTrackedListener(document,"mouseup",at)}destroy(){this.clearScrollBars()}}class b2{constructor(T,m,A,E){this.onScaleChanged=null,this.whiteboardContainer=null,this.slide=null,this.scale=1,this.slideWidth=1,this.slideHeight=1,this.scrollBar=null,this.translateX=.5,this.translateY=.5,this.updateSlideSize=()=>{if(this.slide){let P=!1;(this.slideWidth!==this.slide.width||this.slideHeight!==this.slide.height)&&(this.slideWidth=this.slide.width,this.slideHeight=this.slide.height,P=!0),P&&this.updateResizableContainer()}},this.enableResize=A,this.parent=T,this.context=m,this.root=document.createElement("div"),this.root.style.width="100%",this.root.style.height="100%",this.root.style.overflow="hidden",this.parent.appendChild(this.root),this.scrollContainer=document.createElement("div"),this.scrollContainer.setAttribute("data-resizable-scroll","true"),this.scrollContainer.style.width="100%",this.scrollContainer.style.height="100%",this.scrollContainer.style.position="relative",this.scrollContainer.style.overflow="hidden",this.container=document.createElement("div"),this.container.style.position="relative",this.container.setAttribute("data-resizable-container","true"),this.scrollContainer.appendChild(this.container),this.root.appendChild(this.scrollContainer),this.enableResize&&(this.scrollBar=new x2(this.root,this))}getTranslate(){return{x:this.translateX,y:this.translateY}}getScale(){return this.scale}renderScrollBar(T,m,A,E){this.scrollBar&&this.scrollBar.render(T,A,m,E)}setSlideObject(T){this.slide=T,this.slide.on("renderEnd",this.updateSlideSize)}updateResizableContainer(){const T=this.scrollContainer.getBoundingClientRect();if(this.container.style.width=`${T.width*this.scale}px`,this.container.style.height=`${T.height*this.scale}px`,this.whiteboardContainer&&this.enableResize){const m=this.whiteboardContainer.getBoundingClientRect();if(m.width/m.height>this.slideWidth/this.slideHeight){const A=m.height*this.slideWidth/this.slideHeight,E=(m.width-A)/2;this.whiteboardContainer.style.clipPath=`inset(0px ${E}px 0px ${E}px)`}else if(m.width/m.height<this.slideWidth/this.slideHeight){const A=m.width*this.slideHeight/this.slideWidth,E=(m.height-A)/2;this.whiteboardContainer.style.clipPath=`inset(${E}px 0px ${E}px 0px)`}}this.translateX=.5,this.translateY=.5,this.renderScrollBar(T.width,T.width*this.scale,T.height,T.height*this.scale),this.handleNormalizeTranslate(this.translateX,this.translateY,{triggerScrollBar:!0,triggerSync:!0})}handleNormalizeTranslate(T,m,A){var z;if(Math.abs(T-this.translateX)<.001&&Math.abs(m-this.translateY)<.001&&!A.triggerSync)return;const E=this.scrollContainer.getBoundingClientRect(),P=this.container.getBoundingClientRect(),D=-T*(P.width-E.width),B=-m*(P.height-E.height);this.translateX=T,this.translateY=m,this.container.style.transform=`translate(${D}px, ${B}px)`,A.triggerScrollBar&&((z=this.scrollBar)==null||z.handleNormalizeTranslate(T,m)),A.triggerSync&&this.enableResize&&this.context.getIsWritable()&&this.context.storage.setState({translateX:this.translateX,translateY:this.translateY})}scaleContainer(T){Math.abs(this.scale-T)<.001||!this.enableResize||(T>1?(this.scrollContainer.style.width="calc(100% - 6px)",this.scrollContainer.style.height="calc(100% - 6px)"):(this.scrollContainer.style.width="100%",this.scrollContainer.style.height="100%"),T=this.enableResize?T:1,this.onScaleChanged&&this.enableResize&&this.onScaleChanged(T),this.scale=T,setTimeout(()=>{this.updateResizableContainer()}))}addSlideContainer(T){this.container.appendChild(T)}addWhiteboardContainer(T){this.container.appendChild(T),this.whiteboardContainer=T}getCurrentScale(){return this.scale}destroy(T){var m;(m=this.scrollBar)==null||m.destroy()}}var Ts=[],T2=function(){return Ts.some(function(_){return _.activeTargets.length>0})},S2=function(){return Ts.some(function(_){return _.skippedTargets.length>0})},Fg="ResizeObserver loop completed with undelivered notifications.",w2=function(){var _;typeof ErrorEvent=="function"?_=new ErrorEvent("error",{message:Fg}):(_=document.createEvent("Event"),_.initEvent("error",!1,!1),_.message=Fg),window.dispatchEvent(_)},hl;(function(_){_.BORDER_BOX="border-box",_.CONTENT_BOX="content-box",_.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(hl||(hl={}));var Ss=function(_){return Object.freeze(_)},E2=function(){function _(T,m){this.inlineSize=T,this.blockSize=m,Ss(this)}return _}(),Pv=function(){function _(T,m,A,E){return this.x=T,this.y=m,this.width=A,this.height=E,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Ss(this)}return _.prototype.toJSON=function(){var T=this,m=T.x,A=T.y,E=T.top,P=T.right,D=T.bottom,B=T.left,z=T.width,X=T.height;return{x:m,y:A,top:E,right:P,bottom:D,left:B,width:z,height:X}},_.fromRect=function(T){return new _(T.x,T.y,T.width,T.height)},_}(),yd=function(_){return _ instanceof SVGElement&&"getBBox"in _},Ov=function(_){if(yd(_)){var T=_.getBBox(),m=T.width,A=T.height;return!m&&!A}var E=_,P=E.offsetWidth,D=E.offsetHeight;return!(P||D||_.getClientRects().length)},Bg=function(_){var T;if(_ instanceof Element)return!0;var m=(T=_==null?void 0:_.ownerDocument)===null||T===void 0?void 0:T.defaultView;return!!(m&&_ instanceof m.Element)},A2=function(_){switch(_.tagName){case"INPUT":if(_.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},al=typeof window!="undefined"?window:{},Bh=new WeakMap,kg=/auto|scroll/,C2=/^tb|vertical/,M2=/msie|trident/i.test(al.navigator&&al.navigator.userAgent),so=function(_){return parseFloat(_||"0")},la=function(_,T,m){return _===void 0&&(_=0),T===void 0&&(T=0),m===void 0&&(m=!1),new E2((m?T:_)||0,(m?_:T)||0)},Ug=Ss({devicePixelContentBoxSize:la(),borderBoxSize:la(),contentBoxSize:la(),contentRect:new Pv(0,0,0,0)}),Nv=function(_,T){if(T===void 0&&(T=!1),Bh.has(_)&&!T)return Bh.get(_);if(Ov(_))return Bh.set(_,Ug),Ug;var m=getComputedStyle(_),A=yd(_)&&_.ownerSVGElement&&_.getBBox(),E=!M2&&m.boxSizing==="border-box",P=C2.test(m.writingMode||""),D=!A&&kg.test(m.overflowY||""),B=!A&&kg.test(m.overflowX||""),z=A?0:so(m.paddingTop),X=A?0:so(m.paddingRight),Z=A?0:so(m.paddingBottom),nt=A?0:so(m.paddingLeft),at=A?0:so(m.borderTopWidth),Tt=A?0:so(m.borderRightWidth),bt=A?0:so(m.borderBottomWidth),N=A?0:so(m.borderLeftWidth),R=nt+X,F=z+Z,W=N+Tt,O=at+bt,j=B?_.offsetHeight-O-_.clientHeight:0,Q=D?_.offsetWidth-W-_.clientWidth:0,G=E?R+W:0,It=E?F+O:0,Vt=A?A.width:so(m.width)-G-Q,ot=A?A.height:so(m.height)-It-j,V=Vt+R+Q+W,U=ot+F+j+O,ct=Ss({devicePixelContentBoxSize:la(Math.round(Vt*devicePixelRatio),Math.round(ot*devicePixelRatio),P),borderBoxSize:la(V,U,P),contentBoxSize:la(Vt,ot,P),contentRect:new Pv(nt,z,Vt,ot)});return Bh.set(_,ct),ct},Lv=function(_,T,m){var A=Nv(_,m),E=A.borderBoxSize,P=A.contentBoxSize,D=A.devicePixelContentBoxSize;switch(T){case hl.DEVICE_PIXEL_CONTENT_BOX:return D;case hl.BORDER_BOX:return E;default:return P}},R2=function(){function _(T){var m=Nv(T);this.target=T,this.contentRect=m.contentRect,this.borderBoxSize=Ss([m.borderBoxSize]),this.contentBoxSize=Ss([m.contentBoxSize]),this.devicePixelContentBoxSize=Ss([m.devicePixelContentBoxSize])}return _}(),Dv=function(_){if(Ov(_))return 1/0;for(var T=0,m=_.parentNode;m;)T+=1,m=m.parentNode;return T},I2=function(){var _=1/0,T=[];Ts.forEach(function(D){if(D.activeTargets.length!==0){var B=[];D.activeTargets.forEach(function(X){var Z=new R2(X.target),nt=Dv(X.target);B.push(Z),X.lastReportedSize=Lv(X.target,X.observedBox),nt<_&&(_=nt)}),T.push(function(){D.callback.call(D.observer,B,D.observer)}),D.activeTargets.splice(0,D.activeTargets.length)}});for(var m=0,A=T;m<A.length;m++){var E=A[m];E()}return _},Gg=function(_){Ts.forEach(function(m){m.activeTargets.splice(0,m.activeTargets.length),m.skippedTargets.splice(0,m.skippedTargets.length),m.observationTargets.forEach(function(E){E.isActive()&&(Dv(E.target)>_?m.activeTargets.push(E):m.skippedTargets.push(E))})})},P2=function(){var _=0;for(Gg(_);T2();)_=I2(),Gg(_);return S2()&&w2(),_>0},qc,Fv=[],O2=function(){return Fv.splice(0).forEach(function(_){return _()})},N2=function(_){if(!qc){var T=0,m=document.createTextNode(""),A={characterData:!0};new MutationObserver(function(){return O2()}).observe(m,A),qc=function(){m.textContent="".concat(T?T--:T++)}}Fv.push(_),qc()},L2=function(_){N2(function(){requestAnimationFrame(_)})},Gh=0,D2=function(){return!!Gh},F2=250,B2={attributes:!0,characterData:!0,childList:!0,subtree:!0},Hg=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],jg=function(_){return _===void 0&&(_=0),Date.now()+_},Jc=!1,k2=function(){function _(){var T=this;this.stopped=!0,this.listener=function(){return T.schedule()}}return _.prototype.run=function(T){var m=this;if(T===void 0&&(T=F2),!Jc){Jc=!0;var A=jg(T);L2(function(){var E=!1;try{E=P2()}finally{if(Jc=!1,T=A-jg(),!D2())return;E?m.run(1e3):T>0?m.run(T):m.start()}})}},_.prototype.schedule=function(){this.stop(),this.run()},_.prototype.observe=function(){var T=this,m=function(){return T.observer&&T.observer.observe(document.body,B2)};document.body?m():al.addEventListener("DOMContentLoaded",m)},_.prototype.start=function(){var T=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Hg.forEach(function(m){return al.addEventListener(m,T.listener,!0)}))},_.prototype.stop=function(){var T=this;this.stopped||(this.observer&&this.observer.disconnect(),Hg.forEach(function(m){return al.removeEventListener(m,T.listener,!0)}),this.stopped=!0)},_}(),ed=new k2,zg=function(_){!Gh&&_>0&&ed.start(),Gh+=_,!Gh&&ed.stop()},U2=function(_){return!yd(_)&&!A2(_)&&getComputedStyle(_).display==="inline"},G2=function(){function _(T,m){this.target=T,this.observedBox=m||hl.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return _.prototype.isActive=function(){var T=Lv(this.target,this.observedBox,!0);return U2(this.target)&&(this.lastReportedSize=T),this.lastReportedSize.inlineSize!==T.inlineSize||this.lastReportedSize.blockSize!==T.blockSize},_}(),H2=function(){function _(T,m){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=T,this.callback=m}return _}(),kh=new WeakMap,Vg=function(_,T){for(var m=0;m<_.length;m+=1)if(_[m].target===T)return m;return-1},Uh=function(){function _(){}return _.connect=function(T,m){var A=new H2(T,m);kh.set(T,A)},_.observe=function(T,m,A){var E=kh.get(T),P=E.observationTargets.length===0;Vg(E.observationTargets,m)<0&&(P&&Ts.push(E),E.observationTargets.push(new G2(m,A&&A.box)),zg(1),ed.schedule())},_.unobserve=function(T,m){var A=kh.get(T),E=Vg(A.observationTargets,m),P=A.observationTargets.length===1;E>=0&&(P&&Ts.splice(Ts.indexOf(A),1),A.observationTargets.splice(E,1),zg(-1))},_.disconnect=function(T){var m=this,A=kh.get(T);A.observationTargets.slice().forEach(function(E){return m.unobserve(T,E.target)}),A.activeTargets.splice(0,A.activeTargets.length)},_}(),j2=function(){function _(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.");Uh.connect(this,T)}return _.prototype.observe=function(T,m){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Bg(T))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Uh.observe(this,T,m)},_.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(!Bg(T))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Uh.unobserve(this,T)},_.prototype.disconnect=function(){Uh.disconnect(this)},_.toString=function(){return"function ResizeObserver () { [polyfill code] }"},_}();const z2=window.ResizeObserver||j2,Wg=.5,Kc=({width:_,height:T})=>`${_.toFixed(1)} x ${T.toFixed(1)} px`,Zc=(_,T)=>Boolean(_&&T&&Math.abs(_.width-T.width)<=Wg&&Math.abs(_.height-T.height)<=Wg),V2=new Set(["clicker"]),W2=function(){};class Bv{constructor({context:T,box:m,view:A,mountSlideController:E,mountWhiteboard:P,baseScenePath:D,appId:B,urlInterrupter:z,enableScale:X,onPagesReady:Z,onNavigate:nt}){this.slideController=null,this.isViewMounted=!1,this.justSildeReadonly=!1,this.syncEventQueuePolicy="fifo",this.boxSizeEventCount=0,this._applyResize=(at,Tt)=>{var N,R,F;if(at.width<=0||at.height<=0||Zc(this.lastAppliedSize,at))return;this.lastAppliedSize=at,this.lastAppliedSource=Tt,(N=this.resizableContainer)==null||N.updateResizableContainer(),(F=(R=this.slideController)==null?void 0:R.slide)==null||F.notifyFrameResize(),this.scaleDocsToFit();const bt=this._getContentSize();console.log("[app-slide] resize",{appId:this.appId,source:Tt,eventCount:this.boxSizeEventCount,event:Kc(at),dom:Kc(bt)})},this._applyCurrentBoxSize=at=>{const Tt=at!=null?at:this._getContentSize();this._applyResize(Tt,at?"event":"observer")},this._onObserverSize=at=>{at.width<=0||at.height<=0||(this.lastObserverSize=at,this._applyResize(at,"observer"))},this._onContextBoxSizeChange=at=>{if(at.appId===this.context.appId){if(this.boxSizeEventCount+=1,this.latestBoxSize={width:at.width,height:at.height},Zc(this.lastObserverSize,this.latestBoxSize)||Zc(this.lastAppliedSize,this.latestBoxSize)){console.log("[app-slide] boxSizeChange skipped, observer already applied",{appId:this.appId,eventCount:this.boxSizeEventCount,source:this.lastAppliedSource,size:Kc(this.latestBoxSize)});return}this._applyResize(this.latestBoxSize,"event"),this._reconnectContentObserver()}},this.onError=({error:at,index:Tt})=>{var bt,N;this.viewer.setPaused(),(bt=this.slideController)!=null&&bt.showRenderError&&(this.$overlay.textContent=`Error on slide[page=${this.slideController.page}]: ${at.message}`,this.$overlay.style.opacity="1"),(N=this.slideController)!=null&&N.onRenderError&&this.slideController.onRenderError(at,Tt),Dr.warn("[Slide] render error",at)},this.onRenderStart=()=>{this.$whiteboardView.classList.add(this.wrapClassName("wb-view-hidden")),this.viewer.setPlaying()},this.onRenderEnd=()=>{},this.onPageChanged=()=>{clearTimeout(this._onPageChangedTimer),this._onPageChangedTimer=setTimeout(this._onPageChanged,200)},this._onPageChangedTimer=0,this._onPageChanged=()=>{this.$overlay.style.opacity="",this.$whiteboardView.classList.remove(this.wrapClassName("wb-view-hidden"))},this.refreshPages=()=>{this.slideController&&(this.viewer.pages=tv(this.slideController.slide,this.slideController.previewList),this.viewer.setPageIndex(this.getPageIndex(this.slideController.page)),this.scaleDocsToFit())},this.scaleDocsToFit=()=>{if(this.slideController){const{width:at,height:Tt}=this.slideController.slide;at&&Tt&&(this.whiteboardView.moveCameraToContain({originX:-at/2,originY:-Tt/2,width:at,height:Tt,animationMode:"immediately"}),this.whiteboardView.setCameraBound({damping:1,maxContentMode:()=>this.whiteboardView.camera.scale,minContentMode:()=>this.whiteboardView.camera.scale,centerX:0,centerY:0,width:at,height:Tt}),this.isViewMounted||(this.isViewMounted=!0,console.log("[Slide] mount whiteboard view"),this.mountWhiteboard(this.$whiteboardView)))}},this.onPlay=()=>{this.slideController&&this.slideController.slide.nextStep()},this.onNewPageIndex=(at,Tt)=>{this.slideController&&this.slideController.jumpToPage(at+1,Tt)},this.sideEffect=new ua,this.namespace="netless-app-slide",this.toPdf=async()=>{if(!this.slideController){this.reportProgress(100,null);return}const{slide:at}=this.slideController,Tt=1920,bt=document.createElement("canvas"),N=bt.getContext("2d"),{slideCount:R,width:F,height:W}=at;let O=Math.floor(F),j=Math.floor(W);O>Tt&&(O=Tt,j=Math.floor(W*O/F)),j>Tt&&(j=Tt,O=Math.floor(F*j/W)),bt.width=O,bt.height=j;const Q=document.createElement("canvas");Q.width=O,Q.height=j;const G=Q.getContext("2d");if(!G||!this.getWhiteSnapshot||!N)return this.reportProgress(100,null),null;const It=O>j?"l":"p",{jsPDF:Vt}=await Promise.resolve().then(function(){return jw(require("jspdf"))}),ot=new Vt({format:[O,j],orientation:It,compress:!0});for(let ct=1;ct<=R;ct++){let tt=null;try{tt=await this.slideController.slide.snapshotWithTimingEnd(ct)}catch{}if(tt){const K=document.createElement("img");K.src=tt,await new Promise(dt=>K.onload=dt),N.drawImage(K,0,0,O,j)}G.clearRect(0,0,O,j),await this.getWhiteSnapshot(ct,Q,G,F,W);try{const K=Q.toDataURL("image/png"),dt=document.createElement("img");dt.src=K,await new Promise(rt=>dt.onload=rt),N.drawImage(dt,0,0,O,j)}catch{}const vt=bt.toDataURL("image/jpeg",.6);ct>1&&ot.addPage(),ot.addImage(vt,"JPEG",0,0,O,j,"","FAST"),N.clearRect(0,0,O,j),Math.ceil(ct/R*100)<100&&this.reportProgress(Math.ceil(ct/R*100),null)}const V=ot.output("arraybuffer"),U=this.box.title;this.reportProgress(100,{pdf:V,title:U})},this.context=T,this.box=m,this.whiteboardView=A,this.mountSlideController=E,this.mountWhiteboard=P,this.onNavigate=nt||W2,this.baseScenePath=D,this.enableScale=X!=null?X:!1,this.appId=B,this.viewer=new vd({readonly:m.readonly,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlay,urlInterrupter:z,onPagesReady:Z}),this.sideEffect.add(()=>{const at=Tt=>{this.setReadonly(Tt)};return m.events.on("readonly",at),()=>m.events.off("readonly",at)}),this.sideEffect.add(()=>{const at=Tt=>{Tt.data.type==="@netless/_request_save_pdf_"&&Tt.data.appId===this.appId&&this.toPdf().catch(()=>this.reportProgress(100,null))};return window.addEventListener("message",at),()=>{window.removeEventListener("message",at)}}),this.render(),this._registerBoxSizeChange(),this.sideEffect.add(()=>{const at=bt=>{this.resizableContainer&&this.resizableContainer.scaleContainer(bt)};console.log("[SlideDocsViewer] Initial storage state:",this.context.storage.state),console.log("[SlideDocsViewer] Initial slideScale:",this.context.storage.state.slideScale),this.context.storage.state.slideScale!==void 0?(console.log("[SlideDocsViewer] Applying initial slideScale:",this.context.storage.state.slideScale),at(this.context.storage.state.slideScale)):console.log("[SlideDocsViewer] No initial slideScale found");const Tt=bt=>{var N,R;if(bt.slideScale!==void 0){const F=bt.slideScale.newValue;at(F!=null?F:1)}if(bt.translateX!==void 0||bt.translateY!==void 0){const F=this.resizableContainer.getTranslate(),W=bt.translateX?(N=bt.translateX.newValue)!=null?N:.5:F.x,O=bt.translateY?(R=bt.translateY.newValue)!=null?R:.5:F.y;this.resizableContainer&&this.resizableContainer.handleNormalizeTranslate(W,O,{triggerScrollBar:!0,triggerSync:!1})}};return console.log("[SlideDocsViewer] Adding storage state listener"),this.context.storage.onStateChanged.addListener(Tt),()=>{console.log("[SlideDocsViewer] Removing storage state listener"),this.context.storage.onStateChanged.removeListener(Tt)}})}setJustSildeReadonly(T){this.justSildeReadonly=T,this.applyInteractionState()}setSyncEventQueuePolicy(T){this.syncEventQueuePolicy=T,this.applyInteractionState()}applyInteractionState(){var m;const T=(m=this.slideController)==null?void 0:m.slide;!T||(T.setInteractive(!this.justSildeReadonly),T.setSyncEventQueuePolicy(this.syncEventQueuePolicy))}render(){this.resizableContainer||(this.resizableContainer=new b2(this.viewer.$content,this.context,this.enableScale,this.box)),this.renderSlideContainer(),this.renderWhiteboardView(),this.renderOverlay(),this.resizableContainer.addSlideContainer(this.$slide),this.resizableContainer.addWhiteboardContainer(this.$whiteboardView),this.viewer.$content.appendChild(this.$overlay),this.sideEffect.addEventListener(window,"keydown",T=>{if(!this.justSildeReadonly&&this.box.focus&&this.slideController&&!Jw(T.target))switch(T.key){case"ArrowUp":case"ArrowLeft":{this.slideController.slide.prevStep(),this.onNavigate(this.slideController.page,"keydown");break}case"ArrowRight":case"ArrowDown":{this.slideController.slide.nextStep(),this.onNavigate(this.slideController.page,"keydown");break}}})}renderOverlay(){if(!this.$overlay){const T=document.createElement("div");T.className=this.wrapClassName("overlay"),this.$overlay=T}return this.$overlay}renderSlideContainer(){if(!this.$slide){const T=document.createElement("div");T.className=this.wrapClassName("slide"),T.dataset.appKind="Slide",this.$slide=T}return this.$slide}renderWhiteboardView(){return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view")),this.$whiteboardView}mount(){var T,m,A,E;return this.box.mountContent(this.viewer.$content),this.box.mountFooter(this.viewer.$footer),this.slideController=this.mountSlideController({anchor:this.$slide,onRenderStart:this.onRenderStart,onRenderEnd:this.onRenderEnd,onTransitionStart:this.viewer.setPlaying,onTransitionEnd:this.viewer.setPaused,onReady:this.refreshPages,onNavigate:this.onNavigate,onError:this.onError}),this.applyInteractionState(),this.resizableContainer.setSlideObject(this.slideController.slide),this.scaleDocsToFit(),this.sideEffect.add(()=>(this.whiteboardView.callbacks.on("onSizeUpdated",this.scaleDocsToFit),()=>this.whiteboardView.callbacks.off("onSizeUpdated",this.scaleDocsToFit))),this._observeContentSize(),this._applyCurrentBoxSize(),(E=(A=(m=(T=this.context).getAppProxy)==null?void 0:m.call(T))==null?void 0:A.scheduleBoxSizeSync)==null||E.call(A),this}_getContentSize(){const T=(this.viewer.$content||this.box.$content).getBoundingClientRect();return{width:T.width,height:T.height}}_reconnectContentObserver(){const T=this.viewer.$content;!T||!this.contentResizeObserver||(this.contentResizeObserver.disconnect(),this.contentResizeObserver.observe(T))}_observeContentSize(){this.contentResizeObserver||(this.contentResizeObserver=new z2(T=>{const m=T[T.length-1],A=m!=null&&m.contentRect?{width:m.contentRect.width,height:m.contentRect.height}:this._getContentSize();this._onObserverSize(A)})),this._reconnectContentObserver()}_registerBoxSizeChange(){var T,m,A,E;this.offBoxSizeChange=this.context.emitter.on("boxSizeChange",this._onContextBoxSizeChange),this._observeContentSize(),this._applyCurrentBoxSize(),(E=(A=(m=(T=this.context).getAppProxy)==null?void 0:m.call(T))==null?void 0:A.scheduleBoxSizeSync)==null||E.call(A)}getPageIndex(T){return(T>0?T:1)-1}unmount(){var T,m;return(T=this.offBoxSizeChange)==null||T.call(this),this.offBoxSizeChange=void 0,(m=this.contentResizeObserver)==null||m.disconnect(),this.contentResizeObserver=void 0,this.slideController&&(this.slideController.destroy(),this.slideController=null),this.viewer.unmount(),this.resizableContainer.destroy(this.box),this}setReadonly(T){this.viewer.setReadonly(T)}destroy(){this.sideEffect.flushAll(),this.unmount(),this.viewer.destroy()}toggleClickThrough(T){this.$whiteboardView.style.pointerEvents=!T||V2.has(T)?"none":"auto"}wrapClassName(T){return`${this.namespace}-${T}`}async getWhiteSnapshot(T,m,A,E,P){const D={centerX:0,centerY:0,scale:Math.min(m.width/E,m.height/P)},B=`${this.baseScenePath}/${T}`,z=this.context.manager.windowManger;z._appliancePlugin?await z._appliancePlugin.screenshotToCanvasAsync(A,B,m.width,m.height,D):this.whiteboardView.screenshotToCanvas(A,B,m.width,m.height,D)}reportProgress(T,m){window.postMessage({type:"@netless/_result_save_pdf_",appId:this.appId,progress:T,result:m})}}exports.useFreezer=!1;exports.FreezerLength=2;function X2(){return exports.FreezerLength}function Y2(_){exports.FreezerLength=_<1?1/0:_}const ol=_=>"["+_+"]",jh={map:new Map,boxes:new Map,queue:[],validateQueue(){for(this.queue.sort((_,T)=>{var E,P,D,B;const m=(P=(E=this.boxes.get(_))==null?void 0:E.zIndex)!=null?P:0,A=(B=(D=this.boxes.get(T))==null?void 0:D.zIndex)!=null?B:0;return-(m-A)}),li("[Slide] freezer: validate",ol(this.queue));this.queue.length>exports.FreezerLength;){const _=this.queue.pop(),T=this.map.get(_);T&&(li("[Slide] freezer: validate-freeze",_,ol(this.queue)),T.freeze())}},set(_,T,m){li("[Slide] freezer: add",_,ol(this.queue)),this.map.set(_,T),this.boxes.set(_,m),this.queue.includes(_)||this.queue.unshift(_),this.validateQueue()},delete(_){this.map.delete(_),this.boxes.delete(_),this.queue=this.queue.filter(T=>T!==_),li("[Slide] freezer: delete",_,ol(this.queue))},focus(_){const T=this.map.get(_),m=this.queue.indexOf(_);m>-1&&this.queue.splice(m,1),this.queue.unshift(_),this.validateQueue(),li("[Slide] freezer: focus",_,ol(this.queue)),T&&T.unfreeze()}},nd=new Set;function q2(_){return nd.add(_),()=>nd.delete(_)}const id=new Set;function J2(_){return id.add(_),()=>id.delete(_)}const K2=_=>{exports.useFreezer=!0,_.on("focus",({appId:T})=>{jh.focus(T)}),_.on("created",({appId:T})=>{nd.forEach(m=>m(T))}),_.on("destroy",({appId:T})=>{id.forEach(m=>m(T))})};var kv=`.netless-app-slide-content{position:relative;height:100%;overflow:hidden}.netless-app-slide-preview-mask{display:none;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%}.netless-app-slide-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-slide-preview-active .netless-app-slide-preview-mask{display:block}.netless-app-slide-preview-active .netless-app-slide-preview{transform:translate(0)}.netless-app-slide-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-slide-preview-page:hover,.netless-app-slide-preview-page.netless-app-slide-preview-page-active{border-color:#444e601a}.netless-app-slide-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-slide-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-slide-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;-webkit-user-select:none;-webkit-touch-callout:none;-user-select:none;color:#191919}.netless-app-slide-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-slide-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-slide-footer-btn:hover{background:rgba(237,237,240,.9)}@media (hover: none){.netless-app-slide-footer-btn:hover{background:transparent!important}}.netless-app-slide-footer-btn>svg{width:100%;height:100%}.netless-app-slide-footer-btn>svg:nth-of-type(2){display:none}.netless-app-slide-footer-btn.netless-app-slide-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-slide-footer-btn.netless-app-slide-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-slide-footer-btn~.netless-app-slide-footer-btn{margin-left:15px}.netless-app-slide-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-slide-page-number{margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-slide-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-slide-page-number-input:hover,.netless-app-slide-page-number-input:focus,.netless-app-slide-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-slide-readonly.netless-app-slide-footer{display:none}.telebox-color-scheme-dark .netless-app-slide-page-number-input{color:#a6a6a8}.telebox-color-scheme-dark .netless-app-slide-page-number-input:active,.telebox-color-scheme-dark .netless-app-slide-page-number-input:focus,.telebox-color-scheme-dark .netless-app-slide-page-number-input:hover{color:#222}.telebox-color-scheme-dark .netless-app-slide-footer{color:#a6a6a8;background:#2d2d33;border-top:none}.telebox-color-scheme-dark .netless-app-slide-footer-btn:hover{background:#212126}.telebox-color-scheme-dark .netless-app-slide-preview{background:rgba(50,50,50,.9)}.netless-app-slide-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden;transition:opacity .2s}.netless-app-slide-wb-view-hidden{opacity:0}.netless-app-slide-overlay{display:flex;align-items:center;justify-content:center;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%;padding:8px;background:rgba(255,0,0,.25);transition:opacity .3s;opacity:0;pointer-events:none}.netless-app-slide-slide{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.netless-app-slide-slide canvas{transform:scale(var(--netless-app-slide-scale, 1))}
8073
- `;function Z2({container:_,taskId:T,resourceList:m=[],url:A=od,debug:E=!1}){if(!T)throw new Error("[Slide] taskId is required");_.style.cssText+="display:flex;flex-direction:column";const P=new Uv({target:_});return P.debug=!!E,P.mount(T,A,m),P}class Uv{constructor(T){this.slide=null,this.debug=!1,this.previewList=[],this.sideEffect=new ua,this.ready=!1,this.readyPromise=new Promise(m=>{this.resolveReady=()=>{this.ready=!0,m()}}),this.hotkeyListener=m=>{if(this.slide)switch(m.key){case"ArrowUp":case"ArrowLeft":{this.slide.prevStep();break}case"ArrowRight":case"ArrowDown":{this.slide.nextStep();break}}},this.onPageChanged=m=>{this.viewer.setPageIndex(m-1)},this.onTransitionStart=()=>{this.viewer.setPlaying()},this.onTransitionEnd=()=>{this.viewer.setPaused()},this.onError=({error:m})=>{this.viewer.setPaused(),console.warn("[Slide] render error",m)},this.destroyed=!1,this.refreshPages=()=>{this.slide&&(this.viewer.pages=tv(this.slide,this.previewList),this.viewer.setPageIndex(this.getPageIndex(this.slide.slideState.currentSlideIndex)))},this.onPlay=()=>{this.slide&&this.slide.nextStep()},this.onNewPageIndex=m=>{this.slide&&this.slide.slideCount>0&&this.slide.renderSlide(Yg(m+1,1,this.slide.slideCount))},this.namespace="netless-app-slide",this.target=T.target,this.bgColor=Qg(this.target),this.viewer=new vd({readonly:!1,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlay}),this.render()}render(){this.viewer.$content.appendChild(this.renderSlideContainer()),this.registerHotKeys(window)}registerHotKeys(T){this.sideEffect.addEventListener(T,"keydown",this.hotkeyListener,void 0,"hotkey")}mount(T,m,A,E=[]){this.target.appendChild(this.renderStyle()),this.target.appendChild(this.viewer.$content),this.target.appendChild(this.viewer.$footer),this.slide=new ci.Slide({anchor:this.$slide,interactive:!0,mode:"local",controller:this.debug,enableGlobalClick:!0,renderOptions:{minFPS:25,maxFPS:30,autoFPS:!0,autoResolution:!0,transactionBgColor:this.bgColor}}),this.registerEventListeners(),A.length>0?this.slide.setResourceList(T,A):this.slide.setResource(T,m),this.slide.renderSlide(1),this.previewList=E}renderStyle(){const T=document.createElement("style");return T.appendChild(document.createTextNode(kv)),T}registerEventListeners(){if(!this.slide)return;const{slide:T}=this;T.on(ci.SLIDE_EVENTS.slideChange,this.onPageChanged),T.on(ci.SLIDE_EVENTS.renderStart,this.onTransitionStart),T.on(ci.SLIDE_EVENTS.renderEnd,this.onTransitionEnd),T.on(ci.SLIDE_EVENTS.mainSeqStepStart,this.onTransitionStart),T.on(ci.SLIDE_EVENTS.mainSeqStepEnd,this.onTransitionEnd),T.on(ci.SLIDE_EVENTS.renderError,this.onError),T.on(ci.SLIDE_EVENTS.renderEnd,this.resolveReady),this.readyPromise.then(this.refreshPages)}destroy(){this.sideEffect.flushAll(),this.slide&&!this.destroyed&&(this.slide.destroy(),this.destroyed=!0),this.viewer.destroy()}getPageIndex(T){return(T>0?T:1)-1}renderSlideContainer(){if(!this.$slide){const T=document.createElement("div");T.className=this.wrapClassName("slide"),T.dataset.appKind="Slide",this.$slide=T}return this.$slide}wrapClassName(T){return`${this.namespace}-${T}`}}const $2=ci.Slide.usePlugin.bind(ci.Slide),rd="0.2.100",Q2={kind:"Slide",setup(_){var Z,nt,at,Tt,bt;if(console.log("[Slide] setup @ "+rd),_.getIsWritable()&&_.storage.ensureState(Qc),!_.storage.state.taskId)throw new Error("[Slide] no taskId");const T=_.getView();if(!T)throw new Error("[Slide] no view, please set scenePath on addApp()");T.disableCameraTransform=!0;const m=_.getBox();m.mountStyles(kv);try{m.$content.dataset.appSlideVersion=rd}catch{}const A=_.getInitScenePath();let E=null;const P=N=>{const R=_.getRoom();if(E&&E.slideController){let F=!1;R&&_.getIsWritable()&&($c(R,_,E.slideController.slide,A),F=!0),li("[Slide] page to",N,F?"(synced)":""),E.viewer.setPageIndex(N-1),E.viewer.setPaused(),E.onPageChanged();const W=E.viewer.pages.length;W>0&&_.dispatchAppEvent("pageStateChange",{index:N-1,length:W})}},D=N=>{const R=_.getAppOptions()||{},F=new nv({context:_,...N,onPageChanged:P,onNavigate:N.onNavigate,onRenderError:R.onRenderError,showRenderError:R.showRenderError,invisibleBehavior:R.invisibleBehavior});return exports.useFreezer&&jh.set(_.appId,F,m),Dr.setAppController(_.appId,F),F.readyPromise.then(N.onReady).then(()=>{const W=_.getRoom();let O=!1;W&&_.getIsWritable()&&($c(W,_,F.slide,A),O=!0);const j=F.slide.slideState.currentSlideIndex;li("[Slide] page to",j,O?"(synced)":"","(on ready)"),F.slide.on("renderEnd",N.onRenderEnd)}),F};E=new Bv({context:_,box:m,view:T,mountSlideController:D,mountWhiteboard:_.mountView.bind(_),baseScenePath:A,appId:_.appId,urlInterrupter:(Z=_.getAppOptions())==null?void 0:Z.urlInterrupter,enableScale:(at=(nt=_.getAppOptions())==null?void 0:nt.enableScale)!=null?at:!1,onPagesReady:({length:N})=>{const R=(E==null?void 0:E.viewer.pageIndex)||0;_.dispatchAppEvent("pageStateChange",{index:R,length:N})},onNavigate:(N,R)=>{li("[Slide] user navigate to",N,R?`(${R})`:"")}});const B=_.getAppOptions();E.setSyncEventQueuePolicy((Tt=B==null?void 0:B.syncEventQueuePolicy)!=null?Tt:"fifo"),E.setJustSildeReadonly((bt=B==null?void 0:B.justSildeReadonly)!=null?bt:!1);const z=_.getRoom(),X=new ua;return X.add(()=>{var N;return Dr.setAppContext(_.appId,_),Dr.enable=((N=_.getAppOptions())==null?void 0:N.debug)||!1,Dr.level="debug",()=>Dr.deleteApp(_.appId)}),z&&(E.toggleClickThrough(z.state.memberState.currentApplianceName),X.add(()=>{const N=R=>{R.memberState&&E&&E.toggleClickThrough(R.memberState.currentApplianceName)};return z.callbacks.on("onRoomStateChanged",N),()=>z.callbacks.off("onRoomStateChanged",N)})),_.emitter.on("destroy",()=>{li("[Slide] destroy",_.appId),exports.useFreezer&&jh.delete(_.appId),X.flushAll(),E&&(E.destroy(),E=null)}),E.mount(),{onScaleChanged:N=>{!E||(E.resizableContainer.onScaleChanged=N)},scaleView:N=>{let R=Number(N);Number.isNaN(R)&&(R=1),R<1&&(R=1),R>4&&(R=4),_.storage.setState({slideScale:R}),_.storage.setState({translateX:.5,translateY:.5}),E==null||E.resizableContainer.scaleContainer(R)},getViewScale:()=>E==null?void 0:E.resizableContainer.getScale(),translateView:(N,R)=>{var F,W;if(E!=null&&E.resizableContainer){const O=E.resizableContainer,j=_.getBox().$content.getBoundingClientRect(),Q=O.container.getBoundingClientRect(),G=Q.width-j.width,It=Q.height-j.height;if(G>0||It>0){const Vt=(F=O.translateX)!=null?F:.5,ot=(W=O.translateY)!=null?W:.5,V=G>0?N/G:0,U=It>0?R/It:0,ct=Math.max(0,Math.min(1,Vt+V)),tt=Math.max(0,Math.min(1,ot+U));_.storage.setState({translateX:ct,translateY:tt}),O.handleNormalizeTranslate(ct,tt,{triggerScrollBar:!0,triggerSync:!1})}}},setSildeReadonly:N=>{E==null||E.setJustSildeReadonly(N)},setSyncEventQueuePolicy:N=>{E==null||E.setSyncEventQueuePolicy(N)},viewer:()=>E,controller:()=>E==null?void 0:E.slideController,slide:()=>{var N;return(N=E==null?void 0:E.slideController)==null?void 0:N.slide},nextStep:()=>{var N;return E&&E.slideController?((N=E==null?void 0:E.slideController)==null||N.slide.nextStep(),!0):!1},prevStep:()=>{var N;return E&&E.slideController?((N=E==null?void 0:E.slideController)==null||N.slide.prevStep(),!0):!1},position:()=>{const N=E==null?void 0:E.slideController;if(N)return[N.page,N.pageCount]},nextPage:()=>{const N=E==null?void 0:E.slideController;if(N){const{page:R,pageCount:F}=N;if(F>0&&R<F)return N.jumpToPage(R+1),!0}return!1},prevPage:()=>{const N=E==null?void 0:E.slideController;if(N){const{page:R,pageCount:F}=N;if(F>0&&R>1)return N.jumpToPage(R-1),!0}return!1},jumpToPage:N=>{const R=E==null?void 0:E.slideController;if(R){const{page:F,pageCount:W}=R;if(W>0&&F>0&&F<=W)return R.jumpToPage(N),!0}return!1}}}};exports.DefaultUrl=od;exports.DocsViewer=vd;exports.SideEffectManager=ua;exports.Slide=ci.Slide;exports.SlideController=nv;exports.SlideControllerBase=ev;exports.SlideDocsViewer=Bv;exports.SlidePreviewer=Uv;exports.addHooks=K2;exports.apps=jh;exports.default=Q2;exports.getFreezerLength=X2;exports.log=li;exports.logger=Dr;exports.onCreated=q2;exports.onDestroyed=J2;exports.previewSlide=Z2;exports.setFreezerLength=Y2;exports.syncSceneWithSlide=$c;exports.usePlugin=$2;exports.version=rd;
8073
+ `;function Z2({container:_,taskId:T,resourceList:m=[],url:A=od,debug:E=!1}){if(!T)throw new Error("[Slide] taskId is required");_.style.cssText+="display:flex;flex-direction:column";const P=new Uv({target:_});return P.debug=!!E,P.mount(T,A,m),P}class Uv{constructor(T){this.slide=null,this.debug=!1,this.previewList=[],this.sideEffect=new ua,this.ready=!1,this.readyPromise=new Promise(m=>{this.resolveReady=()=>{this.ready=!0,m()}}),this.hotkeyListener=m=>{if(this.slide)switch(m.key){case"ArrowUp":case"ArrowLeft":{this.slide.prevStep();break}case"ArrowRight":case"ArrowDown":{this.slide.nextStep();break}}},this.onPageChanged=m=>{this.viewer.setPageIndex(m-1)},this.onTransitionStart=()=>{this.viewer.setPlaying()},this.onTransitionEnd=()=>{this.viewer.setPaused()},this.onError=({error:m})=>{this.viewer.setPaused(),console.warn("[Slide] render error",m)},this.destroyed=!1,this.refreshPages=()=>{this.slide&&(this.viewer.pages=tv(this.slide,this.previewList),this.viewer.setPageIndex(this.getPageIndex(this.slide.slideState.currentSlideIndex)))},this.onPlay=()=>{this.slide&&this.slide.nextStep()},this.onNewPageIndex=m=>{this.slide&&this.slide.slideCount>0&&this.slide.renderSlide(Yg(m+1,1,this.slide.slideCount))},this.namespace="netless-app-slide",this.target=T.target,this.bgColor=Qg(this.target),this.viewer=new vd({readonly:!1,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlay}),this.render()}render(){this.viewer.$content.appendChild(this.renderSlideContainer()),this.registerHotKeys(window)}registerHotKeys(T){this.sideEffect.addEventListener(T,"keydown",this.hotkeyListener,void 0,"hotkey")}mount(T,m,A,E=[]){this.target.appendChild(this.renderStyle()),this.target.appendChild(this.viewer.$content),this.target.appendChild(this.viewer.$footer),this.slide=new ci.Slide({anchor:this.$slide,interactive:!0,mode:"local",controller:this.debug,enableGlobalClick:!0,renderOptions:{minFPS:25,maxFPS:30,autoFPS:!0,autoResolution:!0,transactionBgColor:this.bgColor}}),this.registerEventListeners(),A.length>0?this.slide.setResourceList(T,A):this.slide.setResource(T,m),this.slide.renderSlide(1),this.previewList=E}renderStyle(){const T=document.createElement("style");return T.appendChild(document.createTextNode(kv)),T}registerEventListeners(){if(!this.slide)return;const{slide:T}=this;T.on(ci.SLIDE_EVENTS.slideChange,this.onPageChanged),T.on(ci.SLIDE_EVENTS.renderStart,this.onTransitionStart),T.on(ci.SLIDE_EVENTS.renderEnd,this.onTransitionEnd),T.on(ci.SLIDE_EVENTS.mainSeqStepStart,this.onTransitionStart),T.on(ci.SLIDE_EVENTS.mainSeqStepEnd,this.onTransitionEnd),T.on(ci.SLIDE_EVENTS.renderError,this.onError),T.on(ci.SLIDE_EVENTS.renderEnd,this.resolveReady),this.readyPromise.then(this.refreshPages)}destroy(){this.sideEffect.flushAll(),this.slide&&!this.destroyed&&(this.slide.destroy(),this.destroyed=!0),this.viewer.destroy()}getPageIndex(T){return(T>0?T:1)-1}renderSlideContainer(){if(!this.$slide){const T=document.createElement("div");T.className=this.wrapClassName("slide"),T.dataset.appKind="Slide",this.$slide=T}return this.$slide}wrapClassName(T){return`${this.namespace}-${T}`}}const $2=ci.Slide.usePlugin.bind(ci.Slide),rd="0.2.101",Q2={kind:"Slide",setup(_){var Z,nt,at,Tt,bt;if(console.log("[Slide] setup @ "+rd),_.getIsWritable()&&_.storage.ensureState(Qc),!_.storage.state.taskId)throw new Error("[Slide] no taskId");const T=_.getView();if(!T)throw new Error("[Slide] no view, please set scenePath on addApp()");T.disableCameraTransform=!0;const m=_.getBox();m.mountStyles(kv);try{m.$content.dataset.appSlideVersion=rd}catch{}const A=_.getInitScenePath();let E=null;const P=N=>{const R=_.getRoom();if(E&&E.slideController){let F=!1;R&&_.getIsWritable()&&($c(R,_,E.slideController.slide,A),F=!0),li("[Slide] page to",N,F?"(synced)":""),E.viewer.setPageIndex(N-1),E.viewer.setPaused(),E.onPageChanged();const W=E.viewer.pages.length;W>0&&_.dispatchAppEvent("pageStateChange",{index:N-1,length:W})}},D=N=>{const R=_.getAppOptions()||{},F=new nv({context:_,...N,onPageChanged:P,onNavigate:N.onNavigate,onRenderError:R.onRenderError,showRenderError:R.showRenderError,invisibleBehavior:R.invisibleBehavior});return exports.useFreezer&&jh.set(_.appId,F,m),Dr.setAppController(_.appId,F),F.readyPromise.then(N.onReady).then(()=>{const W=_.getRoom();let O=!1;W&&_.getIsWritable()&&($c(W,_,F.slide,A),O=!0);const j=F.slide.slideState.currentSlideIndex;li("[Slide] page to",j,O?"(synced)":"","(on ready)"),F.slide.on("renderEnd",N.onRenderEnd)}),F};E=new Bv({context:_,box:m,view:T,mountSlideController:D,mountWhiteboard:_.mountView.bind(_),baseScenePath:A,appId:_.appId,urlInterrupter:(Z=_.getAppOptions())==null?void 0:Z.urlInterrupter,enableScale:(at=(nt=_.getAppOptions())==null?void 0:nt.enableScale)!=null?at:!1,onPagesReady:({length:N})=>{const R=(E==null?void 0:E.viewer.pageIndex)||0;_.dispatchAppEvent("pageStateChange",{index:R,length:N})},onNavigate:(N,R)=>{li("[Slide] user navigate to",N,R?`(${R})`:"")}});const B=_.getAppOptions();E.setSyncEventQueuePolicy((Tt=B==null?void 0:B.syncEventQueuePolicy)!=null?Tt:"fifo"),E.setJustSildeReadonly((bt=B==null?void 0:B.justSildeReadonly)!=null?bt:!1);const z=_.getRoom(),X=new ua;return X.add(()=>{var N;return Dr.setAppContext(_.appId,_),Dr.enable=((N=_.getAppOptions())==null?void 0:N.debug)||!1,Dr.level="debug",()=>Dr.deleteApp(_.appId)}),z&&(E.toggleClickThrough(z.state.memberState.currentApplianceName),X.add(()=>{const N=R=>{R.memberState&&E&&E.toggleClickThrough(R.memberState.currentApplianceName)};return z.callbacks.on("onRoomStateChanged",N),()=>z.callbacks.off("onRoomStateChanged",N)})),_.emitter.on("destroy",()=>{li("[Slide] destroy",_.appId),exports.useFreezer&&jh.delete(_.appId),X.flushAll(),E&&(E.destroy(),E=null)}),E.mount(),{onScaleChanged:N=>{!E||(E.resizableContainer.onScaleChanged=N)},scaleView:N=>{let R=Number(N);Number.isNaN(R)&&(R=1),R<1&&(R=1),R>4&&(R=4),_.storage.setState({slideScale:R}),_.storage.setState({translateX:.5,translateY:.5}),E==null||E.resizableContainer.scaleContainer(R)},getViewScale:()=>E==null?void 0:E.resizableContainer.getScale(),translateView:(N,R)=>{var F,W;if(E!=null&&E.resizableContainer){const O=E.resizableContainer,j=_.getBox().$content.getBoundingClientRect(),Q=O.container.getBoundingClientRect(),G=Q.width-j.width,It=Q.height-j.height;if(G>0||It>0){const Vt=(F=O.translateX)!=null?F:.5,ot=(W=O.translateY)!=null?W:.5,V=G>0?N/G:0,U=It>0?R/It:0,ct=Math.max(0,Math.min(1,Vt+V)),tt=Math.max(0,Math.min(1,ot+U));_.storage.setState({translateX:ct,translateY:tt}),O.handleNormalizeTranslate(ct,tt,{triggerScrollBar:!0,triggerSync:!1})}}},setSildeReadonly:N=>{E==null||E.setJustSildeReadonly(N)},setSyncEventQueuePolicy:N=>{E==null||E.setSyncEventQueuePolicy(N)},viewer:()=>E,controller:()=>E==null?void 0:E.slideController,slide:()=>{var N;return(N=E==null?void 0:E.slideController)==null?void 0:N.slide},nextStep:()=>{var N;return E&&E.slideController?((N=E==null?void 0:E.slideController)==null||N.slide.nextStep(),!0):!1},prevStep:()=>{var N;return E&&E.slideController?((N=E==null?void 0:E.slideController)==null||N.slide.prevStep(),!0):!1},position:()=>{const N=E==null?void 0:E.slideController;if(N)return[N.page,N.pageCount]},nextPage:()=>{const N=E==null?void 0:E.slideController;if(N){const{page:R,pageCount:F}=N;if(F>0&&R<F)return N.jumpToPage(R+1),!0}return!1},prevPage:()=>{const N=E==null?void 0:E.slideController;if(N){const{page:R,pageCount:F}=N;if(F>0&&R>1)return N.jumpToPage(R-1),!0}return!1},jumpToPage:N=>{const R=E==null?void 0:E.slideController;if(R){const{page:F,pageCount:W}=R;if(W>0&&F>0&&F<=W)return R.jumpToPage(N),!0}return!1}}}};exports.DefaultUrl=od;exports.DocsViewer=vd;exports.SideEffectManager=ua;exports.Slide=ci.Slide;exports.SlideController=nv;exports.SlideControllerBase=ev;exports.SlideDocsViewer=Bv;exports.SlidePreviewer=Uv;exports.addHooks=K2;exports.apps=jh;exports.default=Q2;exports.getFreezerLength=X2;exports.log=li;exports.logger=Dr;exports.onCreated=q2;exports.onDestroyed=J2;exports.previewSlide=Z2;exports.setFreezerLength=Y2;exports.syncSceneWithSlide=$c;exports.usePlugin=$2;exports.version=rd;
8074
8074
  //# sourceMappingURL=main.cjs.js.map