@netless/slide 0.7.1 → 0.7.2
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/README.md +4 -0
- package/lib/Slide.js +1 -1
- package/package.json +2 -2
package/lib/Slide.js
CHANGED
|
@@ -234,4 +234,4 @@ SORTABLE_CHILDREN:!1},dg=function(){function t(){this.minX=1/0,this.minY=1/0,thi
|
|
|
234
234
|
* @pixi/spritesheet is licensed under the MIT License.
|
|
235
235
|
* http://www.opensource.org/licenses/mit-license
|
|
236
236
|
*/
|
|
237
|
-
var v_=function(){function t(t,e,i){void 0===i&&(i=null),this._texture=t instanceof Vd?t:null,this.baseTexture=t instanceof Ad?t:this._texture.baseTexture,this.textures={},this.animations={},this.data=e;var n=this.baseTexture.resource;this.resolution=this._updateResolution(i||(n?n.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}return t.prototype._updateResolution=function(t){void 0===t&&(t=null);var e=this.data.meta.scale,i=yu(t,null);return null===i&&(i=void 0!==e?parseFloat(e):1),1!==i&&this.baseTexture.setResolution(i),i},t.prototype.parse=function(e){this._batchIndex=0,this._callback=e,this._frameKeys.length<=t.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()},t.prototype._processFrames=function(e){for(var i=e,n=t.BATCH_SIZE;i-e<n&&i<this._frameKeys.length;){var r=this._frameKeys[i],s=this._frames[r],o=s.frame;if(o){var a=null,l=null,h=!1!==s.trimmed&&s.sourceSize?s.sourceSize:s.frame,c=new Mu(0,0,Math.floor(h.w)/this.resolution,Math.floor(h.h)/this.resolution);a=s.rotated?new Mu(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):new Mu(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),!1!==s.trimmed&&s.spriteSourceSize&&(l=new Mu(Math.floor(s.spriteSourceSize.x)/this.resolution,Math.floor(s.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[r]=new Vd(this.baseTexture,a,c,l,s.rotated?2:0,s.anchor),Vd.addToCache(this.textures[r],r)}i++}},t.prototype._processAnimations=function(){var t=this.data.animations||{};for(var e in t){this.animations[e]=[];for(var i=0;i<t[e].length;i++){var n=t[e][i];this.animations[e].push(this.textures[n])}}},t.prototype._parseComplete=function(){var t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)},t.prototype._nextBatch=function(){var e=this;this._processFrames(this._batchIndex*t.BATCH_SIZE),this._batchIndex++,setTimeout((function(){e._batchIndex*t.BATCH_SIZE<e._frameKeys.length?e._nextBatch():(e._processAnimations(),e._parseComplete())}),0)},t.prototype.destroy=function(t){var e;for(var i in void 0===t&&(t=!1),this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(null===(e=this._texture)||void 0===e||e.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null},t.BATCH_SIZE=1e3,t}(),__=function(){function t(){}return t.use=function(e,i){var n,r,s=this,o=e.name+"_image";if(e.data&&e.type===h_.TYPE.JSON&&e.data.frames&&!s.resources[o]){var a=null===(r=null===(n=e.data)||void 0===n?void 0:n.meta)||void 0===r?void 0:r.related_multi_packs;if(Array.isArray(a))for(var l=function(t){if("string"!=typeof t)return"continue";var i=t.replace(".json",""),n=Nc.resolve(e.url.replace(s.baseUrl,""),t);if(s.resources[i]||Object.values(s.resources).some((function(t){return Nc.format(Nc.parse(t.url))===n})))return"continue";var r={crossOrigin:e.crossOrigin,loadType:h_.LOAD_TYPE.XHR,xhrType:h_.XHR_RESPONSE_TYPE.JSON,parentResource:e,metadata:e.metadata};s.add(i,n,r)},h=0,c=a;h<c.length;h++){l(c[h])}var u={crossOrigin:e.crossOrigin,metadata:e.metadata.imageMetadata,parentResource:e},d=t.getResourcePath(e,s.baseUrl);s.add(o,d,u,(function(t){if(t.error)i(t.error);else{var n=new v_(t.texture,e.data,e.url);n.parse((function(){e.spritesheet=n,e.textures=n.textures,i()}))}}))}else i()},t.getResourcePath=function(t,e){return t.isDataUrl?t.data.meta.image:Nc.resolve(t.url.replace(e,""),t.data.meta.image)},t}();const y_={ColorMatrixFilter:xm,BlurFilter:cv,BlurFilterPass:hv};Mf.registerPlugin("interaction",Pm),Mf.registerPlugin("batch",Gf),Mf.registerPlugin("extract",Bg),vm.registerPlugin(_d);class x_ extends $a.a{constructor(){super(),this.prevTime=-1,this.times=0,this.valueTotal=0,this.destroyed=!1,this.value=0,this.calcFps()}calcFps(){requestAnimationFrame(t=>{const e=t-this.prevTime;this.valueTotal+=e,this.times+=1,this.times>20&&(this.value=Math.floor(1e3*this.times/this.valueTotal),this.valueTotal=0,this.times=0,this.destroyed||this.emit("update",this.value)),this.prevTime=t,this.destroyed||this.calcFps()})}destroy(){this.destroyed=!0}}var b_;!function(t){t.ResourceError="RESOURCE_ERROR",t.RuntimeError="RUNTIME_ERROR",t.RuntimeWarn="RUNTIME_WARN",t.CanvasCrash="CANVAS_CRASH"}(b_||(b_={}));class T_ extends Error{constructor(t,e){var i,n;super(e),i=this,n=new.target.prototype,Object.setPrototypeOf?Object.setPrototypeOf(i,n):i.__proto__&&(i.__proto__=n),this.errorType=t,this.errorMsg=e}static transform(t){return t instanceof T_?t:new T_(b_.RuntimeError,t.message)}}function E_(){return function(t,e,i){const n=i.value;i.value=function(...t){try{return n.apply(this,t)}catch(t){throw new T_(b_.RuntimeWarn,t.message)}}}}var w_=i(33),S_=i.n(w_),M_=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};function A_(){return o()}const P_="__delay_resolve_result__";function R_(t){return new Promise(e=>{setTimeout(()=>{e(P_)},t)})}function I_(t,e){return M_(this,void 0,void 0,(function*(){const i=yield Promise.race([t(),R_(e)]);return i===P_?P_:i}))}var C_=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};function L_(t,e){return C_(this,void 0,void 0,(function*(){const i=yield I_(()=>fetch(t),e);if(i===P_)throw new T_(b_.ResourceError,`"${t}" loaded timeout"`);if(!i.ok)throw new T_(b_.ResourceError,`"${t}" loaded failed with status "${i.status}"`);return i}))}class N_{constructor(t,e,i,n,r){this.timeout=15e3,this.useCache=!1,this.taskId="",this.delegate=null,this.useCache=e,this.localStorage=t,this.logger=i,this.timeout=n,this.delegate=r||null}attachTaskId(t){this.taskId=t}fetchJson(t){return C_(this,void 0,void 0,(function*(){let e;if(this.useCache&&(this.logger.info("load resource from cache. "+t,this.taskId||""),e=yield this.localStorage.getItem(t)),e)return this.logger.info("cache hit. "+t,this.taskId||""),e;{let e;if(this.delegate){this.logger.info("load resource by delegate. "+t,this.taskId||"");const i=yield I_(()=>this.delegate.loadJson(t),this.timeout);if(i===P_)throw new T_(b_.ResourceError,`"${t}" loaded timeout"`);e=JSON.parse(i)}else this.logger.info("load resource from server. "+t,this.taskId||""),e=yield(yield L_(""+t,this.timeout)).json();return this.logger.info("load end. "+t,this.taskId||""),this.useCache&&this.localStorage.setItem(t,e).catch(()=>{}),e}}))}fetchPng(t){return C_(this,void 0,void 0,(function*(){let e;if(this.useCache&&(this.logger.info("load resource from cache. "+t,this.taskId||""),e=yield this.localStorage.getItem(t)),e)return this.logger.info("cache hit. "+t,this.taskId||""),e;{let i;if(this.delegate){if(this.logger.info("load resource by delegate. "+t,this.taskId||""),i=yield I_(()=>this.delegate.loadImage(t),this.timeout),i===P_)throw new T_(b_.ResourceError,`"${t}" loaded timeout"`)}else{this.logger.info("load resource from server. "+t,this.taskId||"");const e=yield L_(t,this.timeout);i=yield e.blob()}return e=yield function(t){return new Promise((e,i)=>{const n=new FileReader;n.onload=()=>{e(n.result)},n.onerror=()=>{i(new T_(b_.ResourceError,"Failed parse blob data."))},n.readAsDataURL(t)})}(i),this.logger.info("load end. "+t,this.taskId||""),this.useCache&&this.localStorage.setItem(t,e).catch(()=>{}),e}}))}destroy(){}}var O_=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class D_{constructor(t){this.isPaused=!1,this.timestamp=0,this.callbackList=[],this.onTimeUpdate=t=>{const e=t/(Ac.TARGET_FPMS||.06);if(!this.isPaused){this.timestamp+=e,this.callbackList=this.callbackList.filter(t=>t&&!t.applied);let{length:t}=this.callbackList;for(let e=0;e<t;e++){const i=this.callbackList[e];if(i&&!i.applied){if(!(i.triggerTime<=this.timestamp))break;i.running=!0,i.fn(),i.applied=!0,t=this.callbackList.length}}}},this.ticker=t,this.ticker.add(this.onTimeUpdate)}setTimeout(t,e){const i=A_(),n=this.timestamp+Math.max(e||16,16);return this.callbackList.push({fn:t,triggerTime:n,id:i,applied:!1,running:!1}),this.callbackList.sort((t,e)=>t.triggerTime-e.triggerTime),i}clearTimeout(t){const e=this.callbackList.findIndex(e=>e.id===t);e>=0&&!this.callbackList[e].running&&this.callbackList.splice(e,1)}delay(t){return new Promise(e=>{this.setTimeout(e,t)})}waitUntil(t,e){return O_(this,void 0,void 0,(function*(){const i=this.timestamp;for(;!t()&&this.timestamp-i<e;)yield this.delay(50)}))}pause(){this.isPaused=!0}resume(){this.isPaused=!1}}var F_=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};function U_(t,e,i){return i?Math.floor(parseFloat(t)*e):Math.ceil(parseFloat(t)*e)}const k_={w:!0,h:!0,x:!0,y:!0};class B_{constructor(t){this.gifs=Object.create(null),this.textures=Object.create(null),this.frames=Object.create(null),this.spriteSheets=[],this.loader=t}getTexture(t){return this.textures[t]||null}getFrameData(t){return this.frames[t]}getGifFrames(t){return this.gifs[t]?this.gifs[t].filter(t=>!!t):[]}loadSpriteSheetItem(t,e,i,n){return F_(this,void 0,void 0,(function*(){const r=yield this.loader.fetchJson(`${t}/${e}/jsonOutput/${i}.json`),s=yield this.loader.fetchPng(`${t}/${e}/jsonOutput/${i}.png`),o=document.createElement("img");o.src=s,yield new Promise((t,e)=>{o.onload=()=>t(""),o.onerror=()=>e(new Error("load sprite image failed"))});let a=n;const l=o.width||1,h=o.height||1;if(l>2048||h>2048){a*=2048/l;const t=a*h;t>2048&&(a*=h/t)}!function(t,e){t.meta&&t.meta.size&&["w","h"].forEach(i=>{t.meta.size[i]=U_(t.meta.size[i],e,k_[i])}),t.frames&&Object.keys(t.frames).forEach(i=>{t.frames[i].frame&&["x","y","w","h"].forEach(n=>{t.frames[i].frame[n]=U_(t.frames[i].frame[n],e,k_[n])}),t.frames[i].spriteSourceSize&&["x","y","w","h"].forEach(n=>{t.frames[i].spriteSourceSize[n]=U_(t.frames[i].spriteSourceSize[n],e,k_[n])}),t.frames[i].sourceSize&&["w","h"].forEach(n=>{t.frames[i].sourceSize[n]=U_(t.frames[i].sourceSize[n],e,k_[n])})})}(r,a);const c=document.createElement("canvas"),u=Math.ceil(o.width*a),d=Math.ceil(o.height*a);c.width=u,c.height=d;c.getContext("2d").drawImage(o,0,0,u,d);const p=new Ad(c,{resolution:1}),f=new v_(p,r);yield new Promise(t=>{f.parse(()=>t(""))}),this.spriteSheets.push(f),Object.keys(f.textures).forEach(t=>{const e=t.match(/^(.+)_gif_(\d+)$/);if(e&&e[1]&&e[2]){const i=e[1];this.gifs[i]||(this.gifs[i]=[]);const n=parseInt(e[2],10);this.gifs[i][n]=f.textures[t]}else this.frames[t]=r.frames[t],this.textures[t]=f.textures[t]})}))}destroy(){this.spriteSheets.forEach(t=>t.destroy(!0)),this.spriteSheets=[],this.gifs=Object.create(null),this.textures=Object.create(null),this.frames=Object.create(null)}}var G_=i(5),H_=i.n(G_),j_=i(2),z_=i.n(j_);function V_(t,e,i){let n,r;const s=Math.round(t)%360;if(s%180==0)n=Math.cos(s*(Math.PI/180))*e,r=0;else if(s%90==0)n=0,r=Math.sin(s*(Math.PI/180))*i;else{const t=function(t){const e=t*Math.PI/180;return Math.tan(e)}(s);n=e*i/Math.sqrt(Math.pow(i,2)+Math.pow(e*t,2)),(s>90&&s<270||s<-90&&s>-270)&&(n=-n),r=t*n}return{x:n,y:r}}function W_(t,e,i,n,r,s){const o=t,a=e;let l,h,c,u,d;if(0===Math.round(n))l=r,h=s,d=0;else if(Math.round(n)>=360)l=r,h=s,c=r+2*t*Math.abs(Math.cos(-i/180*Math.PI)),u=s+2*e*Math.sin(-i/180*Math.PI),d=1;else{const t=-i,e=-(i+n),{x:c,y:u}=V_(t,o,a),p=r-c,f=s+u,{x:m,y:g}=V_(e,o,a);l=m+p,h=f-g,d=n>=-360&&n<-180?1:n>=-180&&n<0||n>0&&n<180?0:1}return{radiusX:o,radiusY:a,xAxisRotation:0,largeArcFlag:d,sweepFlag:n>0?1:0,endX:l,endY:h,middleX:c,middleY:u}}class X_{constructor(){this.pool=[]}getObject(t){const e=this.pool.find(t=>!t.isUsed);if(e)return e.isUsed=!0,e.obj;{const e={obj:this.createObject(),isUsed:!0,group:t};return this.pool.push(e),e.obj}}collectObject(t){const e=this.pool.find(e=>e.obj===t);e&&(e.isUsed=!1,this.resetObject(e.obj))}collectObjectByGroup(t){this.pool.filter(e=>e.group===t).forEach(t=>this.collectObject(t.obj))}}const Y_=new class extends X_{createObject(){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("version","1.1"),t}resetObject(t){t.removeAttribute("viewBox"),t.removeAttribute("width"),t.removeAttribute("height"),t.innerHTML=""}};const q_=new class extends X_{createObject(){return document.createElement("img")}resetObject(t){t.removeAttribute("src")}};var Z_=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class J_{constructor(){this.imgElements=[],this.svgElements=[],this.idToHashMap=Object.create(null),this.textures=Object.create(null),this.graphics=[],this.hashToIdMap=Object.create(null)}render(t,e,i){return Z_(this,void 0,void 0,(function*(){const{items:e,width:n,height:r}=t,s=q_.getObject(i),o=new Ad(s,{width:n,height:r,resolution:1}),a=Y_.getObject(i);this.imgElements.push(s),this.svgElements.push(a),a.setAttribute("viewBox",`0 0 ${n} ${r}`),a.setAttribute("width",""+n),a.setAttribute("height",""+r);const l={},h={};e.forEach(t=>{const{item:e,x:i,y:n}=t,r=i+2,s=n+2;e.pathsData.forEach(t=>{let e="";t.cmds.forEach(([i,n])=>{e+=i+" ",e+=n.map(e=>(z_()(e)||(e.x=e.x+t.offset.x+r,e.y=e.y+t.offset.y+s),e)).reduce((t,e)=>(z_()(e)?t+=e+" ":t+=`${e.x} ${e.y} `,t),""),e+=" "}),t.pathElement.setAttribute("d",e),a.appendChild(t.pathElement)});const c=e.width-4-2*e.padding,u=e.height-4-2*e.padding;this.textures[e.hash]={texture:new Vd(o,new Mu(r+2,s+2,c,u)),pivot:e.pivot},l[e.hash]={x:r+2,y:s+2,w:c,h:u,pivot:e.pivot},h[e.hash]=this.hashToIdMap[e.hash]});const c=(u='<?xml version="1.0" encoding="utf-8"?>'+a.outerHTML,"data:image/svg+xml,"+encodeURIComponent(u).replace(/'/g,"%27").replace(/"/g,"%22"));var u;s.src=c,yield new Promise((t,e)=>{s.onload=()=>t(""),s.onerror=()=>e()})}))}getGraphicsData(t){const e=this.idToHashMap[t]||"";return this.textures[e]||null}addGraphics(t,e,i,n,r,s,o,a,l,h,c){var u,d;if(!o&&!l)return t;const p=H_()(i+(null!==(d=null===(u=null==o?void 0:o.width)||void 0===u?void 0:u.toString())&&void 0!==d?d:0)+l+h+c);if(this.hashToIdMap[p]||(this.hashToIdMap[p]=[]),this.hashToIdMap[p].push(t),this.idToHashMap[t]=p,this.graphics.findIndex(t=>t.hash===p)<0){const{graphicsWidth:t,graphicsHeight:i,pathsData:a,pivot:u,padding:d}=function(t,e,i,n,r,s,o,a,l){var h;const c=[],u={x:Math.abs(r.x),y:Math.abs(r.y)};let d=0,p=0,f=0,m=0,g=0,v="none";const _=null!==(h=null==n?void 0:n.width)&&void 0!==h?h:0;return o?(d=e,p=i,g=0):(v=l||"#ff0000",g=_,f=.5*_,m=.5*_,d=e+_,p=i+_,u.x+=.5*_,u.y+=.5*_),d+=Math.abs(r.x),p+=Math.abs(r.y),f+=Math.abs(r.x),m+=Math.abs(r.y),d+=4,p+=4,f+=2,m+=2,d=Math.ceil(d),p=Math.ceil(p),t.forEach(t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","path");"none"!==t.fill&&o?e.setAttribute("fill",a||"#ff0000"):e.setAttribute("fill","none"),t.hasStroke&&!o&&(e.setAttribute("stroke-linecap",(null==n?void 0:n.cap)||"butt"),e.setAttribute("stroke-linejoin",(null==n?void 0:n.join)||"miter"),e.setAttribute("stroke-width",g.toString()),e.setAttribute("stroke",v),(null==n?void 0:n.dash)&&e.setAttribute("stroke-dasharray",n.dash));const{scale:i}=t,r=t.path.trim().split(" ");let s={x:0,y:0};const l={offset:{x:f,y:m},cmds:[],pathElement:e};for(let t=0;t<r.length;t+=2){const e=r[t],n=r[t+1];if("M"===e){let[t,e]=n.split(",").map(t=>Number(t));s={x:t,y:e},t=t/9525*i.x,e=e/9525*i.y,l.cmds.push(["M",[{x:t,y:e}]])}else if("A"===e){const[t,e,r,o]=n.split(",").map(t=>Number(t)),a=r/Math.PI*180,h=o/Math.PI*180,c=W_(t,e,a,h,s.x,s.y);Math.round(h)>=360?(s={x:c.endX,y:c.endY},l.cmds.push(["A",[c.radiusX/9525*i.x,c.radiusY/9525*i.y,c.xAxisRotation,c.largeArcFlag,c.sweepFlag,{x:c.middleX/9525*i.x,y:c.middleY/9525*i.y}]]),l.cmds.push(["A",[c.radiusX/9525*i.x,c.radiusY/9525*i.y,c.xAxisRotation,c.largeArcFlag,c.sweepFlag,{x:c.endX/9525*i.x,y:c.endY/9525*i.y}]])):(s={x:c.endX,y:c.endY},l.cmds.push(["A",[c.radiusX/9525*i.x,c.radiusY/9525*i.y,c.xAxisRotation,c.largeArcFlag,c.sweepFlag,{x:c.endX/9525*i.x,y:c.endY/9525*i.y}]]))}else if("L"===e){let[t,e]=n.split(",").map(t=>Number(t));s={x:t,y:e},t=t/9525*i.x,e=e/9525*i.y,l.cmds.push(["L",[{x:t,y:e}]])}else if("QB"===e){let[t,e,r,o]=n.split(",").map(t=>Number(t));s={x:r,y:o},t=t/9525*i.x,e=e/9525*i.y,r=r/9525*i.x,o=o/9525*i.y,l.cmds.push(["Q",[{x:t,y:e},{x:r,y:o}]])}else if("CB"===e){let[t,e,r,o,a,h]=n.split(",").map(t=>Number(t));s={x:a,y:h},t=t/9525*i.x,e=e/9525*i.y,r=r/9525*i.x,o=o/9525*i.y,a=a/9525*i.x,h=h/9525*i.y,l.cmds.push(["C",[{x:t,y:e},{x:r,y:o},{x:a,y:h}]])}else"C"===e&&l.cmds.push(["Z",[]])}c.push(l)}),{graphicsWidth:d,graphicsHeight:p,pivot:u,padding:2,pathsData:c}}(e,r,s,o,n,0,l,h,c);this.graphics.push({hash:p,pathsData:a,pivot:u,width:t,height:i,padding:d})}return t}pack(){this.graphics.forEach(t=>{t.width+=4,t.height+=4});return function t(e){const i=[],n=e.filter(t=>{const e=t.width<2048&&t.height<2048;return e||i.push(t),e}).sort((t,e)=>t.width*t.height-e.width*e.height);let r=n.length+1,s=2050,o=2050;const a=[];let l=null;for(;(s>2048||o>2048)&&n.length>0;)r-=1,l=S_()(n.slice(0,r)),s=l.width,o=l.height;return l&&a.push(l),i.forEach(t=>{const e=S_()([t]);a.push(e)}),r<n.length?a.concat(t(n.slice(r))):a}(this.graphics)}destroy(){Object.keys(this.textures).forEach(t=>{var e;null===(e=this.textures[t])||void 0===e||e.texture.destroy(!0)}),this.textures=Object.create(null),this.imgElements.forEach(t=>q_.collectObject(t)),this.svgElements.forEach(t=>Y_.collectObject(t)),this.graphics=[]}}class K_{constructor(){this.runningTimeNodes={}}addRunningTimeNode(t,e,i){const n=`${e}_${t}`;if(this.runningTimeNodes[n])try{this.runningTimeNodes[n].dispose(!0)}catch(t){}this.runningTimeNodes[n]=i}removeRunningTimeNode(t,e){const i=`${e}_${t}`;delete this.runningTimeNodes[i]}}class $_{constructor(t){this.eventHub=t,this.targets=Object.create(null)}getTargets(){return Object.keys(this.targets).map(t=>this.targets[t])}addTarget(t,e){this.targets[t]=e}getTargetById(t){return this.targets[t]}getTarget(t,e,i={type:"el",index:0,id:""}){var n,r;let s=this.targets[t.id];return"shape"!==t.type?s:("shape"===t.type&&t.txEl&&(s=null!==(n=null==s?void 0:s.getTextElement(t.txEl.type,t.txEl.range))&&void 0!==n?n:null),"shape"===t.type&&t.bg&&0===i.index&&(e=!1,s=null!==(r=null==s?void 0:s.getBgElement())&&void 0!==r?r:null,this.eventHub.emit("IterateTimeNodeEnd",i.id)),e&&s?s.getIterateEntry(i.type,i.index,i.id):(s||this.eventHub.emit("IterateTimeNodeEnd",i.id),s))}clearTargets(){this.targets=Object.create(null)}}var Q_=i(10),ty=i.n(Q_);class ey{constructor(t){this.target=t}get color(){return this.target.strokeColorFilter.currentColor}set color(t){this.target.strokeColorFilter.color=t}get on(){return this.target.strokeActive?"true":"false"}set on(t){this.target.strokeActive="true"===t}}class iy{constructor(t){this.applyCommand=(t,e)=>{this.target.applyCommand(t,e)},this.target=t,this.applyCommand=ty()(this.applyCommand,100,{maxWait:500})}}class ny{constructor(t){this.target=t}get color(){return this.target.fillColorFilter.currentColor}set color(t){this.target.fillActive&&(this.target.fillColorFilter.color=t)}get on(){return this.target.fillActive?"true":"false"}set on(t){this.target.fillActive="true"===t}get designColor(){return this.target.fillColorFilter.designColor}}class ry{constructor(t,e,i){this.hardHidden=!1,this.designRotation=0,this.target=t,!0===e&&(this.hardHidden=!0),this.designRotation=i}get opacity(){return this.target.alpha}set opacity(t){this.target.alpha=t}get rotation(){return this.target.rotation/Math.PI*180}set rotation(t){this.target.rotation=t/180*Math.PI+this.designRotation}get visibility(){return this.target.visible?"visible":"hidden"}set visibility(t){this.visibility===t||this.hardHidden||(this.target.visible="visible"===t)}}class sy{constructor(t,e){this.actions=[],this.ctx=e,this.object=t,this.object.interactive=!0}reset(t){this.object.interactive=!1,this.object.removeAllListeners(),this.object=t,this.object.interactive=!0}addAction(t,e){this.actions.push([t,e]),"click"===e?(this.object.addListener("click",()=>this.handleAction(t)),this.object.cursor="pointer"):"hover"===e&&this.object.addListener("mouseover",()=>this.handleAction(t))}addProxy(t){this.proxy=t,this.hitArea=this.getOriginHitArea(),this.proxy.interactive=!0,this.actions.forEach(([t,e])=>{var i,n;"click"===e?null===(i=this.proxy)||void 0===i||i.addListener("click",e=>this.handleProxyAction(e,t)):"hover"===e&&(null===(n=this.proxy)||void 0===n||n.addListener("mouseover",e=>this.handleProxyAction(e,t)))})}handleProxyAction(t,e){var i;const n=t.data.global,r=this.object.getGlobalPosition(),s=n.x-r.x+this.object.pivot.x,o=n.y-r.y+this.object.pivot.y;(null===(i=this.hitArea)||void 0===i?void 0:i.contains(s,o))&&this.object.visible&&this.handleAction(e,!0)}getOriginHitArea(){return this.object.hitArea?this.object.hitArea:new Iu(0,0,this.object.width,this.object.height)}handleAction(t,e=!1){this.proxy&&!e||(this.ctx.eventHub.emit(Nb.hyperlinkTrigger,t),this.execAction(t))}execAction(t){var e;if(this.ctx.eventHub.emit(Nb.userInput),"ppaction://hlinksldjump"===t.action){const i=(null!==(e=null==t?void 0:t.target)&&void 0!==e?e:"").match(/slide(\d+)\.xml/);i&&i[1]&&this.ctx.eventHub.emit(Nb.requestGotoSlide,Number(i[1]))}else if("ppaction://hlinkshowjump?jump=nextslide"===t.action)this.ctx.eventHub.emit(Nb.requestNextSlide);else if("ppaction://hlinkshowjump?jump=previousslide"===t.action)this.ctx.eventHub.emit(Nb.requestPrevSlide);else if("ppaction://hlinkshowjump?jump=firstslide"===t.action)this.ctx.eventHub.emit(Nb.requestGotoSlide,1);else if("ppaction://hlinkshowjump?jump=lastslide"===t.action)this.ctx.eventHub.emit(Nb.requestGotoSlide,-1);else if("ppaction://hlinkshowjump?jump=lastslideviewed"===t.action){const t=this.ctx.lastViewedIndex;this.ctx.eventHub.emit(Nb.requestGotoSlide,t)}else"ppaction://hlinkshowjump?jump=endshow"===t.action&&this.ctx.eventHub.emit(Nb.requestGotoSlide,-1)}}function oy(t,e,i=5){return Math.abs(t-e)<=Math.pow(10,-i)}function ay(t){return Math.floor(1e6*t)/1e6}class ly{constructor(){this.point={x:0,y:0},this.slope=Math.PI/4}static fromPointSlope(t,e){const i=new ly;return i.point=t,i.slope=e,i}resolveY(t){return Math.tan(this.slope)*(t-this.point.x)+this.point.y}distanceToLinearEquation(t){return oy(this.slope,t.slope)?this.distanceToPoint(t.point):-1}distanceToPoint(t){let e=0;if(Math.tan(this.slope)*(t.x-this.point.x)+this.point.y===t.y)return 0;e=this.slope>=Math.PI/2?this.slope-Math.PI/2:Math.PI/2+this.slope;const i=ly.fromPointSlope(t,e),n=this.crossPoint(i);return n?Math.ceil(Math.sqrt(Math.pow(n.x-t.x,2)+Math.pow(n.y-t.y,2))):0}crossPoint(t){if(oy(t.slope,this.slope))return null;let e=0,i=0;const n=Math.tan(t.slope),r=Math.tan(this.slope),{x:s,y:o}=this.point,{x:a,y:l}=t.point;return oy(this.slope,Math.PI/2)?(e=this.point.x,i=n*(e-a)+l):oy(t.slope,Math.PI/2)?(e=t.point.x,i=r*(e-s)+o):oy(this.slope,Math.PI)||oy(this.slope,0)?(i=this.point.y,e=(i-l)/n+a):oy(t.slope,Math.PI)||oy(t.slope,0)?(i=t.point.y,e=(i-o)/r+s):(e=(n*a-l+o-r*s)/(n-r),i=r*(e-s)+o),{x:e,y:i}}}class hy{constructor(t,e,i){var n,r,s,o,a,l;this.scaleExt={x:1,y:1},this.scaleOrigin={x:1,y:1},this.designScale={x:1,y:1},this.bound=new Mu(0,0,1,1),this.pptX=0,this.pptY=0,this.presetSubType=0,this.designWidth=0,this.designHeight=0,this.designX=0,this.designY=0,this.hasPreset=!1,this.container=new pd,this.ctx=e,this.style=new ry(this.container,!!t.hardHidden,t.rotation||0),this.designGlobalPosition={x:i.x+(null!==(r=null===(n=t.position)||void 0===n?void 0:n.x)&&void 0!==r?r:0),y:i.y+(null!==(o=null===(s=t.position)||void 0===s?void 0:s.y)&&void 0!==o?o:0)},this.container.interactive=!0,(t.hlinkClick||t.hlinkHover)&&(this.hyperlink=new sy(this.container,this.ctx),t.hlinkHover&&(null===(a=this.hyperlink)||void 0===a||a.addAction(t.hlinkHover,"hover")),t.hlinkClick&&(null===(l=this.hyperlink)||void 0===l||l.addAction(t.hlinkClick,"click"))),this.ctx.clock.waitUntil(()=>{try{return!!this.container.width}catch(t){return!1}},3e3).then(()=>{try{this.designWidth=this.designWidth||this.container.width}catch(t){}}),this.ctx.clock.waitUntil(()=>{try{return!!this.container.height}catch(t){return!1}},3e3).then(()=>{try{this.designHeight=this.designHeight||this.container.height}catch(t){}})}updateScale(){this.container&&(this.container.scale.x=this.designScale.x*this.scaleExt.x*this.scaleOrigin.x,this.container.scale.y=this.designScale.y*this.scaleExt.y*this.scaleOrigin.y)}updateTransform(t){var e,i,n,r,s,o,a,l;this.designWidth=t.width,this.designHeight=t.height,this.designX=null!==(i=null===(e=t.position)||void 0===e?void 0:e.x)&&void 0!==i?i:0,this.designY=null!==(r=null===(n=t.position)||void 0===n?void 0:n.y)&&void 0!==r?r:0;const h=this.designWidth/2,c=this.designHeight/2;this.container.width=this.designWidth,this.container.height=this.designHeight,this.container.pivot.x=h,this.container.pivot.y=c;const u=null!==(o=null===(s=t.position)||void 0===s?void 0:s.x)&&void 0!==o?o:0,d=null!==(l=null===(a=t.position)||void 0===a?void 0:a.y)&&void 0!==l?l:0;this.container.x=u+h,this.container.y=d+c,t.scale&&(this.designScale={x:t.scale.x,y:t.scale.y},this.container.scale.x=t.scale.x,this.container.scale.y=t.scale.y),t.rotation&&(this.container.rotation=t.rotation);const p=new Jv;p.drawRect(0,0,this.designWidth,this.designHeight),this.container.addChild(p),this.json.hardHidden&&(this.container.visible=!1),this.bound.x=u,this.bound.y=d,this.bound.width=this.designWidth,this.bound.height=this.designHeight}get scale(){return this.scaleOrigin}set scale(t){this.scaleOrigin.x=t.x,this.scaleOrigin.y=t.y,this.updateScale()}get design_ppt_w(){return ay(this.designWidth/this.ctx.stageWidth)}get design_ppt_h(){return ay((this.designHeight||this.container.height)/this.ctx.stageHeight)}get design_ppt_x(){return ay(this.designX/this.ctx.stageWidth)}get design_ppt_y(){return ay(this.designY/this.ctx.stageHeight)}get ppt_w(){return this.scaleExt.x*this.scaleOrigin.x*this.designWidth/this.ctx.stageWidth}set ppt_w(t){this.designWidth&&(this.scaleExt.x=t*this.ctx.stageWidth/this.designWidth,this.updateScale())}get ppt_h(){const t=this.designHeight||this.container.height;return this.scaleExt.y*this.scaleOrigin.y*t/this.ctx.stageHeight}set ppt_h(t){this.designHeight&&(this.scaleExt.y=t*this.ctx.stageHeight/this.designHeight,this.updateScale())}get ppt_x(){return(this.container.position.x-this.container.pivot.x)/this.ctx.stageWidth}set ppt_x(t){this.pptX=t;const e=544===this.presetSubType?this.scaleExt.x:1;this.container.position.x=t*this.ctx.stageWidth+this.container.pivot.x*e}get ppt_y(){return(this.container.position.y-this.container.pivot.y)/this.ctx.stageHeight}set ppt_y(t){this.pptY=t;const e=544===this.presetSubType?this.scaleExt.y:1;this.container.position.y=t*this.ctx.stageHeight+this.container.pivot.y*e}get r(){return this.container.rotation}set r(t){this.container.rotation=t}set xshear(t){this.container.skew.x=t}get xshear(){return this.container.skew.x}set yshear(t){this.container.skew.y=t}get yshear(){return this.container.skew.y}}var cy=i(90),uy=i.n(cy);class dy{constructor(t){if(this._isInit=!1,this.h=0,this.s=0,this.l=0,this.a=1,t){this._isInit=!0;const e=t.match(/-?[0-9]+/g);e&&(this.h=parseInt(e[0],10),this.s=parseInt(e[1],10)/100,this.l=parseInt(e[2],10)/100)}}isInit(){return this._isInit}by(t,e){e.h=Math.max(Math.min(this.h+t.h,359),0),e.s=Math.max(Math.min(this.s+t.s,1),0),e.l=Math.max(Math.min(this.l+t.l,1),0),e.a=Math.max(Math.min(this.a+t.a,1),0)}fromHexString(t){const[e,i,n,r]=my(t);let s=0,o=0,a=0;const l=Math.max(e,i,n),h=Math.min(e,i,n),c=l-h;a=(l+h)/2,0===c?s=0:l===e?s=(i-n)/c%6*60:l===i?s=60*((n-e)/c+2):l===n&&(s=60*((e-i)/c+4)),o=0===c?0:c/(1-Math.abs(2*a-1)),this.h=s,this.s=o,this.l=a,this.a=r}interpolationFrom(t,e,i){const n=t.h+(this.h-t.h)*e,r=t.s+(this.s-t.s)*e,s=t.l+(this.l-t.l)*e,o=t.a+(this.a-t.a)*e;i.h=Math.max(Math.min(n,359),0),i.s=Math.max(Math.min(r,1),0),i.l=Math.max(Math.min(s,1),0),i.a=Math.max(Math.min(o,1),0)}toHexString(){let t=[0,0,0,0];const{h:e,s:i,l:n}=this;if(e<360&&e>=0&&i<=1&&i>=0&&n<=1&&n>=0){let r,s,o;const a=(1-Math.abs(2*n-1))*i,l=a*(1-Math.abs(e/60%2-1)),h=n-a/2;[r,s,o]=e>=0&&e<60?[a,l,0]:e>=60&&e<120?[l,a,0]:e>=120&&e<180?[0,a,l]:e>=180&&e<240?[0,l,a]:e>=240&&e<300?[l,0,a]:[a,0,l],t=[r+h,s+h,o+h,this.a]}return gy(t)}}class py{constructor(t){this._isInit=!1,this.r=0,this.g=0,this.b=0,this.a=0,t&&(this._isInit=!0,this.fromHexString(t))}fromHexString(t){const[e,i,n,r]=my(t);this.r=e,this.g=i,this.b=n,this.a=r}isInit(){return this._isInit}interpolationFrom(t,e,i){i.r=t.r+(this.r-t.r)*e,i.g=t.g+(this.g-t.g)*e,i.b=t.b+(this.b-t.b)*e,i.a=t.a+(this.a-t.a)*e}by(t,e){e.r=Math.min(Math.max(this.r+t.r,0),255),e.g=Math.min(Math.max(this.g+t.g,0),255),e.b=Math.min(Math.max(this.b+t.b,0),255),e.a=Math.min(Math.max(this.a+t.a,0),1)}toHexString(){return gy([this.r,this.g,this.b,this.a])}}function fy(t){const e=t.substring(1);return[parseInt(e.substring(0,6),16),parseInt(e.substring(6,8),16)/255]}function my(t){return 0===(t=t.replace(/^#/,"")).substring(6,8).length&&(t+="FF"),[parseInt(t.substring(0,2).padStart(8,"0"),16)/255,parseInt(t.substring(2,4).padStart(8,"0"),16)/255,parseInt(t.substring(4,6).padStart(8,"0"),16)/255,parseInt(t.substring(6,8).padStart(8,"0"),16)/255]}function gy(t){return"#"+Math.round(255*t[0]).toString(16).padStart(2,"0")+Math.round(255*t[1]).toString(16).padStart(2,"0")+Math.round(255*t[2]).toString(16).padStart(2,"0")+Math.round(255*t[3]).toString(16).padStart(2,"0")}function vy(t,e,i){const n=my(t),r=my(e),s=Math.round(255*(n[0]+(r[0]-n[0])*i)),o=Math.round(255*(n[1]+(r[1]-n[1])*i)),a=Math.round(255*(n[2]+(r[2]-n[2])*i)),l=Math.round(255*(n[3]+(r[3]-n[3])*i));return"#"+s.toString(16).padStart(2,"0")+o.toString(16).padStart(2,"0")+a.toString(16).padStart(2,"0")+l.toString(16).padStart(2,"0")}class _y extends Wp{constructor(){super(void 0,"\nvarying vec2 vTextureCoord;\n\nuniform vec4 color;\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n\n if (texColor.a > 0.0) {\n vec4 resultColor = color;\n resultColor = resultColor * texColor.a;\n gl_FragColor = resultColor;\n } else {\n gl_FragColor = texColor;\n }\n}\n",{color:new Float32Array([0,0,0,0]),active:0}),this.currentColor="#FFFFFFFF",this.designColor="#FFFFFFFF"}set color(t){this.currentColor=t;const e=my(t);this.uniforms.color=Float32Array.from(e)}get color(){return this.currentColor}}const yy=new y_.ColorMatrixFilter;yy.matrix=[1,0,0,0,-.2,0,1,0,0,-.2,0,0,1,0,-.2,0,0,0,1,0];const xy=new y_.ColorMatrixFilter;xy.matrix=[1,0,0,0,-.1,0,1,0,0,-.1,0,0,1,0,-.1,0,0,0,1,0];const by=new y_.ColorMatrixFilter;by.matrix=[1,0,0,0,.2,0,1,0,0,.2,0,0,1,0,.2,0,0,0,1,0];const Ty=new y_.ColorMatrixFilter;Ty.matrix=[1,0,0,0,.1,0,1,0,0,.1,0,0,1,0,.1,0,0,0,1,0];const Ey={darken:yy,darkenLess:xy,lightenLess:Ty,lighten:by};class wy extends hy{constructor(t,e,i){super({position:{x:t.x,y:t.y},width:t.width,height:t.height},e,i),this.fillColorFilter=new _y,this.fill=new ny(this),this.json=t,this.ctx=e,this.parentGlobalPos=i,this.global={x:i.x+t.x,y:i.y+t.y},this.updateTransform({position:{x:t.x,y:t.y},width:t.width,height:t.height})}get fillActive(){var t,e;return(null!==(e=null===(t=this.container.filters)||void 0===t?void 0:t.length)&&void 0!==e?e:-1)>0}set fillActive(t){var e,i;t?(null!==(i=null===(e=this.container.filters)||void 0===e?void 0:e.indexOf(this.fillColorFilter))&&void 0!==i?i:-1)<0&&(this.container.filters=[this.fillColorFilter]):this.container.filters=[]}get renderContainer(){return this.container}get interactiveContainer(){return this.container}clearOnSlideChange(){}initOnReuse(){}getTextElement(){return null}getBgElement(){return null}get ppt_x(){return this.global.x/this.ctx.stageWidth}set ppt_x(t){const e=t*this.ctx.stageWidth-this.global.x,i=544===this.presetSubType?this.scaleExt.x:1;this.container.position.x=this.designX+e+this.container.pivot.x*i}get ppt_y(){return this.global.y/this.ctx.stageHeight}set ppt_y(t){const e=t*this.ctx.stageHeight-this.global.y,i=544===this.presetSubType?this.scaleExt.y:1;this.container.position.y=this.designY+e+this.container.pivot.y*i}get design_ppt_x(){return ay(this.global.x/this.ctx.stageWidth)}get design_ppt_y(){return ay(this.global.y/this.ctx.stageHeight)}}class Sy{constructor(t,e,i,n,r,s,o,a,l,h,c){this.ctx=t,this.type=e,this.lineWidth=i,this.width=n,this.height=r,this.fillColor=s,this.isHorz=o,this.renderContainer=new pd,this.ghcTextureId=`${a}-text-p${l}-l${h}-u${c}-underLine`}createPaths(){if("ww"===this.type)return null;{let t=`M 0,0 L ${9525*this.width},0`,[e,i]=[this.width,this.lineWidth];return this.isHorz||(t="M 0,0 L 0,"+9525*this.height,[e,i]=[this.lineWidth,this.height]),{paths:[{id:A_(),path:t,fill:"norm",hasStroke:!0,scale:{x:1,y:1},hash:H_()(t)}],width:e,height:i}}}getLineStyle(){const t={width:this.lineWidth};return"dotted"===this.type&&(t.dash=""+this.lineWidth),t}preRender(){const t=this.createPaths();if(t){const{paths:e,width:i,height:n}=t,r=e.reduce((t,e)=>t+e.hash,"");this.ctx.graphicsTexture.addGraphics(this.ghcTextureId,e,r,{x:0,y:0},i,n,this.getLineStyle(),this.ctx.objectPoolGroup,!1,null,this.fillColor)}}render(){if(this.ghcTextureId){const t=this.ctx.graphicsTexture.getGraphicsData(this.ghcTextureId);t&&(this.sprite=new fm,this.sprite.texture=t.texture,this.sprite.pivot.x=t.pivot.x)}}destroy(){var t;null===(t=this.sprite)||void 0===t||t.destroy({texture:!0})}}const My=134217729;function Ay(t,e,i,n,r){let s,o,a,l,h=e[0],c=n[0],u=0,d=0;c>h==c>-h?(s=h,h=e[++u]):(s=c,c=n[++d]);let p=0;if(u<t&&d<i)for(c>h==c>-h?(o=h+s,a=s-(o-h),h=e[++u]):(o=c+s,a=s-(o-c),c=n[++d]),s=o,0!==a&&(r[p++]=a);u<t&&d<i;)c>h==c>-h?(o=s+h,l=o-s,a=s-(o-l)+(h-l),h=e[++u]):(o=s+c,l=o-s,a=s-(o-l)+(c-l),c=n[++d]),s=o,0!==a&&(r[p++]=a);for(;u<t;)o=s+h,l=o-s,a=s-(o-l)+(h-l),h=e[++u],s=o,0!==a&&(r[p++]=a);for(;d<i;)o=s+c,l=o-s,a=s-(o-l)+(c-l),c=n[++d],s=o,0!==a&&(r[p++]=a);return 0===s&&0!==p||(r[p++]=s),p}function Py(t,e){let i=e[0];for(let n=1;n<t;n++)i+=e[n];return i}function Ry(t){return new Float64Array(t)}const Iy=Ry(4),Cy=Ry(8),Ly=Ry(12),Ny=Ry(16),Oy=Ry(4);function Dy(t,e,i,n,r,s){const o=(e-s)*(i-r),a=(t-r)*(n-s),l=o-a;if(0===o||0===a||o>0!=a>0)return l;const h=Math.abs(o+a);return Math.abs(l)>=33306690738754716e-32*h?l:-function(t,e,i,n,r,s,o){let a,l,h,c,u,d,p,f,m,g,v,_,y,x,b,T,E,w;const S=t-r,M=i-r,A=e-s,P=n-s;x=S*P,d=My*S,p=d-(d-S),f=S-p,d=My*P,m=d-(d-P),g=P-m,b=f*g-(x-p*m-f*m-p*g),T=A*M,d=My*A,p=d-(d-A),f=A-p,d=My*M,m=d-(d-M),g=M-m,E=f*g-(T-p*m-f*m-p*g),v=b-E,u=b-v,Iy[0]=b-(v+u)+(u-E),_=x+v,u=_-x,y=x-(_-u)+(v-u),v=y-T,u=y-v,Iy[1]=y-(v+u)+(u-T),w=_+v,u=w-_,Iy[2]=_-(w-u)+(v-u),Iy[3]=w;let R=Py(4,Iy),I=22204460492503146e-32*o;if(R>=I||-R>=I)return R;if(u=t-S,a=t-(S+u)+(u-r),u=i-M,h=i-(M+u)+(u-r),u=e-A,l=e-(A+u)+(u-s),u=n-P,c=n-(P+u)+(u-s),0===a&&0===l&&0===h&&0===c)return R;if(I=11093356479670487e-47*o+33306690738754706e-32*Math.abs(R),R+=S*c+P*a-(A*h+M*l),R>=I||-R>=I)return R;x=a*P,d=My*a,p=d-(d-a),f=a-p,d=My*P,m=d-(d-P),g=P-m,b=f*g-(x-p*m-f*m-p*g),T=l*M,d=My*l,p=d-(d-l),f=l-p,d=My*M,m=d-(d-M),g=M-m,E=f*g-(T-p*m-f*m-p*g),v=b-E,u=b-v,Oy[0]=b-(v+u)+(u-E),_=x+v,u=_-x,y=x-(_-u)+(v-u),v=y-T,u=y-v,Oy[1]=y-(v+u)+(u-T),w=_+v,u=w-_,Oy[2]=_-(w-u)+(v-u),Oy[3]=w;const C=Ay(4,Iy,4,Oy,Cy);x=S*c,d=My*S,p=d-(d-S),f=S-p,d=My*c,m=d-(d-c),g=c-m,b=f*g-(x-p*m-f*m-p*g),T=A*h,d=My*A,p=d-(d-A),f=A-p,d=My*h,m=d-(d-h),g=h-m,E=f*g-(T-p*m-f*m-p*g),v=b-E,u=b-v,Oy[0]=b-(v+u)+(u-E),_=x+v,u=_-x,y=x-(_-u)+(v-u),v=y-T,u=y-v,Oy[1]=y-(v+u)+(u-T),w=_+v,u=w-_,Oy[2]=_-(w-u)+(v-u),Oy[3]=w;const L=Ay(C,Cy,4,Oy,Ly);x=a*c,d=My*a,p=d-(d-a),f=a-p,d=My*c,m=d-(d-c),g=c-m,b=f*g-(x-p*m-f*m-p*g),T=l*h,d=My*l,p=d-(d-l),f=l-p,d=My*h,m=d-(d-h),g=h-m,E=f*g-(T-p*m-f*m-p*g),v=b-E,u=b-v,Oy[0]=b-(v+u)+(u-E),_=x+v,u=_-x,y=x-(_-u)+(v-u),v=y-T,u=y-v,Oy[1]=y-(v+u)+(u-T),w=_+v,u=w-_,Oy[2]=_-(w-u)+(v-u),Oy[3]=w;const N=Ay(L,Ly,4,Oy,Ny);return Ny[N-1]}(t,e,i,n,r,s,h)}Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(8),Ry(8),Ry(8),Ry(4),Ry(8),Ry(8),Ry(8),Ry(12);Ry(192),Ry(192);Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(8),Ry(8),Ry(8),Ry(8),Ry(8),Ry(8),Ry(8),Ry(8),Ry(8),Ry(4),Ry(4),Ry(4),Ry(8),Ry(16),Ry(16),Ry(16),Ry(32),Ry(32),Ry(48),Ry(64);Ry(1152),Ry(1152);Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(24),Ry(24),Ry(24),Ry(24),Ry(24),Ry(24),Ry(24),Ry(24),Ry(24),Ry(24),Ry(1152),Ry(1152),Ry(1152),Ry(1152),Ry(1152),Ry(2304),Ry(2304),Ry(3456),Ry(5760),Ry(8),Ry(8),Ry(8),Ry(16),Ry(24),Ry(48),Ry(48),Ry(96),Ry(192),Ry(384),Ry(384),Ry(384),Ry(768);Ry(96),Ry(96),Ry(96),Ry(1152);const Fy=Math.pow(2,-52),Uy=new Uint32Array(512);class ky{static from(t,e=Vy,i=Wy){const n=t.length,r=new Float64Array(2*n);for(let s=0;s<n;s++){const n=t[s];r[2*s]=e(n),r[2*s+1]=i(n)}return new ky(r)}constructor(t){const e=t.length>>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const i=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*i),this._halfedges=new Int32Array(3*i),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:i,_hullTri:n,_hullHash:r}=this,s=t.length>>1;let o=1/0,a=1/0,l=-1/0,h=-1/0;for(let e=0;e<s;e++){const i=t[2*e],n=t[2*e+1];i<o&&(o=i),n<a&&(a=n),i>l&&(l=i),n>h&&(h=n),this._ids[e]=e}const c=(o+l)/2,u=(a+h)/2;let d,p,f,m=1/0;for(let e=0;e<s;e++){const i=By(c,u,t[2*e],t[2*e+1]);i<m&&(d=e,m=i)}const g=t[2*d],v=t[2*d+1];m=1/0;for(let e=0;e<s;e++){if(e===d)continue;const i=By(g,v,t[2*e],t[2*e+1]);i<m&&i>0&&(p=e,m=i)}let _=t[2*p],y=t[2*p+1],x=1/0;for(let e=0;e<s;e++){if(e===d||e===p)continue;const i=Hy(g,v,_,y,t[2*e],t[2*e+1]);i<x&&(f=e,x=i)}let b=t[2*f],T=t[2*f+1];if(x===1/0){for(let e=0;e<s;e++)this._dists[e]=t[2*e]-t[0]||t[2*e+1]-t[1];jy(this._ids,this._dists,0,s-1);const e=new Uint32Array(s);let i=0;for(let t=0,n=-1/0;t<s;t++){const r=this._ids[t];this._dists[r]>n&&(e[i++]=r,n=this._dists[r])}return this.hull=e.subarray(0,i),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(Dy(g,v,_,y,b,T)<0){const t=p,e=_,i=y;p=f,_=b,y=T,f=t,b=e,T=i}const E=function(t,e,i,n,r,s){const o=i-t,a=n-e,l=r-t,h=s-e,c=o*o+a*a,u=l*l+h*h,d=.5/(o*h-a*l);return{x:t+(h*c-a*u)*d,y:e+(o*u-l*c)*d}}(g,v,_,y,b,T);this._cx=E.x,this._cy=E.y;for(let e=0;e<s;e++)this._dists[e]=By(t[2*e],t[2*e+1],E.x,E.y);jy(this._ids,this._dists,0,s-1),this._hullStart=d;let w=3;i[d]=e[f]=p,i[p]=e[d]=f,i[f]=e[p]=d,n[d]=0,n[p]=1,n[f]=2,r.fill(-1),r[this._hashKey(g,v)]=d,r[this._hashKey(_,y)]=p,r[this._hashKey(b,T)]=f,this.trianglesLen=0,this._addTriangle(d,p,f,-1,-1,-1);for(let s,o,a=0;a<this._ids.length;a++){const l=this._ids[a],h=t[2*l],c=t[2*l+1];if(a>0&&Math.abs(h-s)<=Fy&&Math.abs(c-o)<=Fy)continue;if(s=h,o=c,l===d||l===p||l===f)continue;let u=0;for(let t=0,e=this._hashKey(h,c);t<this._hashSize&&(u=r[(e+t)%this._hashSize],-1===u||u===i[u]);t++);u=e[u];let m,g=u;for(;m=i[g],Dy(h,c,t[2*g],t[2*g+1],t[2*m],t[2*m+1])>=0;)if(g=m,g===u){g=-1;break}if(-1===g)continue;let v=this._addTriangle(g,l,i[g],-1,-1,n[g]);n[l]=this._legalize(v+2),n[g]=v,w++;let _=i[g];for(;m=i[_],Dy(h,c,t[2*_],t[2*_+1],t[2*m],t[2*m+1])<0;)v=this._addTriangle(_,l,m,n[l],-1,n[_]),n[l]=this._legalize(v+2),i[_]=_,w--,_=m;if(g===u)for(;m=e[g],Dy(h,c,t[2*m],t[2*m+1],t[2*g],t[2*g+1])<0;)v=this._addTriangle(m,l,g,-1,n[g],n[m]),this._legalize(v+2),n[m]=v,i[g]=g,w--,g=m;this._hullStart=e[l]=g,i[g]=e[_]=l,i[l]=_,r[this._hashKey(h,c)]=l,r[this._hashKey(t[2*g],t[2*g+1])]=g}this.hull=new Uint32Array(w);for(let t=0,e=this._hullStart;t<w;t++)this.hull[t]=e,e=i[e];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,e){return Math.floor(function(t,e){const i=t/(Math.abs(t)+Math.abs(e));return(e>0?3-i:1+i)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:i,coords:n}=this;let r=0,s=0;for(;;){const o=i[t],a=t-t%3;if(s=a+(t+2)%3,-1===o){if(0===r)break;t=Uy[--r];continue}const l=o-o%3,h=a+(t+1)%3,c=l+(o+2)%3,u=e[s],d=e[t],p=e[h],f=e[c];if(Gy(n[2*u],n[2*u+1],n[2*d],n[2*d+1],n[2*p],n[2*p+1],n[2*f],n[2*f+1])){e[t]=f,e[o]=u;const n=i[c];if(-1===n){let e=this._hullStart;do{if(this._hullTri[e]===c){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,n),this._link(o,i[s]),this._link(s,c);const a=l+(o+1)%3;r<Uy.length&&(Uy[r++]=a)}else{if(0===r)break;t=Uy[--r]}}return s}_link(t,e){this._halfedges[t]=e,-1!==e&&(this._halfedges[e]=t)}_addTriangle(t,e,i,n,r,s){const o=this.trianglesLen;return this._triangles[o]=t,this._triangles[o+1]=e,this._triangles[o+2]=i,this._link(o,n),this._link(o+1,r),this._link(o+2,s),this.trianglesLen+=3,o}}function By(t,e,i,n){const r=t-i,s=e-n;return r*r+s*s}function Gy(t,e,i,n,r,s,o,a){const l=t-o,h=e-a,c=i-o,u=n-a,d=r-o,p=s-a,f=c*c+u*u,m=d*d+p*p;return l*(u*m-f*p)-h*(c*m-f*d)+(l*l+h*h)*(c*p-u*d)<0}function Hy(t,e,i,n,r,s){const o=i-t,a=n-e,l=r-t,h=s-e,c=o*o+a*a,u=l*l+h*h,d=.5/(o*h-a*l),p=(h*c-a*u)*d,f=(o*u-l*c)*d;return p*p+f*f}function jy(t,e,i,n){if(n-i<=20)for(let r=i+1;r<=n;r++){const n=t[r],s=e[n];let o=r-1;for(;o>=i&&e[t[o]]>s;)t[o+1]=t[o--];t[o+1]=n}else{let r=i+1,s=n;zy(t,i+n>>1,r),e[t[i]]>e[t[n]]&&zy(t,i,n),e[t[r]]>e[t[n]]&&zy(t,r,n),e[t[i]]>e[t[r]]&&zy(t,i,r);const o=t[r],a=e[o];for(;;){do{r++}while(e[t[r]]<a);do{s--}while(e[t[s]]>a);if(s<r)break;zy(t,r,s)}t[i+1]=t[s],t[s]=o,n-r+1>=s-i?(jy(t,e,r,n),jy(t,e,i,s-1)):(jy(t,e,i,s-1),jy(t,e,r,n))}}function zy(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function Vy(t){return t[0]}function Wy(t){return t[1]}function Xy(t,e,i){let n=null;const r=new pd;if(t.stopList.sort((t,e)=>t.pos-e.pos),!t.stopList.find(t=>0===t.pos)){const e=t.stopList[0];t.stopList.unshift({pos:0,color:e.color})}if(!t.stopList.find(t=>1===t.pos)){const e=t.stopList[t.stopList.length-1];t.stopList.push({pos:1,color:e.color})}const s=t=>{const e=[];for(let i=0,n=t.length;i<n-1;i++){const n=t[i],r=t[i+1],s=n.pos+.5*(r.pos-n.pos),o=vy(n.color,r.color,.5),a=2*i;e[a]=n,e[a+1]={color:o,pos:s},e[a+2]=r}return e};if(t.stopList=s(t.stopList),t.stopList=s(t.stopList),n=t.line?Yy(t,e,i):t.path?function(t,e,i){var n,r,s;const o=[],a={x:0,y:0};if("circle"===(null===(n=t.path)||void 0===n?void 0:n.path)||"rect"===(null===(r=t.path)||void 0===r?void 0:r.path)||"shape"===(null===(s=t.path)||void 0===s?void 0:s.path)){const n=e/2,r=i/2,s=Math.sqrt(n*n+r*r);t.stopList.forEach(t=>{if(0===t.pos)o.push({point:{x:0,y:0},color:t.color});else{const e=s*t.pos,i=new Xo;i.absellipse(0,0,e,e,0,2*Math.PI,!1,0),i.getPoints(50).forEach(e=>{o.push({point:{x:e.x,y:e.y},color:t.color})})}a.x=n,a.y=r})}return{points:o,position:a}}(t,e,i):Yy(t,e,i),n){const t=[],s=[],{position:o,points:a}=n,l=ky.from(a,t=>t.point.x,t=>t.point.y);for(let e=0;e<l.triangles.length;e+=3)t.push(a[l.triangles[e]].point.x,a[l.triangles[e]].point.y),t.push(a[l.triangles[e+1]].point.x,a[l.triangles[e+1]].point.y),t.push(a[l.triangles[e+2]].point.x,a[l.triangles[e+2]].point.y),s.push(...my(a[l.triangles[e]].color)),s.push(...my(a[l.triangles[e+1]].color)),s.push(...my(a[l.triangles[e+2]].color));const h=new tp;h.addAttribute("aVertexPosition",t,2),h.addAttribute("aColor",s,4);const c=zp.from("\n precision mediump float;\n attribute vec2 aVertexPosition;\n attribute vec4 aColor;\n uniform mat3 translationMatrix;\n uniform mat3 projectionMatrix;\n varying vec4 vColor;\n void main() {\n vColor = aColor;\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n }","precision mediump float; \n varying vec4 vColor;\n void main() {\n float alpha = vColor.a;\n vec4 color = vColor;\n color.a = 1.0;\n gl_FragColor = color * alpha;\n }\n "),u=new Jv;u.drawRect(0,0,e+1,i+1),r.mask=u,r.addChild(u);const d=new _v(h,c);d.position.x=o.x,d.position.y=o.y,r.addChild(d)}return r}function Yy(t,e,i){const n=e/2,r=i/2,s=[{x:-n,y:r},{x:-n,y:-r},{x:n,y:r},{x:n,y:-r}],o=[ly.fromPointSlope({x:-n,y:0},Math.PI/2),ly.fromPointSlope({x:0,y:r},0),ly.fromPointSlope({x:n,y:0},Math.PI/2),ly.fromPointSlope({x:0,y:-r},0)],a=[],l=t.stopList.slice(1,t.stopList.length-1).map(s=>{var l,h,c;const u=2*Math.PI;let d=null!==(h=null===(l=t.line)||void 0===l?void 0:l.ang)&&void 0!==h?h:0;for(;d>u;)d-=u;for(;d<0;)d+=u;const p={x:0,y:0};oy(d,Math.PI/2)?(p.x=0,p.y=i/2-s.pos*i):oy(d,0)?(p.x=s.pos*e-e/2,p.y=0):(p.x=s.pos*e-e/2,p.y=i/2-s.pos*i),d>Math.PI/2&&d<=Math.PI&&(p.x*=-1),d>Math.PI&&d<=2*Math.PI&&(p.y*=-1);const f=ly.fromPointSlope(p,Math.PI/2-((null===(c=t.line)||void 0===c?void 0:c.ang)||0)),m=o.map(t=>f.crossPoint(t)).filter(t=>t&&t.x<=n&&t.x>=-n&&t.y<=r&&t.y>=-r).map(t=>({point:t,color:s.color})).sort((t,e)=>e.point.y-t.point.y);a.push(...m);let g=Math.abs(m[1].point.x-m[0].point.x)/10;for(let t=20;t--;){const e=t%2==0?1:-1,i=p.x+e*g,o=f.resolveY(i);i<=n&&i>=-n&&o<=r&&o>=-r&&a.push({point:{x:i,y:o},color:s.color}),g+=g}return f});let h=[],c=[];t:for(let e=0;e<s.length;e++){const i=s[e];for(let e=0;e<l.length-1;e++){const n=l[e],r=l[e+1],s=n.distanceToLinearEquation(r),o=n.distanceToPoint(i),h=r.distanceToPoint(i);if(o<s&&h<s){const n=t.stopList.slice(1,t.stopList.length-1)[e],r=t.stopList.slice(1,t.stopList.length-1)[e+1],l=vy(n.color,r.color,o/s);a.splice(e+1,0,{point:i,color:l});continue t}}const n=l[0],r=l[l.length-1],o=n.distanceToPoint(i),u=r.distanceToPoint(i);o<=u?h.push({point:i,dis:o}):c.push({point:i,dis:u})}h=h.sort((t,e)=>e.dis-t.dis);const u=h.map((e,i)=>{if(0===i)return{point:e.point,color:t.stopList[0].color};{const i=t.stopList[0].color,n=t.stopList[1].color;return{point:e.point,color:vy(i,n,1-(0===h[0].dis?1:e.dis/h[0].dis))}}}).sort((t,e)=>e.point.y-t.point.y);c=c.sort((t,e)=>e.dis-t.dis);const d=c.map((e,i)=>{if(0===i)return{point:e.point,color:t.stopList[t.stopList.length-1].color};{const i=t.stopList[t.stopList.length-2].color,n=t.stopList[t.stopList.length-1].color;return{point:e.point,color:vy(i,n,0===c[0].dis?0:e.dis/c[0].dis)}}}).sort((t,e)=>e.point.y-t.point.y),p=u.concat(...a).concat(d);for(let t=0;t<p.length;t++)p[t].point.x+=n,p[t].point.y=-p[t].point.y+r;return{points:p,position:{x:0,y:0}}}const qy="\nvec3 rgb2hsl(vec3 rgb) {\n float cMax = max(max(rgb.r, rgb.g), rgb.b);\n float cMin = min(min(rgb.r, rgb.g), rgb.b);\n float delta = cMax - cMin;\n \n float h = 0.0;\n if (delta == 0.0) {\n h = 0.0;\n } else if (cMax == rgb.r) {\n h = 60.0 * mod(((rgb.g - rgb.b) / delta), 6.0);\n } else if (cMax == rgb.g ) {\n h = 60.0 * ((rgb.b - rgb.r) / delta + 2.0);\n } else if (cMax == rgb.b) {\n h = 60.0 * ((rgb.r - rgb.g) / delta + 4.0);\n }\n \n float l = (cMax + cMin) / 2.0;\n \n float s = 0.0;\n if (delta == 0.0) {\n s = 0.0;\n } else {\n s = delta / (1.0 - abs(2.0 * l - 1.0));\n }\n \n return vec3(h, s, l);\n}\n",Zy=[qy],Jy={biLevel:"\nvec4 transform(vec4 texColor, float arg) {\n mat3 rgb2yuv = mat3(\n 0.2126, 0.7152, 0.0722,\n -0.09991, -0.33609, 0.43600,\n 0.615, -0.5586, -0.05639\n );\n vec3 yuv = texColor.rgb * rgb2yuv;\n if (yuv.x >= 0.49 || texColor.a < 0.9) {\n return vec4(1.0, 1.0, 1.0, 1.0) * texColor.a;\n } else {\n return vec4(0.0, 0.0, 0.0, 1.0) * texColor.a;\n }\n}\n",alphaModFix:"\nvec4 transform(vec4 texColor, float arg) {\n return texColor * arg;\n}\n",alphaBiLevel:"\nvec4 transform(vec4 texColor, float arg) {\n vec4 result = vec4(texColor);\n result.rgb = result.rgb / texColor.a;\n if (texColor.a < arg) {\n result.a = 0.0;\n } else {\n result.a = 1.0;\n }\n return result;\n}\n",alphaCeiling:"\nvec4 transform(vec4 texColor, float arg) {\n vec4 result = vec4(texColor);\n result.rgb = result.rgb / texColor.a;\n if (texColor.a > 0.0) {\n result.a = 1.0;\n }\n return result;\n}\n",alphaFloor:"\nvec4 transform(vec4 texColor, float arg) {\n vec4 result = vec4(texColor);\n result.rgb = result.rgb / texColor.a;\n if (texColor.a < 1.0) {\n result.a = 0.0;\n }\n return result;\n}\n",grayscl:"\nvec4 transform(vec4 texColor, float arg) {\n float avg = (texColor.r + texColor.g + texColor.b) / 3.0;\n return vec4(avg, avg, avg, texColor.a);\n}\n"};class Ky extends Wp{constructor(t,e){var i;super(void 0,(i=Jy[t],`\nvarying vec2 vTextureCoord;\n\nuniform float arg;\nuniform sampler2D uSampler;\n\n${Zy.map(t=>t+"\n").join("\n")}\n\n${i}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg);\n}\n`),{arg:e})}}const $y=[qy],Qy={clrChange:"\nvec4 transform(vec4 texColor, vec4 arg1, vec4 arg2) {\n float epsilon = 0.001;\n vec3 colorDiff = arg1.rgb - (texColor.rgb / max(texColor.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n if (colorDistance < epsilon) {\n arg2.rgb *= arg2.a;\n return arg2;\n } else {\n return texColor;\n }\n}\n",changeBulletColor:"\nvec4 transform(vec4 texColor, vec4 arg1, vec4 arg2) {\n if (texColor.a == 0.0) {\n return texColor;\n } else {\n return arg2;\n }\n}\n",duotone:"\nvec4 transform(vec4 texColor, vec4 arg1, vec4 arg2) {\n float avg = (texColor.r + texColor.g + texColor.b) / 3.0;\n\n vec3 hsl = rgb2hsl(vec3(avg, avg, avg));\n\n vec3 result = arg2.rgb * hsl.z + arg1.rgb * (1.0 - hsl.z);\n\n return vec4(result * texColor.a, texColor.a);\n}\n"};class tx extends Wp{constructor(t,e,i){var n;super(void 0,(n=Qy[t],`\nvarying vec2 vTextureCoord;\n\nuniform vec4 arg1;\nuniform vec4 arg2;\nuniform sampler2D uSampler;\n\n${$y.map(t=>t+"\n").join("\n")}\n\n${n}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg1, arg2);\n}\n`),{arg1:Float32Array.from(e),arg2:Float32Array.from(i)})}}const ex=[qy],ix={lum:"\nvec4 transform(vec4 texColor, float arg1, float arg2) {\n vec3 rgb = texColor.rgb / texColor.a;\n\n // 对比度\n float C = arg2 * 255.0;\n float F = (259.0 * (255.0 + C)) / (255.0 * (259.0 - C));\n rgb.rgb = F * (rgb.rgb - 0.5) + 0.5;\n\n // 亮度\n rgb.rgb += arg1;\n\n rgb.rgb *= texColor.a;\n return vec4(rgb, texColor.a);\n}\n"};class nx extends Wp{constructor(t,e,i){var n;super(void 0,(n=ix[t],`\nvarying vec2 vTextureCoord;\n\nuniform float arg1;\nuniform float arg2;\nuniform sampler2D uSampler;\n\n${ex.map(t=>t+"\n").join("\n")}\n\n${n}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg1, arg2);\n}\n`),{arg1:e,arg2:i})}}const rx=[qy],sx={alphaInv:"\nvec4 transform(vec4 texColor, vec4 arg1) {\n float alpha = 1.0 - texColor.a;\n arg1.rgb = arg1.rgb * alpha;\n arg1.a = alpha;\n return arg1;\n}\n"};class ox extends Wp{constructor(t,e){var i;super(void 0,(i=sx[t],`\nvarying vec2 vTextureCoord;\n\nuniform vec4 arg1;\nuniform sampler2D uSampler;\n\n${rx.map(t=>t+"\n").join("\n")}\n\n${i}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg1);\n}\n`),{arg1:Float32Array.from(e)})}}class ax{constructor(t,e,i,n,r){this.ctx=t,this.fillStyle=e,this.width=i,this.height=n,this.config=r,this.clonedObjects=[],this._displayObject=null,this.gradientHash=H_()(`${JSON.stringify(e)}${Math.ceil(i)}${Math.ceil(n)}`)}get displayObject(){return this._displayObject||(this._displayObject=this.createDisplayObject()),this._displayObject}set displayObject(t){this._displayObject&&this._displayObject.destroy({children:!0,texture:!0}),this._displayObject=t}get hasFill(){return!!this.fillStyle&&"noFill"!==this.fillStyle.fillType}createDisplayObject(){var t;if(!this.fillStyle)return null;if(this.config.useSlideBackgroundFill&&this.ctx.bgTexture){const t=new fm;return t.texture=this.ctx.bgTexture,t}if("solidFill"===this.fillStyle.fillType||"noFill"===this.fillStyle.fillType)return null;if("gradientFill"===this.fillStyle.fillType){const t=new fm;let e=ax.gradientPool.get(this.gradientHash);if(!e){const t=Xy(this.fillStyle,this.width,this.height),i=Wd.create({width:this.width,height:this.height,resolution:this.ctx.renderer.resolution});this.ctx.renderer.render(t,{renderTexture:i}),e=i,ax.gradientPool.set(this.gradientHash,e),t.destroy({children:!0,texture:!0})}return t.texture=e,t}if("blipFill"===this.fillStyle.fillType){const{src:e,filters:i}=this.fillStyle,n=this.ctx.spriteTexture.getTexture(e),r=this.ctx.spriteTexture.getFrameData(e);if(n){const e=new fm;if(e.texture=n,i.length>0&&this.config.useFilter&&(this.ctx.featureList||{}).filter&&(e.filters=function(t,e){const i=[];return t.forEach(t=>{const n=((null==e?void 0:e.filter)||[]).indexOf(t.type)>=0;if(["biLevel","alphaBiLevel","alphaCeiling","alphaModFix","alphaFloor","grayscl"].indexOf(t.type)>=0&&n)i.push(new Ky(t.type,t.args[0]||0));else if(["clrChange","changeBulletColor","duotone"].indexOf(t.type)>=0&&n){const e=my(t.args[0]),n=my(t.args[1]);i.push(new tx(t.type,e,n))}else if("lum"===t.type&&n)i.push(new nx(t.type,t.args[0],t.args[1]));else if("alphaInv"===t.type&&n){const e=my(t.args[0]);i.push(new ox(t.type,e))}}),i}(i,this.ctx.featureList)),this.config.fillFloat){const{l:i,t:n,r:r,b:s}=this.config.fillFloat.fillRect,o=this.width*(1-i-r),a=this.height*(1-n-s),l=null!==(t=this.config.shapeRotation)&&void 0!==t?t:0,h=new Jv;h.drawRect(0,0,o,a),h.pivot.x=o/2,h.pivot.y=a/2,h.rotation=l;const c=h.getBounds(),u=c.width,d=c.height;e.width=u,e.height=d,e.anchor.x=.5,e.anchor.y=.5,e.rotation=-1*l,e.name="math-texture",0===l?(e.position.x=u/2+i*this.width,e.position.y=d/2+n*this.width):(e.position.x=this.width/2,e.position.y=this.height/2)}else e.width=this.width,e.height=this.height,r.rotate&&(e.position.x=this.width/2,e.position.y=this.height/2,e.anchor.x=.5,e.anchor.y=.5,e.rotation=r.rotate/180*Math.PI);return e}}else if("gifFill"===this.fillStyle.fillType){const{src:t,delays:e}=this.fillStyle,i=this.ctx.spriteTexture.getGifFrames(t).map((t,i)=>({texture:t,time:e[i]||20})),n=new Qv(i,!0);n.name=A_(),n.width=this.width,n.height=this.height;const r=this.fillStyle.loop;let s=1;return n.onLoop=()=>{s+=1,r>0&&s>r&&n.gotoAndStop(n.totalFrames)},n}return null}isSolidFill(){var t;return"solidFill"===(null===(t=this.fillStyle)||void 0===t?void 0:t.fillType)}getSolidFillColor(){var t;return"solidFill"===(null===(t=this.fillStyle)||void 0===t?void 0:t.fillType)?this.fillStyle.color:"#000000"}getClonedDisplayObject(){const t=this.createDisplayObject();return this.clonedObjects.push(t),t}destroy(){var t;null===(t=this._displayObject)||void 0===t||t.destroy(),this._displayObject=null,this.clonedObjects.forEach(t=>{null==t||t.destroy()}),this.clonedObjects=[]}}ax.gradientPool=new Map;var lx=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class hx extends wy{constructor(t,e,i){var n;super(t,e,i),this.textureContainer=new pd,this.underline=null,this.cacheSprite=new fm;const{shapeId:r,paragraphIndex:s,lineIndex:o,unitIndex:a,lineHeight:l,width:h,underLine:c,fill:u,height:d,isHorz:p,lineWidth:f}=t,m="solidFill"===(null===(n=null==u?void 0:u.fill)||void 0===n?void 0:n.fillType)?u.fill.color:null;if(c){const t=p?l/16:f/16;this.underline=new Sy(e,c.type,t,h,d,m,p,r,s,o,a)}this.textGraphics=this.createTextGraphics(),this.textFill=this.createTextFill(),this.strokeGraphics=this.createStrokeGraphics(),this.strokeFill=this.createStrokeFill()}createStrokeFill(){const{stroke:t,lineWidth:e,lineHeight:i}=this.json;return new ax(this.ctx,null==t?void 0:t.fill,e,i,{useFilter:!1,useSlideBackgroundFill:!1})}createStrokeGraphics(){const{stroke:t}=this.json,e=(null==t?void 0:t.key)?{fillType:"blipFill",src:t.key,filters:[]}:void 0;return new ax(this.ctx,e,(null==t?void 0:t.width)||0,(null==t?void 0:t.height)||0,{useFilter:!1,useSlideBackgroundFill:!1})}createTextFill(){const{isHorz:t,fill:e,lineWidth:i,lineHeight:n,fillLineHeight:r}=this.json;return t?new ax(this.ctx,null==e?void 0:e.fill,i,Math.max(r,n),{useFilter:!1,useSlideBackgroundFill:!1}):new ax(this.ctx,null==e?void 0:e.fill,r,n,{useFilter:!1,useSlideBackgroundFill:!1})}createTextGraphics(){var t;const{fill:e,content:i}=this.json;let n="#000000";"solidFill"===(null===(t=null==e?void 0:e.fill)||void 0===t?void 0:t.fillType)&&(n=e.fill.color);const r=(null==e?void 0:e.key)?{fillType:"blipFill",src:e.key,filters:[{type:"changeBulletColor",args:["#000000",n]}]}:void 0;return new ax(this.ctx,r,(null==e?void 0:e.width)||0,(null==e?void 0:e.height)||0,{useFilter:"◾"===i,useSlideBackgroundFill:!1})}getIterateEntry(){return null}getBgElement(){return null}updateTransform(t){var e,i,n,r;const{isHorz:s}=this.json;t.position={x:s&&null!==(i=null===(e=t.position)||void 0===e?void 0:e.x)&&void 0!==i?i:0,y:s?0:null!==(r=null===(n=t.position)||void 0===n?void 0:n.y)&&void 0!==r?r:0},t.width=s?this.json.width:this.json.lineWidth,t.height=s?this.json.lineHeight:this.json.height,super.updateTransform(t)}preRender(){var t;null===(t=this.underline)||void 0===t||t.preRender()}render(t){t.addSubMTask(()=>lx(this,void 0,void 0,(function*(){this.doRender()})),"@TextUnitImpl[doRender]")}doRender(){let t=!1;const{lineWidth:e,lineHeight:i,baseLine:n,isHorz:r,underline:s,height:o,width:a,highlightColor:l,x:h,y:c,content:u,fillLineHeight:d,fill:p}=this.json;let f=!1!==this.json.needFill;if(p&&p.fill&&"solidFill"!==p.fill.fillType&&(f=!0),l){const t=new Jv,[n,s]=fy(l);t.beginFill(n,s),t.drawRect(0,0,r?a:e,r?i:o),t.endFill(),this.textureContainer.addChild(t)}if(this.textGraphics.displayObject){const e=this.textGraphics.displayObject;if(r&&(e.position.y=c>0?c:0),f){const i=this.textFill.displayObject;if(i)i.mask=e,i.addChild(e),i.position.x=-h,e.position.x+=h,t=!0,this.textureContainer.addChild(i);else if(this.textFill.isSolidFill()){const i=new _y;i.color=this.textFill.getSolidFillColor(),e.filters=[i],t=!0,this.textureContainer.addChild(e)}}else this.textureContainer.addChild(e)}if(this.strokeGraphics.displayObject){const e=this.strokeGraphics.displayObject;if(f){const i=this.strokeFill.displayObject;if(i)i.mask=e,i.addChild(e),r?i.position.y=c>0?c:0:i.position.x=h,this.textureContainer.addChild(i);else if(this.strokeFill.isSolidFill()){r?e.position.y=c>0?c:0:e.position.x=h;const i=new _y;i.color=this.strokeFill.getSolidFillColor(),e.filters=[i],t=!0,this.textureContainer.addChild(e)}}else r?e.position.y=c>0?c:0:e.position.x=h,this.textureContainer.addChild(e)}if(this.underline&&(this.underline.render(),this.underline.sprite)){r?(this.underline.sprite.position.y=s?s-i/16:n,this.underline.sprite.position.x=0):(this.underline.sprite.position.x=0,this.underline.sprite.position.y=0);const t=this.textFill.getClonedDisplayObject();t?(t.mask=this.underline.sprite,t.addChild(this.underline.sprite),this.textureContainer.addChild(t)):this.textureContainer.addChild(this.underline.sprite)}if(t){const t=Wd.create({width:r?a:e,height:r?Math.max(d,i):o,resolution:this.ctx.renderer.resolution});this.ctx.renderer.render(this.textureContainer,{renderTexture:t}),this.cacheSprite.texture=t,r&&c<0&&(this.cacheSprite.position.y=c),this.container.addChild(this.cacheSprite)}else this.container.addChild(this.textureContainer);this.container.name=u}destroy(){this.textFill.destroy(),this.textGraphics.destroy(),this.strokeFill.destroy(),this.strokeGraphics.destroy(),this.cacheSprite.texture.destroy(!0),this.cacheSprite.destroy(),this.textureContainer.destroy(),this.container.destroy()}}var cx=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class ux extends wy{constructor(){super(...arguments),this.units=[],this.isHorz=!0}getIterateElements(){return this.units}getIterateEntry(t,e,i){return this.units[e]?this.units[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",i),null)}preRender(){}createUnits(t,e,i,n){for(let r=0,s=this.json.textUnits.length;r<s;r++)n.addSubMTask(()=>cx(this,void 0,void 0,(function*(){const n=this.json.textUnits[r],{height:s,width:o,fillHeight:a,baseline:l,y:h,underline:c}=this.json,u=new hx(Object.assign(Object.assign({},n),{lineHeight:s,lineWidth:o,baseLine:l-h,underline:c,fillLineHeight:a||s,isHorz:this.isHorz,shapeId:t,paragraphIndex:e,lineIndex:i,unitIndex:r}),this.ctx,this.global);u.preRender(),this.units.push(u)})),"@TextLineImpl[createUnits]")}render(t){for(const e of this.units.reverse())e.render(t),t.addSubMTask(()=>cx(this,void 0,void 0,(function*(){this.container.addChild(e.container)})),"@TextLineImpl[container.addChild]")}destroy(){this.units.forEach(t=>{t.destroy()}),this.container.destroy({children:!1})}}var dx=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class px extends wy{constructor(){super(...arguments),this.iterateElements=[],this.lines=[],this.isHorz=!0}getIterateElements(){if(this.iterateElements.length>0)return this.iterateElements;const t=this.lines.reduce((t,e)=>t=t.concat(e.getIterateElements()),[]);return this.iterateElements=t,t}getIterateEntry(t,e,i){const n=this.getIterateElements();return n[e]?n[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",i),null)}preRender(){}createLines(t,e,i){for(let n=0,r=this.json.lines.length;n<r;n++)i.addSubMTask(()=>dx(this,void 0,void 0,(function*(){const r=this.json.lines[n],s=new ux(r,this.ctx,this.global);s.isHorz=this.isHorz,s.container.name="line-"+n,s.createUnits(t,e,n,i),this.lines.push(s)})),"@TextParagraphImpl[createLines]")}render(t){for(const e of this.lines)e.render(t),t.addSubMTask(()=>dx(this,void 0,void 0,(function*(){this.container.addChild(e.container)})),"@TextParagraphImpl[container.addChild]")}destroy(){this.lines.forEach(t=>{t.destroy()}),this.container.destroy({children:!1})}}var fx=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class mx{constructor(t,e,i,n){this.iterateElements=[],this.paragraphs=[],this.container=new pd,this.json=t,this.ctx=e,this.parentGlobalPos=n,this.iterateType=i,this.container.name="textBody",this.global={x:this.parentGlobalPos.x+t.position.x,y:this.parentGlobalPos.y+t.position.y},this.container.position.x=t.position.x,this.container.position.y=t.position.y,this.container.scale.x=t.scale.x,this.container.scale.y=t.scale.y;const r=new Jv;r.drawRect(0,0,t.width,t.height),this.container.addChild(r)}get width(){return this.json.width}get height(){return this.json.height}get x(){return this.json.position.x}get y(){return this.json.position.y}getTextElement(t,e){return"paragraph"===t?this.paragraphs[e[0]]:null}getIterateEntry(t,e){return this.iterateElements[t]?this.iterateElements[t]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",e),null)}destroy(){this.paragraphs.forEach(t=>{t.destroy()})}createParagraphs(t,e){for(let i=0,n=this.json.paragraphs.length;i<n;i++)e.addSubMTask(()=>fx(this,void 0,void 0,(function*(){var n;const r=this.json.paragraphs[i],s=new px(r,this.ctx,this.global);s.isHorz=null===(n=this.json.isHorz)||void 0===n||n,s.createLines(t,i,e),e.addSubMTask(()=>fx(this,void 0,void 0,(function*(){this.iterateElements=this.iterateElements.concat(s.getIterateElements()),s.container.name="段落-"+i,this.paragraphs.push(s)})),"@TextBodyImpl[paragraphs.push]")})),"@TextBodyImpl[createParagraphs]")}render(t){for(const e of this.paragraphs)e.render(t),t.addSubMTask(()=>fx(this,void 0,void 0,(function*(){this.container.addChild(e.container)})),"@TextBodyImpl[container.addChild]");t.addSubMTask(()=>fx(this,void 0,void 0,(function*(){const{width:t}=this.container;this.container.scale.x<0&&(this.container.x+=-1*t)})),"@TextBodyImpl[reset width]")}}class gx{constructor(t){this.scaleX=1,this.scaleY=1,this.pivot={x:0,y:0},this.paths=[],this.hash="",this.width=0,this.height=0,this.graphicsId="",this.textureId="",this.id=t.id,this.type=t.type,this.heightSize=t.heightSize,this.widthSize=t.widthSize,this.fillStyle=t.fillStyle||{fillType:"solidFill",color:"#ffffffff"},this.lineWidth=t.lineWidth||1,this.position=t.position||{x:0,y:0},this.rotate=t.rotation||1,this.path=this.getUnitPath(),this.setScaleFromLineWidth(),this.setScaleFromSize(),this.generatePaths(),this.setPivot()}setPivot(){switch(this.type){case"oval":case"diamond":this.pivot={x:this.width/2,y:this.height/2};break;case"triangle":this.pivot={x:.7*this.width,y:this.height/2};break;case"arrow":case"stealth":default:this.pivot={x:this.width,y:this.height/2}}}generatePaths(){this.hash="arrow-"+H_()(this.path+this.scaleX+this.scaleY),this.paths=[{id:this.id,path:this.path,fill:"norm",hasStroke:!1,hash:this.hash,scale:{x:this.scaleX,y:this.scaleY}}]}getUnitPath(){switch(this.type){case"stealth":return"M 0,0 L 95250,47625 L 0,95250 L 28575,47625 C C";case"oval":return"M 0,47625 A 47625,47625,-3.14159265,6.2831853 C C";case"diamond":return"M 47625,0 L 95250,47625 L 47625,95250 L 0,47625 C C";case"arrow":return"M 9525,0 L 95250,47625 L 9525,95250 L 0,85725 L 68389.5,47625 L 0,9525 C C";case"triangle":return"M 0,0 L 95250,47625 L 0,95250 C C";default:return""}}setScaleFromLineWidth(){switch(this.type){case"stealth":case"oval":case"diamond":case"arrow":case"triangle":this.scaleX*=.29*this.lineWidth+.7,this.scaleY*=.29*this.lineWidth+.7;break;default:throw new Error("can't match any arrow type!")}}setScaleFromSize(){switch(this.type){case"stealth":case"oval":case"diamond":case"arrow":case"triangle":this.scaleX*=1,this.scaleY*=1;break;default:throw new Error("can't match any arrow type!")}switch(this.widthSize){case"sm":this.scaleX*=3/4;break;case"lg":this.scaleX*=1.25;break;case"med":this.scaleX*=1}switch(this.heightSize){case"sm":this.scaleY*=3/4;break;case"lg":this.scaleY*=1.25;break;case"med":this.scaleY*=1}this.width=10*this.scaleX,this.height=10*this.scaleY}}class vx{constructor(t,e,i,n,r,s,o,a,l,h,c){this.id=t,this.ctx=e,this.paths=i,this.hash=n,this.nept=r,this.width=s,this.height=o,this.lineStyle=a,this.shouldFill=l,this.bgColor=h,this.lnColor=c,this.clonedObjects=[],this._displayObject=null,this.isRectangle=!1,this.isPureRect=!1,this.isColoredPureRect=!1,this.isRectangle=this.rectangleDetect(i),this.isRectangle&&l?this.bgColor?this.isColoredPureRect=!0:this.isPureRect=!0:this.ctx.graphicsTexture.addGraphics(this.id,this.paths,this.hash,this.nept,this.width,this.height,this.lineStyle,this.ctx.objectPoolGroup,this.shouldFill,this.bgColor,this.lnColor)}get displayObject(){return this._displayObject}pointDis(t,e){return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)}rectangleDetect(t){if(1!==t.length)return!1;const e=t[0].path.trim().split(" ");if(10!==e.length)return!1;const i=[],n=[];for(let t=0;t<e.length;t+=2){const r=e[t],s=e[t+1],[o,a]=s.split(",").map(t=>Number(t)/100);i.push(r),n.push({x:o,y:a})}if("MLLLC"!==i.join(""))return!1;for(let t=0;t<3;t++){const e=n[t],i=n[t+1];if(e.x!==i.x&&e.y!==i.y)return!1}const r=n.slice(0,4).reduce((t,e)=>t+e.x,0)/4,s=n.slice(0,4).reduce((t,e)=>t+e.y,0)/4;if(Number.isNaN(r)||Number.isNaN(s))return!1;const o={x:r,y:s};return oy(this.pointDis(o,n[0]),this.pointDis(o,n[1]))&&oy(this.pointDis(o,n[0]),this.pointDis(o,n[2]))&&oy(this.pointDis(o,n[0]),this.pointDis(o,n[3]))&&this.pointDis(o,n[0])===this.pointDis(o,n[1])}createDisplayObject(){if(this.isPureRect){const t=new Jv;return t.beginFill(0,1),t.drawRect(0,0,this.width,this.height),t}if(this.isColoredPureRect&&this.bgColor){const t=new Jv,[e,i]=fy(this.bgColor);return t.beginFill(e,i),t.drawRect(0,0,this.width,this.height),t}{const t=new fm,e=this.ctx.graphicsTexture.getGraphicsData(this.id);return e?(t.texture=e.texture,t.pivot.x=e.pivot.x,t.pivot.y=e.pivot.y,t):null}}getClonedDisplayObject(){const t=this.createDisplayObject();return this.clonedObjects.push(t),t}render(){this._displayObject=this.createDisplayObject()}isNeedMask(t,e){let i=!1;return this._displayObject&&(i=!(this.isRectangle&&Math.abs(t-this._displayObject.width)<2&&Math.abs(e-this._displayObject.height)<2&&this.shouldFill)),i}addArrows(t){var e;null===(e=this._displayObject)||void 0===e||e.addChild(t)}destroy(){var t;null===(t=this._displayObject)||void 0===t||t.destroy(),this._displayObject=null,this.clonedObjects.forEach(t=>{null==t||t.destroy()}),this.clonedObjects=[]}}var _x=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};const yx={pivot:{x:0,y:0},width:0,height:0};class xx extends hy{constructor(t,e,i,n){var r;super(t,e,i),this.renderContainer=new pd,this.needCacheAsBitMap=!1,this.backgroundGraphics=null,this.effectList=[],this.strokeGraphics=null,this.arrowList=[],this.fillColorFilter=new _y,this.strokeColorFilter=new _y,this.id="",this.fill=new ny(this),this.stroke=new ey(this),this.effectObject=null,this.effectContainer=new pd,this.effectDisposer=()=>{},this.json=t,this.json.fillStyle&&"groupFill"===this.json.fillStyle.fillType&&n&&(this.json.fillStyle=n),this.id=t.id;const{fillStyle:s,lineStyle:o}=this.json;this.container.sortableChildren=!0,this.container.name=t.id+"_container_[Shape]",this.effectContainer.name="effect-container",this.effectContainer.zIndex=1,this.container.addChild(this.effectContainer),this.renderContainer.name=t.id+"_render_container_[Shape]",this.generateArrowList(),this.backgroundFill=this.createBackgroundFill(),this.backgroundGraphics=this.createBackgroundGraphics(),this.strokeFill=this.createStrokeFill(),this.strokeGraphics=this.createStrokeGraphics(),this.ctx.timingTargets.addTarget(this.id,this),"solidFill"===(null==s?void 0:s.fillType)&&(this.fillColorFilter.currentColor=s.color,this.fillColorFilter.designColor=s.color),"solidFill"===(null===(r=null==o?void 0:o.fill)||void 0===r?void 0:r.fillType)&&(this.strokeColorFilter.currentColor=o.fill.color,this.strokeColorFilter.designColor=o.fill.color),this.updateTransform(this.json),t.textBody&&(this.text=new mx(t.textBody,this.ctx,t.textBody.iterateType,{x:this.designGlobalPosition.x,y:this.designGlobalPosition.y})),this.container.hitArea=new Iu(1,1,this.json.width,this.json.height),this.ctx.slideScopeEventHub.once("slide-render",t=>{if(this.ctx.slideIndex===t&&this.effectObject){const t=this.getEffectTexture();t&&this.effectObject.createFrame(1,t)}})}get interactiveContainer(){return this.renderContainer}get strokeActive(){var t,e,i,n,r,s,o;return this.strokeFill.displayObject?(null!==(i=null===(e=null===(t=this.strokeFill.displayObject)||void 0===t?void 0:t.filters)||void 0===e?void 0:e.length)&&void 0!==i?i:-1)>0:(null!==(o=null===(s=null===(r=null===(n=this.strokeGraphics)||void 0===n?void 0:n.displayObject)||void 0===r?void 0:r.filters)||void 0===s?void 0:s.length)&&void 0!==o?o:-1)>0}set strokeActive(t){var e,i,n,r,s,o;const{displayObject:a}=this.strokeFill;t?a&&(null!==(i=null===(e=a.filters)||void 0===e?void 0:e.indexOf(this.strokeColorFilter))&&void 0!==i?i:-1)<0?a.filters=[this.strokeColorFilter]:(null===(n=this.strokeGraphics)||void 0===n?void 0:n.displayObject)&&(null!==(s=null===(r=this.strokeGraphics.displayObject.filters)||void 0===r?void 0:r.indexOf(this.strokeColorFilter))&&void 0!==s?s:-1)<0&&(this.strokeGraphics.displayObject.filters=[this.strokeColorFilter]):a?a.filters=[]:(null===(o=this.strokeGraphics)||void 0===o?void 0:o.displayObject)&&(this.strokeGraphics.displayObject.filters=[])}get fillActive(){var t,e,i,n,r,s,o;return this.backgroundFill.displayObject?(null!==(i=null===(e=null===(t=this.backgroundFill.displayObject)||void 0===t?void 0:t.filters)||void 0===e?void 0:e.length)&&void 0!==i?i:-1)>0:(null!==(o=null===(s=null===(r=null===(n=this.backgroundGraphics)||void 0===n?void 0:n.displayObject)||void 0===r?void 0:r.filters)||void 0===s?void 0:s.length)&&void 0!==o?o:-1)>0}set fillActive(t){var e,i,n,r,s,o;t?this.backgroundFill.displayObject&&(null!==(i=null===(e=this.backgroundFill.displayObject.filters)||void 0===e?void 0:e.indexOf(this.fillColorFilter))&&void 0!==i?i:-1)<0?this.backgroundFill.displayObject.filters=[this.fillColorFilter]:(null===(n=this.backgroundGraphics)||void 0===n?void 0:n.displayObject)&&(null!==(s=null===(r=this.backgroundGraphics.displayObject.filters)||void 0===r?void 0:r.indexOf(this.fillColorFilter))&&void 0!==s?s:-1)<0&&(this.backgroundGraphics.displayObject.filters=[this.fillColorFilter]):this.backgroundFill.displayObject?this.backgroundFill.displayObject.filters=[]:(null===(o=this.backgroundGraphics)||void 0===o?void 0:o.displayObject)&&(this.backgroundGraphics.displayObject.filters=[])}getTextElement(t,e){var i,n;return null!==(n=null===(i=this.text)||void 0===i?void 0:i.getTextElement(t,e))&&void 0!==n?n:null}getBgElement(){return this}getIterateEntry(t,e,i){return 0===e?this:"el"===t?(this.ctx.eventHub.emit("IterateTimeNodeEnd",i),null):this.text?this.text.getIterateEntry(e-1,i)||null:(this.ctx.eventHub.emit("IterateTimeNodeEnd",i),null)}getEffectTexture(){if(0===this.effectContainer.children.length)return null;const t=Wd.create({width:this.json.width,height:this.json.height,resolution:this.ctx.renderer.resolution});return this.ctx.renderer.render(this.effectContainer,{renderTexture:t}),t}createStrokeGraphics(){var t,e,i,n;const{id:r,geometry:s,lineStyle:o}=this.json,{width:a,height:l,pivot:h}=(null==s?void 0:s.lineTransform)||yx,c=a||this.json.width,u=l||this.json.height,d="solidFill"===(null===(t=null==o?void 0:o.fill)||void 0===t?void 0:t.fillType)?o.fill.color:null;return o&&"noFill"!==(null===(e=o.fill)||void 0===e?void 0:e.fillType)?new vx(r+"-path-graphics",this.ctx,null!==(i=null==s?void 0:s.paths)&&void 0!==i?i:[],null!==(n=null==s?void 0:s.hash)&&void 0!==n?n:"",h||{x:0,y:0},c,u,o,!1,null,d):null}createStrokeFill(){const[t,e]=this.calculateFillObjectOffset(),{geometry:i,lineStyle:n,width:r,height:s}=this.json,o=(null==i?void 0:i.lineTransform)||yx,a=z_()(null==n?void 0:n.width)?n.width:1;return new ax(this.ctx,null==n?void 0:n.fill,(o.width||r)+a+t,Math.max((o.height||s)+a,e),{useFilter:!0,useSlideBackgroundFill:!1})}createBackgroundGraphics(){var t;const{geometry:e,lineStyle:i,fillStyle:n,id:r}=this.json,{width:s,height:o,pivot:a}=(null==e?void 0:e.lineTransform)||yx,l=s||this.json.width,h=o||this.json.height,c="solidFill"===(null==n?void 0:n.fillType)?n.color:null;return n&&"noFill"!==n.fillType||this.json.isPicture?new vx(r+"-bg-graphics",this.ctx,null!==(t=null==e?void 0:e.paths)&&void 0!==t?t:[],(null==e?void 0:e.hash)||"",a||{x:0,y:0},l,h,i,!0,c,null):null}createBackgroundFill(){var t,e;const{fillStyle:i,width:n,height:r,lineStyle:s,geometry:o}=this.json,a=(null==o?void 0:o.fillTransform)||yx;return new ax(this.ctx,i,(a.width||n)+(null!==(t=null==s?void 0:s.width)&&void 0!==t?t:0),(a.height||r)+(null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0),{useFilter:!0,useSlideBackgroundFill:this.json.useBgFill,fillFloat:this.json.fillFloat,shapeRotation:this.json.rotation})}createBackground(){var t,e,i,n,r,s,o,a;const{pivot:l,width:h,height:c}=(null===(t=this.json.geometry)||void 0===t?void 0:t.fillTransform)||yx,{displayObject:u}=this.backgroundFill;u?(this.json.useBgFill&&(null===(i=this.backgroundGraphics)||void 0===i?void 0:i.displayObject)?(this.needCacheAsBitMap=!0,u.mask=this.backgroundGraphics.displayObject,u.pivot.x=(null===(n=this.json.position)||void 0===n?void 0:n.x)||0,u.pivot.y=(null===(r=this.json.position)||void 0===r?void 0:r.y)||0,this.effectContainer.addChild(this.backgroundGraphics.displayObject)):"gifFill"===(null===(s=this.json.fillStyle)||void 0===s?void 0:s.fillType)?(u.height=c||this.designHeight,u.width=h||this.designWidth,u instanceof Qv&&u.play(),(null===(o=this.backgroundGraphics)||void 0===o?void 0:o.isNeedMask(u.width,u.height))&&(u.mask=this.backgroundGraphics.displayObject,this.backgroundGraphics.displayObject&&this.effectContainer.addChild(this.backgroundGraphics.displayObject))):(null===(a=this.backgroundGraphics)||void 0===a?void 0:a.isNeedMask(u.width,u.height))&&(this.json.fillFloat||(this.needCacheAsBitMap=!0,u.mask=this.backgroundGraphics.displayObject,this.backgroundGraphics.displayObject&&this.effectContainer.addChild(this.backgroundGraphics.displayObject))),this.json.fillFloat||(u.x=l.x,u.y=l.y),this.effectContainer.addChild(u)):this.backgroundFill.hasFill&&(null===(e=this.backgroundGraphics)||void 0===e?void 0:e.displayObject)&&this.effectContainer.addChild(this.backgroundGraphics.displayObject)}createPathFill(){var t,e,i;const{displayObject:n}=this.strokeFill,r=null===(t=this.strokeGraphics)||void 0===t?void 0:t.displayObject,[s,o]=this.calculateFillObjectOffset();n?((null===(e=this.strokeGraphics)||void 0===e?void 0:e.isNeedMask(n.width,n.height))&&r&&(this.needCacheAsBitMap=!0,n.pivot.x=r.pivot.x,n.pivot.y=r.pivot.y,r.pivot.x=0,r.pivot.y=0,n.mask=r,n.addChild(r),n.position.x=-s/2,n.position.y=-o/2,r.position.x=s/2,r.position.y=o/2),this.effectContainer.addChild(n)):this.strokeFill.hasFill&&(null===(i=this.strokeGraphics)||void 0===i?void 0:i.displayObject)&&this.effectContainer.addChild(this.strokeGraphics.displayObject)}createFilledPathMask(){var t,e,i;const n=(null===(e=null===(t=this.json.geometry)||void 0===t?void 0:t.paths)||void 0===e?void 0:e.filter(t=>"none"!==t.fill&&"norm"!==t.fill))||[];for(const t of n){const e=this.ctx.graphicsTexture.getGraphicsData(t.id);if(e){const n=new fm(e.texture);n.pivot.x=e.pivot.x,n.pivot.y=e.pivot.y;const r=this.backgroundFill.getClonedDisplayObject(),s=null===(i=this.backgroundGraphics)||void 0===i?void 0:i.getClonedDisplayObject(),o=r||s;o&&(this.backgroundFill.displayObject&&(o.pivot.x=this.backgroundFill.displayObject.pivot.x,o.pivot.y=this.backgroundFill.displayObject.pivot.y),o.mask=n,o.filters=[Ey[t.fill]],this.needCacheAsBitMap=!0,this.effectContainer.addChild(o),this.effectContainer.addChild(n))}}}createArrow(){this.arrowList.length&&this.arrowList.forEach(t=>{var e;const i=this.ctx.graphicsTexture.getGraphicsData(t.graphicsId);if(i){const{texture:n}=i,r=new fm(n);r.pivot.x=t.pivot.x,r.pivot.y=t.pivot.y,r.position.x=t.position.x,r.position.y=t.position.y,r.rotation=t.rotate/180*Math.PI,null===(e=this.backgroundGraphics)||void 0===e||e.addArrows(r)}})}generateArrowList(){var t,e;const{lineArrowList:i,lineStyle:n,id:r}=this.json,s="solidFill"===(null===(t=null==n?void 0:n.fill)||void 0===t?void 0:t.fillType)?n.fill.color:null;null===(e=i||[])||void 0===e||e.forEach((t,e)=>{var i,o;const a=new gx(Object.assign(Object.assign({},t),{fillStyle:null==n?void 0:n.fill,lineWidth:null!==(i=null==n?void 0:n.width)&&void 0!==i?i:0}));a.graphicsId=`${r}-arrow-${e}-graphics`,a.textureId=`${r}-arrow-${e}-fill`,this.ctx.graphicsTexture.addGraphics(a.graphicsId,null!==(o=a.paths)&&void 0!==o?o:[],a.hash,{x:0,y:0},a.width,a.height,void 0,this.ctx.objectPoolGroup,!0,s,null),this.arrowList.push(a)})}calculateFillObjectOffset(){let[t,e]=[0,0];return this.arrowList.length&&(t=this.arrowList.reduce((t,e)=>Math.max(t,e.width),0),e=this.arrowList.reduce((t,e)=>Math.max(t,e.height),0)),[t,e]}preRender(t){var e,i,n;const{lineStyle:r,geometry:s}=this.json,{width:o,height:a}=(null==s?void 0:s.lineTransform)||yx,l=o||this.json.width,h=a||this.json.height,c=(null===(e=null==s?void 0:s.paths)||void 0===e?void 0:e.filter(t=>"none"!==t.fill&&"norm"!==t.fill))||[],u="solidFill"===(null===(i=null==r?void 0:r.fill)||void 0===i?void 0:i.fillType)?r.fill.color:null;t.addSubMTask(()=>_x(this,void 0,void 0,(function*(){for(const t of c)this.ctx.graphicsTexture.addGraphics(t.id,[t],t.hash,((null==s?void 0:s.lineTransform)||yx).pivot,l,h,r,this.ctx.objectPoolGroup,!0,null,u)})),"@ShapeImpl[addGraphics]"),null===(n=this.text)||void 0===n||n.createParagraphs(this.json.id,t)}subClassRender(){}render(t){t.addSubMTask(()=>_x(this,void 0,void 0,(function*(){var t,e;null===(t=this.strokeGraphics)||void 0===t||t.render(),null===(e=this.backgroundGraphics)||void 0===e||e.render(),this.createBackground(),this.subClassRender(),this.createFilledPathMask(),this.createPathFill(),this.createArrow()})),"@ShapeImpl[render]"),this.text&&this.text.render(t),t.addSubMTask(()=>_x(this,void 0,void 0,(function*(){var t,e,i,n,r,s,o,a,l;if("wd"===(null===(t=this.json.textBody)||void 0===t?void 0:t.iterateType)||"lt"===(null===(e=this.json.textBody)||void 0===e?void 0:e.iterateType))this.renderContainer.addChild(this.container),this.text&&(this.text.container.scale.y=null!==(n=null===(i=this.json.scale)||void 0===i?void 0:i.y)&&void 0!==n?n:1,this.text.container.position.x+=(null!==(s=null===(r=this.json.position)||void 0===r?void 0:r.x)&&void 0!==s?s:0)+this.text.x,this.text.container.position.y+=(null!==(a=null===(o=this.json.position)||void 0===o?void 0:o.y)&&void 0!==a?a:0)+this.text.y,-1===this.text.container.scale.y&&(this.text.container.position.y+=this.text.height),this.renderContainer.addChild(this.text.container));else{if(this.text){if(uy()(this.json.textRotateWithShape)&&!this.json.textRotateWithShape){const t=this.json.rotation||0;this.text.container.rotation=-t;const{width:e}=this.text;this.text.container.position.x=e}this.text.container.zIndex=100;const t=null===(l=this.json.effectList)||void 0===l?void 0:l.find(t=>"outerShadow"===t.type);t&&1!==t.sx?this.container.addChild(this.text.container):this.effectContainer.addChild(this.text.container)}this.renderContainer.addChild(this.container)}if(this.needCacheAsBitMap,"background"===this.json.id&&this.ctx.hasBackgroundFillShape){const t=Wd.create({width:this.json.width,height:this.json.height,resolution:Math.ceil(this.ctx.renderer.resolution)});this.ctx.renderer.render(this.renderContainer,{renderTexture:t}),this.ctx.bgTexture=t}})),"@ShapeImpl[post.render]")}clearOnSlideChange(){}initOnReuse(){}destroy(){var t,e,i,n;null===(t=this.text)||void 0===t||t.destroy(),this.fillColorFilter.destroy(),this.strokeColorFilter.destroy(),this.backgroundFill.destroy(),null===(e=this.backgroundGraphics)||void 0===e||e.destroy(),this.strokeFill.destroy(),null===(i=this.strokeGraphics)||void 0===i||i.destroy(),this.renderContainer.destroy(),null===(n=this.arrowRenderTexture)||void 0===n||n.destroy(!0),this.arrowList=[],this.effectDisposer()}}var bx=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};function Tx(t,e){for(const i in e)t.style[i]=e[i]}class Ex{constructor(t){var e,i;this.progress=document.createElement("div"),this.totalTime=document.createElement("span"),this.playButton=document.createElement("div"),this.pauseButton=document.createElement("div"),this.currentTime=document.createElement("span"),this.mediaController=document.createElement("div"),this.currentProgress=document.createElement("div"),this.medianIsEnd=!1,this.pickBookmarkIndex=0,this.playCallBackList=[],this.duration=0,this.start=0,this.end=0,this.changeMediaProgress=t=>{if(this.ctx.isPlayerPaused())return void this.ctx.logger.info("Media controller prevent seek event with paused state",this.ctx.taskId);t.stopPropagation();const e=t.offsetX/this.progress.clientWidth*this.duration;this.medianIsEnd=!1,"interactive"!==this.ctx.mode&&this.jumpToTime(e),"local"!==this.ctx.mode&&this.ctx.eventHub.emit(Nb.mediaSeek,{id:this.targetId,time:e,isPlaying:this.media.isPlaying})},this.jumpToTime=(t=0)=>{const e=Math.floor(t)+this.start;this.media.currentTime!==e&&(this.media.currentTime=e,this.changeBookmarkIndex(e,e>this.media.currentTime))},this.showController=t=>{t.stopPropagation(),this.show()},this.getMediaDuration=()=>{this.duration&&!Number.isNaN(this.duration)||(this.duration=this.media.duration,this.start&&(this.duration-=this.start,this.jumpToTime()),this.end&&(this.duration-=this.end)),this.totalTime.innerText=Ex.formatTime(this.duration)},this.playMedia=()=>bx(this,void 0,void 0,(function*(){this.playButton.style.display="none",this.pauseButton.style.display="block",yield this.media.play(),this.medianIsEnd&&(this.medianIsEnd=!1,this.jumpToTime()),this.playCallBackList.forEach(t=>{t()})})),this.pauseMedia=()=>bx(this,void 0,void 0,(function*(){this.playButton.style.display="block",this.pauseButton.style.display="none",yield this.media.pause()})),this.onMouseOut=t=>{t.stopPropagation(),this.mediaController.style.display="none"},this.mediaTimeUpdate=()=>bx(this,void 0,void 0,(function*(){const t=this.media.currentTime-this.start;if(this.duration>0&&(t>this.duration||this.media.ended)&&(yield this.pauseMedia(),this.medianIsEnd=!0),this.currentTime.innerText=Ex.formatTime(t),this.currentProgress.style.flex=(t/this.duration).toString(),!this.bookmarkList||0===this.bookmarkList.length)return;const e=this.bookmarkList[this.pickBookmarkIndex];e&&e.time.toFixed(0)===this.media.currentTime.toFixed(0)&&(this.ctx.timingEventHub.emit(`shape ${this.shapeId} onMediaBookmark ${e.name}`),this.pickBookmarkIndex+=1)})),this.onPauseMedia=()=>{this.playButton.style.display="block",this.pauseButton.style.display="none"},this.onPlayMedia=()=>{this.playButton.style.display="none",this.pauseButton.style.display="block",this.playCallBackList.forEach(t=>{t()})},this.playMediaFromCtrl=()=>{this.ctx.isPlayerPaused()?this.ctx.logger.info("Media controller prevent play event with paused state",this.ctx.taskId):("interactive"!==this.ctx.mode&&this.playMedia(),"local"!==this.ctx.mode&&this.ctx.eventHub.emit(Nb.mediaPlay,{id:this.targetId,time:this.media.currentTime-this.start}))},this.pauseMediaFromCtrl=()=>{this.ctx.isPlayerPaused()?this.ctx.logger.info("Media controller prevent pause event with paused state",this.ctx.taskId):("interactive"!==this.ctx.mode&&this.pauseMedia(),"local"!==this.ctx.mode&&this.ctx.eventHub.emit(Nb.mediaPause,{id:this.targetId,time:this.media.currentTime-this.start}))},this.targetId=t.targetId,this.ctx=t.ctx,this.height=t.height,this.width=t.width,this.target=t.target,this.media=t.media,this.info=t.info,this.shapeId=t.shapeId,this.canvasElement=t.canvasElement,this.getMedianContainer(),this.createMediaController(),this.info.cut&&(this.start=null!==(e=this.info.cut.start)&&void 0!==e?e:0,this.end=null!==(i=this.info.cut.end)&&void 0!==i?i:0),this.info.bookmarkList&&(this.bookmarkList=this.info.bookmarkList.sort((t,e)=>t.time-e.time))}getMedianContainer(){var t;let e=null===(t=this.canvasElement.parentElement)||void 0===t?void 0:t.querySelector(".median-container");e||(e=document.createElement("div"),e.className="median-container",this.canvasElement.parentElement.appendChild(e)),this.container=e}static formatTime(t){let e="00:00";if(t){const i=Math.floor(t/60),n=String(i<0?0:i).padStart(2,"0"),r=Math.floor(t%60);e=`${n}:${String(r<0?0:r).padStart(2,"0")}`}return e}generatePlayButton(t=20,e=20){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttributeNS(null,"viewBox","0 0 512 512"),i.setAttributeNS(null,"height",t.toString()),i.setAttributeNS(null,"width",e.toString());const n=document.createElementNS("http://www.w3.org/2000/svg","polyline");return n.setAttributeNS(null,"points","35 0, 477 256, 35 512"),n.setAttributeNS(null,"fill","#000000"),i.appendChild(n),i}generatePauseButton(t=20,e=20){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");Tx(i,{height:"20px"}),i.setAttributeNS(null,"viewBox","0 0 512 512"),i.setAttributeNS(null,"height",t.toString()),i.setAttributeNS(null,"width",e.toString());const n=document.createElementNS("http://www.w3.org/2000/svg","rect");n.setAttributeNS(null,"x","35"),n.setAttributeNS(null,"y","0"),n.setAttributeNS(null,"width","148"),n.setAttributeNS(null,"height","512");const r=n.cloneNode(!0);return r.setAttributeNS(null,"x","330"),i.append(n,r),i}createButton(){const t={marginLeft:"15px",marginRight:"10px",fontSize:"0",height:"20px"};Tx(this.playButton,Object.assign(Object.assign({},t),{display:"block"}));const e=this.generatePlayButton();Tx(e,{height:"20px"}),this.playButton.appendChild(e),Tx(this.pauseButton,Object.assign(Object.assign({},t),{display:"none"}));const i=this.generatePauseButton();Tx(i,{height:"20px"}),this.pauseButton.appendChild(i)}createTimer(){const t=document.createElement("div");Tx(t,{width:"100px"}),this.currentTime.innerText="00:00";const e=document.createElement("span");return e.innerText="/",t.append(this.currentTime,e,this.totalTime),t}createProgress(){Tx(this.progress,{flex:"1",position:"relative",marginRight:"10px"});const t=document.createElement("div");Tx(t,{background:"#D9D9D9",position:"relative",height:"10px",display:"flex"}),this.progress.appendChild(t),Tx(this.currentProgress,{background:"#4F4F4F",top:"0px",left:"0",height:"10px",flex:"0"}),t.appendChild(this.currentProgress)}changeBookmarkIndex(t,e){if(this.bookmarkList&&0!==this.bookmarkList.length){if(this.pickBookmarkIndex>0)for(let e=0;e<this.pickBookmarkIndex;e++)if(this.bookmarkList[e].time>t){this.pickBookmarkIndex=e;break}if(e){let e=this.pickBookmarkIndex-1;for(let i=0;i<this.bookmarkList.length;i++)this.bookmarkList[i].time<t&&(e=i);for(let t=this.pickBookmarkIndex;t<=e;t++){const e=this.bookmarkList[t];e&&this.ctx.timingEventHub.emit(`shape ${this.shapeId} onMediaBookmark ${e.name}`)}this.pickBookmarkIndex=e+1}}}bindEvent(){this.mediaController.addEventListener("mouseover",this.showController,!1),this.mediaController.addEventListener("mouseout",this.onMouseOut,!1),this.progress.addEventListener("mousedown",this.changeMediaProgress,!1),this.playButton.addEventListener("click",this.playMediaFromCtrl,!1),this.pauseButton.addEventListener("click",this.pauseMediaFromCtrl,!1),this.media.on("durationchange",this.getMediaDuration,!1),this.media.on("timeupdate",this.mediaTimeUpdate,!1),this.media.on("pause",this.onPauseMedia,!1),this.media.on("play",this.onPlayMedia,!1)}setControllerPosition(){var t;const{target:e}=this,{stageWidth:i,stageHeight:n}=this.ctx,r=e.getGlobalPosition(),s=Number(null===(t=this.container)||void 0===t?void 0:t.getAttribute("data-scale")),o=i*s,a=1/s*(300>o?o/300:1);r.y=r.y+this.height-50,r.x=Math.max(r.x,0),r.x=Math.min(r.x,i-300*a),r.y=Math.max(r.y,0),r.y=Math.min(r.y,n-50),Tx(this.mediaController,{height:"50px",borderRadius:"25px",width:"300px",flexDirection:"row",alignItems:"center",position:"absolute",left:r.x+"px",top:r.y+"px",display:"none",background:"#fff",zIndex:"2",border:"1px solid #ccc",transform:`scale(${a})`,transformOrigin:"0 100%"})}createMediaController(){this.setControllerPosition(),this.createButton();const t=this.createTimer();this.createProgress(),this.mediaController.append(this.playButton,this.pauseButton,t,this.progress),this.container.appendChild(this.mediaController),this.bindEvent()}addPlayCallBack(t){this.playCallBackList.push(t)}unbindEvent(){this.mediaController.removeEventListener("mouseover",this.showController,!1),this.mediaController.removeEventListener("mouseout",this.onMouseOut,!1),this.progress.removeEventListener("mousedown",this.changeMediaProgress,!1),this.playButton.removeEventListener("click",this.playMediaFromCtrl,!1),this.pauseButton.removeEventListener("click",this.pauseMediaFromCtrl,!1),this.media.removeAllListeners()}show(){this.setControllerPosition(),this.mediaController.style.display="flex"}hide(){this.mediaController.style.display="none"}destroy(){var t;this.unbindEvent(),this.playCallBackList=[],null===(t=this.container)||void 0===t||t.removeChild(this.mediaController)}}var wx=i(91);class Sx extends $a.a{constructor(t,e){super(),this.isGlobalPause=!1,this.lastTime=-1,this.howl=null,this.rctClient=null,this.url=t,this.runningAudio=e,Ob.RtcAudioClazz?(this.rctClient=new Ob.RtcAudioClazz(t),this.rctClient.on("load",()=>this.emit("load")),this.rctClient.on("pause",()=>this.emit("pause")),this.rctClient.on("play",()=>this.emit("play"))):(this.howl=new wx.Howl({src:[t]}),this.howl.on("load",()=>this.emit("load")),this.howl.on("pause",()=>this.emit("pause")),this.howl.on("play",()=>this.emit("play")))}startTimeChangeEmit(){this.currentTime!==this.lastTime&&(this.lastTime=this.currentTime,this.emit("timeupdate")),this.isEnded||setTimeout(()=>this.startTimeChangeEmit(),300)}play(){var t,e,i;this.runningAudio.has(this.url)&&(null===(t=this.runningAudio.get(this.url))||void 0===t||t.stop(),this.runningAudio.delete(this.url)),this.lastTime=-1,null===(e=this.howl)||void 0===e||e.play(),null===(i=this.rctClient)||void 0===i||i.play(),this.startTimeChangeEmit(),this.runningAudio.set(this.url,this)}pause(){var t,e;null===(t=this.howl)||void 0===t||t.pause(),null===(e=this.rctClient)||void 0===e||e.pause(),this.runningAudio.has(this.url)&&this.runningAudio.delete(this.url)}globalPause(){this.isPaused||(this.isGlobalPause=!0,this.pause())}globalResume(){this.isGlobalPause&&(this.isGlobalPause=!1,this.play())}stop(){var t;null===(t=this.howl)||void 0===t||t.stop(),this.rctClient&&(this.rctClient.pause(),this.rctClient.currentTime=0),this.runningAudio.has(this.url)&&this.runningAudio.delete(this.url)}destroy(){var t,e,i,n,r,s,o;null===(t=this.howl)||void 0===t||t.pause(),null===(e=this.howl)||void 0===e||e.unload(),null===(i=this.rctClient)||void 0===i||i.pause(),null===(n=this.rctClient)||void 0===n||n.destroy(),null===(r=this.rctClient)||void 0===r||r.removeAllListeners("load"),null===(s=this.rctClient)||void 0===s||s.removeAllListeners("play"),null===(o=this.rctClient)||void 0===o||o.removeAllListeners("pause"),this.runningAudio.has(this.url)&&this.runningAudio.delete(this.url)}get currentTime(){return this.rctClient?this.rctClient.currentTime:this.howl?this.howl.seek():-1}set currentTime(t){this.rctClient?this.rctClient.currentTime=t:this.howl&&this.howl.seek(t)}get duration(){return this.rctClient?this.rctClient.duration:this.howl?this.howl.duration():0}get isEnded(){return Math.abs(this.currentTime-this.duration)<.001}get isPaused(){return this.rctClient?this.rctClient.isPaused:!!this.howl&&this.howl.playing()}volume(t){this.rctClient?this.rctClient.volume(t):this.howl&&this.howl.volume(t)}}var Mx=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class Ax extends $a.a{constructor(t){var e,i;super(),this.type="video",this.sprite=new fm,this.isPlaying=!1,this.isGlobalPause=!1,this.updateVolume=t=>{Ob.RtcAudioClazz?this.rtcAudio.volume(t):this.videoResource.source&&(this.videoResource.source.volume=t)},this.id=t.id,this.start=null===(e=t.video.cut)||void 0===e?void 0:e.start,this.end=null===(i=t.video.cut)||void 0===i?void 0:i.end,this.container=t.container,this.ctx=t.ctx,this.ctx.medias[this.id]=this;let n=t.video.src;this.ctx.loaderDelegate&&(n=this.ctx.loaderDelegate.redirectMedia(n),this.ctx.logger.info(`redirect media url from ${t.video.src} to ${n} by delegate.`,t.ctx.taskId)),this.videoResource=new Dd(n,{autoLoad:!0,autoPlay:!1,updateFPS:30,crossorigin:!0});let r=t.video.src.replace(/4$/,"3");this.ctx.loaderDelegate&&(r=this.ctx.loaderDelegate.redirectMedia(r),this.ctx.logger.info(`redirect media url from ${t.video.src.replace(/4$/,"3")} to ${r} by delegate.`,t.ctx.taskId)),this.rtcAudio=new Sx(r,t.ctx.runningAudio);const{video:s,width:o,height:a,target:l}=t;this.controller=new Ex({targetId:t.id,shapeId:t.shapeId,ctx:t.ctx,width:o,height:a,target:l,media:this,info:s,canvasElement:t.canvasElement}),this.controller.addPlayCallBack(()=>{this.sprite.width=o,this.sprite.height=a,this.ctx.clock.setTimeout(()=>{this.sprite.visible=!0},50)});const h=new Ad(null,{height:a,width:o});h.resource=this.videoResource,this.videoResource.bind(h),this.sprite=new fm,this.sprite.visible=!1,this.sprite.texture=new Vd(h),this.sprite.interactive=!0,this.container.addChild(this.sprite),this.sprite.on("mouseover",t=>{t.stopPropagation(),this.controller.show()}),this.sprite.on("mouseout",t=>{t.stopPropagation(),this.controller.hide()}),["durationchange","timeupdate","pause","play"].forEach(t=>{this.videoResource.source.addEventListener(t,()=>{"timeupdate"!==t||this.isPlaying||this.pause(),this.emit(t)})}),this.ctx.activeMedia.add(this),this.ctx.volumeAdjuster.on("update",this.updateVolume)}get currentTime(){var t,e;return null!==(e=null===(t=this.videoResource.source)||void 0===t?void 0:t.currentTime)&&void 0!==e?e:0}set currentTime(t){Ob.RtcAudioClazz&&(this.rtcAudio.currentTime=t),this.videoResource.source&&(this.videoResource.source.currentTime=t)}get paused(){var t,e;return null===(e=null===(t=this.videoResource.source)||void 0===t?void 0:t.paused)||void 0===e||e}get ended(){var t,e;return null===(e=null===(t=this.videoResource.source)||void 0===t?void 0:t.ended)||void 0===e||e}get duration(){var t,e;return null!==(e=null===(t=this.videoResource.source)||void 0===t?void 0:t.duration)&&void 0!==e?e:0}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){var t;return Mx(this,void 0,void 0,(function*(){this.isPlaying=!0,this.updateVolume(this.ctx.volumeAdjuster.volume),yield this.load(),yield this.ctx.clock.waitUntil(()=>{const t=this.videoResource.source;return!!(t&&t.videoWidth>0)},3e3);const e=this.videoResource.source;e&&e.videoWidth<=0||(Ob.RtcAudioClazz?(this.videoResource.source.volume=0,this.rtcAudio.once("play",()=>{var t;null===(t=this.videoResource.source)||void 0===t||t.play()}),this.rtcAudio.play()):yield null===(t=this.videoResource.source)||void 0===t?void 0:t.play())}))}load(){return this.videoResource.load()}pause(){var t;this.isPlaying=!1,Ob.RtcAudioClazz?(this.rtcAudio.once("pause",()=>{var t;null===(t=this.videoResource.source)||void 0===t||t.pause()}),this.rtcAudio.pause()):null===(t=this.videoResource.source)||void 0===t||t.pause()}globalPause(){this.isPlaying&&(this.isGlobalPause=!0,this.pause())}globalResume(){this.isGlobalPause&&(this.isGlobalPause=!1,this.play())}togglePause(){this.isPlaying?this.pause():this.play()}seek(t){this.controller.jumpToTime(t)}stop(){this.seek(0),this.pause()}destroy(){var t;this.ctx.volumeAdjuster.removeListener("update",this.updateVolume),this.sprite.interactive=!1,this.sprite.destroy({texture:!0,baseTexture:!0}),null===(t=this.videoResource)||void 0===t||t.destroy(),this.rtcAudio.destroy(),this.controller.destroy(),this.ctx.activeMedia.delete(this)}}var Px=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class Rx extends $a.a{constructor(t){super(),this.type="audio",this.isPlaying=!1,this.isGlobalPause=!1,this.updateVolume=t=>{this.audioPlayer.volume(t)},this.id=t.id;let e=t.audio.src;t.ctx.loaderDelegate&&(e=t.ctx.loaderDelegate.redirectMedia(e),t.ctx.logger.info(`redirect media url from ${t.audio.src} to ${e} by delegate.`,t.ctx.taskId)),this.audioPlayer=new Sx(e,t.ctx.runningAudio),t.audio.cut&&(this.start=t.audio.cut.start,this.end=t.audio.cut.end),this.ctx=t.ctx,this.ctx.medias[this.id]=this;const{width:i,height:n,target:r}=t;this.controller=new Ex({targetId:t.id,shapeId:t.shapeId,ctx:t.ctx,height:n,width:i,target:r,media:this,info:t.audio,canvasElement:t.canvasElement}),this.audioPlayer.on("load",()=>this.emit("durationchange")),this.audioPlayer.on("timeupdate",()=>this.emit("timeupdate")),this.audioPlayer.on("pause",()=>this.emit("pause")),this.audioPlayer.on("play",()=>this.emit("play")),this.ctx.activeMedia.add(this),this.ctx.volumeAdjuster.on("update",this.updateVolume)}get currentTime(){return this.audioPlayer.currentTime}set currentTime(t){this.audioPlayer.currentTime=t}get paused(){return this.audioPlayer.isPaused}get isPaused(){return this.audioPlayer.isPaused}get ended(){return this.audioPlayer.isEnded}get duration(){return this.audioPlayer.duration}load(){return Promise.resolve()}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){return Px(this,void 0,void 0,(function*(){this.ctx.isPlayerPaused()?this.ctx.logger.info("Audio player prevent play event with paused state",this.ctx.taskId):(this.updateVolume(this.ctx.volumeAdjuster.volume),this.isPlaying=!0,this.audioPlayer.play())}))}pause(){this.ctx.isPlayerPaused()?this.ctx.logger.info("Audio player prevent pause event with paused state",this.ctx.taskId):(this.isPlaying=!1,this.audioPlayer.pause())}globalPause(){this.isPlaying&&(this.isGlobalPause=!0,this.pause())}globalResume(){this.isGlobalPause&&(this.isGlobalPause=!1,this.play())}togglePause(){this.isPlaying?this.pause():this.play()}seek(t){this.ctx.isPlayerPaused()?this.ctx.logger.info("Audio player prevent seek event with paused state",this.ctx.taskId):this.controller.jumpToTime(t)}stop(){this.seek(0),this.pause()}destroy(){this.ctx.volumeAdjuster.removeListener("update",this.updateVolume),this.audioPlayer.pause(),this.controller.destroy(),this.ctx.activeMedia.delete(this)}}class Ix extends xx{constructor(t,e,i,n){super(Object.assign(Object.assign({},t),{type:"Shape",useBgFill:!1,textRotateWithShape:!0,isPicture:!0}),e,i,n),this.isInteractiveOutside=!1,this.cmd=new iy(this),this.media=null==t?void 0:t.media,this.container.name=t.id+"_container_[Picture]",this.renderContainer.name=t.id+"_render_container_[Picture]",this.picFill=new ax(this.ctx,t.picFill,t.width,t.height,{useFilter:!0,useSlideBackgroundFill:!1})}applyCommand(t,e){var i,n,r,s,o;if("call"===e)if(/playFrom\(([0-9.]+)\)/.test(t)){const e=t.match(/playFrom\(([0-9.]+)\)/),n=Number(e[1]||"0");null===(i=this.mediaPlayer)||void 0===i||i.play().then(()=>{var t;null===(t=this.mediaPlayer)||void 0===t||t.seek(n)})}else"custom-pause"===t?null===(n=this.mediaPlayer)||void 0===n||n.pause():"togglePause"===t?null===(r=this.mediaPlayer)||void 0===r||r.togglePause():"stop"===t&&(null===(s=this.mediaPlayer)||void 0===s||s.pause(),null===(o=this.mediaPlayer)||void 0===o||o.seek(0))}renderPic(){var t,e,i,n,r,s;const{displayObject:o}=this.picFill;if(o){o.name=this.json.id+"_pic_fill_[Picture]";const a=null===(t=this.backgroundGraphics)||void 0===t?void 0:t.getClonedDisplayObject();if((null===(e=this.backgroundGraphics)||void 0===e?void 0:e.isNeedMask(o.width,o.height))&&a&&(o.mask=a,this.effectContainer.addChild(a)),o.width=this.designWidth,o.height=this.designHeight,o instanceof Qv&&this.ctx.slideScopeEventHub.once("slide-render",t=>{var e;this.ctx.slideIndex===t&&(null===(e=this.effectObject)||void 0===e||e.setFrameCount(o.totalFrames),o.play(),o.onFrameChange=t=>{if(this.effectObject)if(this.effectObject.hasFrame(t))this.effectObject.updateFrame(t);else{const e=this.getEffectTexture();e&&this.effectObject.createFrame(t,e)}})}),this.effectContainer.addChild(o),"video"===(null===(i=this.media)||void 0===i?void 0:i.type)&&this.media.src){if(this.mediaPlayer=new Ax({id:this.json.id+"-video",shapeId:this.json.id,ctx:this.ctx,video:this.media,height:this.designHeight,width:this.designWidth,target:o,container:this.effectContainer,canvasElement:this.ctx.view}),(null===(n=this.mediaPlayer)||void 0===n?void 0:n.sprite)&&a){const t=null===(r=this.backgroundGraphics)||void 0===r?void 0:r.getClonedDisplayObject();t&&(this.mediaPlayer.sprite.mask=t,this.container.addChild(t))}}else"audio"===(null===(s=this.media)||void 0===s?void 0:s.type)&&this.media.src&&(this.mediaPlayer=new Rx({id:this.json.id+"-audio",shapeId:this.json.id,ctx:this.ctx,audio:this.media,height:this.designHeight,width:this.designWidth,target:o,canvasElement:this.ctx.view}));this.mediaPlayer&&(this.isInteractiveOutside=!!this.container.interactive,this.container.interactive=!0,this.container.on("mouseover",()=>{this.mediaPlayer.showController()}),this.container.on("mouseout",()=>{this.mediaPlayer.hideController()},!1))}}preRender(t){super.preRender(t)}subClassRender(){this.renderPic()}clearOnSlideChange(){super.clearOnSlideChange(),this.mediaPlayer&&(this.container.interactive=!1,this.mediaPlayer.stop(),this.mediaPlayer.hideController())}initOnReuse(){super.initOnReuse(),this.mediaPlayer&&(this.container.interactive=!0)}destroy(){this.mediaPlayer&&(this.picFill.displayObject&&!this.isInteractiveOutside&&(this.container.interactive=!1),this.mediaPlayer.destroy(),this.mediaPlayer=void 0),this.picFill.destroy()}}var Cx=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class Lx extends hy{constructor(t,e,i,n,r){super(t,e,i),this.children=[],this.cacheSprite=new fm,this.cacheContainer=new pd,this.json=t,this.json.fillStyle&&"groupFill"===this.json.fillStyle.fillType&&n&&(this.json.fillStyle=n),this.container.name=t.id+"_container_[Container]",this.cacheContainer.name=t.id+"_cache_container_[Container]",this.ctx.timingTargets.addTarget(t.id,this),this.updateTransform(this.json),this.fillObject=new ax(this.ctx,t.fillStyle,t.width,t.height,{useFilter:!1,useSlideBackgroundFill:!1}),this.createChildren(r)}createChildren(t){var e,i,n,r;const s={x:null!==(i=null===(e=this.json.position)||void 0===e?void 0:e.x)&&void 0!==i?i:0,y:null!==(r=null===(n=this.json.position)||void 0===n?void 0:n.y)&&void 0!==r?r:0};for(let e=0,i=this.json.children.length;e<i;e++)t.addSubMTask(()=>Cx(this,void 0,void 0,(function*(){const i=this.json.children[e];let n=null;"Shape"===(null==i?void 0:i.type)?n=new xx(i,this.ctx,s,this.json.fillStyle):"Picture"===(null==i?void 0:i.type)?n=new Ix(i,this.ctx,s,this.json.fillStyle):"Container"===(null==i?void 0:i.type)&&(n=new Lx(i,this.ctx,s,this.json.fillStyle,t)),n&&this.children.push(n)})),"@ContainerImpl[child.init]")}get interactiveContainer(){return this.container}get renderContainer(){return this.container}preRender(t){for(const e of this.children)t.addSubMTask(()=>Cx(this,void 0,void 0,(function*(){e.preRender(t)})),"@ContainerImpl[child.preRender]")}getBgElement(){return null}getIterateEntry(t,e,i){return 0===e?this:(this.ctx.eventHub.emit("IterateTimeNodeEnd",i),null)}getTextElement(){return null}render(t){for(const e of this.children)e.render(t),t.addSubMTask(()=>Cx(this,void 0,void 0,(function*(){var t;this.cacheContainer.addChild(e.renderContainer),(e.json.hlinkHover||e.json.hlinkClick)&&(null===(t=e.hyperlink)||void 0===t||t.addProxy(this.container))})),"@ContainerImpl[child.render]");t.addSubMTask(()=>Cx(this,void 0,void 0,(function*(){this.container.addChild(this.cacheContainer)})),"@ContainerImpl[child.append]")}clearOnSlideChange(){this.children.forEach(t=>t.clearOnSlideChange())}initOnReuse(){this.children.forEach(t=>t.initOnReuse())}isChildrenInteractive(){for(const t of this.json.children)if("Container"===(null==t?void 0:t.type)||"Stage"===(null==t?void 0:t.type)||(null==t?void 0:t.hlinkHover)||(null==t?void 0:t.hlinkClick))return!0;return!1}destroy(){this.cacheSprite&&this.cacheSprite.destroy({texture:!0}),this.children.forEach(t=>t.destroy()),this.container.destroy({children:!0,texture:!0,baseTexture:!0}),this.cacheContainer.destroy({children:!0,texture:!0,baseTexture:!0})}}class Nx extends $a.a{constructor(t,e,i,n){super(),this.cond={},this.timeoutIds=[],this.condHandle=(t,e={})=>{if(t)if(t.delay&&t.delay>0){const i=this.ctx.clock.setTimeout(()=>{t.event&&(this.cond[t.event]=!0,this.detectTrigger(e))},t.delay);this.timeoutIds.push(i)}else this.cond[t.event]=!0,this.detectTrigger(e);else this.detectTrigger(e)},this.id=t,this.ctx=n,this.eventHubs=i,e.forEach(t=>{this.addCond(t)})}setTriggerParams(t){this.triggerParams=t}addCond(t){const e=e=>{this.condHandle(t,e)};t.event&&(/^shape/.test(t.event)||/^time/.test(t.event)?(this.cond[t.event]=!1,this.eventHubs.global.addListener(t.event,e)):/^runtime/.test(t.event)?(this.cond[t.event]=!1,this.eventHubs.runtime.addListener(t.event,e)):/^self/.test(t.event)?t.delay&&t.delay>0&&(this.cond[t.event]=!1,this.eventHubs.runtime.addListener(t.event,e)):this.cond[t.event]=!1)}isTrigger(){return Object.keys(this.cond).every(t=>!!this.cond[t])}isTriggerWithoutParent(){return Object.keys(this.cond).filter(t=>"self"!==t).every(t=>!!this.cond[t])}detectTrigger(t){if(Object.keys(this.cond).every(t=>!!this.cond[t])){Object.keys(this.cond).forEach(t=>{this.cond[t]=!1});const e=this.triggerParams;this.triggerParams=void 0,this.emit("active",e,t)}}reset(){Object.keys(this.cond).forEach(t=>{this.cond[t]=!1}),this.timeoutIds.forEach(t=>this.ctx.clock.clearTimeout(t))}}class Ox extends $a.a{constructor(t){super(),this.isTimeNodeEndSync=!1,this.interactiveListeners=[],this.runtimeNodeEventHub=new $a.a,this._currentSeqIndex=0,this._currentSeqState="idle",this.isForward=!0,this.autoPlay=!1,this.handlePrev=(t=!1)=>{var e,i,n,r,s,o;this.hasPrev()||!this.isMainSeq?"idle"===this.currentSeqState?(this.decrSeqIndex(),null===(e=this.commonTimeNode.children[this.currentSeqIndex])||void 0===e||e.commonTimeNode.seekToStart(),null===(i=this.commonTimeNode.children[this.currentSeqIndex])||void 0===i||i.commonTimeNode.clearSubList(),this.currentSeqState="idle"):"running"===this.currentSeqState?(null===(n=this.commonTimeNode.children[this.currentSeqIndex])||void 0===n||n.commonTimeNode.seekToStart(),null===(r=this.commonTimeNode.children[this.currentSeqIndex])||void 0===r||r.commonTimeNode.clearSubList(),this.currentSeqState="idle"):"end"===this.currentSeqState&&(this.currentSeqIndex>=this.commonTimeNode.children.length&&(this.currentSeqIndex=this.commonTimeNode.children.length-1),null===(s=this.commonTimeNode.children[this.currentSeqIndex])||void 0===s||s.commonTimeNode.seekToStart(),null===(o=this.commonTimeNode.children[this.currentSeqIndex])||void 0===o||o.commonTimeNode.clearSubList(),this.currentSeqState="idle"):this.globalEventHub.emit("c:prev slide",t)},this.handleNext=(t=!1)=>{var e,i,n,r;this.isTimeNodeEndSync&&(this.isTimeNodeEndSync=!1,this.currentSeqState="idle",this.currentSeqIndex=0),this.hasNext()||!this.isMainSeq?"idle"===this.currentSeqState?null===(e=this.commonTimeNode.children[this.currentSeqIndex])||void 0===e||e.commonTimeNode.startTimeNodeForce():"running"===this.currentSeqState?(null===(i=this.commonTimeNode.children[this.currentSeqIndex])||void 0===i||i.commonTimeNode.seekToEnd(!1,!0),this.currentSeqState="end",this.incrSeqIndex(),null===(n=this.commonTimeNode.children[this.currentSeqIndex])||void 0===n||n.commonTimeNode.startTimeNodeForce()):"end"===this.currentSeqState&&(this.incrSeqIndex(),null===(r=this.commonTimeNode.children[this.currentSeqIndex])||void 0===r||r.commonTimeNode.startTimeNodeForce()):this.globalEventHub.emit("c:next slide",t)};const{json:e,iterateType:i,isIterate:n,isSub:r,parent:s,ctx:o,eventHub:a,iterateIndex:l,iterateId:h,isInInteractiveSeq:c}=t;this.isMainSeq="mainSeq"===e.ctn.nodeType,this.isInteractiveSeq="interactiveSeq"===e.ctn.nodeType,this.id=e.ctn.id,this.isIterate=n,this.json=e,this.ctx=o,this.globalEventHub=a,this.commonTimeNode=new lb({json:e.ctn,isSub:r,eventHubs:{global:a,runtime:this.runtimeNodeEventHub},ctx:o,parent:s,isIterate:!1,iterateType:i,iterateIndex:l,iterateId:h,isInInteractiveSeq:c||this.isInteractiveSeq}),this.bindShapeEvent(),this.nextConds=new Nx("mainSeq",e.nextCondLst,{global:a,runtime:this.runtimeNodeEventHub},this.ctx),this.prevConds=new Nx("mainSeq",e.preCondLst,{global:a,runtime:this.runtimeNodeEventHub},this.ctx),this.commonTimeNode.on("timeNodeRestart",()=>{this.currentSeqIndex=0,this.currentSeqState="idle"}),this.commonTimeNode.on("childTimeNodeStart",t=>{const e=this.commonTimeNode.children.findIndex(e=>e.commonTimeNode.uuid===t.id);e>=0&&(this.currentSeqIndex=e),this.currentSeqState="running",this.isMainSeq&&this.ctx.eventHub.emit(Nb.mainSeqStepStart,e)}),this.commonTimeNode.on("childTimeNodeEnd",t=>{const e=this.commonTimeNode.children.findIndex(e=>e.commonTimeNode.uuid===t.id);e>=0&&(this.currentSeqIndex=e),this.currentSeqState="end",this.autoPlay&&this.ctx.clock.setTimeout(()=>{this.handleNext()}),this.isMainSeq&&this.ctx.eventHub.emit(Nb.mainSeqStepEnd,e)}),this.commonTimeNode.on("timeNodeEndSync",()=>{this.isTimeNodeEndSync=!0,this.commonTimeNode.resetForRepeat()}),this.commonTimeNode.on("timeNodeDestroy",()=>{this.interactiveListeners.forEach(([t,e])=>{t&&e&&t.interactiveContainer.removeListener("pointerdown",e)}),this.interactiveListeners=[]}),this.nextConds.on("active",(t,e)=>{this.handleNext(e)}),this.prevConds.on("active",(t,e)=>{this.handlePrev(e)})}get currentSeqIndex(){return this._currentSeqIndex}set currentSeqIndex(t){this._currentSeqIndex=t,this.isMainSeq?this.ctx.eventHub.emit(Nb.mainSeqStepChange,t):this.isInteractiveSeq&&this.ctx.eventHub.emit(Nb.interactiveSeqStateChange,{id:this.json.ctn.id,state:{step:t,state:this._currentSeqState}})}get currentSeqState(){return this._currentSeqState}set currentSeqState(t){this._currentSeqState=t,this.isMainSeq?this.ctx.eventHub.emit(Nb.mainSeqStateChange,t):this.isInteractiveSeq&&this.ctx.eventHub.emit(Nb.interactiveSeqStateChange,{id:this.json.ctn.id,state:{step:this._currentSeqIndex,state:t}})}get stepLength(){return this.commonTimeNode.children.length}get currentStep(){return this.currentSeqIndex}get currentState(){return this.currentSeqState}startAutoPlay(){this.autoPlay=!0,this.commonTimeNode.children[0].commonTimeNode.startTimeNodeForce()}incrSeqIndex(){this.currentSeqIndex+1<=this.commonTimeNode.children.length&&(this.currentSeqIndex+=1)}decrSeqIndex(){this.currentSeqIndex-1>=-1&&(this.currentSeqIndex-=1)}hasPrev(){return!(this.currentSeqIndex<=0&&"idle"===this.currentSeqState)}hasNext(){return!(this.currentSeqIndex>=this.commonTimeNode.children.length||this.currentSeqIndex===this.commonTimeNode.children.length-1&&"end"===this.currentSeqState)}bindShapeEvent(){"interactiveSeq"===this.json.ctn.nodeType&&this.json.nextCondLst.forEach(t=>{if(/^shape/.test(t.event)){const e=t.event.split(" ")[1];if(e){const t=this.ctx.timingTargets.getTargetById(e);if(t){t.interactiveContainer.interactive=!0,t.interactiveContainer.cursor="pointer";const i=()=>{this.ctx.eventHub.emit(Nb.userInput);const t=`shape ${e} onClick`,{mode:i}=this.ctx;"interactive"!==i&&"sync"!==i||this.ctx.eventHub.emit(Nb.interactiveSeqAction,{action:t,seqId:this.json.ctn.id}),"sync"!==i&&"local"!==i||this.globalEventHub.emit(t)};t.interactiveContainer.on("pointerdown",i),this.interactiveListeners.push([t,i])}}}})}setCurrentStep(t,e){this.isInteractiveSeq&&0===this.commonTimeNode.applyCount&&(this.commonTimeNode.applyCount=1);let i=t;this.commonTimeNode.seekToStart();const{length:n}=this.commonTimeNode.children;if(-1===i&&(i=n-1),0!==i||"start"!==e){if(i>=0&&i<n)for(let t=0;t<=i;t++){const n=this.commonTimeNode.children[t];t!==i?n.commonTimeNode.seekToEnd(!1,!0):"start"===e?n.commonTimeNode.seekToStart():"end"===e&&n.commonTimeNode.seekToEnd(!1,!0)}this.currentSeqIndex=i,this.currentSeqState="start"===e?"idle":"end"}}}function Dx(t,e,i){const n=e.split(".");n.reduce((r,s,o)=>{if(r)return o!==n.length-1?r[s]:void(r[s]=i);console.warn(`${t} not support ${e}`)},t)}function Fx(t,e){if(!e)return null;return e.split(".").reduce((i,n)=>{if(i)return i[n];console.warn(`${t} not support ${e}`)},t)}class Ux{constructor(t){this.timingTarget=null,this.runtimeNodeEventHub=new $a.a,this.basicOnTimeNodeEnd=()=>{if(this.isConflict){const{target:t}=this.json.cBhvr,e=this.getTargetId(t);this.ctx.conflictTimeNodeManager.removeRunningTimeNode(e,this.modifyAttrKey)}},this.basicOnTimeLineStart=()=>{if(this.isConflict){const{target:t}=this.json.cBhvr;if("next"===this.activeWhenConflict){const e=this.getTargetId(t);this.ctx.conflictTimeNodeManager.addRunningTimeNode(e,this.modifyAttrKey,this.commonTimeNode)}else"prev"===this.activeWhenConflict&&this.commonTimeNode.dispose()}};const{isIterate:e,isSub:i,json:n,ctx:r,parent:s,eventHub:o,iterateType:a,iterateIndex:l,iterateId:h,isInInteractiveSeq:c}=t;this.json=n,this.id=n.cBhvr.ctn.id,this.ctx=r,this.globalEventHub=o,this.commonTimeNode=new lb({json:n.cBhvr.ctn,isSub:i,eventHubs:{global:o,runtime:this.runtimeNodeEventHub},ctx:r,parent:s,isIterate:e,iterateType:a,iterateIndex:l,iterateId:h,isInInteractiveSeq:c}),this.timingTarget=this.ctx.timingTargets.getTarget(n.cBhvr.target,e,{type:a,index:l,id:h}),this.commonTimeNode.on("seekToStart",()=>this.onSeekToStart()),this.commonTimeNode.on("seekToEnd",()=>this.onSeekToEnd()),this.commonTimeNode.on("timelineStart",this.basicOnTimeLineStart),this.commonTimeNode.on("timeNodeEnd",this.basicOnTimeNodeEnd)}getTargetId(t){let e=t.id;return"shape"===t.type&&t.txEl&&(e=`${e}-txEl-${t.txEl.range[0]}`),this.commonTimeNode.isIterate&&(e=`${e}-iterate-${this.commonTimeNode.iterateIndex}`),e}}class kx extends Ux{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.updateStartValue=()=>{this.timingTarget&&(this.startVal=Fx(this.timingTarget,this.json.cBhvr.attrList[0]))},this.onSeekToStart=()=>{const t=this.json.cBhvr.attrList[0];null!==this.startVal&&this.timingTarget&&Dx(this.timingTarget,t,this.startVal)},this.onSeekToEnd=()=>{const t=this.json.cBhvr.attrList[0],e=this.json.cBhvr.to||this.json.to;e&&this.timingTarget&&Dx(this.timingTarget,t,e)},this.commonTimeNode.on("timeNodeStart",this.updateStartValue),this.commonTimeNode.on("timeNodeCreate",this.updateStartValue),this.commonTimeNode.on("timeUpdate",({duration:t,delta:e})=>{if(e/t>=1){const t=this.json.cBhvr.attrList[0];this.json.cBhvr.attrList.length>1&&console.warn("this.json.cBhvr.attrList.length > 0");const e=this.json.cBhvr.to||this.json.to;e&&this.timingTarget&&Dx(this.timingTarget,t,e)}})}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}}var Bx=function(t,e,i,n){var r,s=arguments.length,o=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,i,o):r(e,i))||o);return s>3&&o&&Object.defineProperty(e,i,o),o};class Gx{constructor(t,e){this.math={pi:Math.PI,e:Math.E,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,ceil:Math.ceil,cos:Math.cos,cosh:Math.cosh,deg:t=>t/Math.PI*180,exp:Math.exp,floor:Math.floor,ln:Math.log,max:Math.max,min:Math.min,rad:t=>t/180*Math.PI,rand:Math.random,sin:Math.sin,sinh:Math.sinh,sqrt:Math.sqrt,tan:Math.tan,tanh:Math.tanh},this.timingTarget=e,this.val=t.val.value,this.time=t.time,t.fmla&&(this.fmla=this.parseFmla(t.fmla))}parseFmla(t){let e=t.replace(/#ppt_h/g,`(${this.timingTarget.design_ppt_h})`);return e=e.replace(/#ppt_w/g,`(${this.timingTarget.design_ppt_w})`),e=e.replace(/#ppt_x/g,`(${this.timingTarget.design_ppt_x})`),e=e.replace(/#ppt_y/g,`(${this.timingTarget.design_ppt_y})`),e=e.replace(/ppt_w/g,"vars.ppt_w"),e=e.replace(/ppt_h/g,"vars.ppt_h"),e=e.replace(/ppt_x/g,"vars.ppt_x"),e=e.replace(/ppt_y/g,"vars.ppt_y"),e=e.replace(/#/g,"vars."),["abs","acos","asin","atan","ceil","cos","cosh","deg","exp","floor","ln","max","min","rad","rand","sin","sinh","sqrt","tan","tanh","pi","e"].forEach(t=>{const i=new RegExp(`([^a-z])${t}([^a-z])`,"g");e=e.replace(i,(e,i,n)=>`${i}math.${t}${n}`)}),new Function("vars","math","$","return "+e)}}class Hx extends Gx{constructor(t,e,i){super(t,e),this.value=t.val.value,i&&(this.fmla=this.parseFmla(i))}resolveValue(){return this.value}interpolationFrom(t,e,i){const n=t.resolveValue(i),r=n+(this.resolveValue()-n)*e;return t.fmla?t.fmla(i,this.math,r):r}}Bx([E_()],Hx.prototype,"interpolationFrom",null);class jx extends Gx{constructor(t,e){var i;super(t,e),this.value=null===(i=t.val)||void 0===i?void 0:i.value}interpolationFrom(t,e,i){let n=t.resolveValue(i);return e>this.time&&(n=this.resolveValue()),n}resolveValue(){return this.value||""}}Bx([E_()],jx.prototype,"interpolationFrom",null);class zx extends Gx{constructor(t,e){super(t,e),this.fn=this.parseFmla(this.val)}resolveValue(t){return this.fn(t,this.math,1)}interpolationFrom(t,e,i){const n=t.resolveValue(i),r=n+(this.resolveValue(i)-n)*e;return t.fmla?t.fmla(i,this.math,r):r}}Bx([E_()],zx.prototype,"interpolationFrom",null);class Vx extends Gx{constructor(t,e){super(t,e),this.value=t.val.value}interpolationFrom(t,e){return vy(t.resolveValue(),this.value,e)}resolveValue(){return this.value}}Bx([E_()],Vx.prototype,"interpolationFrom",null);class Wx extends Ux{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.startVal=null,this.vars={ppt_x:0,ppt_y:0,ppt_w:0,ppt_h:0},this.keyFrames=[],this.isColorAnim=!1,this.onTimeNodeStart=()=>{this.timingTarget&&(this.startVal=Fx(this.timingTarget,this.json.cBhvr.attrList[0]))},this.updateVars=()=>{var t,e,i,n;(null===(t=this.timingTarget)||void 0===t?void 0:t.ppt_h)&&(this.vars.ppt_h=this.timingTarget.ppt_h),(null===(e=this.timingTarget)||void 0===e?void 0:e.ppt_w)&&(this.vars.ppt_w=this.timingTarget.ppt_w),(null===(i=this.timingTarget)||void 0===i?void 0:i.ppt_x)&&(this.vars.ppt_x=this.timingTarget.ppt_x),(null===(n=this.timingTarget)||void 0===n?void 0:n.ppt_y)&&(this.vars.ppt_y=this.timingTarget.ppt_y),this.isColorAnim},this.onTimeUpdate=({duration:t,delta:e})=>{const i=e/t,n=this.keyFrames.findIndex(t=>i<=t[0]),{attrList:r}=this.json.cBhvr;if(n<0){const t=this.keyFrames[this.keyFrames.length-1];return void(this.timingTarget&&r&&r[0]&&Dx(this.timingTarget,r[0],t[1].resolveValue(this.vars)))}const s=n-1,o=this.keyFrames[n],a=this.keyFrames[s]||o,l=o[0]-a[0]==0?1:(i-a[0])/(o[0]-a[0]),h=o[1].interpolationFrom(a[1],l,this.vars);this.timingTarget&&r&&r[0]&&Dx(this.timingTarget,r[0],h)},this.onSeekToStart=()=>{null!==this.startVal&&this.timingTarget&&Dx(this.timingTarget,this.json.cBhvr.attrList[0],this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.initKeyFrames(),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timelineStart",this.updateVars),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart)}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}initKeyFrames(){var t;const{valueType:e}=this.json;if(this.json.tavLst.length<=0)if(this.json.to){if(this.json.from||this.startVal){const t={time:0,val:{type:"string",value:this.json.from||this.startVal.toString()},fmla:""};if("num"===e&&this.timingTarget){const e=new zx(t,this.timingTarget);this.keyFrames.push([t.time,e])}}const t={time:1,val:{type:"string",value:this.json.to},fmla:""};if("num"===e&&this.timingTarget){const e=new zx(t,this.timingTarget);this.keyFrames.push([t.time,e])}}else if(this.json.by){const i={time:0,val:{type:"string",value:this.json.cBhvr.attrList[0]},fmla:""};if("num"===e&&this.timingTarget){const t=new zx(i,this.timingTarget);this.keyFrames.push([i.time,t])}const n={time:1,val:{type:"string",value:((null===(t=i.val)||void 0===t?void 0:t.value)||"")+"+"+this.json.by},fmla:""};if("num"===e&&this.timingTarget){const t=new zx(n,this.timingTarget);this.keyFrames.push([n.time,t])}}if(this.json.tavLst.length>0)for(const t of this.json.tavLst)if(t.val&&this.timingTarget){let i=null;"string"===t.val.type?"num"===e?i=new zx(t,this.timingTarget):"str"===e&&(i=new jx(t,this.timingTarget)):"number"===t.val.type?i=new Hx(t,this.timingTarget):"color"===t.val.type?(this.isColorAnim=!0,i=new Vx(t,this.timingTarget)):"boolean"===t.val.type&&console.warn("not implements"),i&&this.keyFrames.push([t.time,i])}}}var Xx=i(92),Yx=i.n(Xx),qx=i(93),Zx=i.n(qx);class Jx extends Wp{constructor(){super(Zx.a,Yx.a,{percent:0,direction:1,transition:0})}set transition(t){this.uniforms.transition=t}set percent(t){this.uniforms.percent=t}set direction(t){this.uniforms.direction=t}}var Kx=i(94),$x=i.n(Kx);class Qx extends Wp{constructor(){super(void 0,$x.a,{percent:0,transition:1})}set transition(t){this.uniforms.transition=Math.pow(t,t)}set percent(t){this.uniforms.percent=t}}class tb extends Ux{constructor(t){var e;super(t),this.filterType="",this.isConflict=!0,this.activeWhenConflict="prev",this.onTimeUpdate=({duration:t,delta:e})=>{const i=e/t;this.filter&&(this.filter.percent=this.commonTimeNode.applyTimeFilter(i)),i>=1&&this.timingTarget&&this.ctx.clock.setTimeout(()=>{this.timingTarget&&(this.timingTarget.container.filters=[])})},this.onSeekToStart=()=>{this.timingTarget&&(this.timingTarget.container.filters=[])},this.onSeekToEnd=()=>{this.timingTarget&&(this.timingTarget.container.filters=[])},this.commonTimeNode.on("timelineStart",()=>{this.filter&&this.timingTarget&&(this.timingTarget.container.filters=[this.filter])}),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate);let i=0;"out"===t.json.transition?i=-1:"in"===t.json.transition&&(i=1);const n=null===(e=t.json.filter)||void 0===e?void 0:e.match(/^([a-zA-Z]+)(\((.+)\))?/);if(n){const t=n[1],e=n[3];if("wipe"===t){const i=new Jx;"up"===e?i.direction=1:"down"===e?i.direction=2:"left"===e?i.direction=3:"right"===e&&(i.direction=4),this.filter=i,this.filterType=`${t}-${e}`}else if("fade"===t){const e=new Qx;this.filter=e,this.filterType=""+t}this.filter&&(this.filter.transition=i)}}get modifyAttrKey(){return this.filterType}}class eb extends Ux{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.startPos=null,this.onTimeNodeStart=()=>{var t,e;this.startPos={x:(null===(t=this.timingTarget)||void 0===t?void 0:t.ppt_x)||0,y:(null===(e=this.timingTarget)||void 0===e?void 0:e.ppt_y)||0}},this.onTimeUpdate=({duration:t,delta:e})=>{var i;const n=e/t,r=null===(i=this.path)||void 0===i?void 0:i.getPoint(n);this.timingTarget&&r&&(this.timingTarget.ppt_x=r.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=r.y+ +this.timingTarget.design_ppt_y)},this.onSeekToStart=()=>{this.timingTarget&&this.startPos&&(this.timingTarget.ppt_x=this.startPos.x,this.timingTarget.ppt_y=this.startPos.y)},this.onSeekToEnd=()=>{var t,e,i;const n=null!==(e=null===(t=this.commonTimeNode.json)||void 0===t?void 0:t.spd)&&void 0!==e?e:1,r=null===(i=this.path)||void 0===i?void 0:i.getPoint(n>0?1:0);this.timingTarget&&r&&(this.timingTarget.ppt_x=r.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=r.y+this.timingTarget.design_ppt_y)},this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.createPath()}get modifyAttrKey(){return"motion"}createPath(){var t;const e=new Xo,i=null===(t=this.json.path)||void 0===t?void 0:t.match(/[MLCmlc][^MLCmlc]+/g);if(i)for(const t of i){const[i,...n]=t.trim().replace(/\s+/g," ").split(" ");if("M"===i){const[t,i]=n.map(t=>Number(t));e.moveTo(t,i)}else if("L"===i){const[t,i]=n.map(t=>Number(t));e.lineTo(t,i)}else if("C"===i){const[t,i,r,s,o,a]=n.map(t=>Number(t));e.bezierCurveTo(t,i,r,s,o,a)}else if("Z"===i)e.closePath();else if("E"===i)console.warn("not implements");else if("c"===i){const[t,i,r,s,o,a]=n.map(t=>Number(t)),l=e.currentPoint;e.bezierCurveTo(t+l.x,i+l.y,r+l.x,s+l.y,o+l.x,a+l.y)}else if("l"===i){const t=e.currentPoint,[i,r]=n.map(t=>Number(t));e.lineTo(i+t.x,r+t.y)}else if("m"===i){const t=e.currentPoint,[i,r]=n.map(t=>Number(t));e.moveTo(i+t.x,r+t.y)}}this.path=e}}class ib extends Ux{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.startVal=null,this.onTimelineStart=t=>{t.isReverse||this.updateCurrentValue()},this.onTimeUpdate=({duration:t,delta:e})=>{var i,n,r,s,o;const a=e/t,l={x:1,y:1};if(this.to){const t=null!==(i=this.from)&&void 0!==i?i:{x:null!==(r=null===(n=this.startVal)||void 0===n?void 0:n.x)&&void 0!==r?r:1,y:null!==(o=null===(s=this.startVal)||void 0===s?void 0:s.y)&&void 0!==o?o:1};l.x=t.x+(this.to.x-t.x)*a,l.y=t.y+(this.to.y-t.y)*a}else if(this.by){const t={x:this.by.x,y:this.by.y};l.x=1+(t.x-1)*a,l.y=1+(t.y-1)*a}this.timingTarget&&(this.timingTarget.scale=l)},this.onTimeNodeStart=()=>{this.timingTarget&&(this.startVal={x:this.timingTarget.scale.x,y:this.timingTarget.scale.y})},this.onSeekToStart=()=>{this.timingTarget&&this.startVal&&(this.timingTarget.scale=this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.from=t.json.from,this.to=t.json.to,this.by=t.json.by,this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart)}get modifyAttrKey(){return"scale"}updateCurrentValue(){this.timingTarget&&(this.current={x:this.timingTarget.scale.x,y:this.timingTarget.scale.y})}}class nb extends Ux{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.isTimelineStart=!1,this.startColorString=null,this.currentColorString="#FFFFFFFF",this.onTimelineStart=t=>{if(this.isTimelineStart)return;this.isTimelineStart=!0,t.isReverse||this.updateCurrentValue(),this.from.isInit()||this.from.fromHexString(this.currentColorString),this.to.isInit()||this.from.by(this.by,this.to);const[e]=this.json.cBhvr.attrList[0].split(".");Dx(this.timingTarget,e+".on","true")},this.onTimeNodeEnd=()=>{if("remove"===this.json.cBhvr.ctn.fill){const[t]=this.json.cBhvr.attrList[0].split(".");Dx(this.timingTarget,t+".on","false")}this.isTimelineStart=!1},this.onSeekToStart=()=>{var t;if(this.timingTarget&&(this.onTimeUpdate({duration:1,delta:0}),(null===(t=this.timingTarget.fill)||void 0===t?void 0:t.designColor.toUpperCase())===this.from.toHexString().toUpperCase())){const[t]=this.json.cBhvr.attrList[0].split(".");Dx(this.timingTarget,t+".on","false")}},this.onTimeNodeStart=()=>{if(this.timingTarget){const t=Fx(this.timingTarget,this.json.cBhvr.attrList[0]);t&&(this.startColorString=t)}},this.onTimeUpdate=({delta:t,duration:e})=>{const i=t/e;this.to.interpolationFrom(this.from,i,this.target),this.timingTarget&&Dx(this.timingTarget,this.json.cBhvr.attrList[0],this.target.toHexString())},this.onSeekToEnd=()=>{this.isTimelineStart||this.onTimelineStart({isReverse:!1,activeCount:0,id:""}),this.onTimeUpdate({duration:1,delta:1})},"rgb"===this.json.clrSpc?(this.from=new py(this.json.from),this.to=new py(this.json.to),this.by=new py(this.json.by),this.target=new py):(this.from=new dy(this.json.from),this.to=new dy(this.json.to),this.by=new dy(this.json.by),this.target=new dy),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeNodeEnd",this.onTimeNodeEnd),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate)}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}updateCurrentValue(){if(this.timingTarget){const t=Fx(this.timingTarget,this.json.cBhvr.attrList[0]);t&&(this.currentColorString=t)}}}class rb extends Ux{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.lastVal=null,this.onTimelineStart=t=>{this.lastVal=null,t.isReverse||this.updateCurrentValue()},this.onTimeUpdate=({duration:t,delta:e})=>{const i=e/t;let n=0,r=0;if(void 0!==this.from&&void 0!==this.to){n=this.from,r=this.to;const t=n+(r-n)*i;this.timingTarget&&(this.timingTarget.r=t)}else if(void 0!==this.by){this.lastVal||(this.lastVal=0);const t=this.by*i-this.lastVal;this.lastVal=this.by*i,this.timingTarget&&(this.timingTarget.r+=t)}},this.onTimeNodeStart=()=>{var t;z_()(null===(t=this.timingTarget)||void 0===t?void 0:t.r)&&(this.startVal=this.timingTarget.r)},this.onSeekToStart=()=>{this.timingTarget&&null!==this.startVal&&(this.timingTarget.r=this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.from=this.json.from,this.to=this.json.to,this.by=this.json.by,this.by?this.isConflict=!1:this.isConflict=!0,this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate)}get modifyAttrKey(){return"rotate"}updateCurrentValue(){var t;this.currentVal=null===(t=this.timingTarget)||void 0===t?void 0:t.r}}class sb extends Ux{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.isApplied=!1,this.onTimeUpdate=()=>{var t,e;const{cmd:i,cmdType:n}=this.json;!this.isApplied&&i&&n&&(this.isApplied=!0,null===(e=null===(t=this.timingTarget)||void 0===t?void 0:t.cmd)||void 0===e||e.applyCommand(i,n))},this.onSeekToStart=()=>{var t,e;null===(e=null===(t=this.timingTarget)||void 0===t?void 0:t.cmd)||void 0===e||e.applyCommand("custom-pause","call")},this.onSeekToEnd=()=>{},this.commonTimeNode.on("timeNodeStart",()=>{this.isApplied=!1}),this.commonTimeNode.on("timeNodeEnd",()=>{this.isApplied=!1}),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("seekToStart",this.onSeekToStart),this.commonTimeNode.on("seekToEnd",this.onSeekToEnd)}get modifyAttrKey(){var t,e,i,n;return(null!==(e=null===(t=this.json)||void 0===t?void 0:t.cmd)&&void 0!==e?e:"")+(null!==(n=null===(i=this.json)||void 0===i?void 0:i.cmdType)&&void 0!==n?n:"")}}class ob{constructor(t){this.runtimeNodeEventHub=new $a.a,this.onVolumeUpdate=t=>{this.audio.volume(t)},this.stopAudio=()=>{this.audio.stop()},this.destroy=()=>{this.stopAudio(),this.audio.destroy(),this.ctx.activeMedia.delete(this.audio),this.ctx.volumeAdjuster.off("update",this.onVolumeUpdate)};const{json:e,isIterate:i,isSub:n,eventHub:r,ctx:s,parent:o,iterateType:a,iterateIndex:l,iterateId:h,isInInteractiveSeq:c}=t;this.json=e,this.id=e.cMediaNode.ctn.id,this.commonTimeNode=new lb({json:e.cMediaNode.ctn,isSub:n,eventHubs:{global:r,runtime:this.runtimeNodeEventHub},ctx:s,parent:o,isIterate:i,iterateType:a,iterateIndex:l,iterateId:h,isInInteractiveSeq:c});let u=e.cMediaNode.tgtEl;s.loaderDelegate&&(u=s.loaderDelegate.redirectMedia(u),s.logger.info(`redirect media url from ${e.cMediaNode.tgtEl} to ${u} by delegate.`,s.taskId)),this.audio=new Sx(u,s.runningAudio),s.activeMedia.add(this.audio),this.commonTimeNode.on("timelineStart",()=>{this.audio.volume(s.volumeAdjuster.volume),this.audio.play()}),this.commonTimeNode.on("seekToStart",this.stopAudio),this.commonTimeNode.on("seekToEnd",this.stopAudio),this.commonTimeNode.on("timeNodeDestroy",this.destroy),this.ctx=s,this.ctx.volumeAdjuster.on("update",this.onVolumeUpdate)}}var ab=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class lb extends $a.a{constructor(t){var e,i;super(),this.uuid=A_(),this.isSub=!1,this.isShadow=!1,this.startCount=0,this.applyCount=0,this.isReverse=!1,this.isConflictDispose=!1,this.isIterateEnd=!1,this.parentTimeNode=null,this.isActive=!1,this.isDestroy=!1,this.shouldSeekOnStart=!1,this.repeatTimeoutId="",this.iterateShadows=[],this.isEndEventsEmitted=!1,this.tmFilter=[],this.timeDelta=0,this.isIterate=!1,this.iterateType="el",this.iterateIndex=0,this.children=[],this.subList=[],this.duration=0,this.isNegativeSpeed=!1,this.handleEndCond=()=>{this.isActive&&(this.isActive=!1,this.isInfiniteRepeat()?this.repeatTimeNodeEnd():this.seekToEnd(!1,!0))},this.handleActive=(t=!0)=>{if(this.isActive=!0,this.isConflictDispose=!1,this.applyCount+=1,this.json.iterate||this.emit("timeNodeStart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.startCount>0&&this.json.restart){if("never"===this.json.restart)return;"whenNotActive"!==this.json.restart&&"always"!==this.json.restart||(this.seekToStart(),this.emit("timeNodeRestart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.startTimeLine(t))}else this.startTimeLine(t)},this.updateTimeLine=t=>{const e=t/(Ac.TARGET_FPMS||.06);this.timeDelta+=e,this.duration-this.timeDelta<=e&&(this.timeDelta=this.duration),this.timeDelta<this.duration?this.emit("timeUpdate",{delta:this.isReverse||this.isNegativeSpeed?this.duration-this.timeDelta:this.timeDelta,duration:this.duration,isReverse:this.isReverse}):(this.emit("timeUpdate",{delta:this.isReverse||this.isNegativeSpeed?0:this.duration,duration:this.duration,isReverse:this.isReverse}),this.onTimeLineEnd())},this.handleEnd=(t=!1)=>{(this.isTimeNodeEnd()||t)&&(this.isActive=!1,this.isSub&&this.destroy(),this.emitEndEvents())};const{isSub:n,isIterate:r,ctx:s,eventHubs:o,parent:a,json:l,iterateType:h,iterateId:c,iterateIndex:u,isInInteractiveSeq:d}=t;this.isSub=n,this.isInInteractiveSeq=d,this.isIterate=r,this.parentTimeNode=a,this.json=l,this.ctx=s,this.iterateIndex=u,this.eventHubs=o,this.iterateType=h,this.iterateId=c,this.tmFilter=null!==(i=null===(e=l.tmFilter)||void 0===e?void 0:e.split(";").map(t=>t.split(",").map(t=>parseFloat(t.trim()))))&&void 0!==i?i:[];const p=Number(this.json.dur),f=this.json.spd||1;this.isNegativeSpeed=f<0,Number.isNaN(p)||(this.duration=p/Math.abs(f)),this.uuid+="--"+this.json.id,this.setPreStyle(),l.childTnLst&&this.createChildren(l.childTnLst),this.startConds=new Nx(this.json.id||"",l.stCondLst,o,this.ctx),this.endConds=new Nx(this.json.id||"",l.endCondLst,o,this.ctx),l.endSync&&(this.endSync=new Nx(this.json.id||"",[l.endSync],o,this.ctx),this.endSync.on("active",()=>{var t;"interactiveSeq"===this.json.nodeType&&(this.isActive=!1,this.shouldSeekOnStart=!0,this.emit("timeNodeEndSync"),null===(t=this.endSync)||void 0===t||t.reset())})),this.startConds.on("active",t=>{this.isActive||(this.shouldSeekOnStart&&(this.shouldSeekOnStart=!1,this.seekToStart()),this.handleActive(t))}),this.endConds.on("active",()=>{this.handleEndCond(),this.children.forEach(t=>t.commonTimeNode.handleEndCond())}),this.parentTimeNode&&this.parentTimeNode.on("timeNodeStart",()=>{this.applyCount=0}),this.isSub&&"nextClick"===this.json.masterRel&&this.startConds.addCond({event:"shape slide onNext"}),this.json.iterate&&!1===this.isIterate&&this.createIterateShadow()}createIterateShadow(){const t=A_();let e=!0,i=0;const n=i=>{i===t&&(e=!1,this.ctx.eventHub.removeListener("IterateTimeNodeEnd",n))};for(this.ctx.eventHub.on("IterateTimeNodeEnd",n);e;){const e=JSON.parse(JSON.stringify(this.json)),n=new lb({json:e,isSub:!1,eventHubs:this.eventHubs,ctx:this.ctx,parent:null,isIterate:!0,iterateType:e.iterate.type,iterateIndex:i,iterateId:t,isInInteractiveSeq:this.isInInteractiveSeq});this.iterateShadows[i]=n,i+=1}}isInfiniteRepeat(){return this.json.repeatCount>999999998}getReverse(){return this.isReverse}setReverse(t){this.isReverse=t}createTimeNode(t,e){let i=null;const n={json:t,isSub:e,isIterate:this.isIterate,eventHub:this.eventHubs.global,ctx:this.ctx,parent:this,iterateType:this.iterateType,iterateIndex:this.iterateIndex,iterateId:this.iterateId,isInInteractiveSeq:this.isInInteractiveSeq};return"seq"===t.type?i=new Ox(n):"par"===t.type?i=new hb(n):"set"===t.type?i=new kx(n):"anim"===t.type?i=new Wx(n):"animEffect"===t.type?i=new tb(n):"animMotion"===t.type?i=new eb(n):"animScale"===t.type?i=new ib(n):"animClr"===t.type?i=new nb(n):"animRot"===t.type?i=new rb(n):"cmd"===t.type?i=new sb(n):"audio"===t.type&&(i=new ob(n)),i}createSubList(t){this.subList&&this.subList.forEach(t=>t.commonTimeNode.destroy()),this.subList=[],t.forEach(t=>{const e=this.createTimeNode(t,!0);e&&this.subList.push(e)})}bindCommonTimeNodeEvent(t){t.commonTimeNode.on("timeNodeStart",t=>{this.emit("childTimeNodeStart",t)}),t.commonTimeNode.on("timeNodeEnd",t=>{this.emit("childTimeNodeEnd",t),this.children.every(t=>t.commonTimeNode.isTimeNodeEndWhenDetectEndSync())&&(this.json.iterate||this.allChildrenEndHandle())})}createChildren(t){function e(t){return(e=t,function(t){var e;return!!(null===(e=t)||void 0===e?void 0:e.cBhvr)}(e)?e.cBhvr.ctn:function(t){var e,i;return!!(null===(i=null===(e=t)||void 0===e?void 0:e.cMediaNode)||void 0===i?void 0:i.ctn)}(e)?e.cMediaNode.ctn:e.ctn).presetOrder;var e}if(t&&t[0]&&e(t[0])){[...t].sort((t,i)=>{var n,r;return(null!==(n=e(t))&&void 0!==n?n:0)-(null!==(r=e(i))&&void 0!==r?r:0)}).forEach(e=>{const i=t.findIndex(t=>t===e),n=this.createTimeNode(e,!1);n&&(this.bindCommonTimeNodeEvent(n),this.children[i]=n)})}else t.forEach(t=>{const e=this.createTimeNode(t,!1);e&&(this.bindCommonTimeNodeEvent(e),this.children.push(e))})}playReverse(){this.isReverse=!0,this.startReverseTimeLine(),this.children.forEach(t=>t.commonTimeNode.playReverse())}allChildrenEndHandle(){if(!this.isDestroy){if(this.json.autoRev&&!this.isReverse)return this.isReverse=!0,void this.playReverse();this.isReverse&&(this.isReverse=!1),this.json.repeatCount&&this.json.repeatCount>this.applyCount?this.repeatTimeoutId=this.ctx.clock.setTimeout(()=>{this.seekToStart(!1),this.resetForRepeat(),this.startTimeNodeRepeat()}):(this.json.iterate&&!this.isIterate&&(this.isIterateEnd=!0),this.eventHubs.runtime.emit("runtime all end"),this.startSubList(),this.handleEnd())}}resetForRepeat(){this.isInInteractiveSeq&&this.isInfiniteRepeat()&&this.repeatTimeNodeEnd(),this.timeDelta=0,this.children.forEach(t=>t.commonTimeNode.resetForRepeat())}startSubList(){this.subList.forEach(t=>t.commonTimeNode.startTimeNode())}startReverseTimeLine(){this.isEndEventsEmitted=!1,this.timeDelta=0;const t=1e3/this.ctx.ticker.maxFPS;this.duration<=t&&this.duration>0?(this.emit("timeUpdate",{delta:this.duration,duration:this.duration,isReverse:this.isReverse}),this.ctx.eventHub.emit(Nb.animateEnd),this.ctx.ticker.remove(this.updateTimeLine)):this.duration>t&&(this.ctx.eventHub.emit(Nb.animateStart),this.ctx.ticker.add(this.updateTimeLine))}startTimeLine(t=!0){if(t&&(this.isEndEventsEmitted=!1,this.eventHubs.global.emit(`time ${this.json.id} begin`),this.eventHubs.global.emit(`time ${this.json.id} onBegin`),this.eventHubs.runtime.emit(`runtime ${this.json.id} begin`)),this.json.iterate)return void this.startIterate();this.timeDelta=0,this.emit("timelineStart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse});const e=1e3/this.ctx.ticker.maxFPS;this.duration<=e&&this.duration>0?(this.timeDelta=this.isReverse?0:this.duration,this.emit("timeUpdate",{delta:this.timeDelta,duration:this.duration,isReverse:this.isReverse}),this.emit("timelineEnd",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.ctx.ticker.addOnce(()=>{this.onTimeLineEnd()})):this.duration>e&&(this.ctx.eventHub.emit(Nb.animateStart),this.updateTimeLine(0),this.ctx.ticker.add(this.updateTimeLine))}startIterate(){return ab(this,void 0,void 0,(function*(){if(this.json.iterate){this.isIterateEnd=!1;for(const t of this.iterateShadows){if(this.isIterateEnd)break;t.children.forEach(t=>{t.commonTimeNode.startTimeNode()}),t.applyCount+=1,yield this.ctx.clock.delay(this.json.iterate.interval)}this.onTimeLineEnd()}}))}applyTimeFilter(t){if(!this.tmFilter.every(t=>z_()(t[0])&&z_()(t[1])))return t;for(let e=0;e<this.tmFilter.length;e++){const i=this.tmFilter[e];if(t<i[0]){const n=this.tmFilter[e-1];return(t-n[0])/(i[0]-n[0])*(i[1]-n[1])+n[1]}}return this.tmFilter.length>0?this.tmFilter[this.tmFilter.length-1][1]:t}isNatureTimeEnd(){return this.duration>=0&&this.timeDelta>=this.duration}findTargets(){const t=[],e=i=>{i.forEach(i=>{var n,r,s;i.cBhvr&&i.cBhvr.target&&t.findIndex(t=>t.id===i.cBhvr.target.id)<0&&t.push(i.cBhvr.target),(null===(r=null===(n=null==i?void 0:i.cBhvr)||void 0===n?void 0:n.ctn)||void 0===r?void 0:r.childTnLst)&&i.cBhvr.ctn.childTnLst.length>0&&e(i.cBhvr.ctn.childTnLst),(null===(s=null==i?void 0:i.ctn)||void 0===s?void 0:s.childTnLst)&&i.ctn.childTnLst.length>0&&e(i.ctn.childTnLst)})};return e(this.json.childTnLst||[]),t}setPreStyle(){this.json.presetClass&&this.findTargets().forEach(t=>{if(this.json.iterate){let e=0,i=!0;for(;i;){const n=this.ctx.timingTargets.getTarget(t,!0,{type:this.json.iterate.type,index:e,id:""});n&&(this.setPreStyleForTarget(n),e+=1),i=!!n}}else{const e=this.ctx.timingTargets.getTarget(t,!1);e&&this.setPreStyleForTarget(e)}})}setPreStyleForTarget(t){var e,i;if(t&&this.json.presetSubtype&&(t.presetSubType=this.json.presetSubtype),t&&!t.hasPreset)if("entr"===this.json.presetClass){const n=null===(i=null===(e=this.json)||void 0===e?void 0:e.childTnLst)||void 0===i?void 0:i.filter(t=>"set"===t.type&&"visible"===t.to);(null==n?void 0:n.length)&&(t.hasPreset=!0,t.style.visibility="hidden")}else("exit"===this.json.presetClass||"path"===this.json.presetClass||"emph"===this.json.presetClass)&&(t.hasPreset=!0,t.style.visibility="visible")}startTimeNodeRepeat(){this.timeDelta=0,this.isActive=!0,this.applyCount+=1,this.startTimeLine(!1),this.json.iterate||this.emit("timeNodeRepeat",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse})}startTimeNodeForce(){this.json.subTnLst&&this.createSubList(this.json.subTnLst),this.timeDelta=0,this.isActive=!0,this.handleActive(!1)}startTimeNode(t=!0){if(this.isDestroy)return;this.collectStartValue(),this.timeDelta=0,this.isReverse=!1,this.json.subTnLst&&this.createSubList(this.json.subTnLst),this.startConds.setTriggerParams(t);const e=this.json.stCondLst.filter(t=>/^self/.test(t.event||""))[0];e&&this.startConds.condHandle(e);const i=this.json.endCondLst.filter(t=>/^self/.test(t.event||""))[0];i&&this.endConds.condHandle(i),this.startConds.condHandle()}onTimeLineEnd(){this.dispose(),(0===this.children.length||this.json.iterate)&&this.allChildrenEndHandle()}clearSubList(){this.subList.forEach(t=>t.commonTimeNode.destroy())}seekToStart(t=!0){if(this.isEndEventsEmitted=!1,this.isActive=!1,this.dispose(),this.timeDelta=0,this.emit("seekToStart"),this.json.iterate&&!this.isIterate)return this.isIterateEnd=!0,void this.iterateShadows.forEach(e=>e.seekToStart(t));if(t)for(let t=this.subList.length-1;t>=0;t--){const e=this.subList[t];null==e||e.commonTimeNode.seekToStart()}for(let t=this.children.length-1;t>=0;t--){const e=this.children[t];null==e||e.commonTimeNode.seekToStart()}if(this.children.length>1)for(let t=this.children.length-1;t>=0;t--){const e=this.children[t];null==e||e.commonTimeNode.seekToStart()}}repeatTimeNodeEnd(){this.dispose(),this.children.forEach(t=>{t.commonTimeNode.isActive=!1,t.commonTimeNode.dispose()})}dispose(t=!1){this.isConflictDispose=t,this.ctx.clock.clearTimeout(this.repeatTimeoutId),this.ctx.eventHub.emit(Nb.animateEnd);try{this.ctx.ticker.remove(this.updateTimeLine)}catch(t){}this.startConds.reset(),this.endConds.reset()}seekToEnd(t,e=!1){if(this.isInfiniteRepeat())return;!this.isActive&&this.applyCount<=0&&this.collectStartValue(),this.applyCount=this.json.repeatCount,this.json.autoRev&&(this.isReverse=!0),this.timeDelta=this.duration,this.isActive=!1,this.dispose();const i=this.json.autoRev||t;if(i?this.emit("seekToStart"):this.emit("seekToEnd"),this.json.iterate&&!this.isIterate)return this.isIterateEnd=!0,void this.iterateShadows.forEach(t=>t.seekToEnd(i,e));0===this.children.length&&(this.eventHubs.runtime.emit("runtime all end"),this.handleEnd()),this.children.forEach(t=>t.commonTimeNode.seekToEnd(i,e)),e&&this.json.subTnLst&&(this.subList.length<=0&&this.createSubList(this.json.subTnLst),this.subList.forEach(t=>t.commonTimeNode.seekToEnd(!1)),this.clearSubList())}isTimeNodeEndWhenDetectEndSync(){if(this.isInInteractiveSeq&&this.isInfiniteRepeat())return!0;let t=!0;return this.children.length>0&&(t=t&&this.children.every(t=>t.commonTimeNode.isTimeNodeEndWhenDetectEndSync())),this.json.repeatCount&&(t=t&&this.applyCount>=this.json.repeatCount),this.json.autoRev&&(t=t&&!this.isReverse),t=t&&this.isNatureTimeEnd(),!!this.isConflictDispose||(!(!this.isIterateEnd||!this.json.iterate)||t)}isTimeNodeEnd(){let t=!0;return this.children.length>0&&(t=t&&this.children.every(t=>t.commonTimeNode.isTimeNodeEnd())),this.json.repeatCount&&(t=t&&this.applyCount>=this.json.repeatCount),this.json.autoRev&&(t=t&&!this.isReverse),t=t&&this.isNatureTimeEnd(),!!this.isConflictDispose||(!(!this.isIterateEnd||!this.json.iterate)||t)}emitEndEvents(){this.isEndEventsEmitted||(this.isEndEventsEmitted=!0,this.eventHubs.global.emit(`time ${this.json.id} end`),this.eventHubs.global.emit(`time ${this.json.id} onEnd`),this.eventHubs.runtime.emit(`runtime ${this.json.id} end`),this.emit("timeNodeEnd",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}))}collectStartValue(){this.emit("timeNodeCreate"),this.children.forEach(t=>t.commonTimeNode.collectStartValue())}destroy(){this.emit("timeNodeDestroy"),this.isDestroy=!0,this.dispose(),this.startConds.removeAllListeners(),this.endConds.removeAllListeners(),this.children.forEach(t=>t.commonTimeNode.destroy()),this.clearSubList()}}class hb extends $a.a{constructor(t){super(),this.isRunning=!1,this.runtimeNodeEventHub=new $a.a;const{json:e,iterateType:i,isIterate:n,isSub:r,parent:s,ctx:o,eventHub:a,iterateIndex:l,iterateId:h,isInInteractiveSeq:c}=t;this.id=e.ctn.id,this.json=e,this.ctx=o,this.isIterate=n,this.globalEventHub=a,this.commonTimeNode=new lb({json:e.ctn,isSub:r,eventHubs:{global:a,runtime:this.runtimeNodeEventHub},ctx:o,parent:s,isIterate:!1,iterateType:i,iterateIndex:l,iterateId:h,isInInteractiveSeq:c}),this.commonTimeNode.on("timeNodeStart",()=>{this.commonTimeNode.children.forEach(t=>{t.commonTimeNode.setReverse(this.commonTimeNode.getReverse()),t.commonTimeNode.startTimeNode()}),this.isRunning||(this.isRunning=!0,this.globalEventHub.emit(`runtime ${this.id} begin`),this.emit("begin"))}),this.commonTimeNode.on("timeNodeRepeat",()=>{this.commonTimeNode.children.forEach(t=>{t.commonTimeNode.startTimeNode(!1)})}),this.commonTimeNode.on("timeNodeEnd",()=>{this.commonTimeNode.isTimeNodeEnd()&&this.isRunning&&(this.isRunning=!1,this.globalEventHub.emit(`runtime ${this.id} end`),this.emit("end"))})}}var cb=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class ub{constructor(t,e,i){this.json=t,this.ctx=i,this.globalEventHub=e;const n=t.timeNodeList.find(t=>"par"===t.type&&"tmRoot"===t.ctn.nodeType);n&&(this.tmRoot=new hb({json:n,isSub:!1,isIterate:!1,eventHub:e,ctx:i,parent:null,iterateType:"el",iterateIndex:0,iterateId:"",isInInteractiveSeq:!1}),this.mainSeq=this.tmRoot.commonTimeNode.children.find(t=>{var e,i,n;return"seq"===(null===(e=t.json)||void 0===e?void 0:e.type)&&"mainSeq"===(null===(n=null===(i=t.json)||void 0===i?void 0:i.ctn)||void 0===n?void 0:n.nodeType)}))}findSeq(t){var e;return null===(e=this.tmRoot)||void 0===e?void 0:e.commonTimeNode.children.find(e=>{var i,n,r;return"seq"===(null===(i=e.json)||void 0===i?void 0:i.type)&&(null===(r=null===(n=e.json)||void 0===n?void 0:n.ctn)||void 0===r?void 0:r.id)===t})}start(){var t,e;return cb(this,void 0,void 0,(function*(){this.json.autoPlayMainSeq?(yield this.ctx.clock.delay(16),null===(t=this.mainSeq)||void 0===t||t.commonTimeNode.startTimeNode()):null===(e=this.mainSeq)||void 0===e||e.commonTimeNode.startTimeNode()}))}setMainSeqApplied(){this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1)}collectMainSeqStartValue(){var t;null===(t=this.mainSeq)||void 0===t||t.commonTimeNode.collectStartValue()}setMainSeqStep(t,e){var i;-1===t&&this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1),null===(i=this.mainSeq)||void 0===i||i.setCurrentStep(t,e)}destroy(){var t;this.globalEventHub.removeAllListeners(),null===(t=this.tmRoot)||void 0===t||t.commonTimeNode.destroy()}hasMainSeq(){return!!this.mainSeq&&this.mainSeq.commonTimeNode.children.length>0}currentMainSeqState(){return this.mainSeq?this.mainSeq.currentState:null}currentMainSeqStep(){return this.mainSeq?this.mainSeq.currentStep:0}currentMainSeqLength(){return this.mainSeq?this.mainSeq.stepLength:0}mainSeqHasNextStep(){return!!this.mainSeq&&this.mainSeq.hasNext()}mainSeqHasPrevStep(){return!!this.mainSeq&&this.mainSeq.hasPrev()}seekInteractiveSeqToEnd(t){const e=this.findSeq(t);e&&e.commonTimeNode.seekToEnd(!1,!0)}setInteractiveSeqState(t,e,i){const n=this.findSeq(t);n&&n.setCurrentStep(e,i)}resetAllInteractiveSeq(){var t;((null===(t=this.tmRoot)||void 0===t?void 0:t.commonTimeNode.children.filter(t=>{var e,i,n;return"seq"===(null===(e=t.json)||void 0===e?void 0:e.type)&&"interactiveSeq"===(null===(n=null===(i=t.json)||void 0===i?void 0:i.ctn)||void 0===n?void 0:n.nodeType)}))||[]).forEach(t=>{t.setCurrentStep(0,"start")})}applyInteractiveAction(t){this.globalEventHub.emit(t)}}var db=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class pb extends Lx{constructor(t,e,i,n){super({id:"stage",width:t.width,height:t.height,type:"Container",children:t.children},e,i,void 0,n),this.isRendered=!1,this.isTimingStartValueCollected=!1,this.json=t,e.hasBackgroundFillShape=this.detectUseBackgroundFill(this.json),this.container.visible=!1,this.ctx=e;const r=new Jv;r.beginFill(16777215),r.drawRect(0,0,t.width,t.height),r.endFill(),this.container.addChild(r)}detectUseBackgroundFill(t){return!!t&&("Picture"===t.type||"Shape"===t.type?t.useBgFill:!(!t.children||!Array.isArray(t.children))&&t.children.some(t=>this.detectUseBackgroundFill(t)))}initOnReuse(){super.initOnReuse(),this.ctx.timingEventHub.on("c:prev slide",t=>{this.ctx.eventHub.emit(Nb.requestPrevSlide,t)}),this.ctx.timingEventHub.on("c:next slide",t=>{this.ctx.eventHub.emit(Nb.requestNextSlide,t)})}get interactiveContainer(){return this.container}render(t){if(this.isRendered)return;this.collectAnimatedIds().forEach(t=>this.ctx.animatedIds.add(t)),this.isRendered=!0,super.render(t),t.addSubMTask(()=>db(this,void 0,void 0,(function*(){this.ctx.eventHub.emit("StageRenderEnd")})),"@StageImpl[emit.StageRenderEnd]")}isListTimeNode(t){return["excel","seq","par"].indexOf(t.type)>=0}isAnimatedTimeNode(t){return!!t.cBhvr}collectAnimatedIdsForTimeNode(t,e){var i;this.isListTimeNode(t)?null===(i=t.ctn.childTnLst)||void 0===i||i.forEach(t=>{this.collectAnimatedIdsForTimeNode(t,e)}):this.isAnimatedTimeNode(t)&&e.push(t.cBhvr.target.id)}collectAnimatedIds(){const t=[];return this.json.timing&&this.json.timing.timeNodeList.forEach(e=>{this.collectAnimatedIdsForTimeNode(e,t)}),t}createTiming(){this.json.timing&&!this.timing&&(this.timing=new ub(this.json.timing,this.ctx.timingEventHub,this.ctx))}startTiming(){var t;return(null===(t=this.timing)||void 0===t?void 0:t.start())||Promise.resolve()}setMainSeqApplied(){var t;null===(t=this.timing)||void 0===t||t.setMainSeqApplied()}setMainSeqStep(t,e){var i;null===(i=this.timing)||void 0===i||i.setMainSeqStep(t,e)}collectMainSeqStartValue(){var t;this.isTimingStartValueCollected||(this.isTimingStartValueCollected=!0,null===(t=this.timing)||void 0===t||t.collectMainSeqStartValue())}hasTiming(){return!!this.timing}clearOnSlideChange(){this.ctx.eventHub.removeAllListeners(),this.ctx.timingEventHub.removeAllListeners(),super.clearOnSlideChange()}clearOnTransactionEnd(){var t,e;this.ctx.timingTargets.getTargets().forEach(t=>{t.hasPreset=!1}),null===(t=this.timing)||void 0===t||t.resetAllInteractiveSeq(),null===(e=this.timing)||void 0===e||e.destroy(),this.timing=void 0}destroy(){var t,e;this.isTimingStartValueCollected=!1,this.isRendered=!1,this.ctx.eventHub.removeAllListeners(),this.ctx.graphicsTexture.destroy(),null===(t=this.ctx.bgTexture)||void 0===t||t.destroy(!0),this.ctx.spriteTexture.destroy(),this.ctx.timingEventHub.removeAllListeners(),null===(e=this.timing)||void 0===e||e.destroy(),this.timing=void 0,super.destroy()}mainSeqStep(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.currentMainSeqStep())&&void 0!==e?e:0}mainSeqLength(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.currentMainSeqLength())&&void 0!==e?e:0}mainSeqHasNextStep(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.mainSeqHasNextStep())&&void 0!==e&&e}mainSeqHasPrevStep(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.mainSeqHasPrevStep())&&void 0!==e&&e}mainSeqState(){return this.timing?this.timing.currentMainSeqState():null}nextStep(t=!1){var e;this.hasTiming()&&(null===(e=this.timing)||void 0===e?void 0:e.hasMainSeq())?(this.ctx.timingEventHub.emit("shape slide onStopAudio"),this.ctx.timingEventHub.emit("shape slide onNext",t)):this.ctx.eventHub.emit(Nb.requestNextSlide,t)}prevStep(t=!1){var e;this.hasTiming()&&(null===(e=this.timing)||void 0===e?void 0:e.hasMainSeq())?(this.ctx.timingEventHub.emit("shape slide onStopAudio"),this.ctx.timingEventHub.emit("shape slide onPrev",t)):this.ctx.eventHub.emit(Nb.requestPrevSlide,t)}applyInteractiveAction(t){var e;null===(e=this.timing)||void 0===e||e.applyInteractiveAction(t)}seekInteractiveSeqToEnd(t){var e;null===(e=this.timing)||void 0===e||e.seekInteractiveSeqToEnd(t)}setInteractiveSeqState(t,e,i){var n;null===(n=this.timing)||void 0===n||n.setInteractiveSeqState(t,e,i)}setMediaState(t,e){return db(this,void 0,void 0,(function*(){const i=this.ctx.medias[t];i&&(e?yield i.play():yield i.pause())}))}setMediaCurrentTime(t,e){const i=this.ctx.medias[t];i&&i.seek(e)}}class fb{constructor(t){this.ticker=t,this.tasks=[],this.couldRunning=!1,this.applyNext=()=>{const t=this.tasks[0];t&&t.applyNext()},t.add(this.applyNext)}addTask(t){this.tasks.push(t),t.once("task-finish",()=>{const e=this.tasks.indexOf(t);e>=0&&this.tasks.splice(e,1)}),t.once("task-error",()=>{const e=this.tasks.indexOf(t);e>=0&&this.tasks.splice(e,1)})}start(){this.couldRunning=!0}stop(){this.couldRunning=!1}}var mb=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};const gb=t=>new Promise(e=>setTimeout(e,t));class vb extends $a.a{constructor(t,e,i){super(),this.slideIndex=t,this.taskId=e,this.logger=i,this.uuid=A_(),this.isCancel=!1,this.tasks=[]}addMTask(t,e){this.tasks.push({fn:t,state:"wait",sub:[],name:e})}addSubMTask(t,e){let i=this.tasks.findIndex(t=>"running"===t.state);i<0&&(i=0),this.tasks[i].sub.push({fn:t,state:"wait",sub:[],name:e})}cancel(){this.tasks=[],this.isCancel=!0}applyNext(){if(this.tasks.some(t=>"running"===t.state))return;if(this.tasks.some(t=>"error"===t.state))return;if(this.tasks.every(t=>"finish"===t.state))return void(this.isCancel||this.emit("task-finish"));const t=this.tasks.find(t=>"wait"===t.state);t&&(t.state="running",t.fn.apply(null).then(()=>{if(t.state="finish",t.sub.length>0){const e=this.tasks.findIndex(e=>e===t);this.tasks.splice(e+1,0,...t.sub)}}).catch(e=>{t.state="error",this.logger.error(`${e} ${e.stack}`,this.taskId),this.emit("task-error",T_.transform(e),this.slideIndex)}))}applyAll(){return mb(this,void 0,void 0,(function*(){for(;!this.tasks.every(t=>"finish"===t.state);)if(this.tasks.some(t=>"running"===t.state))yield gb(16);else{if(this.tasks.some(t=>"error"===t.state))return;{const t=this.tasks.find(t=>"wait"===t.state);if(t){t.state="running";try{if((yield I_(()=>t.fn.apply(null),6e4))===P_)throw new T_(b_.RuntimeError,`subtask ${t.name} apply timeout`);if(t.state="finish",t.sub.length>0){const e=this.tasks.findIndex(e=>e===t);this.tasks.splice(e+1,0,...t.sub)}}catch(e){let i;i=(null==e?void 0:e.errorType)?e:new T_(b_.RuntimeError,`subtask ${t.name} error. ${e}`),t.state="error",this.logger.error(`${e} ${e.stack}`,this.taskId),this.emit("task-error",T_.transform(i),this.slideIndex);break}}}}!this.isCancel&&this.tasks.every(t=>"finish"===t.state)&&this.emit("task-finish")}))}}var _b=i(95);const yb=new(i.n(_b).a),xb=yb.getDevice(),bb=yb.getBrowser(),Tb=yb.getOS(),Eb={isDesktop(){let t=!0;return"mobile"===xb.type&&(t=!1),/Samsung/.test(bb.name||"")&&(t=!1),window.__nativeTags&&window.__nativeTags.platform&&(t=!1),t},isIOS(){let t=!1;return window.__nativeTags&&window.__nativeTags.platform&&/^ios/i.test(window.__nativeTags.platform)&&(t=!0),Tb.name&&/iOS/.test(Tb.name)&&(t=!0),t},isAndroid(){let t=!1;return window.__nativeTags&&window.__nativeTags.platform&&/^android/i.test(window.__nativeTags.platform)&&(t=!0),Tb.name&&/android/i.test(Tb.name)&&(t=!0),t},isLowGpuMemory(){var t,e;const i=null!==(e=null===(t=window.__nativeTags)||void 0===t?void 0:t.platform)&&void 0!==e?e:"";if(i){const t=i.split(" ");if(t[1]){if(/^iPad/.test(t[1])){const e=t[1].match(/^iPad(\d+)/);return!(e&&e[1]&&parseInt(e[1],10)>=6)}if(/^iPhone/.test(t[1])){const e=t[1].match(/^iPhone(\d+)/);return!(e&&e[1]&&parseInt(e[1],10)>=9)}return!1}return!1}return!0}};var wb=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class Sb{constructor(t,e){if(this.renderer=t,this.localStorage=e,this.outputData=new Map,this.loadingSdfKeys=new Set,!Sb.worker){const t=new Blob(['\nself.onmessage = function(e) {\n var data = e.data.data;\n var key = e.data.key;\n var height = Math.ceil(e.data.height);\n var width = Math.ceil(e.data.width);\n if (!data || !key) {\n return;\n }\n var maxDis = 0;\n var d = [];\n var p = [];\n var maxInt = Number.MAX_SAFE_INTEGER || 255 * 255 * 255;\n var setD = function(x, y, v) { d[y * width + x] = v; };\n var getD = function(x, y) { return d[y * width + x]; };\n var setP = function(x, y, v) { p[y * width + x] = v; };\n var getP = function(x, y) { return p[y * width + x]; };\n var isContains = function(x, y) { return x >= 0 && x < width && y >= 0 && y < height; };\n var isInterior = function(x, y) { return data[(y * width + x) * 4 + 3] > 10; };\n for (var y = 0; y < height; ++ y) {\n for (var x = 0; x < width; ++ x) {\n var c = isInterior(x, y);\n var t = isContains(x, y - 1) ? isInterior(x, y - 1) : false;\n var b = isContains(x, y + 1) ? isInterior(x, y + 1) : false;\n var l = isContains(x - 1, y) ? isInterior(x - 1, y) : false;\n var r = isContains(x + 1, y) ? isInterior(x + 1, y) : false;\n if (c !== t || c !== b || c !== l || c !== r) {\n setD(x, y, 0);\n setP(x, y, [x, y]);\n } else {\n setD(x, y, maxInt);\n setP(x, y, [-1, -1]);\n }\n }\n }\n \n var f = function (x, y, dir) {\n var d1 = 1;\n var d2 = Math.sqrt(2);\n var dx;\n var dy;\n var od;\n switch (dir) {\n case "TL": dx = -1; dy = -1; od = d2; break;\n case "T": dx = 0; dy = -1; od = d1; break;\n case "TR": dx = 1; dy = -1; od = d2; break;\n case "L": dx = -1; dy = 0; od = d1; break;\n case "R": dx = 1; dy = 0; od = d1; break;\n case "BL": dx = -1; dy = 1; od = d2; break;\n case "B": dx = 0; dy = 1; od = d1; break;\n case "BR": dx = 1; dy = 1; od = d2; break;\n }\n var b = isContains(x + dx, y + dy);\n var cb = b ? getD(x + dx, y + dy) : maxInt;\n if (cb + od < getD(x, y)) {\n var p = b ? getP(x + dx, y + dy) : [-1, -1];\n var dis = Math.sqrt(Math.pow(x - p[0], 2) + Math.pow(y - p[1], 2));\n setP(x, y, p);\n setD(x, y, dis);\n if (dis > maxDis) {\n maxDis = dis;\n }\n }\n };\n \n for (var y = 0; y < height; ++ y) {\n for (var x = 0; x < width; ++ x) {\n var dirs = ["TL", "T", "TR", "L"];\n for (var i = 0; i < dirs.length; ++ i) {\n var dir = dirs[i];\n f(x, y, dir);\n }\n }\n }\n\n for (var y = height - 1; y >= 0; -- y) {\n for (var x = width - 1; x >= 0; -- x) {\n var dirs = ["R", "BL", "B", "BR"];\n for (var i = 0; i < dirs.length; ++ i) {\n var dir = dirs[i];\n f(x, y, dir);\n }\n }\n }\n\n var outputData = [];\n for (var y = 0; y < height; ++ y) {\n for (var x = 0; x < width; ++ x) {\n outputData.push(isInterior(x, y) ? 255: 0);\n outputData.push(0);\n outputData.push(0);\n outputData.push(Math.ceil(getD(x, y) / maxDis * 255));\n }\n }\n self.postMessage({\n key, outputData, maxDis\n });\n};\n'],{type:"text/javascript"});Sb.worker=new Worker(URL.createObjectURL(t)),Sb.worker.onmessage=t=>{this.outputData.set(t.data.key,{data:t.data.outputData,maxDis:t.data.maxDis})},this.outputData.set("111","222")}}createSdfByWorker(t,e,i,n,r,s,o,a){const l=document.createElement("canvas");l.width=r,l.height=s;const h=l.getContext("2d");if(!h||!Sb.worker)return;h.drawImage(o,t,e,i,n);const{data:c}=h.getImageData(0,0,r,s);Sb.worker.postMessage({data:c,key:a,width:r,height:s})}createSdf(t,e,i){const n=document.createElement("canvas");n.width=t,n.height=e;const r=n.getContext("2d");if(!r)return{src:"",maxDis:1};r.drawImage(i,0,0);let s=0;const{data:o}=r.getImageData(0,0,t,e),a=[],l=[],h=function(e,i,n){a[i*t+e]=n},c=function(e,i){return a[i*t+e]},u=function(e,i,n){l[i*t+e]=n},d=function(e,i){return l[i*t+e]},p=function(i,n){return i>=0&&i<t&&n>=0&&n<e},f=function(e,i){return o[4*(i*t+e)+3]>10};for(let i=0;i<e;++i)for(let e=0;e<t;++e){const t=f(e,i),n=!!p(e,i-1)&&f(e,i-1),r=!!p(e,i+1)&&f(e,i+1),s=!!p(e-1,i)&&f(e-1,i),o=!!p(e+1,i)&&f(e+1,i);t!==n||t!==r||t!==s||t!==o?(h(e,i,0),u(e,i,[e,i])):(h(e,i,Number.MAX_SAFE_INTEGER),u(e,i,[-1,-1]))}const m=function(t,e,i){const n=Math.sqrt(2);let r,o,a;switch(i){case"TL":r=-1,o=-1,a=n;break;case"T":r=0,o=-1,a=1;break;case"TR":r=1,o=-1,a=n;break;case"L":r=-1,o=0,a=1;break;case"R":r=1,o=0,a=1;break;case"BL":r=-1,o=1,a=n;break;case"B":r=0,o=1,a=1;break;case"BR":r=1,o=1,a=n}const l=p(t+r,e+o);if((l?c(t+r,e+o):Number.MAX_SAFE_INTEGER)+a<c(t,e)){const i=l?d(t+r,e+o):[-1,-1],n=Math.sqrt(Math.pow(t-i[0],2)+Math.pow(e-i[1],2));u(t,e,i),h(t,e,n),n>s&&(s=n)}};for(let i=0;i<e;++i)for(let e=0;e<t;++e){const t=["TL","T","TR","L"];for(const n of t)m(e,i,n)}for(let i=e-1;i>=0;--i)for(let e=t-1;e>=0;--e){const t=["R","BL","B","BR"];for(const n of t)m(e,i,n)}const g=[];for(let i=0;i<e;++i)for(let e=0;e<t;++e)g.push(0,0,0,Math.ceil(c(e,i)/s*255));return r.putImageData(new ImageData(Uint8ClampedArray.from(g),t,e),0,0),{src:n.toDataURL("image/png"),maxDis:s}}getSdf(t,e,i){return wb(this,void 0,void 0,(function*(){const n=Math.ceil(e.width),r=Math.ceil(e.height),s=Math.ceil(e.width-t.width)/2,o=Math.ceil(e.height-t.height)/2;let a=yield this.localStorage.getItem(`sdf-${i}-src`),l=yield this.localStorage.getItem(`sdf-${i}-maxDis`);if(!(a&&l||this.loadingSdfKeys.has(i))){this.loadingSdfKeys.add(i);const e=this.renderer.plugins.extract.image(t,"image/png");e.addEventListener("load",()=>{this.createSdfByWorker(s,o,t.width,t.height,n,r,e,i)}),e.addEventListener("error",()=>null),yield function(t,e){return M_(this,void 0,void 0,(function*(){const i=Date.now();for(;!t()&&Date.now()-i<e;)yield R_(16)}))}(()=>!!this.outputData.has(i),2e3),this.loadingSdfKeys.delete(i);const h=this.outputData.get(i);if(h){this.outputData.delete(i);const t=document.createElement("canvas");t.width=n,t.height=r;const e=t.getContext("2d");if(!e)return null;e.putImageData(new ImageData(Uint8ClampedArray.from(h.data),n,r),0,0),a=t.toDataURL("image/png"),l=h.maxDis,this.localStorage.setItem(`sdf-${i}-src`,a).catch(()=>{}),this.localStorage.setItem(`sdf-${i}-maxDis`,l).catch(()=>{})}}if(!a||!l)return null;return document.createElement("img").src=a,Vd.fromURL(a).then(t=>({texture:t,maxDis:l})).catch(()=>null)}))}}Sb.worker=null;var Mb=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class Ab{constructor(t,e,i,n,r,s,o,a,l,h,c,u,d,p){this.loader=t,this.mode=e,this.renderer=i,this.ticker=n,this.view=r,this.clock=s,this.objPoolGroup=o,this.errorChannel=a,this.localstorage=l,this.logger=h,this.loaderDelegate=c,this.isPlayerPaused=u,this.maxResolution=d,this.volumeAdjuster=p,this.currentStageIndex=0,this.cacheCount=Eb.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 fb(n),this.sdfManager=new Sb(i,l)}setResourceData(t,e){this.taskId=t,this.url=e}createCtx(t){const{task:e}=this.stageStates[t];e.addMTask(()=>Mb(this,void 0,void 0,(function*(){const e=new B_(this.loader),i=new $a.a,n={taskId:this.taskId,mode:this.mode,renderer:this.renderer,graphicsTexture:new J_,stageWidth:0,stageHeight:0,ticker:this.ticker,timingTargets:new $_(i),eventHub:i,view:this.view,medias:Object.create(null),lastViewedIndex:0,conflictTimeNodeManager:new K_,clock:this.clock,spriteTexture:e,slideIndex:t,objectPoolGroup:this.objPoolGroup,hasBackgroundFillShape:!1,slideScopeEventHub:new $a.a,logger:this.logger,sdfManager:this.sdfManager,loaderDelegate:this.loaderDelegate,runningAudio:this.runningAudio,activeMedia:this.activeMedia,isPlayerPaused:this.isPlayerPaused,timingEventHub:new $a.a,maxResolution:this.maxResolution,animatedIds:new Set,volumeAdjuster:this.volumeAdjuster};this.stageCtxs[t]=n})),"@StagePool[createCtx]")}loadStageJson(t){const{task:e}=this.stageStates[t];e.addMTask(()=>Mb(this,void 0,void 0,(function*(){const e=yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/slide-${t}.json`);this.stageJsons[t]=e,this.stageCtxs[t].stageWidth=e.width,this.stageCtxs[t].stageHeight=e.height,this.stageCtxs[t].featureList=e.featureList})),"@StagePool[loadStageJson]")}loadSpriteSheets(t){const{task:e}=this.stageStates[t];e.addMTask(()=>{const i=this.stageJsons[t],{spriteTexture:n,stageWidth:r,stageHeight:s}=this.stageCtxs[t],{coloredSheets:o,sheets:a}=i,l=o||a;return l&&l.forEach(t=>{e.addSubMTask(()=>{let e=1;if(r>this.maxResolution.x||s>this.maxResolution.y){e=this.maxResolution.x/r;const t=e*s;t>this.maxResolution.y&&(e*=this.maxResolution.y/t)}return n.loadSpriteSheetItem(this.url,this.taskId,t,e)},"@StagePool[spriteTexture.loadSpriteSheetItem]")}),Promise.resolve()},"@StagePool[loadSpriteSheets]")}createStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>{const i=this.stageJsons[t],n=this.stageCtxs[t],r=new pb(i,n,{x:0,y:0},e);return this.stageImpls[t]=r,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(()=>Mb(this,void 0,void 0,(function*(){const i=this.stageCtxs[t];i.graphicsTexture.pack().forEach((t,n)=>{e.addSubMTask(()=>i.graphicsTexture.render(t,n,this.objPoolGroup),"@StagePool[graphicsTexture.render]")})})),"@StagePool[createGraphicsTexture]")}renderStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>Mb(this,void 0,void 0,(function*(){const i=this.stageImpls[t];yield i.render(e)})),"@StagePool[renderStage]")}destroyStageByIndex(t){"load"===this.stageStates[t].state&&this.stageStates[t].task.cancel(),delete this.stageStates[t];this.stageImpls[t].destroy(),delete this.stageImpls[t],delete this.stageCtxs[t]}destroyStage(){Object.keys(this.stageImpls).forEach(t=>{const e=parseInt(t,10);Math.abs(this.currentStageIndex-e)>this.cacheCount&&this.destroyStageByIndex(e)})}destroyAllStage(){Object.keys(this.stageImpls).forEach(t=>{const e=parseInt(t,10);this.destroyStageByIndex(e)})}preload(t,e=!1){if(this.stageImpls[t]||this.stageStates[t])return Promise.resolve();const i=new vb(t,this.taskId,this.logger);return i.on("task-error",(t,e)=>{delete this.stageStates[e],delete this.stageImpls[e],delete this.stageCtxs[e],this.errorChannel.emit("error",t,e)}),this.stageStates[t]={state:"load",task:i},this.createCtx(t),this.loadStageJson(t),this.loadSpriteSheets(t),this.createStage(t),this.preRenderStage(t),this.createGraphicsTexture(t),this.renderStage(t),this.microTaskManager.addTask(i),e?i.applyAll():new Promise(e=>{i.once("task-finish",()=>{this.stageStates[t].state="finish";Object.keys(this.stageStates).length>2*this.cacheCount+1&&this.destroyStage(),e()})})}getStageJson(t){return this.stageJsons[t]||null}getStage(t){return Mb(this,void 0,void 0,(function*(){this.currentStageIndex=t;const e=this.stageStates[t];return"finish"===(null==e?void 0:e.state)&&this.stageImpls[t]?this.stageImpls[t]:"load"===(null==e?void 0:e.state)?(yield e.task.applyAll(),this.stageImpls[t]):(yield this.preload(t,!0),this.stageImpls[t])}))}destroy(){this.runningAudio.clear()}}var Pb=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class Rb{constructor(t){var e;this.logger=t,this.taskId="",this.isIndexDBReady=!1,this.memoryCache=new Map,null===(e=Rb.localCache)||void 0===e||e.ready(()=>{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 Pb(this,void 0,void 0,(function*(){let e=null;return this.couldUseIndexDBCache&&Rb.localCache&&(e=yield I_(()=>Rb.localCache.getItem(`${this.taskId}/${t}`),500)),e=e===P_?null:e,e||this.memoryCache.get(t)||null}))}setItem(t,e,i=!1){return Pb(this,void 0,void 0,(function*(){if(!this.couldUseIndexDBCache)return i&&this.memoryCache.set(t,e),Promise.resolve();if(Rb.localCache){(yield I_(()=>Rb.localCache.setItem(`${this.taskId}/${t}`,e).catch(()=>{i&&this.memoryCache.set(t,e)}),500))===P_&&i&&this.memoryCache.set(t,e)}}))}dispose(){var t;this.memoryCache=new Map,this.couldUseIndexDBCache&&(null===(t=Rb.localCache)||void 0===t||t.keys().then(t=>{t.filter(t=>t.indexOf(this.taskId)>=0).forEach(t=>{var e;null===(e=Rb.localCache)||void 0===e||e.removeItem(t).catch(()=>{})})}))}}Rb.localCache=null;try{Rb.localCache=a.createInstance({name:"slide_local_cache",driver:a.INDEXEDDB,version:1})}catch(t){}class Ib extends $a.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 Cb=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};window.PIXI=r,n.skipHello();const Lb={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"},Nb={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",requestNextSlide:"requestNextSlide",requestPrevSlide:"requestPrevSlide",requestGotoSlide:"requestGotoSlide",userInput:"userInput"};class Ob extends $a.a{constructor(t,e={}){super(),this.errorChannel=new $a.a,this.transactionPlayer=null,this.isForward=!0,this.drawCall=0,this.scale=1,this._isPaused=!1,this.maxResolution=new wu(0,0),this.fps=new x_,this.designWidth=0,this.designHeight=0,this.currentIndex=0,this.slideCount=0,this.runtime={drawCall:0,fps:0},this.isPlayerPaused=()=>this._isPaused,this.onWebGLLost=()=>{this.errorChannel.emit("error",new T_(b_.CanvasCrash,"webgl context lost."))},this.logger=t.logger,this.mode=t.mode,this.volumeAdjuster=t.volumeAdjuster,this.localStorage=new Rb(this.logger),this.config={minFPS:il()(e.minFPS)?30:e.minFPS,maxFPS:il()(e.maxFPS)?40:e.maxFPS,resolution:il()(e.resolution)?1:e.resolution,autoFPS:!il()(e.autoFPS)&&e.autoFPS,autoResolution:!il()(e.autoResolution)&&e.autoResolution,transactionBgColor:il()(e.transactionBgColor)?0:e.transactionBgColor,maxResolutionLevel:this.getMaxResolution(e.maxResolutionLevel)},this.updateMaxResolutionLevel(this.config.maxResolutionLevel),this.loader=new N_(this.localStorage,t.useLocalCache,this.logger,t.resourceTimeout,t.loadDelegate),this.app=new vm({antialias:!0,autoDensity:!1,backgroundColor:16777215}),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 i=this.app.renderer,{drawElements:n}=i.gl;i.gl.drawElements=(...t)=>{n.call(i.gl,...t),this.drawCall+=1},this.fps.on("update",t=>{if(t<this.config.minFPS){if(this.config.autoResolution){const t=.7*this.scale,e=this.app.renderer.resolution,i=Math.max(t,e-.1);i>=t&&this.updateResolution(i)}}else if(t>this.config.maxFPS&&this.config.autoResolution){const t=this.scale*this.config.resolution,e=this.app.renderer.resolution,i=Math.min(t,e+.1);i<=this.config.resolution&&this.updateResolution(i)}}),this.app.ticker.add(()=>{this.runtime.drawCall=this.drawCall,this.runtime.fps=Math.floor(this.app.ticker.minFPS),this.drawCall=0},null,fd.LOW),this.clock=new D_(this.app.ticker),this.objPoolGroup=A_(),this.stagePool=new Ab(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,this.isPlayerPaused,this.maxResolution,this.volumeAdjuster),this.app.view.addEventListener("webglcontextlost",this.onWebGLLost);try{this.transactionPlayer=new Sh}catch(t){/Error creating WebGL context/.test(t.message)?this.errorChannel.emit("error",new T_(b_.CanvasCrash,"webgl context lost.")):this.errorChannel.emit("error",new T_(b_.RuntimeWarn,t.message))}}get view(){return this.app.renderer?this.app.view:null}get nextSlideIndex(){var t;return(null===(t=this.currentStage)||void 0===t?void 0:t.json.nextIndex)?this.currentStage.json.nextIndex:this.currentIndex+1}get prevSlideIndex(){var t;return(null===(t=this.currentStage)||void 0===t?void 0:t.json.prevIndex)?this.currentStage.json.prevIndex:this.currentIndex-1}getMaxResolution(t){return!il()(t)&&Number.isInteger(t)?(t<1&&(t=1),t>4&&(t=4),t):Ob.platform.isAndroid()||Ob.platform.isIOS()?2:4}updateMaxResolutionLevel(t){t<1&&(t=1),t>4&&(t=4);const e=[999999,960,1280,1920,3200][t],i=[999999,540,720,1080,1800][t];this.maxResolution.set(e,i)}updateConfig(t){il()(t.maxFPS)||(this.config.maxFPS=t.maxFPS),il()(t.minFPS)||(this.config.minFPS=t.minFPS),il()(t.resolution)||(this.config.resolution=t.resolution,this.updateResolution(this.scale*this.config.resolution)),il()(t.autoFPS)||(this.config.autoFPS=t.autoFPS),il()(t.autoResolution)||(this.config.autoResolution=t.autoResolution),il()(t.transactionBgColor)||(this.config.transactionBgColor=t.transactionBgColor),this.taskId&&this.logger.info("ppt player update config: "+JSON.stringify(this.config),this.taskId),il()(t.maxResolutionLevel)||(this.config.maxResolutionLevel=t.maxResolutionLevel,this.updateMaxResolutionLevel(this.config.maxResolutionLevel))}preload(t){return Cb(this,void 0,void 0,(function*(){t<1||t>this.slideCount||(this.logger.info(`preload slide ${t} begin`,this.taskId),yield this.stagePool.preload(t),this.logger.info(`preload slide ${t} end`,this.taskId))}))}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(e=>{t.on(e,(...t)=>{this.emit(e,...t)})})}renderSlide(t){var e,i,n;return Cb(this,void 0,void 0,(function*(){if(this._isPaused)return void this.logger.info("ppt play prevent render slide with paused state",this.taskId);this.logger.info("render slide "+t,this.taskId),this.emit(Nb.renderStart,t);const r=yield this.stagePool.getStage(t);if(!r)return;this.translateEvent(r.ctx.eventHub,[Nb.mainSeqStepChange,Nb.mainSeqStateChange,Nb.hyperlinkTrigger,Nb.interactiveSeqAction,Nb.mainSeqStepStart,Nb.mainSeqStepEnd,Nb.animateStart,Nb.animateEnd,Nb.mediaPlay,Nb.mediaPause,Nb.mediaSeek,Nb.requestGotoSlide,Nb.requestNextSlide,Nb.requestPrevSlide,Nb.interactiveSeqStateChange,Nb.userInput]),this.currentIndex=Number(t);const{width:s,height:o,slideCount:a}=r.json;this.slideCount=a,this.designWidth=s,this.designHeight=o,null===(e=this.currentStage)||void 0===e||e.clearOnSlideChange();const l=this.currentStage;this.currentStage=r,r.initOnReuse(),r.createTiming(),r.container.visible=!0,r.collectMainSeqStartValue(),this.isForward?r.setMainSeqStep(0,"start"):r.setMainSeqStep(-1,"end");let h=!1;if(r.json.transition&&r.json.transition.type&&this.app.stage.children.length>0&&this.view){let{transition:t}=r.json;!this.isForward&&(null==l?void 0:l.json.transition)&&(t=l.json.transition),this.initTransactionPlayer(t);const e=new ps(this.view);null===(i=this.transactionPlayer)||void 0===i||i.setPrevTexture(e),h=!0}if(this.app.stage.addChild(r.container),this.updateResolution(this.config.resolution*this.scale),l&&(l.clearOnTransactionEnd(),this.app.stage.removeChild(l.container)),r.json.transition&&r.json.transition.type&&this.app.stage.children.length>0&&this.view&&this.transactionPlayer&&h){const t=new ps(this.view);this.transactionPlayer.setNextTexture(t),yield this.transactionPlayer.play();const e=this.transactionPlayer.renderer.domElement;if(this.view.parentElement&&e)try{this.view.parentElement.removeChild(e)}catch(t){}null===(n=this.transactionPlayer)||void 0===n||n.dispose()}this.isForward?yield r.startTiming():r.setMainSeqApplied(),r.ctx.slideScopeEventHub.emit("slide-render",r.ctx.slideIndex),this.emit(Nb.renderEnd,t),this.emit(Nb.slideChange,t),this.preload(t+1).catch(e=>{this.errorChannel.emit("error",T_.transform(e),t+1)}),this.preload(t-1).catch(e=>{this.errorChannel.emit("error",T_.transform(e),t-1)})}))}renderToBase64(t,e,i){return Cb(this,void 0,void 0,(function*(){const n=yield this.stagePool.getStage(t);if(n){const{width:r,height:s}=n.json;this.designWidth=r,this.designHeight=s;const o=Wd.create({width:this.designWidth,height:this.designHeight,resolution:e});n.container.visible=!0,this.app.renderer.render(n.container,{renderTexture:o});const a=this.app.renderer.plugins.extract.base64(o,i);return this.stagePool.destroyStageByIndex(t),a}return"__null__"}))}getBase64(t){if(!t.container.transform)return null;const e=Wd.create({width:this.designWidth,height:this.designHeight,resolution:1});this.app.renderer.render(t.container,{renderTexture:e});const i=this.app.renderer.plugins.extract.base64(e,"image/jpeg");return e.destroy(!0),i}initTransactionPlayer(t){var e,i,n,r,s;const o=null===(e=this.view)||void 0===e?void 0:e.parentElement;if(this.view&&o&&Lb[t.type]&&this.transactionPlayer){const e=null===(i=this.transactionPlayer)||void 0===i?void 0:i.renderer.domElement;this.transactionPlayer.initPlayer({reverse:!this.isForward,stageWidth:this.view.width,stageHeight:this.view.height,presetType:Lb[t.type],duration:null===(r=null===(n=this.currentStage)||void 0===n?void 0:n.json.transition)||void 0===r?void 0:r.dur,delay:0,clearColor:this.config.transactionBgColor,maxFPS:Math.ceil(null!==(s=this.config.maxFPS)&&void 0!==s?s:60),options:t.options}),e&&(e.style.position="absolute",e.style.zIndex="9",e.style.left="0",e.style.top="0",e.style.width=this.view.style.width,e.style.height=this.view.style.height),o.appendChild(e)}}scaleView(t,e,i){var n;this.view&&(this.view.style.width=Math.floor(this.designWidth*t)+"px",this.view.style.height=Math.floor(this.designHeight*t)+"px");const r=null===(n=this.transactionPlayer)||void 0===n?void 0:n.renderer.domElement;if(r&&this.view&&(r.style.width=this.view.style.width,r.style.height=this.view.style.height),e){this.scale=t;const e=this.scale*this.config.resolution;this.updateResolution(e,i)}}updateResolution(t,e){this.app.ticker.addOnce(()=>{let i=Eb.isDesktop()?t:1;for(;i*this.designWidth>this.maxResolution.x||i*this.designHeight>this.maxResolution.y;)i-=.1;this.app.renderer.resolution=i,this.app.renderer.plugins.interaction.resolution=this.app.renderer.resolution,this.app.renderer.resize(this.designWidth,this.designHeight),tl()(e)&&e()})}nextStep(t=!1){var e;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{null===(e=this.currentStage)||void 0===e||e.nextStep(t)}catch(t){this.errorChannel.emit("error",T_.transform(t),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{null===(e=this.currentStage)||void 0===e||e.prevStep(t)}catch(t){this.errorChannel.emit("error",T_.transform(t),this.currentIndex)}}}mainSeqLength(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqLength())&&void 0!==e?e:0}mainSeqStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqStep())&&void 0!==e?e:0}setMainSeqStep(t,e){var i;null===(i=this.currentStage)||void 0===i||i.setMainSeqStep(t,e)}mainSeqState(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqState())&&void 0!==e?e:null}mainSeqHasNextStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqHasNextStep())&&void 0!==e&&e}mainSeqHasPrevStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqHasPrevStep())&&void 0!==e&&e}nextTick(t){this.app.ticker.addOnce(()=>{t()},fd.LOW)}applyInteractiveAction(t){var e;null===(e=this.currentStage)||void 0===e||e.applyInteractiveAction(t)}seekInteractiveSeqToEnd(t){var e;null===(e=this.currentStage)||void 0===e||e.seekInteractiveSeqToEnd(t)}setInteractiveSeqState(t,e,i){var n;null===(n=this.currentStage)||void 0===n||n.setInteractiveSeqState(t,e,i)}setMediaState(t,e){var i;return Cb(this,void 0,void 0,(function*(){yield null===(i=this.currentStage)||void 0===i?void 0:i.setMediaState(t,e)}))}setMediaCurrentTime(t,e){var i;null===(i=this.currentStage)||void 0===i||i.setMediaCurrentTime(t,e)}pause(){var t;this.app.ticker.stop(),null===(t=this.currentStage)||void 0===t||t.ctx.activeMedia.forEach(t=>{t.globalPause()}),this._isPaused=!0}resume(){var t;this._isPaused=!1,this.app.ticker.start(),null===(t=this.currentStage)||void 0===t||t.ctx.activeMedia.forEach(t=>{t.globalResume()})}getSnapshot(){return this.currentStage&&this.getBase64(this.currentStage)||""}clearLocalCache(){this.localStorage.dispose()}static clearLocalCache(){var t;null===(t=Rb.localCache)||void 0===t||t.clear().catch(()=>{})}destroy(){var t,e;try{this.app.view.removeEventListener("webglcontextlost",this.onWebGLLost);try{this.app.renderer.filter.texturePool.clear(!0)}catch(t){}Y_.collectObjectByGroup(this.objPoolGroup),q_.collectObjectByGroup(this.objPoolGroup),null===(t=this.transactionPlayer)||void 0===t||t.destroy(),this.loader.destroy(),this.fps.destroy(),this.stagePool.destroyAllStage(),this.stagePool.destroy();try{this.app.renderer.gl.getExtension("WEBGL_lose_context").loseContext()}catch(t){}this.app.destroy(!0,{children:!0,texture:!0,baseTexture:!0}),null===(e=Sb.worker)||void 0===e||e.terminate()}catch(t){}}}Ob.platform=Eb,Ob.RtcAudioClazz=null;var Db=new Map;function Fb(t){var e=Db.get(t.hookPoint)||[];e.push(t),Db.set(t.hookPoint,e)}var Ub,kb=i(96),Bb=i.n(kb),Gb=i(34),Hb=i.n(Gb),jb=[],zb="ResizeObserver loop completed with undelivered notifications.";!function(t){t.BORDER_BOX="border-box",t.CONTENT_BOX="content-box",t.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"}(Ub||(Ub={}));var Vb,Wb=function(t){return Object.freeze(t)},Xb=function(t,e){this.inlineSize=t,this.blockSize=e,Wb(this)},Yb=function(){function t(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Wb(this)}return t.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}},t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t}(),qb=function(t){return t instanceof SVGElement&&"getBBox"in t},Zb=function(t){if(qb(t)){var e=t.getBBox(),i=e.width,n=e.height;return!i&&!n}var r=t,s=r.offsetWidth,o=r.offsetHeight;return!(s||o||t.getClientRects().length)},Jb=function(t){var e;if(t instanceof Element)return!0;var i=null===(e=null==t?void 0:t.ownerDocument)||void 0===e?void 0:e.defaultView;return!!(i&&t instanceof i.Element)},Kb="undefined"!=typeof window?window:{},$b=new WeakMap,Qb=/auto|scroll/,tT=/^tb|vertical/,eT=/msie|trident/i.test(Kb.navigator&&Kb.navigator.userAgent),iT=function(t){return parseFloat(t||"0")},nT=function(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=!1),new Xb((i?e:t)||0,(i?t:e)||0)},rT=Wb({devicePixelContentBoxSize:nT(),borderBoxSize:nT(),contentBoxSize:nT(),contentRect:new Yb(0,0,0,0)}),sT=function(t,e){if(void 0===e&&(e=!1),$b.has(t)&&!e)return $b.get(t);if(Zb(t))return $b.set(t,rT),rT;var i=getComputedStyle(t),n=qb(t)&&t.ownerSVGElement&&t.getBBox(),r=!eT&&"border-box"===i.boxSizing,s=tT.test(i.writingMode||""),o=!n&&Qb.test(i.overflowY||""),a=!n&&Qb.test(i.overflowX||""),l=n?0:iT(i.paddingTop),h=n?0:iT(i.paddingRight),c=n?0:iT(i.paddingBottom),u=n?0:iT(i.paddingLeft),d=n?0:iT(i.borderTopWidth),p=n?0:iT(i.borderRightWidth),f=n?0:iT(i.borderBottomWidth),m=u+h,g=l+c,v=(n?0:iT(i.borderLeftWidth))+p,_=d+f,y=a?t.offsetHeight-_-t.clientHeight:0,x=o?t.offsetWidth-v-t.clientWidth:0,b=r?m+v:0,T=r?g+_:0,E=n?n.width:iT(i.width)-b-x,w=n?n.height:iT(i.height)-T-y,S=E+m+x+v,M=w+g+y+_,A=Wb({devicePixelContentBoxSize:nT(Math.round(E*devicePixelRatio),Math.round(w*devicePixelRatio),s),borderBoxSize:nT(S,M,s),contentBoxSize:nT(E,w,s),contentRect:new Yb(u,l,E,w)});return $b.set(t,A),A},oT=function(t,e,i){var n=sT(t,i),r=n.borderBoxSize,s=n.contentBoxSize,o=n.devicePixelContentBoxSize;switch(e){case Ub.DEVICE_PIXEL_CONTENT_BOX:return o;case Ub.BORDER_BOX:return r;default:return s}},aT=function(t){var e=sT(t);this.target=t,this.contentRect=e.contentRect,this.borderBoxSize=Wb([e.borderBoxSize]),this.contentBoxSize=Wb([e.contentBoxSize]),this.devicePixelContentBoxSize=Wb([e.devicePixelContentBoxSize])},lT=function(t){if(Zb(t))return 1/0;for(var e=0,i=t.parentNode;i;)e+=1,i=i.parentNode;return e},hT=function(){var t=1/0,e=[];jb.forEach((function(i){if(0!==i.activeTargets.length){var n=[];i.activeTargets.forEach((function(e){var i=new aT(e.target),r=lT(e.target);n.push(i),e.lastReportedSize=oT(e.target,e.observedBox),r<t&&(t=r)})),e.push((function(){i.callback.call(i.observer,n,i.observer)})),i.activeTargets.splice(0,i.activeTargets.length)}}));for(var i=0,n=e;i<n.length;i++){(0,n[i])()}return t},cT=function(t){jb.forEach((function(e){e.activeTargets.splice(0,e.activeTargets.length),e.skippedTargets.splice(0,e.skippedTargets.length),e.observationTargets.forEach((function(i){i.isActive()&&(lT(i.target)>t?e.activeTargets.push(i):e.skippedTargets.push(i))}))}))},uT=function(){var t,e=0;for(cT(e);jb.some((function(t){return t.activeTargets.length>0}));)e=hT(),cT(e);return jb.some((function(t){return t.skippedTargets.length>0}))&&("function"==typeof ErrorEvent?t=new ErrorEvent("error",{message:zb}):((t=document.createEvent("Event")).initEvent("error",!1,!1),t.message=zb),window.dispatchEvent(t)),e>0},dT=[],pT=function(t){if(!Vb){var e=0,i=document.createTextNode("");new MutationObserver((function(){return dT.splice(0).forEach((function(t){return t()}))})).observe(i,{characterData:!0}),Vb=function(){i.textContent="".concat(e?e--:e++)}}dT.push(t),Vb()},fT=0,mT={attributes:!0,characterData:!0,childList:!0,subtree:!0},gT=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],vT=function(t){return void 0===t&&(t=0),Date.now()+t},_T=!1,yT=new(function(){function t(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return t.prototype.run=function(t){var e=this;if(void 0===t&&(t=250),!_T){_T=!0;var i,n=vT(t);i=function(){var i=!1;try{i=uT()}finally{if(_T=!1,t=n-vT(),!fT)return;i?e.run(1e3):t>0?e.run(t):e.start()}},pT((function(){requestAnimationFrame(i)}))}},t.prototype.schedule=function(){this.stop(),this.run()},t.prototype.observe=function(){var t=this,e=function(){return t.observer&&t.observer.observe(document.body,mT)};document.body?e():Kb.addEventListener("DOMContentLoaded",e)},t.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),gT.forEach((function(e){return Kb.addEventListener(e,t.listener,!0)})))},t.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),gT.forEach((function(e){return Kb.removeEventListener(e,t.listener,!0)})),this.stopped=!0)},t}()),xT=function(t){!fT&&t>0&&yT.start(),!(fT+=t)&&yT.stop()},bT=function(){function t(t,e){this.target=t,this.observedBox=e||Ub.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return t.prototype.isActive=function(){var t,e=oT(this.target,this.observedBox,!0);return t=this.target,qb(t)||function(t){switch(t.tagName){case"INPUT":if("image"!==t.type)break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1}(t)||"inline"!==getComputedStyle(t).display||(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},t}(),TT=function(t,e){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=e},ET=new WeakMap,wT=function(t,e){for(var i=0;i<t.length;i+=1)if(t[i].target===e)return i;return-1},ST=function(){function t(){}return t.connect=function(t,e){var i=new TT(t,e);ET.set(t,i)},t.observe=function(t,e,i){var n=ET.get(t),r=0===n.observationTargets.length;wT(n.observationTargets,e)<0&&(r&&jb.push(n),n.observationTargets.push(new bT(e,i&&i.box)),xT(1),yT.schedule())},t.unobserve=function(t,e){var i=ET.get(t),n=wT(i.observationTargets,e),r=1===i.observationTargets.length;n>=0&&(r&&jb.splice(jb.indexOf(i),1),i.observationTargets.splice(n,1),xT(-1))},t.disconnect=function(t){var e=this,i=ET.get(t);i.observationTargets.slice().forEach((function(i){return e.unobserve(t,i.target)})),i.activeTargets.splice(0,i.activeTargets.length)},t}(),MT=function(){function t(t){if(0===arguments.length)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if("function"!=typeof t)throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");ST.connect(this,t)}return t.prototype.observe=function(t,e){if(0===arguments.length)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Jb(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");ST.observe(this,t,e)},t.prototype.unobserve=function(t){if(0===arguments.length)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Jb(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");ST.unobserve(this,t)},t.prototype.disconnect=function(){ST.disconnect(this)},t.toString=function(){return"function ResizeObserver () { [polyfill code] }"},t}(),AT=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))},PT=function(t,e){var i,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},RT=function(){function t(t,e,i,n,r){this.state="idle",this.index=-1,this.slideIndex=-1,this.fn=i,this.index=t,this.slideIndex=e,this.eventHub=n,this.id=r}return t.prototype.apply=function(){return AT(this,void 0,void 0,(function(){var t;return PT(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]}}))}))},t}(),IT=function(){function t(){var t=this;this.eventHub=new $a.a,this.tasks=[],this.index=0,this.eventHub.on("task-end",(function(e){var i,n=t.tasks.findIndex((function(t){return t.index===e.index})),r=n+1;r>=0&&(null===(i=t.tasks[r])||void 0===i||i.apply()),n>=0&&(t.tasks.splice(n,1),t.replaceIdleTask()),t.eventHub.emit("task-end-"+e.id)})),this.eventHub.on("task-error",(function(e){var i=e.task,n=t.tasks.findIndex((function(t){return t.index===i.index}));n>=0&&(t.tasks.splice(n,1),t.replaceIdleTask())}))}return t.prototype.replaceIdleTask=function(){for(var t,e=this,i=new Set,n=0,r=this.tasks.length;n<r;n++)"idle"===this.tasks[n].state&&"idle"===(null===(t=this.tasks[n+1])||void 0===t?void 0:t.state)&&i.add(n);Array.from(i).forEach((function(t){e.tasks.splice(t,1)}))},t.prototype.addTask=function(t,e,i){var n=new RT(this.index++,e,t,this.eventHub,i);this.tasks.push(n),this.tasks.sort((function(t,e){return t.index-e.index})),this.replaceIdleTask(),1===this.tasks.length&&n.apply()},t.prototype.hasStartTask=function(){return this.tasks.some((function(t){return"start"===t.state}))},t.prototype.destroy=function(){this.eventHub.removeAllListeners()},t}();function CT(t,e){var i=t.__state.conversionName.toString(),n=Math.round(t.r),r=Math.round(t.g),s=Math.round(t.b),o=t.a,a=Math.round(t.h),l=t.s.toFixed(1),h=t.v.toFixed(1);if(e||"THREE_CHAR_HEX"===i||"SIX_CHAR_HEX"===i){for(var c=t.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===i?"rgb("+n+","+r+","+s+")":"CSS_RGBA"===i?"rgba("+n+","+r+","+s+","+o+")":"HEX"===i?"0x"+t.hex.toString(16):"RGB_ARRAY"===i?"["+n+","+r+","+s+"]":"RGBA_ARRAY"===i?"["+n+","+r+","+s+","+o+"]":"RGB_OBJ"===i?"{r:"+n+",g:"+r+",b:"+s+"}":"RGBA_OBJ"===i?"{r:"+n+",g:"+r+",b:"+s+",a:"+o+"}":"HSV_OBJ"===i?"{h:"+a+",s:"+l+",v:"+h+"}":"HSVA_OBJ"===i?"{h:"+a+",s:"+l+",v:"+h+",a:"+o+"}":"unknown format"}var LT=Array.prototype.forEach,NT=Array.prototype.slice,OT={BREAK:{},extend:function(t){return this.each(NT.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(i){this.isUndefined(e[i])||(t[i]=e[i])}.bind(this))}),this),t},defaults:function(t){return this.each(NT.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(i){this.isUndefined(t[i])&&(t[i]=e[i])}.bind(this))}),this),t},compose:function(){var t=NT.call(arguments);return function(){for(var e=NT.call(arguments),i=t.length-1;i>=0;i--)e=[t[i].apply(this,e)];return e[0]}},each:function(t,e,i){if(t)if(LT&&t.forEach&&t.forEach===LT)t.forEach(e,i);else if(t.length===t.length+0){var n,r=void 0;for(r=0,n=t.length;r<n;r++)if(r in t&&e.call(i,t[r],r)===this.BREAK)return}else for(var s in t)if(e.call(i,t[s],s)===this.BREAK)return},defer:function(t){setTimeout(t,0)},debounce:function(t,e,i){var n=void 0;return function(){var r=this,s=arguments;function o(){n=null,i||t.apply(r,s)}var a=i||!n;clearTimeout(n),n=setTimeout(o,e),a&&t.apply(r,s)}},toArray:function(t){return t.toArray?t.toArray():NT.call(t)},isUndefined:function(t){return void 0===t},isNull:function(t){return null===t},isNaN:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){return isNaN(t)})),isArray:Array.isArray||function(t){return t.constructor===Array},isObject:function(t){return t===Object(t)},isNumber:function(t){return t===t+0},isString:function(t){return t===t+""},isBoolean:function(t){return!1===t||!0===t},isFunction:function(t){return t instanceof Function}},DT=[{litmus:OT.isString,conversions:{THREE_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString()+e[1].toString()+e[2].toString()+e[2].toString()+e[3].toString()+e[3].toString(),0)}},write:CT},SIX_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9]{6})$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString(),0)}},write:CT},CSS_RGB:{read:function(t){var e=t.match(/^rgb\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3])}},write:CT},CSS_RGBA:{read:function(t){var e=t.match(/^rgba\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3]),a:parseFloat(e[4])}},write:CT}}},{litmus:OT.isNumber,conversions:{HEX:{read:function(t){return{space:"HEX",hex:t,conversionName:"HEX"}},write:function(t){return t.hex}}}},{litmus:OT.isArray,conversions:{RGB_ARRAY:{read:function(t){return 3===t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2]}},write:function(t){return[t.r,t.g,t.b]}},RGBA_ARRAY:{read:function(t){return 4===t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2],a:t[3]}},write:function(t){return[t.r,t.g,t.b,t.a]}}}},{litmus:OT.isObject,conversions:{RGBA_OBJ:{read:function(t){return!!(OT.isNumber(t.r)&&OT.isNumber(t.g)&&OT.isNumber(t.b)&&OT.isNumber(t.a))&&{space:"RGB",r:t.r,g:t.g,b:t.b,a:t.a}},write:function(t){return{r:t.r,g:t.g,b:t.b,a:t.a}}},RGB_OBJ:{read:function(t){return!!(OT.isNumber(t.r)&&OT.isNumber(t.g)&&OT.isNumber(t.b))&&{space:"RGB",r:t.r,g:t.g,b:t.b}},write:function(t){return{r:t.r,g:t.g,b:t.b}}},HSVA_OBJ:{read:function(t){return!!(OT.isNumber(t.h)&&OT.isNumber(t.s)&&OT.isNumber(t.v)&&OT.isNumber(t.a))&&{space:"HSV",h:t.h,s:t.s,v:t.v,a:t.a}},write:function(t){return{h:t.h,s:t.s,v:t.v,a:t.a}}},HSV_OBJ:{read:function(t){return!!(OT.isNumber(t.h)&&OT.isNumber(t.s)&&OT.isNumber(t.v))&&{space:"HSV",h:t.h,s:t.s,v:t.v}},write:function(t){return{h:t.h,s:t.s,v:t.v}}}}}],FT=void 0,UT=void 0,kT=function(){UT=!1;var t=arguments.length>1?OT.toArray(arguments):arguments[0];return OT.each(DT,(function(e){if(e.litmus(t))return OT.each(e.conversions,(function(e,i){if(FT=e.read(t),!1===UT&&!1!==FT)return UT=FT,FT.conversionName=i,FT.conversion=e,OT.BREAK})),OT.BREAK})),UT},BT=void 0,GT={hsv_to_rgb:function(t,e,i){var n=Math.floor(t/60)%6,r=t/60-Math.floor(t/60),s=i*(1-e),o=i*(1-r*e),a=i*(1-(1-r)*e),l=[[i,a,s],[o,i,s],[s,i,a],[s,o,i],[a,s,i],[i,s,o]][n];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(t,e,i){var n=Math.min(t,e,i),r=Math.max(t,e,i),s=r-n,o=void 0;return 0===r?{h:NaN,s:0,v:0}:(o=t===r?(e-i)/s:e===r?2+(i-t)/s:4+(t-e)/s,(o/=6)<0&&(o+=1),{h:360*o,s:s/r,v:r/255})},rgb_to_hex:function(t,e,i){var n=this.hex_with_component(0,2,t);return n=this.hex_with_component(n,1,e),n=this.hex_with_component(n,0,i)},component_from_hex:function(t,e){return t>>8*e&255},hex_with_component:function(t,e,i){return i<<(BT=8*e)|t&~(255<<BT)}},HT="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jT=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},zT=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),VT=function t(e,i,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,i);if(void 0===r){var s=Object.getPrototypeOf(e);return null===s?void 0:t(s,i,n)}if("value"in r)return r.value;var o=r.get;return void 0!==o?o.call(n):void 0},WT=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},XT=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},YT=function(){function t(){if(jT(this,t),this.__state=kT.apply(this,arguments),!1===this.__state)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return zT(t,[{key:"toString",value:function(){return CT(this)}},{key:"toHexString",value:function(){return CT(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),t}();function qT(t,e,i){Object.defineProperty(t,e,{get:function(){return"RGB"===this.__state.space||YT.recalculateRGB(this,e,i),this.__state[e]},set:function(t){"RGB"!==this.__state.space&&(YT.recalculateRGB(this,e,i),this.__state.space="RGB"),this.__state[e]=t}})}function ZT(t,e){Object.defineProperty(t,e,{get:function(){return"HSV"===this.__state.space||YT.recalculateHSV(this),this.__state[e]},set:function(t){"HSV"!==this.__state.space&&(YT.recalculateHSV(this),this.__state.space="HSV"),this.__state[e]=t}})}YT.recalculateRGB=function(t,e,i){if("HEX"===t.__state.space)t.__state[e]=GT.component_from_hex(t.__state.hex,i);else{if("HSV"!==t.__state.space)throw new Error("Corrupted color state");OT.extend(t.__state,GT.hsv_to_rgb(t.__state.h,t.__state.s,t.__state.v))}},YT.recalculateHSV=function(t){var e=GT.rgb_to_hsv(t.r,t.g,t.b);OT.extend(t.__state,{s:e.s,v:e.v}),OT.isNaN(e.h)?OT.isUndefined(t.__state.h)&&(t.__state.h=0):t.__state.h=e.h},YT.COMPONENTS=["r","g","b","h","s","v","hex","a"],qT(YT.prototype,"r",2),qT(YT.prototype,"g",1),qT(YT.prototype,"b",0),ZT(YT.prototype,"h"),ZT(YT.prototype,"s"),ZT(YT.prototype,"v"),Object.defineProperty(YT.prototype,"a",{get:function(){return this.__state.a},set:function(t){this.__state.a=t}}),Object.defineProperty(YT.prototype,"hex",{get:function(){return"HEX"!==this.__state.space&&(this.__state.hex=GT.rgb_to_hex(this.r,this.g,this.b),this.__state.space="HEX"),this.__state.hex},set:function(t){this.__state.space="HEX",this.__state.hex=t}});var JT=function(){function t(e,i){jT(this,t),this.initialValue=e[i],this.domElement=document.createElement("div"),this.object=e,this.property=i,this.__onChange=void 0,this.__onFinishChange=void 0}return zT(t,[{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()}}]),t}(),KT={};OT.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},(function(t,e){OT.each(t,(function(t){KT[t]=e}))}));var $T=/(\d+(\.\d+)?)px/;function QT(t){if("0"===t||OT.isUndefined(t))return 0;var e=t.match($T);return OT.isNull(e)?0:parseFloat(e[1])}var tE={makeSelectable:function(t,e){void 0!==t&&void 0!==t.style&&(t.onselectstart=e?function(){return!1}:function(){},t.style.MozUserSelect=e?"auto":"none",t.style.KhtmlUserSelect=e?"auto":"none",t.unselectable=e?"on":"off")},makeFullscreen:function(t,e,i){var n=i,r=e;OT.isUndefined(r)&&(r=!0),OT.isUndefined(n)&&(n=!0),t.style.position="absolute",r&&(t.style.left=0,t.style.right=0),n&&(t.style.top=0,t.style.bottom=0)},fakeEvent:function(t,e,i,n){var r=i||{},s=KT[e];if(!s)throw new Error("Event type "+e+" not supported.");var o=document.createEvent(s);switch(s){case"MouseEvents":var a=r.x||r.clientX||0,l=r.y||r.clientY||0;o.initMouseEvent(e,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=o.initKeyboardEvent||o.initKeyEvent;OT.defaults(r,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),h(e,r.bubbles||!1,r.cancelable,window,r.ctrlKey,r.altKey,r.shiftKey,r.metaKey,r.keyCode,r.charCode);break;default:o.initEvent(e,r.bubbles||!1,r.cancelable||!0)}OT.defaults(o,n),t.dispatchEvent(o)},bind:function(t,e,i,n){var r=n||!1;return t.addEventListener?t.addEventListener(e,i,r):t.attachEvent&&t.attachEvent("on"+e,i),tE},unbind:function(t,e,i,n){var r=n||!1;return t.removeEventListener?t.removeEventListener(e,i,r):t.detachEvent&&t.detachEvent("on"+e,i),tE},addClass:function(t,e){if(void 0===t.className)t.className=e;else if(t.className!==e){var i=t.className.split(/ +/);-1===i.indexOf(e)&&(i.push(e),t.className=i.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return tE},removeClass:function(t,e){if(e)if(t.className===e)t.removeAttribute("class");else{var i=t.className.split(/ +/),n=i.indexOf(e);-1!==n&&(i.splice(n,1),t.className=i.join(" "))}else t.className=void 0;return tE},hasClass:function(t,e){return new RegExp("(?:^|\\s+)"+e+"(?:\\s+|$)").test(t.className)||!1},getWidth:function(t){var e=getComputedStyle(t);return QT(e["border-left-width"])+QT(e["border-right-width"])+QT(e["padding-left"])+QT(e["padding-right"])+QT(e.width)},getHeight:function(t){var e=getComputedStyle(t);return QT(e["border-top-width"])+QT(e["border-bottom-width"])+QT(e["padding-top"])+QT(e["padding-bottom"])+QT(e.height)},getOffset:function(t){var e=t,i={left:0,top:0};if(e.offsetParent)do{i.left+=e.offsetLeft,i.top+=e.offsetTop,e=e.offsetParent}while(e);return i},isActive:function(t){return t===document.activeElement&&(t.type||t.href)}},eE=function(t){function e(t,i){jT(this,e);var n=XT(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),r=n;return n.__prev=n.getValue(),n.__checkbox=document.createElement("input"),n.__checkbox.setAttribute("type","checkbox"),tE.bind(n.__checkbox,"change",(function(){r.setValue(!r.__prev)}),!1),n.domElement.appendChild(n.__checkbox),n.updateDisplay(),n}return WT(e,t),zT(e,[{key:"setValue",value:function(t){var i=VT(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),i}},{key:"updateDisplay",value:function(){return!0===this.getValue()?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0,this.__prev=!0):(this.__checkbox.checked=!1,this.__prev=!1),VT(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(JT),iE=function(t){function e(t,i,n){jT(this,e);var r=XT(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),s=n,o=r;if(r.__select=document.createElement("select"),OT.isArray(s)){var a={};OT.each(s,(function(t){a[t]=t})),s=a}return OT.each(s,(function(t,e){var i=document.createElement("option");i.innerHTML=e,i.setAttribute("value",t),o.__select.appendChild(i)})),r.updateDisplay(),tE.bind(r.__select,"change",(function(){var t=this.options[this.selectedIndex].value;o.setValue(t)})),r.domElement.appendChild(r.__select),r}return WT(e,t),zT(e,[{key:"setValue",value:function(t){var i=VT(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),i}},{key:"updateDisplay",value:function(){return tE.isActive(this.__select)?this:(this.__select.value=this.getValue(),VT(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this))}}]),e}(JT),nE=function(t){function e(t,i){jT(this,e);var n=XT(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),r=n;function s(){r.setValue(r.__input.value)}return n.__input=document.createElement("input"),n.__input.setAttribute("type","text"),tE.bind(n.__input,"keyup",s),tE.bind(n.__input,"change",s),tE.bind(n.__input,"blur",(function(){r.__onFinishChange&&r.__onFinishChange.call(r,r.getValue())})),tE.bind(n.__input,"keydown",(function(t){13===t.keyCode&&this.blur()})),n.updateDisplay(),n.domElement.appendChild(n.__input),n}return WT(e,t),zT(e,[{key:"updateDisplay",value:function(){return tE.isActive(this.__input)||(this.__input.value=this.getValue()),VT(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(JT);function rE(t){var e=t.toString();return e.indexOf(".")>-1?e.length-e.indexOf(".")-1:0}var sE=function(t){function e(t,i,n){jT(this,e);var r=XT(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),s=n||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,OT.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=rE(r.__impliedStep),r}return WT(e,t),zT(e,[{key:"setValue",value:function(t){var i=t;return void 0!==this.__min&&i<this.__min?i=this.__min:void 0!==this.__max&&i>this.__max&&(i=this.__max),void 0!==this.__step&&i%this.__step!=0&&(i=Math.round(i/this.__step)*this.__step),VT(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,i)}},{key:"min",value:function(t){return this.__min=t,this}},{key:"max",value:function(t){return this.__max=t,this}},{key:"step",value:function(t){return this.__step=t,this.__impliedStep=t,this.__precision=rE(t),this}}]),e}(JT);var oE=function(t){function e(t,i,n){jT(this,e);var r=XT(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i,n));r.__truncationSuspended=!1;var s=r,o=void 0;function a(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function l(t){var e=o-t.clientY;s.setValue(s.getValue()+e*s.__impliedStep),o=t.clientY}function h(){tE.unbind(window,"mousemove",l),tE.unbind(window,"mouseup",h),a()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),tE.bind(r.__input,"change",(function(){var t=parseFloat(s.__input.value);OT.isNaN(t)||s.setValue(t)})),tE.bind(r.__input,"blur",(function(){a()})),tE.bind(r.__input,"mousedown",(function(t){tE.bind(window,"mousemove",l),tE.bind(window,"mouseup",h),o=t.clientY})),tE.bind(r.__input,"keydown",(function(t){13===t.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,a())})),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return WT(e,t),zT(e,[{key:"updateDisplay",value:function(){var t,i,n;return this.__input.value=this.__truncationSuspended?this.getValue():(t=this.getValue(),i=this.__precision,n=Math.pow(10,i),Math.round(t*n)/n),VT(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(sE);function aE(t,e,i,n,r){return n+(t-e)/(i-e)*(r-n)}var lE=function(t){function e(t,i,n,r,s){jT(this,e);var o=XT(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i,{min:n,max:r,step:s})),a=o;function l(t){t.preventDefault();var e=a.__background.getBoundingClientRect();return a.setValue(aE(t.clientX,e.left,e.right,a.__min,a.__max)),!1}function h(){tE.unbind(window,"mousemove",l),tE.unbind(window,"mouseup",h),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(t){var e=t.touches[0].clientX,i=a.__background.getBoundingClientRect();a.setValue(aE(e,i.left,i.right,a.__min,a.__max))}function u(){tE.unbind(window,"touchmove",c),tE.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return o.__background=document.createElement("div"),o.__foreground=document.createElement("div"),tE.bind(o.__background,"mousedown",(function(t){document.activeElement.blur(),tE.bind(window,"mousemove",l),tE.bind(window,"mouseup",h),l(t)})),tE.bind(o.__background,"touchstart",(function(t){if(1!==t.touches.length)return;tE.bind(window,"touchmove",c),tE.bind(window,"touchend",u),c(t)})),tE.addClass(o.__background,"slider"),tE.addClass(o.__foreground,"slider-fg"),o.updateDisplay(),o.__background.appendChild(o.__foreground),o.domElement.appendChild(o.__background),o}return WT(e,t),zT(e,[{key:"updateDisplay",value:function(){var t=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*t+"%",VT(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(sE),hE=function(t){function e(t,i,n){jT(this,e);var r=XT(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),s=r;return r.__button=document.createElement("div"),r.__button.innerHTML=void 0===n?"Fire":n,tE.bind(r.__button,"click",(function(t){return t.preventDefault(),s.fire(),!1})),tE.addClass(r.__button,"button"),r.domElement.appendChild(r.__button),r}return WT(e,t),zT(e,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),e}(JT),cE=function(t){function e(t,i){jT(this,e);var n=XT(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i));n.__color=new YT(n.getValue()),n.__temp=new YT(0);var r=n;n.domElement=document.createElement("div"),tE.makeSelectable(n.domElement,!1),n.__selector=document.createElement("div"),n.__selector.className="selector",n.__saturation_field=document.createElement("div"),n.__saturation_field.className="saturation-field",n.__field_knob=document.createElement("div"),n.__field_knob.className="field-knob",n.__field_knob_border="2px solid ",n.__hue_knob=document.createElement("div"),n.__hue_knob.className="hue-knob",n.__hue_field=document.createElement("div"),n.__hue_field.className="hue-field",n.__input=document.createElement("input"),n.__input.type="text",n.__input_textShadow="0 1px 1px ",tE.bind(n.__input,"keydown",(function(t){13===t.keyCode&&u.call(this)})),tE.bind(n.__input,"blur",u),tE.bind(n.__selector,"mousedown",(function(){tE.addClass(this,"drag").bind(window,"mouseup",(function(){tE.removeClass(r.__selector,"drag")}))})),tE.bind(n.__selector,"touchstart",(function(){tE.addClass(this,"drag").bind(window,"touchend",(function(){tE.removeClass(r.__selector,"drag")}))}));var s,o=document.createElement("div");function a(t){p(t),tE.bind(window,"mousemove",p),tE.bind(window,"touchmove",p),tE.bind(window,"mouseup",h),tE.bind(window,"touchend",h)}function l(t){f(t),tE.bind(window,"mousemove",f),tE.bind(window,"touchmove",f),tE.bind(window,"mouseup",c),tE.bind(window,"touchend",c)}function h(){tE.unbind(window,"mousemove",p),tE.unbind(window,"touchmove",p),tE.unbind(window,"mouseup",h),tE.unbind(window,"touchend",h),d()}function c(){tE.unbind(window,"mousemove",f),tE.unbind(window,"touchmove",f),tE.unbind(window,"mouseup",c),tE.unbind(window,"touchend",c),d()}function u(){var t=kT(this.value);!1!==t?(r.__color.__state=t,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function d(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function p(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=r.__saturation_field.getBoundingClientRect(),i=t.touches&&t.touches[0]||t,n=i.clientX,s=i.clientY,o=(n-e.left)/(e.right-e.left),a=1-(s-e.top)/(e.bottom-e.top);return a>1?a=1:a<0&&(a=0),o>1?o=1:o<0&&(o=0),r.__color.v=a,r.__color.s=o,r.setValue(r.__color.toOriginal()),!1}function f(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=r.__hue_field.getBoundingClientRect(),i=1-((t.touches&&t.touches[0]||t).clientY-e.top)/(e.bottom-e.top);return i>1?i=1:i<0&&(i=0),r.__color.h=360*i,r.setValue(r.__color.toOriginal()),!1}return OT.extend(n.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),OT.extend(n.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:n.__field_knob_border+(n.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),OT.extend(n.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),OT.extend(n.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),OT.extend(o.style,{width:"100%",height:"100%",background:"none"}),dE(o,"top","rgba(0,0,0,0)","#000"),OT.extend(n.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(s=n.__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%);",OT.extend(n.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:n.__input_textShadow+"rgba(0,0,0,0.7)"}),tE.bind(n.__saturation_field,"mousedown",a),tE.bind(n.__saturation_field,"touchstart",a),tE.bind(n.__field_knob,"mousedown",a),tE.bind(n.__field_knob,"touchstart",a),tE.bind(n.__hue_field,"mousedown",l),tE.bind(n.__hue_field,"touchstart",l),n.__saturation_field.appendChild(o),n.__selector.appendChild(n.__field_knob),n.__selector.appendChild(n.__saturation_field),n.__selector.appendChild(n.__hue_field),n.__hue_field.appendChild(n.__hue_knob),n.domElement.appendChild(n.__input),n.domElement.appendChild(n.__selector),n.updateDisplay(),n}return WT(e,t),zT(e,[{key:"updateDisplay",value:function(){var t=kT(this.getValue());if(!1!==t){var e=!1;OT.each(YT.COMPONENTS,(function(i){if(!OT.isUndefined(t[i])&&!OT.isUndefined(this.__color.__state[i])&&t[i]!==this.__color.__state[i])return e=!0,{}}),this),e&&OT.extend(this.__color.__state,t)}OT.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var i=this.__color.v<.5||this.__color.s>.5?255:0,n=255-i;OT.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("+i+","+i+","+i+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,dE(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),OT.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+i+","+i+","+i+")",textShadow:this.__input_textShadow+"rgba("+n+","+n+","+n+",.7)"})}}]),e}(JT),uE=["-moz-","-o-","-webkit-","-ms-",""];function dE(t,e,i,n){t.style.background="",OT.each(uE,(function(r){t.style.cssText+="background: "+r+"linear-gradient("+e+", "+i+" 0%, "+n+" 100%); "}))}var pE=function(t,e){var i=e||document,n=document.createElement("style");n.type="text/css",n.innerHTML=t;var r=i.getElementsByTagName("head")[0];try{r.appendChild(n)}catch(t){}},fE='<div id="dg-save" class="dg dialogue">\n\n Here\'s the new load parameter for your <code>GUI</code>\'s constructor:\n\n <textarea id="dg-new-constructor"></textarea>\n\n <div id="dg-save-locally">\n\n <input id="dg-local-storage" type="checkbox"/> Automatically save\n values to <code>localStorage</code> on exit.\n\n <div id="dg-local-explain">The values saved to <code>localStorage</code> will\n override those passed to <code>dat.GUI</code>\'s constructor. This makes it\n easier to work incrementally, but <code>localStorage</code> is fragile,\n and your friends may not see the same values you do.\n\n </div>\n\n </div>\n\n</div>',mE=function(t,e){var i=t[e];return OT.isArray(arguments[2])||OT.isObject(arguments[2])?new iE(t,e,arguments[2]):OT.isNumber(i)?OT.isNumber(arguments[2])&&OT.isNumber(arguments[3])?OT.isNumber(arguments[4])?new lE(t,e,arguments[2],arguments[3],arguments[4]):new lE(t,e,arguments[2],arguments[3]):OT.isNumber(arguments[4])?new oE(t,e,{min:arguments[2],max:arguments[3],step:arguments[4]}):new oE(t,e,{min:arguments[2],max:arguments[3]}):OT.isString(i)?new nE(t,e):OT.isFunction(i)?new hE(t,e,""):OT.isBoolean(i)?new eE(t,e):null};var gE=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,1e3/60)},vE=function(){function t(){jT(this,t),this.backgroundElement=document.createElement("div"),OT.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"}),tE.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),OT.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 e=this;tE.bind(this.backgroundElement,"click",(function(){e.hide()}))}return zT(t,[{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(),OT.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 e(){t.domElement.style.display="none",t.backgroundElement.style.display="none",tE.unbind(t.domElement,"webkitTransitionEnd",e),tE.unbind(t.domElement,"transitionend",e),tE.unbind(t.domElement,"oTransitionEnd",e)};tE.bind(this.domElement,"webkitTransitionEnd",e),tE.bind(this.domElement,"transitionend",e),tE.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-tE.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-tE.getHeight(this.domElement)/2+"px"}}]),t}();pE(function(t){if(t&&"undefined"!=typeof window){var e=document.createElement("style");return e.setAttribute("type","text/css"),e.innerHTML=t,document.head.appendChild(e),t}}(".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}\n"));var _E=function(){try{return!!window.localStorage}catch(t){return!1}}(),yE=void 0,xE=!0,bE=void 0,TE=!1,EE=[],wE=function t(e){var i=this,n=e||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),tE.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],n=OT.defaults(n,{closeOnTop:!1,autoPlace:!0,width:t.DEFAULT_WIDTH}),n=OT.defaults(n,{resizable:n.autoPlace,hideable:n.autoPlace}),OT.isUndefined(n.load)?n.load={preset:"Default"}:n.preset&&(n.load.preset=n.preset),OT.isUndefined(n.parent)&&n.hideable&&EE.push(this),n.resizable=OT.isUndefined(n.parent)&&n.resizable,n.autoPlace&&OT.isUndefined(n.scrollable)&&(n.scrollable=!0);var r,s=_E&&"true"===localStorage.getItem(IE(this,"isLocal")),o=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 i.parent?i.getRoot().preset:n.load.preset},set:function(t){i.parent?i.getRoot().preset=t:n.load.preset=t,function(t){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].value===t.preset&&(t.__preset_select.selectedIndex=e)}(this),i.revert()}},width:{get:function(){return n.width},set:function(t){n.width=t,DE(i,t)}},name:{get:function(){return n.name},set:function(t){n.name=t,a&&(a.innerHTML=n.name)}},closed:{get:function(){return n.closed},set:function(e){n.closed=e,n.closed?tE.addClass(i.__ul,t.CLASS_CLOSED):tE.removeClass(i.__ul,t.CLASS_CLOSED),this.onResize(),i.__closeButton&&(i.__closeButton.innerHTML=e?t.TEXT_OPEN:t.TEXT_CLOSED)}},load:{get:function(){return n.load}},useLocalStorage:{get:function(){return s},set:function(t){_E&&(s=t,t?tE.bind(window,"unload",o):tE.unbind(window,"unload",o),localStorage.setItem(IE(i,"isLocal"),t))}}}),OT.isUndefined(n.parent)){if(this.closed=n.closed||!1,tE.addClass(this.domElement,t.CLASS_MAIN),tE.makeSelectable(this.domElement,!1),_E&&s){i.useLocalStorage=!0;var l=localStorage.getItem(IE(this,"gui"));l&&(n.load=JSON.parse(l))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=t.TEXT_CLOSED,tE.addClass(this.__closeButton,t.CLASS_CLOSE_BUTTON),n.closeOnTop?(tE.addClass(this.__closeButton,t.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(tE.addClass(this.__closeButton,t.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),tE.bind(this.__closeButton,"click",(function(){i.closed=!i.closed}))}else{void 0===n.closed&&(n.closed=!0);var h=document.createTextNode(n.name);tE.addClass(h,"controller-name"),a=SE(i,h);tE.addClass(this.__ul,t.CLASS_CLOSED),tE.addClass(a,"title"),tE.bind(a,"click",(function(t){return t.preventDefault(),i.closed=!i.closed,!1})),n.closed||(this.closed=!1)}n.autoPlace&&(OT.isUndefined(n.parent)&&(xE&&(bE=document.createElement("div"),tE.addClass(bE,"dg"),tE.addClass(bE,t.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(bE),xE=!1),bE.appendChild(this.domElement),tE.addClass(this.domElement,t.CLASS_AUTO_PLACE)),this.parent||DE(i,n.width)),this.__resizeHandler=function(){i.onResizeDebounced()},tE.bind(window,"resize",this.__resizeHandler),tE.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),tE.bind(this.__ul,"transitionend",this.__resizeHandler),tE.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),n.resizable&&OE(this),o=function(){_E&&"true"===localStorage.getItem(IE(i,"isLocal"))&&localStorage.setItem(IE(i,"gui"),JSON.stringify(i.getSaveObject()))},this.saveToLocalStorageIfPossible=o,n.parent||((r=i.getRoot()).width+=1,OT.defer((function(){r.width-=1})))};function SE(t,e,i){var n=document.createElement("li");return e&&n.appendChild(e),i?t.__ul.insertBefore(n,i):t.__ul.appendChild(n),t.onResize(),n}function ME(t){tE.unbind(window,"resize",t.__resizeHandler),t.saveToLocalStorageIfPossible&&tE.unbind(window,"unload",t.saveToLocalStorageIfPossible)}function AE(t,e){var i=t.__preset_select[t.__preset_select.selectedIndex];i.innerHTML=e?i.value+"*":i.value}function PE(t,e){var i=t.getRoot(),n=i.__rememberedObjects.indexOf(e.object);if(-1!==n){var r=i.__rememberedObjectIndecesToControllers[n];if(void 0===r&&(r={},i.__rememberedObjectIndecesToControllers[n]=r),r[e.property]=e,i.load&&i.load.remembered){var s=i.load.remembered,o=void 0;if(s[t.preset])o=s[t.preset];else{if(!s.Default)return;o=s.Default}if(o[n]&&void 0!==o[n][e.property]){var a=o[n][e.property];e.initialValue=a,e.setValue(a)}}}}function RE(t,e,i,n){if(void 0===e[i])throw new Error('Object "'+e+'" has no property "'+i+'"');var r=void 0;if(n.color)r=new cE(e,i);else{var s=[e,i].concat(n.factoryArgs);r=mE.apply(t,s)}n.before instanceof JT&&(n.before=n.before.__li),PE(t,r),tE.addClass(r.domElement,"c");var o=document.createElement("span");tE.addClass(o,"property-name"),o.innerHTML=r.property;var a=document.createElement("div");a.appendChild(o),a.appendChild(r.domElement);var l=SE(t,a,n.before);return tE.addClass(l,wE.CLASS_CONTROLLER_ROW),r instanceof cE?tE.addClass(l,"color"):tE.addClass(l,HT(r.getValue())),function(t,e,i){if(i.__li=e,i.__gui=t,OT.extend(i,{options:function(e){if(arguments.length>1){var n=i.__li.nextElementSibling;return i.remove(),RE(t,i.object,i.property,{before:n,factoryArgs:[OT.toArray(arguments)]})}if(OT.isArray(e)||OT.isObject(e)){var r=i.__li.nextElementSibling;return i.remove(),RE(t,i.object,i.property,{before:r,factoryArgs:[e]})}},name:function(t){return i.__li.firstElementChild.firstElementChild.innerHTML=t,i},listen:function(){return i.__gui.listen(i),i},remove:function(){return i.__gui.remove(i),i}}),i instanceof lE){var n=new oE(i.object,i.property,{min:i.__min,max:i.__max,step:i.__step});OT.each(["updateDisplay","onChange","onFinishChange","step","min","max"],(function(t){var e=i[t],r=n[t];i[t]=n[t]=function(){var t=Array.prototype.slice.call(arguments);return r.apply(n,t),e.apply(i,t)}})),tE.addClass(e,"has-slider"),i.domElement.insertBefore(n.domElement,i.domElement.firstElementChild)}else if(i instanceof oE){var r=function(e){if(OT.isNumber(i.__min)&&OT.isNumber(i.__max)){var n=i.__li.firstElementChild.firstElementChild.innerHTML,r=i.__gui.__listening.indexOf(i)>-1;i.remove();var s=RE(t,i.object,i.property,{before:i.__li.nextElementSibling,factoryArgs:[i.__min,i.__max,i.__step]});return s.name(n),r&&s.listen(),s}return e};i.min=OT.compose(r,i.min),i.max=OT.compose(r,i.max)}else i instanceof eE?(tE.bind(e,"click",(function(){tE.fakeEvent(i.__checkbox,"click")})),tE.bind(i.__checkbox,"click",(function(t){t.stopPropagation()}))):i instanceof hE?(tE.bind(e,"click",(function(){tE.fakeEvent(i.__button,"click")})),tE.bind(e,"mouseover",(function(){tE.addClass(i.__button,"hover")})),tE.bind(e,"mouseout",(function(){tE.removeClass(i.__button,"hover")}))):i instanceof cE&&(tE.addClass(e,"color"),i.updateDisplay=OT.compose((function(t){return e.style.borderLeftColor=i.__color.toString(),t}),i.updateDisplay),i.updateDisplay());i.setValue=OT.compose((function(e){return t.getRoot().__preset_select&&i.isModified()&&AE(t.getRoot(),!0),e}),i.setValue)}(t,l,r),t.__controllers.push(r),r}function IE(t,e){return document.location.href+"."+e}function CE(t,e,i){var n=document.createElement("option");n.innerHTML=e,n.value=e,t.__preset_select.appendChild(n),i&&(t.__preset_select.selectedIndex=t.__preset_select.length-1)}function LE(t,e){e.style.display=t.useLocalStorage?"block":"none"}function NE(t){var e=t.__save_row=document.createElement("li");tE.addClass(t.domElement,"has-save"),t.__ul.insertBefore(e,t.__ul.firstChild),tE.addClass(e,"save-row");var i=document.createElement("span");i.innerHTML=" ",tE.addClass(i,"button gears");var n=document.createElement("span");n.innerHTML="Save",tE.addClass(n,"button"),tE.addClass(n,"save");var r=document.createElement("span");r.innerHTML="New",tE.addClass(r,"button"),tE.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",tE.addClass(s,"button"),tE.addClass(s,"revert");var o=t.__preset_select=document.createElement("select");if(t.load&&t.load.remembered?OT.each(t.load.remembered,(function(e,i){CE(t,i,i===t.preset)})):CE(t,"Default",!1),tE.bind(o,"change",(function(){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].innerHTML=t.__preset_select[e].value;t.preset=this.value})),e.appendChild(o),e.appendChild(i),e.appendChild(n),e.appendChild(r),e.appendChild(s),_E){var a=document.getElementById("dg-local-explain"),l=document.getElementById("dg-local-storage");document.getElementById("dg-save-locally").style.display="block","true"===localStorage.getItem(IE(0,"isLocal"))&&l.setAttribute("checked","checked"),LE(t,a),tE.bind(l,"change",(function(){t.useLocalStorage=!t.useLocalStorage,LE(t,a)}))}var h=document.getElementById("dg-new-constructor");tE.bind(h,"keydown",(function(t){!t.metaKey||67!==t.which&&67!==t.keyCode||yE.hide()})),tE.bind(i,"click",(function(){h.innerHTML=JSON.stringify(t.getSaveObject(),void 0,2),yE.show(),h.focus(),h.select()})),tE.bind(n,"click",(function(){t.save()})),tE.bind(r,"click",(function(){var e=prompt("Enter a new preset name.");e&&t.saveAs(e)})),tE.bind(s,"click",(function(){t.revert()}))}function OE(t){var e=void 0;function i(i){return i.preventDefault(),t.width+=e-i.clientX,t.onResize(),e=i.clientX,!1}function n(){tE.removeClass(t.__closeButton,wE.CLASS_DRAG),tE.unbind(window,"mousemove",i),tE.unbind(window,"mouseup",n)}function r(r){return r.preventDefault(),e=r.clientX,tE.addClass(t.__closeButton,wE.CLASS_DRAG),tE.bind(window,"mousemove",i),tE.bind(window,"mouseup",n),!1}t.__resize_handle=document.createElement("div"),OT.extend(t.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),tE.bind(t.__resize_handle,"mousedown",r),tE.bind(t.__closeButton,"mousedown",r),t.domElement.insertBefore(t.__resize_handle,t.domElement.firstElementChild)}function DE(t,e){t.domElement.style.width=e+"px",t.__save_row&&t.autoPlace&&(t.__save_row.style.width=e+"px"),t.__closeButton&&(t.__closeButton.style.width=e+"px")}function FE(t,e){var i={};return OT.each(t.__rememberedObjects,(function(n,r){var s={},o=t.__rememberedObjectIndecesToControllers[r];OT.each(o,(function(t,i){s[i]=e?t.initialValue:t.getValue()})),i[r]=s})),i}wE.toggleHide=function(){TE=!TE,OT.each(EE,(function(t){t.domElement.style.display=TE?"none":""}))},wE.CLASS_AUTO_PLACE="a",wE.CLASS_AUTO_PLACE_CONTAINER="ac",wE.CLASS_MAIN="main",wE.CLASS_CONTROLLER_ROW="cr",wE.CLASS_TOO_TALL="taller-than-window",wE.CLASS_CLOSED="closed",wE.CLASS_CLOSE_BUTTON="close-button",wE.CLASS_CLOSE_TOP="close-top",wE.CLASS_CLOSE_BOTTOM="close-bottom",wE.CLASS_DRAG="drag",wE.DEFAULT_WIDTH=245,wE.TEXT_CLOSED="Close Controls",wE.TEXT_OPEN="Open Controls",wE._keydownHandler=function(t){"text"===document.activeElement.type||72!==t.which&&72!==t.keyCode||wE.toggleHide()},tE.bind(window,"keydown",wE._keydownHandler,!1),OT.extend(wE.prototype,{add:function(t,e){return RE(this,t,e,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(t,e){return RE(this,t,e,{color:!0})},remove:function(t){this.__ul.removeChild(t.__li),this.__controllers.splice(this.__controllers.indexOf(t),1);var e=this;OT.defer((function(){e.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&&bE.removeChild(this.domElement);var t=this;OT.each(this.__folders,(function(e){t.removeFolder(e)})),tE.unbind(window,"keydown",wE._keydownHandler,!1),ME(this)},addFolder:function(t){if(void 0!==this.__folders[t])throw new Error('You already have a folder in this GUI by the name "'+t+'"');var e={name:t,parent:this};e.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[t]&&(e.closed=this.load.folders[t].closed,e.load=this.load.folders[t]);var i=new wE(e);this.__folders[t]=i;var n=SE(this,i.domElement);return tE.addClass(n,"folder"),i},removeFolder:function(t){this.__ul.removeChild(t.domElement.parentElement),delete this.__folders[t.name],this.load&&this.load.folders&&this.load.folders[t.name]&&delete this.load.folders[t.name],ME(t);var e=this;OT.each(t.__folders,(function(e){t.removeFolder(e)})),OT.defer((function(){e.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 t=this.getRoot();if(t.scrollable){var e=tE.getOffset(t.__ul).top,i=0;OT.each(t.__ul.childNodes,(function(e){t.autoPlace&&e===t.__save_row||(i+=tE.getHeight(e))})),window.innerHeight-e-20<i?(tE.addClass(t.domElement,wE.CLASS_TOO_TALL),t.__ul.style.height=window.innerHeight-e-20+"px"):(tE.removeClass(t.domElement,wE.CLASS_TOO_TALL),t.__ul.style.height="auto")}t.__resize_handle&&OT.defer((function(){t.__resize_handle.style.height=t.__ul.offsetHeight+"px"})),t.__closeButton&&(t.__closeButton.style.width=t.width+"px")},onResizeDebounced:OT.debounce((function(){this.onResize()}),50),remember:function(){if(OT.isUndefined(yE)&&((yE=new vE).domElement.innerHTML=fE),this.parent)throw new Error("You can only call remember on a top level GUI.");var t=this;OT.each(Array.prototype.slice.call(arguments),(function(e){0===t.__rememberedObjects.length&&NE(t),-1===t.__rememberedObjects.indexOf(e)&&t.__rememberedObjects.push(e)})),this.autoPlace&&DE(this,this.width)},getRoot:function(){for(var t=this;t.parent;)t=t.parent;return t},getSaveObject:function(){var t=this.load;return t.closed=this.closed,this.__rememberedObjects.length>0&&(t.preset=this.preset,t.remembered||(t.remembered={}),t.remembered[this.preset]=FE(this)),t.folders={},OT.each(this.__folders,(function(e,i){t.folders[i]=e.getSaveObject()})),t},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=FE(this),AE(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(t){this.load.remembered||(this.load.remembered={},this.load.remembered.Default=FE(this,!0)),this.load.remembered[t]=FE(this),this.preset=t,CE(this,t,!0),this.saveToLocalStorageIfPossible()},revert:function(t){OT.each(this.__controllers,(function(e){this.getRoot().load.remembered?PE(t||this.getRoot(),e):e.setValue(e.initialValue),e.__onFinishChange&&e.__onFinishChange.call(e,e.getValue())}),this),OT.each(this.__folders,(function(t){t.revert(t)})),t||AE(this.getRoot(),!1)},listen:function(t){var e=0===this.__listening.length;this.__listening.push(t),e&&function t(e){0!==e.length&&gE.call(window,(function(){t(e)}));OT.each(e,(function(t){t.updateDisplay()}))}(this.__listening)},updateDisplay:function(){OT.each(this.__controllers,(function(t){t.updateDisplay()})),OT.each(this.__folders,(function(t){t.updateDisplay()}))}});var UE=wE,kE=function(){function t(t){this.player=t}return Object.defineProperty(t.prototype,"frameRate",{get:function(){return this.player.fps.value},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"drawFrames",{get:function(){return this.player.runtime.fps},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"drawCall",{get:function(){return this.player.runtime.drawCall},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolution",{get:function(){return this.player.config.resolution},set:function(t){this.player.updateConfig({resolution:t})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var t,e;return(null===(t=this.player.view)||void 0===t?void 0:t.width)+"*"+(null===(e=this.player.view)||void 0===e?void 0:e.height)},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minFPS",{get:function(){return this.player.config.minFPS},set:function(t){this.player.updateConfig({minFPS:t})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxFPS",{get:function(){return this.player.config.maxFPS},set:function(t){this.player.updateConfig({maxFPS:t})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"autoResolution",{get:function(){return this.player.config.autoResolution},set:function(t){this.player.updateConfig({autoResolution:t})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"autoFPS",{get:function(){return this.player.config.autoFPS},set:function(t){this.player.updateConfig({autoFPS:t})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"backgroundColor",{get:function(){return this.player.config.transactionBgColor},set:function(t){this.player.updateConfig({transactionBgColor:t})},enumerable:!1,configurable:!0}),t}(),BE=function(){function t(t,e){var i;this.config=new kE(t),this.anchor=e,i=this.createControllerGUI(),this.gui=i[0],this.controller=i[1],this.createStats()}return t.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)},t.prototype.createControllerGUI=function(){var t=new UE({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"),transactionBgColor:t.addColor(this.config,"backgroundColor")};return[t,e]},t.prototype.destroy=function(){try{window.clearInterval(this.stateId),this.anchor.removeChild(this.gui.domElement),this.gui.destroy()}catch(t){}},t}(),GE=function(){function t(t){var e=this;this.tasks=[],this.isDestroy=!1,this.isScheduling=!1,this.schedule=function(){e.isScheduling=!0;var t=e.tasks.shift();t&&!e.isDestroy&&e.fn(t).then((function(){e.tasks.length>0?window.requestAnimationFrame(e.schedule):e.isScheduling=!1}))},this.fn=t}return t.prototype.destroy=function(){this.isDestroy=!0},t.prototype.addTask=function(t){this.tasks.push(t),this.isScheduling||this.schedule()},t}(),HE=function(){function t(t){this.autoUnlock=Object.create(null),this.locks=Object.create(null),this.available=!1,this.available=t}return t.prototype.addLock=function(t,e){var i=this;this.available&&(this.locks[t]=e,this.autoUnlock[t]=window.setTimeout((function(){delete i.locks[t]}),3e3))},t.prototype.unlock=function(t,e){this.available&&e&&this.locks[t]&&this.locks[t]===e&&(window.clearTimeout(this.autoUnlock[t]),delete this.locks[t])},t.prototype.isLocked=function(t){return!!this.available&&!!this.locks[t]},t}(),jE=function(){function t(){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?window.requestAnimationFrame(t.schedule):t.isScheduling=!1})).catch((function(){t.tasks.length>0?window.requestAnimationFrame(t.schedule):t.isScheduling=!1})))}}return t.prototype.getRunningTask=function(){return this.tasks[0]&&"running"===this.tasks[0].status?this.tasks[0]:null},t.prototype.addTask=function(t,e){var i={type:t,status:"wait",fn:e},n=this.getRunningTask();n&&t===n.type||(this.tasks=this.tasks.filter((function(e){return e.type!==t})),this.tasks.push(i),this.isScheduling||this.schedule())},t.prototype.destroy=function(){this.isDestroy=!0},t}(),zE=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))},VE=function(t,e){var i,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}};function WE(t,e,i){return zE(this,void 0,void 0,(function(){var n,r,s,o;return VE(this,(function(a){switch(a.label){case 0:return n=document.createElement("div"),(r=new rw({anchor:n,renderOptions:{minFPS:1,maxFPS:1,resolution:1},mode:"local",interactive:!1})).setResource(t,e),[4,r.getSlideCountAsync()];case 1:if(s=a.sent(),i)return[3,6];o=1,a.label=2;case 2:return o<=s?[4,r.player.stagePool.preload(o,!0)]:[3,5];case 3:a.sent(),a.label=4;case 4:return o++,[3,2];case 5:return[3,6];case 6:return r.destroy(),[2]}}))}))}var XE=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),YE=function(){return(YE=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},qE=function(t,e,i,n){var r,s=arguments.length,o=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,i,o):r(e,i))||o);return s>3&&o&&Object.defineProperty(e,i,o),o},ZE=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))},JE=function(t,e){var i,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},KE=window.ResizeObserver||MT,$E=function(t){return new Promise((function(e){return setTimeout(e,t)}))};function QE(t,e){return ZE(this,void 0,void 0,(function(){var i;return JE(this,(function(n){switch(n.label){case 0:i=Date.now(),n.label=1;case 1:return!t()&&Date.now()-i<e?[4,$E(50)]:[3,3];case 2:return n.sent(),i=Date.now(),[3,1];case 3:return[2]}}))}))}var tw={syncDispatch:"syncDispatch",syncReceive:"syncReceive",syncEventLag:"syncEventLag",renderStart:"renderStart",renderEnd:"renderEnd",renderError:"renderError",slideChange:"slideChange",mainSeqStepStart:"mainSeqStepStart",mainSeqStepEnd:"mainSeqStepEnd",animateStart:"animateStart",animateEnd:"animateEnd",stateChange:"stateChange"},ew={taskId:"",url:"",currentSlideIndex:-1,mainSeqStep:-1,mainSeqState:null,mediaState:Object.create(null),interactiveSeqState:Object.create(null)},iw="";try{iw="0.7.0"}catch(t){iw="dev"}var nw=null;try{nw=a.createInstance({name:"__slide_local_log__",driver:a.INDEXEDDB,version:1})}catch(t){}var rw=function(t){function e(i){var n=t.call(this)||this;return n.iosResetCache=[],n.needClearCacheImage=!1,n.version=iw,n.__slideState=Hb()(ew),n.userInputTime=0,n.isSyncingSlideState=!1,n.frozenTaskManager=new jE,n.randomId=o(),n.resize=!1,n.isAnimating=!1,n.renderingTaskManager=new IT,n.isLoading=!1,n.interactive=!0,n.renderingIndex=0,n.frameWidth=1,n.frameHeight=1,n.frame=document.createElement("div"),n.canvasContainer=document.createElement("div"),n.medianController=document.createElement("div"),n.frameResizeObserver=new KE((function(){return n.frameResizeHandler()})),n.timestamp=function(){return Date.now()},n.mode="local",n.enableGlobalClick=!1,n.lastEmitedState=null,n.playerController=null,n.isInitResized=!1,n.cacheImage=document.createElement("img"),n.isTouchStart=!1,n.touchStartId=void 0,n.taskId="",n.volumeAdjuster=new Ib,n.designWidth=0,n.designHeight=0,n._slideCount=0,n._dispatchIncrId=0,n._receiveIncrId=0,n.recoverHandler=function(t){if("@slide/_recover_"===t.data.type&&t.data.slideId===n.randomId){var e=t.data,i=e.recoverBy,r=e.payload;if(!r)return;"renderOtherPage"===i&&r.slideIndex?n.renderSlide(r.slideIndex):"reloadCurrentPage"===i&&n.renderSlide(n.renderingIndex)}},n.userInputHandle=function(){n.userInputTime=Date.now()},n.handleViewClick=function(){setTimeout((function(){var t=Date.now();Math.abs(t-n.userInputTime)>500&&n.enableGlobalClick&&n.nextStep()}))},n.handleViewTouchStart=function(){window.clearTimeout(n.touchStartId),n.isTouchStart=!0,n.touchStartId=setTimeout((function(){n.isTouchStart=!1}),350)},n.handleViewTouchEnd=function(){n.isTouchStart&&(n.isTouchStart=!1,n.handleViewClick())},n.handleSlideRef=function(){console.log(n),window.__slide=n},n.receiveSyncHandler=function(t){return ZE(n,void 0,void 0,(function(){var e,i,n,r,s=this;return JE(this,(function(o){switch(o.label){case 0:return z_()(t.incrId)&&(t.incrId&&t.incrId-this._receiveIncrId!=1&&this.emit(tw.syncEventLag),this._receiveIncrId=t.incrId||0),this.logger.info("sync receive "+JSON.stringify(t),this.taskId),"nextStep"!==t.type?[3,1]:(this.mainSeqStep!==t.next-1&&this.mainSeqStep+1!==this.mainSeqLength&&this.player?(this.setMainSeqStep(t.next,"start"),this.player.nextTick((function(){s.doNextStep(!0)}))):this.doNextStep(!0),[3,6]);case 1:return"prevStep"!==t.type?[3,2]:(0===this.mainSeqStep&&"idle"===this.mainSeqState||this.mainSeqStep===t.next+1||this.mainSeqStep+1===this.mainSeqLength?this.doPrevStep(!0):(this.setMainSeqStep(t.next+1,"start"),null===(e=this.player)||void 0===e||e.nextTick((function(){s.doPrevStep(!0)}))),[3,6]);case 2:return"interactiveAnim"!==t.type?[3,3]:(this.player?this.player.applyInteractiveAction(t.action):this.__slideState.interactiveSeqState[t.seqId]?this.__slideState.interactiveSeqState[t.seqId].step+=1:this.__slideState.interactiveSeqState[t.seqId]={step:0,state:"end"},[3,6]);case 3:return"renderSlide"!==t.type?[3,5]:[4,this.doRenderSlide(t.index,t.isForward)];case 4:return o.sent(),[3,6];case 5:"mediaPlay"===t.type?(null===(i=this.player)||void 0===i||i.setMediaState(t.id,!0),this.__slideState.mediaState[t.id]=t.state):"mediaPause"===t.type?(null===(n=this.player)||void 0===n||n.setMediaState(t.id,!1),this.__slideState.mediaState[t.id]=t.state):"mediaSeek"===t.type&&(null===(r=this.player)||void 0===r||r.setMediaCurrentTime(t.id,t.time),this.__slideState.mediaState[t.id]=t.state),o.label=6;case 6:return[2]}}))}))},n.handlePrevSlide=function(t){return void 0===t&&(t=!1),ZE(n,void 0,void 0,(function(){var e;return JE(this,(function(i){return this.player?((e=this.player.prevSlideIndex)>=1&&(this.config.navigatorDelegate?this.config.navigatorDelegate.gotoPage(e):t?this.doRenderSlide(e,!1):this.renderSlide(e,!1)),[2]):[2]}))}))},n.handleNextSlide=function(t){return void 0===t&&(t=!1),ZE(n,void 0,void 0,(function(){var e;return JE(this,(function(i){return this.player?((e=this.player.nextSlideIndex)<=this.slideCount&&(this.config.navigatorDelegate?this.config.navigatorDelegate.gotoPage(e):t?this.doRenderSlide(e,!0):this.renderSlide(e,!0)),[2]):[2]}))}))},n.handleGotoSlide=function(t){if(t<=n.slideCount&&t>=1){var e=n.slideState.currentSlideIndex<=t;n.renderSlide(t,e)}else-1===t&&n.renderSlide(n.slideCount,!0)},n.config=n.initSlideConfig(i),n.logger={info:function(t,i){var r;e._tempLog+="INFO - "+(new Date).toISOString()+" - {"+n.randomId+"}["+i+"] "+t+"\n";var s=null===(r=n.config.logger)||void 0===r?void 0:r.info;s&&s("["+i+"] "+t)},warn:function(t,i){var r;e._tempLog+="WARN - "+(new Date).toISOString()+" - {"+n.randomId+"}["+i+"] "+t+"\n";var s=null===(r=n.config.logger)||void 0===r?void 0:r.warn;s&&s("["+i+"] "+t)},error:function(t,i){var r;e._tempLog+="ERROR - "+(new Date).toISOString()+" - {"+n.randomId+"}["+i+"] "+t+"\n";var s=null===(r=n.config.logger)||void 0===r?void 0:r.error;s&&s("["+i+"] "+t)}},n.logger.info("new slide",n.taskId),n.anchor=n.config.anchor,n.syncQueue=new GE(n.receiveSyncHandler),n.lock=new HE("interactive"===n.mode),n.cacheImage.style.position="absolute",n.cacheImage.style.zIndex="100",n.setMedianControllerAttribute(),n.canvasContainer.style.position="relative",n.canvasContainer.appendChild(n.medianController),n.frame.appendChild(n.canvasContainer),n.frameResizeObserver.observe(n.frame),n.on(tw.syncReceive,(function(t){n.lock.unlock(t.type,t.uuid),n.syncQueue.addTask(t)})),n.renderingTaskManager.eventHub.on("task-error",(function(t){var e=t.error,i=t.task,r=T_.transform(e);r.errorType===b_.RuntimeWarn?n.logger.warn(r.message,n.taskId):n.logger.error(r.message,n.taskId),n.isLoading=!1,n.reportError(r,i.slideIndex)})),window.addEventListener("__slide_ref__",n.handleSlideRef),n.resizeView=ty()(n.resizeView.bind(n),50),n.player=n.initPlayer(n.config),n.config.controller&&n.createController(),n.player.view&&n.canvasContainer.appendChild(n.player.view),n.handleViewClick=ty()(n.handleViewClick,300),n.player.errorChannel.on("error",(function(t,e){var i=T_.transform(t);i.errorType===b_.RuntimeWarn?n.logger.warn(i.message,n.taskId):n.logger.error(i.message,n.taskId),n.isLoading=!1,e===n.renderingIndex&&n.reportError(t,e)})),window.addEventListener("message",n.recoverHandler),n}var i,n;return XE(e,t),e.flushLog=function(t){return void 0===t&&(t=!1),ZE(this,void 0,void 0,(function(){return JE(this,(function(i){switch(i.label){case 0:return e._tempLog.length>131072||t&&e._tempLog.length>0?[4,null==nw?void 0:nw.setItem("run_time_log_"+e._tempLogIndex,e._tempLog)]:[3,2];case 1:i.sent(),e._tempLog="",e._tempLogIndex+=1,i.label=2;case 2:return[2]}}))}))},Object.defineProperty(e.prototype,"dispatchIncrId",{get:function(){return this._dispatchIncrId++},enumerable:!1,configurable:!0}),e.prototype.reportError=function(t,e){this.emit(tw.renderError,{error:t,index:e}),window.postMessage({type:"@slide/_error_",errorType:t.errorType,errorMsg:t.errorMsg,slideId:this.randomId,slideIndex:e})},e.prototype.initSlideConfig=function(t){return t.timestamp&&(this.timestamp=t.timestamp),t.rtcAudio&&(Ob.RtcAudioClazz=t.rtcAudio),this.mode=t.mode,this.anchor=t.anchor,this.anchor.appendChild(this.frame),this.enableGlobalClick=!il()(t.enableGlobalClick)&&t.enableGlobalClick,this.resize=t.resize||!1,this.interactive=t.interactive,this.frame.style.cssText=t.fixedFrameSize?"width:"+t.fixedFrameSize.width+"px;height:"+t.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;",t.fixedFrameSize&&(this.frameWidth=t.fixedFrameSize.width,this.frameHeight=t.fixedFrameSize.height),t},e.prototype.initPlayer=function(t){var e,i,n,r=this,s=new Ob({mode:this.mode,useLocalCache:!!il()(this.config.useLocalCache)||this.config.useLocalCache,logger:this.logger,resourceTimeout:il()(this.config.resourceTimeout)?15e3:this.config.resourceTimeout,loadDelegate:this.config.loaderDelegate,volumeAdjuster:this.volumeAdjuster});return s.setInteractive(this.interactive),s.updateConfig(t.renderOptions||{}),s.on(Nb.renderStart,(function(t){r.isLoading=!0,r.emit(tw.renderStart,t)})),s.on(Nb.renderEnd,(function(t){r.isLoading=!1,r.player&&(r.designHeight=r.player.designHeight,r.designWidth=r.player.designWidth,r.cacheImage.style.width=r.player.designWidth+"px",r.cacheImage.style.height=r.player.designHeight+"px",r._slideCount=r.player.slideCount),r.emit(tw.renderEnd,t)})),s.on(Nb.slideChange,(function(t){r.__slideState.currentSlideIndex=t,r.emitStateChange(),r.emit(tw.slideChange,t)})),s.on(Nb.mainSeqStateChange,(function(t){r.__slideState.mainSeqState=t,r.emitStateChange()})),s.on(Nb.mainSeqStepChange,(function(t){r.__slideState.mainSeqStep=t,r.emitStateChange()})),s.on(Nb.interactiveSeqStateChange,(function(t){var e=t.id,i=t.state;r.__slideState.interactiveSeqState[e]=i,r.emitStateChange()})),s.on(Nb.animateStart,(function(){!0!==r.isAnimating&&(r.isAnimating=!0,r.emit(tw.animateStart))})),s.on(Nb.animateEnd,(function(){!1!==r.isAnimating&&(r.isAnimating=!1,r.emit(tw.animateEnd))})),s.on(Nb.interactiveSeqAction,(function(t){var e=t.action,i=t.seqId;r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"interactiveAnim",action:e,seqId:i}),r.emitStateChange()})),s.on(Nb.mainSeqStepStart,(function(t){r.emit(tw.mainSeqStepStart,t)})),s.on(Nb.mainSeqStepEnd,(function(t){r.emit(tw.mainSeqStepEnd,t)})),s.on(Nb.mediaPlay,(function(t){var e={type:"play",time:r.timestamp()-1e3*t.time};r.__slideState.mediaState[t.id]=e,r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaPlay",id:t.id,state:e}),r.emitStateChange()})),s.on(Nb.mediaPause,(function(t){var e={type:"pause",time:t.time};r.__slideState.mediaState[t.id]=e,r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaPause",id:t.id,state:e}),r.emitStateChange()})),s.on(Nb.mediaSeek,(function(t){var e={type:"pause",time:0};t.isPlaying?(e.type="play",r.__slideState.mediaState[t.id]?e.time=r.__slideState.mediaState[t.id].time-1e3*t.time:e.time=r.timestamp()-1e3*t.time,r.__slideState.mediaState[t.id]=e):(e.type="pause",e.time=t.time,r.__slideState.mediaState[t.id]=e),r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaSeek",id:t.id,time:t.time,state:e}),r.emitStateChange()})),s.on(Nb.requestPrevSlide,(function(t){r.handlePrevSlide(t)})),s.on(Nb.requestNextSlide,(function(t){r.handleNextSlide(t)})),s.on(Nb.requestGotoSlide,(function(t){r.config.navigatorDelegate?r.config.navigatorDelegate.gotoPage(t):r.handleGotoSlide(t)})),null===(e=s.view)||void 0===e||e.addEventListener("touchend",this.handleViewTouchEnd),null===(i=s.view)||void 0===i||i.addEventListener("touchstart",this.handleViewTouchStart),null===(n=s.view)||void 0===n||n.addEventListener("click",this.handleViewClick),s.on(Nb.userInput,this.userInputHandle),s},e.prototype.createController=function(){this.player&&(this.playerController=new BE(this.player,this.frame))},e.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"},e.prototype.frameResizeHandler=function(){if(!this.config.fixedFrameSize){var t=this.frame.getBoundingClientRect(),e=t.width,i=t.height;this.frameWidth=e,this.frameHeight=i,this.resizeView()}},e.prototype.updateFixedFrameSize=function(t,e,i){this.config.fixedFrameSize&&(this.frameWidth=t,this.frameHeight=e,this.frame.style.width=t+"px",this.frame.style.height=e+"px",this.resizeView(i))},e.prototype.resizeView=function(t){var e,i,n=this,r=this.width,s=this.height;if(r>0&&s>0){var o=this.frameWidth/r,a=o*s;a>this.frameHeight&&(o*=this.frameHeight/a),null===(e=this.player)||void 0===e||e.scaleView(o,this.resize,t),this.cacheImage.style.transform="scale("+o+")",this.medianController.style.transform="scale("+o+")",this.medianController.setAttribute("data-scale",o.toString()),this.isInitResized||(this.isInitResized=!0,null===(i=this.player)||void 0===i||i.clock.setTimeout((function(){n.frame.style.visibility="visible"}),32))}},e.prototype.setSlideState=function(t){var e,i,n;return ZE(this,void 0,void 0,(function(){var r,s=this;return JE(this,(function(o){switch(o.label){case 0:return this.isSyncingSlideState=!0,this.logger.info("stateChange receive "+JSON.stringify(t),this.taskId),t.taskId&&t.taskId!==this.__slideState.taskId&&(this.__slideState.taskId=t.taskId,null===(e=this.player)||void 0===e||e.setResourceData(t.taskId,this.__slideState.url)),t.url&&t.url!==this.__slideState.url&&(this.__slideState.url=t.url,null===(i=this.player)||void 0===i||i.setResourceData(this.__slideState.taskId,t.url)),Number.isInteger(t.currentSlideIndex)&&t.currentSlideIndex!==this.__slideState.currentSlideIndex?(this.__slideState.currentSlideIndex=t.currentSlideIndex,[4,this.doRenderSlide(t.currentSlideIndex)]):[3,2];case 1:o.sent(),o.label=2;case 2:return[4,null===(n=this.player)||void 0===n?void 0:n.clock.waitUntil((function(){var e,i;return(null===(e=s.player)||void 0===e?void 0:e.currentIndex)===t.currentSlideIndex&&(null===(i=s.player)||void 0===i?void 0:i.currentStage)}),3e3)];case 3:return o.sent(),r=!1,Number.isInteger(t.mainSeqStep)&&t.mainSeqStep!==this.__slideState.mainSeqStep&&(r=!0,this.__slideState.mainSeqStep=t.mainSeqStep),t.mainSeqState&&t.mainSeqState!==this.__slideState.mainSeqState&&(r=!0,this.__slideState.mainSeqState=t.mainSeqState),r&&this.setMainSeqStep(this.__slideState.mainSeqStep,"idle"===this.__slideState.mainSeqState?"start":"end"),t.mediaState&&(this.initMedia(t),this.__slideState.mediaState=t.mediaState),t.interactiveSeqState&&(this.initInteractiveSeq(t),this.__slideState.interactiveSeqState=t.interactiveSeqState),this.isSyncingSlideState=!1,[2]}}))}))},e.prototype.initInteractiveSeq=function(t){var e;for(var i in t.interactiveSeqState){var n=t.interactiveSeqState[i];null===(e=this.player)||void 0===e||e.setInteractiveSeqState(i,n.step,"idle"===n.state?"start":"end")}},e.prototype.initMedia=function(t){var e,i,n=this,r=function(r){var o=t.mediaState[r],a=s.__slideState.mediaState[r];if(a&&o.type===a.type&&o.time===a.time)return"continue";"play"===o.type?null===(e=s.player)||void 0===e||e.setMediaState(r,!0).then((function(){var t,e=n.timestamp();null===(t=n.player)||void 0===t||t.setMediaCurrentTime(r,(e-o.time)/1e3)})):null===(i=s.player)||void 0===i||i.setMediaState(r,!1).then((function(){var t;null===(t=n.player)||void 0===t||t.setMediaCurrentTime(r,o.time)}))},s=this;for(var o in t.mediaState)r(o)},Object.defineProperty(e.prototype,"slideCount",{get:function(){return this._slideCount},enumerable:!1,configurable:!0}),e.prototype.getSizeAsync=function(){return ZE(this,void 0,void 0,(function(){var t;return JE(this,(function(e){switch(e.label){case 0:if(this.width>0&&this.height>0)return[2,[this.width,this.height]];e.label=1;case 1:return e.trys.push([1,4,,5]),[4,fetch(this.__slideState.url+"/"+this.__slideState.taskId+"/jsonOutput/slide-1.json")];case 2:return[4,e.sent().json()];case 3:return[2,[(t=e.sent()).width,t.height]];case 4:return e.sent(),[2,[0,0]];case 5:return[2]}}))}))},e.prototype.getSlideCountAsync=function(){return ZE(this,void 0,void 0,(function(){return JE(this,(function(t){switch(t.label){case 0:if(this._slideCount>0)return[2,this._slideCount];t.label=1;case 1:return t.trys.push([1,4,,5]),[4,fetch(this.__slideState.url+"/"+this.__slideState.taskId+"/jsonOutput/slide-1.json")];case 2:return[4,t.sent().json()];case 3:return[2,t.sent().slideCount];case 4:return t.sent(),[2,0];case 5:return[2]}}))}))},Object.defineProperty(e.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(e.prototype,"mainSeqLength",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.mainSeqLength())||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mainSeqStep",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.mainSeqStep())||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mainSeqState",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.mainSeqState())||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderOptions",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.config)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"drawCall",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.runtime.drawCall)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderFps",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.runtime.fps)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"runtimeFps",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.fps.value)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"view",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.view)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.designWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.designHeight},enumerable:!1,configurable:!0}),e.prototype.updateRenderOption=function(t){this.player&&(this.player.updateConfig(t),this.renderOptions&&(this.config.renderOptions=this.renderOptions))},e.prototype.setResource=function(t,e){var i;this.taskId=t,null===(i=this.player)||void 0===i||i.setResourceData(t,e),this.__slideState.taskId=t,this.__slideState.url=e,this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"setResource",taskId:t,url:e})},e.prototype._renderSlide=function(t){var e;return ZE(this,void 0,void 0,(function(){var i=this;return JE(this,(function(n){switch(n.label){case 0:return this.renderingIndex=t,this.player&&t===this.player.currentIndex?[2]:((Ob.platform.isIOS()||Ob.platform.isAndroid())&&this.iosResetCache.indexOf(t)<0&&this.iosResetCache.push(t),[4,null===(e=this.player)||void 0===e?void 0:e.renderSlide(t)]);case 1:return n.sent(),this.__slideState.currentSlideIndex=t,this.resizeView(),this.__slideState.interactiveSeqState={},this.emitStateChange(),setTimeout((function(){var t,e;if("hidden"===(null===(e=null===(t=i.player)||void 0===t?void 0:t.view)||void 0===e?void 0:e.style.visibility)&&(i.player.view.style.visibility="visible"),"hidden"===i.frame.style.visibility&&(i.frame.style.visibility="visible"),i.needClearCacheImage)try{i.frame.removeChild(i.cacheImage)}catch(t){}}),100),[2]}}))}))},e.prototype.renderSlide=function(t,e){if(void 0===e&&(e=!0),this.player){var i=Number(t);(i!==this.player.currentIndex||this.renderingTaskManager.hasStartTask())&&(i>this.slideCount&&this.slideCount>0||this.poseRenderSlide(i,e))}},e.prototype.needCreateNewPlayer=function(){var t=Ob.platform.isLowGpuMemory()?15:30;return(Ob.platform.isIOS()||Ob.platform.isAndroid())&&this.iosResetCache.length>t},e.prototype.poseRenderSlide=function(t,e){"interactive"===this.mode?this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:t,isForward:e}):"sync"===this.mode?(this.doRenderSlide(t,e),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:t,isForward:e})):this.doRenderSlide(t,e)},e.prototype.doRenderSlide=function(t,e){var i,n,r,s=this;if(void 0===e&&(e=!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 o=this.player.getSnapshot();this.cacheImage.src=o,this.frame.appendChild(this.cacheImage),this.player.destroy(),null===(i=this.playerController)||void 0===i||i.destroy(),this.player=this.iosNewPlayer,this.iosNewPlayer=void 0,(null===(n=this.config)||void 0===n?void 0:n.controller)&&this.createController(),this.needClearCacheImage=!0,(null===(r=null==this?void 0:this.player)||void 0===r?void 0:r.view)&&(this.player.view.style.visibility="hidden",this.canvasContainer.appendChild(this.player.view))}var a=Math.random().toString(32).substr(2);return this.player.isForward=e,this.renderingTaskManager.addTask((function(){return s._renderSlide(t)}),t,a),new Promise((function(t){s.renderingTaskManager.eventHub.once("task-end-"+a,t)}))},e.prototype.nextStep=function(){!this.isLoading&&this.player&&this.interactive?this.player.mainSeqHasNextStep()?"interactive"===this.mode?this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"nextStep",next:this.player.mainSeqStep()+1}):"sync"===this.mode?(this.doNextStep(),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"nextStep",next:this.player.mainSeqStep()})):this.doNextStep():this.handleNextSlide():this.logger.info("prevent nextStep. "+this.isLoading+" "+this.player+" "+this.interactive,this.taskId)},e.prototype.doNextStep=function(t){if(void 0===t&&(t=!1),this.player){this.player.nextStep(t);var e=this.player.mainSeqStep();this.__slideState.mainSeqStep=e,this.emitStateChange()}},e.prototype.prevStep=function(){!this.isLoading&&this.player&&this.interactive?this.player.mainSeqHasPrevStep()?"interactive"===this.mode?this.emitSyncDispatch({type:"prevStep",slideIndex:this.__slideState.currentSlideIndex,next:this.player.mainSeqStep()-1}):"sync"===this.mode?(this.doPrevStep(),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"prevStep",next:this.player.mainSeqStep()})):this.doPrevStep():this.handlePrevSlide():this.logger.info("prevent nextStep. "+this.isLoading+" "+this.player+" "+this.interactive,this.taskId)},e.prototype.doPrevStep=function(t){if(void 0===t&&(t=!1),this.player){this.player.prevStep(t);var e=this.player.mainSeqStep();this.__slideState.mainSeqStep=e,this.emitStateChange()}},e.prototype.isSlideStateReady=function(t){return t.taskId.length>0&&t.url.length>0&&t.currentSlideIndex>0},e.prototype.emitStateChange=function(){if("local"!==this.mode&&!this.isSyncingSlideState){var t=this.slideState;!Bb()(this.lastEmitedState,t)&&this.isSlideStateReady(t)&&(this.lastEmitedState=t,this.emit(tw.stateChange,t),this.logger.info("stateChange dispatch "+JSON.stringify(this.slideState),this.taskId))}},e.prototype.emitSyncDispatch=function(t){if(!this.lock.isLocked(t.type)){var e=Math.random().toString(32).substr(2);this.lock.addLock(t.type,e);var i=YE(YE({},t),{uuid:e});"sync"===this.config.mode&&(i.incrId=this.dispatchIncrId),this.emit(tw.syncDispatch,i),this.logger.info("sync dispatch "+JSON.stringify(i),this.taskId)}},e.prototype.setMainSeqStep=function(t,e){var i;null===(i=this.player)||void 0===i||i.setMainSeqStep(t,e)},e.prototype.setInteractive=function(t){var e;this.interactive=t,null===(e=this.player)||void 0===e||e.setInteractive(t)},e.prototype.pause=function(){var t;null===(t=this.player)||void 0===t||t.pause()},e.prototype.resume=function(){var t;null===(t=this.player)||void 0===t||t.resume()},e.prototype._doFrozen=function(){var t;return ZE(this,void 0,void 0,(function(){var e,i,n,r=this;return JE(this,(function(s){switch(s.label){case 0:return this.logger.info("frozen with player["+!!this.player+"]",this.taskId),this.view&&this.player?[4,this.player.clock.waitUntil((function(){return!r.isLoading}),6e4)]:[3,2];case 1:for(i in s.sent(),e=this.player.getSnapshot()||"",this.cacheImage.src=e,this.frame.appendChild(this.cacheImage),this.player.destroy(),null===(t=this.playerController)||void 0===t||t.destroy(),this.player=void 0,this.__slideState.mediaState)n=this.__slideState.mediaState[i],this.__slideState.mediaState[i]=YE(YE({},n),{frozenTime:this.timestamp()});s.label=2;case 2:return[2]}}))}))},e.prototype.frozen=function(){var t=this;this.frozenTaskManager.addTask("frozen",(function(){return t._doFrozen()}))},e.prototype._doRelease=function(){var t,e;return ZE(this,void 0,void 0,(function(){var i,n,r,s;return JE(this,(function(o){switch(o.label){case 0:if(this.logger.info("do release slide",this.taskId),this.player)return[2];for(n in this.player=this.initPlayer(this.config),(null===(t=this.config)||void 0===t?void 0:t.controller)&&this.createController(),this.player.view&&(this.canvasContainer.appendChild(this.player.view),this.player.view.style.visibility="hidden"),i=this.__slideState,this.__slideState=Hb()(ew),i.mediaState)"play"===(r=i.mediaState[n]).type&&(s=Math.max(null!==(e=r.frozenTime)&&void 0!==e?e:0,r.time),r.time=this.timestamp()-(s-r.time),r.frozenTime=void 0);return[4,this.setSlideState(i)];case 1:return o.sent(),[4,this.player.clock.delay(333)];case 2:o.sent(),this.player.view&&(this.player.view.style.visibility="visible");try{this.frame.removeChild(this.cacheImage)}catch(t){}return[2]}}))}))},e.prototype.release=function(){var t=this;this.frozenTaskManager.addTask("release",(function(){return t._doRelease()}))},e.prototype._doDestroy=function(){var t,e,i,n;this.logger.info("do destroy slide",this.taskId),this.playerController&&this.playerController.destroy(),this.frameResizeObserver.disconnect(),null===(t=this.player)||void 0===t||t.removeAllListeners(),null===(e=this.player)||void 0===e||e.destroy(),null===(i=this.player)||void 0===i||i.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("message",this.recoverHandler),this.removeAllListeners();try{(null===(n=this.player)||void 0===n?void 0:n.view)&&this.anchor.removeChild(this.player.view),this.anchor.removeChild(this.frame)}catch(t){}},e.prototype.waitLoadEnd=function(){return ZE(this,void 0,void 0,(function(){var t;return JE(this,(function(e){switch(e.label){case 0:t=0,e.label=1;case 1:return this.isLoading&&t<10?[4,$E(100)]:[3,3];case 2:return e.sent(),t+=1,[3,1];case 3:return[2]}}))}))},e.prototype.preload=function(t){return this.player?this.player.preload(t):Promise.resolve()},e.prototype.destroy=function(){var t=this;this.logger.info("pre destroy slide",""),this.isLoading?this.waitLoadEnd().then((function(){t._doDestroy()})):this._doDestroy()},e.prototype.clearSlideCache=function(){var t;null===(t=this.player)||void 0===t||t.clearLocalCache()},e.prototype.hasNextStep=function(){if(!this.player)return!1;var t=this.player.currentIndex===this.slideCount,e=0===this.mainSeqLength||this.mainSeqStep>=this.mainSeqLength-1,i="end"===this.mainSeqState||"running"===this.mainSeqState||null==this.mainSeqState;return!(t&&e&&i)},e.prototype.hasPrevStep=function(){if(!this.player)return!1;var t=1===this.player.currentIndex,e=0===this.mainSeqLength||0===this.mainSeqStep,i="idle"===this.mainSeqState||null===this.mainSeqState;return!(t&&e&&i)},e.prototype.updateGlobalVolume=function(t){this.volumeAdjuster.volume=t},e.prototype.getGlobalVolume=function(){return this.volumeAdjuster.volume},e.clearLocalCache=function(){Ob.clearLocalCache()},e.disposeLocalCache=function(){},i=e,e._tempLog="",e._tempLogIndex=1,e.usePlugin=Fb,e.handleLogReport=function(){return ZE(void 0,void 0,void 0,(function(){var t,n,r,s,o,a;return JE(i,(function(i){switch(i.label){case 0:return[4,e.flushLog(!0)];case 1:return i.sent(),nw?[4,nw.keys()]:[3,6];case 2:t=(i.sent()||[]).sort((function(t,e){return parseInt(t.replace("run_time_log_",""))-parseInt(e.replace("run_time_log_",""))})),n=0,r=t,i.label=3;case 3:return n<r.length?(s=r[n],o=s.replace("run_time_log_",""),[4,nw.getItem(s)]):[3,6];case 4:a=i.sent(),window.postMessage({type:"@slide/_report_log_",log:a,index:parseInt(o,10),total:t.length}),i.label=5;case 5:return n++,[3,3];case 6:return[2]}}))}))},e.handleLogDownload=function(){return ZE(void 0,void 0,void 0,(function(){var t,n,r,s,o,a,l;return JE(i,(function(i){switch(i.label){case 0:return[4,e.flushLog(!0)];case 1:return i.sent(),t="",nw?[4,nw.keys()]:[3,6];case 2:n=(i.sent()||[]).sort((function(t,e){return parseInt(t.replace("run_time_log_",""))-parseInt(e.replace("run_time_log_",""))})),r=0,s=n,i.label=3;case 3:return r<s.length?(o=s[r],a=t,[4,nw.getItem(o)]):[3,6];case 4:t=a+(i.sent()||""),i.label=5;case 5:return r++,[3,3];case 6:return(l=document.createElement("a")).setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(t)),l.setAttribute("download","slide_log"),l.style.display="none",document.body.appendChild(l),l.click(),document.body.removeChild(l),[2]}}))}))},qE([(n="Slide.initConfig",function(t,e,i){var r=i.value;i.value=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var i=Db.get(n)||[],s=t,o=0,a=i;o<a.length;o++){var l=a[o];try{s=l.before(s)}catch(t){}if(!Array.isArray(s)||s.length!==t.length)throw new Error("plugin before hook return invalid args")}for(var h=r.bind(this).apply(void 0,s),c=0,u=i.reverse();c<u.length;c++){l=u[c];try{h=l.after(h)}catch(t){}if(!h)throw new Error("plugin after hook return undefined result")}return h}})],e.prototype,"initSlideConfig",null),e}($a.a);null==nw||nw.clear(),window.addEventListener("__slide_log__",rw.handleLogDownload),window.addEventListener("message",(function(t){"@slide/_request_log_"===t.data.type&&rw.handleLogReport().catch((function(){}))})),window.setInterval((function(){rw.flushLog().catch((function(){}))}),2e3)}]);
|
|
237
|
+
var v_=function(){function t(t,e,i){void 0===i&&(i=null),this._texture=t instanceof Vd?t:null,this.baseTexture=t instanceof Ad?t:this._texture.baseTexture,this.textures={},this.animations={},this.data=e;var n=this.baseTexture.resource;this.resolution=this._updateResolution(i||(n?n.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}return t.prototype._updateResolution=function(t){void 0===t&&(t=null);var e=this.data.meta.scale,i=yu(t,null);return null===i&&(i=void 0!==e?parseFloat(e):1),1!==i&&this.baseTexture.setResolution(i),i},t.prototype.parse=function(e){this._batchIndex=0,this._callback=e,this._frameKeys.length<=t.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()},t.prototype._processFrames=function(e){for(var i=e,n=t.BATCH_SIZE;i-e<n&&i<this._frameKeys.length;){var r=this._frameKeys[i],s=this._frames[r],o=s.frame;if(o){var a=null,l=null,h=!1!==s.trimmed&&s.sourceSize?s.sourceSize:s.frame,c=new Mu(0,0,Math.floor(h.w)/this.resolution,Math.floor(h.h)/this.resolution);a=s.rotated?new Mu(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):new Mu(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),!1!==s.trimmed&&s.spriteSourceSize&&(l=new Mu(Math.floor(s.spriteSourceSize.x)/this.resolution,Math.floor(s.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[r]=new Vd(this.baseTexture,a,c,l,s.rotated?2:0,s.anchor),Vd.addToCache(this.textures[r],r)}i++}},t.prototype._processAnimations=function(){var t=this.data.animations||{};for(var e in t){this.animations[e]=[];for(var i=0;i<t[e].length;i++){var n=t[e][i];this.animations[e].push(this.textures[n])}}},t.prototype._parseComplete=function(){var t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)},t.prototype._nextBatch=function(){var e=this;this._processFrames(this._batchIndex*t.BATCH_SIZE),this._batchIndex++,setTimeout((function(){e._batchIndex*t.BATCH_SIZE<e._frameKeys.length?e._nextBatch():(e._processAnimations(),e._parseComplete())}),0)},t.prototype.destroy=function(t){var e;for(var i in void 0===t&&(t=!1),this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(null===(e=this._texture)||void 0===e||e.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null},t.BATCH_SIZE=1e3,t}(),__=function(){function t(){}return t.use=function(e,i){var n,r,s=this,o=e.name+"_image";if(e.data&&e.type===h_.TYPE.JSON&&e.data.frames&&!s.resources[o]){var a=null===(r=null===(n=e.data)||void 0===n?void 0:n.meta)||void 0===r?void 0:r.related_multi_packs;if(Array.isArray(a))for(var l=function(t){if("string"!=typeof t)return"continue";var i=t.replace(".json",""),n=Nc.resolve(e.url.replace(s.baseUrl,""),t);if(s.resources[i]||Object.values(s.resources).some((function(t){return Nc.format(Nc.parse(t.url))===n})))return"continue";var r={crossOrigin:e.crossOrigin,loadType:h_.LOAD_TYPE.XHR,xhrType:h_.XHR_RESPONSE_TYPE.JSON,parentResource:e,metadata:e.metadata};s.add(i,n,r)},h=0,c=a;h<c.length;h++){l(c[h])}var u={crossOrigin:e.crossOrigin,metadata:e.metadata.imageMetadata,parentResource:e},d=t.getResourcePath(e,s.baseUrl);s.add(o,d,u,(function(t){if(t.error)i(t.error);else{var n=new v_(t.texture,e.data,e.url);n.parse((function(){e.spritesheet=n,e.textures=n.textures,i()}))}}))}else i()},t.getResourcePath=function(t,e){return t.isDataUrl?t.data.meta.image:Nc.resolve(t.url.replace(e,""),t.data.meta.image)},t}();const y_={ColorMatrixFilter:xm,BlurFilter:cv,BlurFilterPass:hv};Mf.registerPlugin("interaction",Pm),Mf.registerPlugin("batch",Gf),Mf.registerPlugin("extract",Bg),vm.registerPlugin(_d);class x_ extends $a.a{constructor(){super(),this.prevTime=-1,this.times=0,this.valueTotal=0,this.destroyed=!1,this.value=0,this.calcFps()}calcFps(){requestAnimationFrame(t=>{const e=t-this.prevTime;this.valueTotal+=e,this.times+=1,this.times>20&&(this.value=Math.floor(1e3*this.times/this.valueTotal),this.valueTotal=0,this.times=0,this.destroyed||this.emit("update",this.value)),this.prevTime=t,this.destroyed||this.calcFps()})}destroy(){this.destroyed=!0}}var b_;!function(t){t.ResourceError="RESOURCE_ERROR",t.RuntimeError="RUNTIME_ERROR",t.RuntimeWarn="RUNTIME_WARN",t.CanvasCrash="CANVAS_CRASH"}(b_||(b_={}));class T_ extends Error{constructor(t,e){var i,n;super(e),i=this,n=new.target.prototype,Object.setPrototypeOf?Object.setPrototypeOf(i,n):i.__proto__&&(i.__proto__=n),this.errorType=t,this.errorMsg=e}static transform(t){return t instanceof T_?t:new T_(b_.RuntimeError,t.message)}}function E_(){return function(t,e,i){const n=i.value;i.value=function(...t){try{return n.apply(this,t)}catch(t){throw new T_(b_.RuntimeWarn,t.message)}}}}var w_=i(33),S_=i.n(w_),M_=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};function A_(){return o()}const P_="__delay_resolve_result__";function R_(t){return new Promise(e=>{setTimeout(()=>{e(P_)},t)})}function I_(t,e){return M_(this,void 0,void 0,(function*(){const i=yield Promise.race([t(),R_(e)]);return i===P_?P_:i}))}var C_=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};function L_(t,e){return C_(this,void 0,void 0,(function*(){const i=yield I_(()=>fetch(t),e);if(i===P_)throw new T_(b_.ResourceError,`"${t}" loaded timeout"`);if(!i.ok)throw new T_(b_.ResourceError,`"${t}" loaded failed with status "${i.status}"`);return i}))}class N_{constructor(t,e,i,n,r){this.timeout=15e3,this.useCache=!1,this.taskId="",this.delegate=null,this.useCache=e,this.localStorage=t,this.logger=i,this.timeout=n,this.delegate=r||null}attachTaskId(t){this.taskId=t}fetchJson(t){return C_(this,void 0,void 0,(function*(){let e;if(this.useCache&&(this.logger.info("load resource from cache. "+t,this.taskId||""),e=yield this.localStorage.getItem(t)),e)return this.logger.info("cache hit. "+t,this.taskId||""),e;{let e;if(this.delegate){this.logger.info("load resource by delegate. "+t,this.taskId||"");const i=yield I_(()=>this.delegate.loadJson(t),this.timeout);if(i===P_)throw new T_(b_.ResourceError,`"${t}" loaded timeout"`);e=JSON.parse(i)}else this.logger.info("load resource from server. "+t,this.taskId||""),e=yield(yield L_(""+t,this.timeout)).json();return this.logger.info("load end. "+t,this.taskId||""),this.useCache&&this.localStorage.setItem(t,e).catch(()=>{}),e}}))}fetchPng(t){return C_(this,void 0,void 0,(function*(){let e;if(this.useCache&&(this.logger.info("load resource from cache. "+t,this.taskId||""),e=yield this.localStorage.getItem(t)),e)return this.logger.info("cache hit. "+t,this.taskId||""),e;{let i;if(this.delegate){if(this.logger.info("load resource by delegate. "+t,this.taskId||""),i=yield I_(()=>this.delegate.loadImage(t),this.timeout),i===P_)throw new T_(b_.ResourceError,`"${t}" loaded timeout"`)}else{this.logger.info("load resource from server. "+t,this.taskId||"");const e=yield L_(t,this.timeout);i=yield e.blob()}return e=yield function(t){return new Promise((e,i)=>{const n=new FileReader;n.onload=()=>{e(n.result)},n.onerror=()=>{i(new T_(b_.ResourceError,"Failed parse blob data."))},n.readAsDataURL(t)})}(i),this.logger.info("load end. "+t,this.taskId||""),this.useCache&&this.localStorage.setItem(t,e).catch(()=>{}),e}}))}destroy(){}}var O_=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class D_{constructor(t){this.isPaused=!1,this.timestamp=0,this.callbackList=[],this.onTimeUpdate=t=>{const e=t/(Ac.TARGET_FPMS||.06);if(!this.isPaused){this.timestamp+=e,this.callbackList=this.callbackList.filter(t=>t&&!t.applied);let{length:t}=this.callbackList;for(let e=0;e<t;e++){const i=this.callbackList[e];if(i&&!i.applied){if(!(i.triggerTime<=this.timestamp))break;i.running=!0,i.fn(),i.applied=!0,t=this.callbackList.length}}}},this.ticker=t,this.ticker.add(this.onTimeUpdate)}setTimeout(t,e){const i=A_(),n=this.timestamp+Math.max(e||16,16);return this.callbackList.push({fn:t,triggerTime:n,id:i,applied:!1,running:!1}),this.callbackList.sort((t,e)=>t.triggerTime-e.triggerTime),i}clearTimeout(t){const e=this.callbackList.findIndex(e=>e.id===t);e>=0&&!this.callbackList[e].running&&this.callbackList.splice(e,1)}delay(t){return new Promise(e=>{this.setTimeout(e,t)})}waitUntil(t,e){return O_(this,void 0,void 0,(function*(){const i=this.timestamp;for(;!t()&&this.timestamp-i<e;)yield this.delay(50)}))}pause(){this.isPaused=!0}resume(){this.isPaused=!1}}var F_=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};function U_(t,e,i){return i?Math.floor(parseFloat(t)*e):Math.ceil(parseFloat(t)*e)}const k_={w:!0,h:!0,x:!0,y:!0};class B_{constructor(t){this.gifs=Object.create(null),this.textures=Object.create(null),this.frames=Object.create(null),this.spriteSheets=[],this.loader=t}getTexture(t){return this.textures[t]||null}getFrameData(t){return this.frames[t]}getGifFrames(t){return this.gifs[t]?this.gifs[t].filter(t=>!!t):[]}loadSpriteSheetItem(t,e,i,n){return F_(this,void 0,void 0,(function*(){const r=yield this.loader.fetchJson(`${t}/${e}/jsonOutput/${i}.json`),s=yield this.loader.fetchPng(`${t}/${e}/jsonOutput/${i}.png`),o=document.createElement("img");o.src=s,yield new Promise((t,e)=>{o.onload=()=>t(""),o.onerror=()=>e(new Error("load sprite image failed"))});let a=n;const l=o.width||1,h=o.height||1;if(l>2048||h>2048){a*=2048/l;const t=a*h;t>2048&&(a*=h/t)}!function(t,e){t.meta&&t.meta.size&&["w","h"].forEach(i=>{t.meta.size[i]=U_(t.meta.size[i],e,k_[i])}),t.frames&&Object.keys(t.frames).forEach(i=>{t.frames[i].frame&&["x","y","w","h"].forEach(n=>{t.frames[i].frame[n]=U_(t.frames[i].frame[n],e,k_[n])}),t.frames[i].spriteSourceSize&&["x","y","w","h"].forEach(n=>{t.frames[i].spriteSourceSize[n]=U_(t.frames[i].spriteSourceSize[n],e,k_[n])}),t.frames[i].sourceSize&&["w","h"].forEach(n=>{t.frames[i].sourceSize[n]=U_(t.frames[i].sourceSize[n],e,k_[n])})})}(r,a);const c=document.createElement("canvas"),u=Math.ceil(o.width*a),d=Math.ceil(o.height*a);c.width=u,c.height=d;c.getContext("2d").drawImage(o,0,0,u,d);const p=new Ad(c,{resolution:1}),f=new v_(p,r);yield new Promise(t=>{f.parse(()=>t(""))}),this.spriteSheets.push(f),Object.keys(f.textures).forEach(t=>{const e=t.match(/^(.+)_gif_(\d+)$/);if(e&&e[1]&&e[2]){const i=e[1];this.gifs[i]||(this.gifs[i]=[]);const n=parseInt(e[2],10);this.gifs[i][n]=f.textures[t]}else this.frames[t]=r.frames[t],this.textures[t]=f.textures[t]})}))}destroy(){this.spriteSheets.forEach(t=>t.destroy(!0)),this.spriteSheets=[],this.gifs=Object.create(null),this.textures=Object.create(null),this.frames=Object.create(null)}}var G_=i(5),H_=i.n(G_),j_=i(2),z_=i.n(j_);function V_(t,e,i){let n,r;const s=Math.round(t)%360;if(s%180==0)n=Math.cos(s*(Math.PI/180))*e,r=0;else if(s%90==0)n=0,r=Math.sin(s*(Math.PI/180))*i;else{const t=function(t){const e=t*Math.PI/180;return Math.tan(e)}(s);n=e*i/Math.sqrt(Math.pow(i,2)+Math.pow(e*t,2)),(s>90&&s<270||s<-90&&s>-270)&&(n=-n),r=t*n}return{x:n,y:r}}function W_(t,e,i,n,r,s){const o=t,a=e;let l,h,c,u,d;if(0===Math.round(n))l=r,h=s,d=0;else if(Math.round(n)>=360)l=r,h=s,c=r+2*t*Math.abs(Math.cos(-i/180*Math.PI)),u=s+2*e*Math.sin(-i/180*Math.PI),d=1;else{const t=-i,e=-(i+n),{x:c,y:u}=V_(t,o,a),p=r-c,f=s+u,{x:m,y:g}=V_(e,o,a);l=m+p,h=f-g,d=n>=-360&&n<-180?1:n>=-180&&n<0||n>0&&n<180?0:1}return{radiusX:o,radiusY:a,xAxisRotation:0,largeArcFlag:d,sweepFlag:n>0?1:0,endX:l,endY:h,middleX:c,middleY:u}}class X_{constructor(){this.pool=[]}getObject(t){const e=this.pool.find(t=>!t.isUsed);if(e)return e.isUsed=!0,e.obj;{const e={obj:this.createObject(),isUsed:!0,group:t};return this.pool.push(e),e.obj}}collectObject(t){const e=this.pool.find(e=>e.obj===t);e&&(e.isUsed=!1,this.resetObject(e.obj))}collectObjectByGroup(t){this.pool.filter(e=>e.group===t).forEach(t=>this.collectObject(t.obj))}}const Y_=new class extends X_{createObject(){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("version","1.1"),t}resetObject(t){t.removeAttribute("viewBox"),t.removeAttribute("width"),t.removeAttribute("height"),t.innerHTML=""}};const q_=new class extends X_{createObject(){return document.createElement("img")}resetObject(t){t.removeAttribute("src")}};var Z_=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class J_{constructor(){this.imgElements=[],this.svgElements=[],this.idToHashMap=Object.create(null),this.textures=Object.create(null),this.graphics=[],this.hashToIdMap=Object.create(null)}render(t,e,i){return Z_(this,void 0,void 0,(function*(){const{items:e,width:n,height:r}=t,s=q_.getObject(i),o=new Ad(s,{width:n,height:r,resolution:1}),a=Y_.getObject(i);this.imgElements.push(s),this.svgElements.push(a),a.setAttribute("viewBox",`0 0 ${n} ${r}`),a.setAttribute("width",""+n),a.setAttribute("height",""+r);const l={},h={};e.forEach(t=>{const{item:e,x:i,y:n}=t,r=i+2,s=n+2;e.pathsData.forEach(t=>{let e="";t.cmds.forEach(([i,n])=>{e+=i+" ",e+=n.map(e=>(z_()(e)||(e.x=e.x+t.offset.x+r,e.y=e.y+t.offset.y+s),e)).reduce((t,e)=>(z_()(e)?t+=e+" ":t+=`${e.x} ${e.y} `,t),""),e+=" "}),t.pathElement.setAttribute("d",e),a.appendChild(t.pathElement)});const c=e.width-4-2*e.padding,u=e.height-4-2*e.padding;this.textures[e.hash]={texture:new Vd(o,new Mu(r+2,s+2,c,u)),pivot:e.pivot},l[e.hash]={x:r+2,y:s+2,w:c,h:u,pivot:e.pivot},h[e.hash]=this.hashToIdMap[e.hash]});const c=(u='<?xml version="1.0" encoding="utf-8"?>'+a.outerHTML,"data:image/svg+xml,"+encodeURIComponent(u).replace(/'/g,"%27").replace(/"/g,"%22"));var u;s.src=c,yield new Promise((t,e)=>{s.onload=()=>t(""),s.onerror=()=>e()})}))}getGraphicsData(t){const e=this.idToHashMap[t]||"";return this.textures[e]||null}addGraphics(t,e,i,n,r,s,o,a,l,h,c){var u,d;if(!o&&!l)return t;const p=H_()(i+(null!==(d=null===(u=null==o?void 0:o.width)||void 0===u?void 0:u.toString())&&void 0!==d?d:0)+l+h+c);if(this.hashToIdMap[p]||(this.hashToIdMap[p]=[]),this.hashToIdMap[p].push(t),this.idToHashMap[t]=p,this.graphics.findIndex(t=>t.hash===p)<0){const{graphicsWidth:t,graphicsHeight:i,pathsData:a,pivot:u,padding:d}=function(t,e,i,n,r,s,o,a,l){var h;const c=[],u={x:Math.abs(r.x),y:Math.abs(r.y)};let d=0,p=0,f=0,m=0,g=0,v="none";const _=null!==(h=null==n?void 0:n.width)&&void 0!==h?h:0;return o?(d=e,p=i,g=0):(v=l||"#ff0000",g=_,f=.5*_,m=.5*_,d=e+_,p=i+_,u.x+=.5*_,u.y+=.5*_),d+=Math.abs(r.x),p+=Math.abs(r.y),f+=Math.abs(r.x),m+=Math.abs(r.y),d+=4,p+=4,f+=2,m+=2,d=Math.ceil(d),p=Math.ceil(p),t.forEach(t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","path");"none"!==t.fill&&o?e.setAttribute("fill",a||"#ff0000"):e.setAttribute("fill","none"),t.hasStroke&&!o&&(e.setAttribute("stroke-linecap",(null==n?void 0:n.cap)||"butt"),e.setAttribute("stroke-linejoin",(null==n?void 0:n.join)||"miter"),e.setAttribute("stroke-width",g.toString()),e.setAttribute("stroke",v),(null==n?void 0:n.dash)&&e.setAttribute("stroke-dasharray",n.dash));const{scale:i}=t,r=t.path.trim().split(" ");let s={x:0,y:0};const l={offset:{x:f,y:m},cmds:[],pathElement:e};for(let t=0;t<r.length;t+=2){const e=r[t],n=r[t+1];if("M"===e){let[t,e]=n.split(",").map(t=>Number(t));s={x:t,y:e},t=t/9525*i.x,e=e/9525*i.y,l.cmds.push(["M",[{x:t,y:e}]])}else if("A"===e){const[t,e,r,o]=n.split(",").map(t=>Number(t)),a=r/Math.PI*180,h=o/Math.PI*180,c=W_(t,e,a,h,s.x,s.y);Math.round(h)>=360?(s={x:c.endX,y:c.endY},l.cmds.push(["A",[c.radiusX/9525*i.x,c.radiusY/9525*i.y,c.xAxisRotation,c.largeArcFlag,c.sweepFlag,{x:c.middleX/9525*i.x,y:c.middleY/9525*i.y}]]),l.cmds.push(["A",[c.radiusX/9525*i.x,c.radiusY/9525*i.y,c.xAxisRotation,c.largeArcFlag,c.sweepFlag,{x:c.endX/9525*i.x,y:c.endY/9525*i.y}]])):(s={x:c.endX,y:c.endY},l.cmds.push(["A",[c.radiusX/9525*i.x,c.radiusY/9525*i.y,c.xAxisRotation,c.largeArcFlag,c.sweepFlag,{x:c.endX/9525*i.x,y:c.endY/9525*i.y}]]))}else if("L"===e){let[t,e]=n.split(",").map(t=>Number(t));s={x:t,y:e},t=t/9525*i.x,e=e/9525*i.y,l.cmds.push(["L",[{x:t,y:e}]])}else if("QB"===e){let[t,e,r,o]=n.split(",").map(t=>Number(t));s={x:r,y:o},t=t/9525*i.x,e=e/9525*i.y,r=r/9525*i.x,o=o/9525*i.y,l.cmds.push(["Q",[{x:t,y:e},{x:r,y:o}]])}else if("CB"===e){let[t,e,r,o,a,h]=n.split(",").map(t=>Number(t));s={x:a,y:h},t=t/9525*i.x,e=e/9525*i.y,r=r/9525*i.x,o=o/9525*i.y,a=a/9525*i.x,h=h/9525*i.y,l.cmds.push(["C",[{x:t,y:e},{x:r,y:o},{x:a,y:h}]])}else"C"===e&&l.cmds.push(["Z",[]])}c.push(l)}),{graphicsWidth:d,graphicsHeight:p,pivot:u,padding:2,pathsData:c}}(e,r,s,o,n,0,l,h,c);this.graphics.push({hash:p,pathsData:a,pivot:u,width:t,height:i,padding:d})}return t}pack(){this.graphics.forEach(t=>{t.width+=4,t.height+=4});return function t(e){const i=[],n=e.filter(t=>{const e=t.width<2048&&t.height<2048;return e||i.push(t),e}).sort((t,e)=>t.width*t.height-e.width*e.height);let r=n.length+1,s=2050,o=2050;const a=[];let l=null;for(;(s>2048||o>2048)&&n.length>0;)r-=1,l=S_()(n.slice(0,r)),s=l.width,o=l.height;return l&&a.push(l),i.forEach(t=>{const e=S_()([t]);a.push(e)}),r<n.length?a.concat(t(n.slice(r))):a}(this.graphics)}destroy(){Object.keys(this.textures).forEach(t=>{var e;null===(e=this.textures[t])||void 0===e||e.texture.destroy(!0)}),this.textures=Object.create(null),this.imgElements.forEach(t=>q_.collectObject(t)),this.svgElements.forEach(t=>Y_.collectObject(t)),this.graphics=[]}}class K_{constructor(){this.runningTimeNodes={}}addRunningTimeNode(t,e,i){const n=`${e}_${t}`;if(this.runningTimeNodes[n])try{this.runningTimeNodes[n].dispose(!0)}catch(t){}this.runningTimeNodes[n]=i}removeRunningTimeNode(t,e){const i=`${e}_${t}`;delete this.runningTimeNodes[i]}}class $_{constructor(t){this.eventHub=t,this.targets=Object.create(null)}getTargets(){return Object.keys(this.targets).map(t=>this.targets[t])}addTarget(t,e){this.targets[t]=e}getTargetById(t){return this.targets[t]}getTarget(t,e,i={type:"el",index:0,id:""}){var n,r;let s=this.targets[t.id];return"shape"!==t.type?s:("shape"===t.type&&t.txEl&&(s=null!==(n=null==s?void 0:s.getTextElement(t.txEl.type,t.txEl.range))&&void 0!==n?n:null),"shape"===t.type&&t.bg&&0===i.index&&(e=!1,s=null!==(r=null==s?void 0:s.getBgElement())&&void 0!==r?r:null,this.eventHub.emit("IterateTimeNodeEnd",i.id)),e&&s?s.getIterateEntry(i.type,i.index,i.id):(s||this.eventHub.emit("IterateTimeNodeEnd",i.id),s))}clearTargets(){this.targets=Object.create(null)}}var Q_=i(10),ty=i.n(Q_);class ey{constructor(t){this.target=t}get color(){return this.target.strokeColorFilter.currentColor}set color(t){this.target.strokeColorFilter.color=t}get on(){return this.target.strokeActive?"true":"false"}set on(t){this.target.strokeActive="true"===t}}class iy{constructor(t){this.applyCommand=(t,e)=>{this.target.applyCommand(t,e)},this.target=t,this.applyCommand=ty()(this.applyCommand,100,{maxWait:500})}}class ny{constructor(t){this.target=t}get color(){return this.target.fillColorFilter.currentColor}set color(t){this.target.fillActive&&(this.target.fillColorFilter.color=t)}get on(){return this.target.fillActive?"true":"false"}set on(t){this.target.fillActive="true"===t}get designColor(){return this.target.fillColorFilter.designColor}}class ry{constructor(t,e,i){this.hardHidden=!1,this.designRotation=0,this.target=t,!0===e&&(this.hardHidden=!0),this.designRotation=i}get opacity(){return this.target.alpha}set opacity(t){this.target.alpha=t}get rotation(){return this.target.rotation/Math.PI*180}set rotation(t){this.target.rotation=t/180*Math.PI+this.designRotation}get visibility(){return this.target.visible?"visible":"hidden"}set visibility(t){this.visibility===t||this.hardHidden||(this.target.visible="visible"===t)}}class sy{constructor(t,e){this.actions=[],this.ctx=e,this.object=t,this.object.interactive=!0}reset(t){this.object.interactive=!1,this.object.removeAllListeners(),this.object=t,this.object.interactive=!0}addAction(t,e){this.actions.push([t,e]),"click"===e?(this.object.addListener("click",()=>this.handleAction(t)),this.object.cursor="pointer"):"hover"===e&&this.object.addListener("mouseover",()=>this.handleAction(t))}addProxy(t){this.proxy=t,this.hitArea=this.getOriginHitArea(),this.proxy.interactive=!0,this.actions.forEach(([t,e])=>{var i,n;"click"===e?null===(i=this.proxy)||void 0===i||i.addListener("click",e=>this.handleProxyAction(e,t)):"hover"===e&&(null===(n=this.proxy)||void 0===n||n.addListener("mouseover",e=>this.handleProxyAction(e,t)))})}handleProxyAction(t,e){var i;const n=t.data.global,r=this.object.getGlobalPosition(),s=n.x-r.x+this.object.pivot.x,o=n.y-r.y+this.object.pivot.y;(null===(i=this.hitArea)||void 0===i?void 0:i.contains(s,o))&&this.object.visible&&this.handleAction(e,!0)}getOriginHitArea(){return this.object.hitArea?this.object.hitArea:new Iu(0,0,this.object.width,this.object.height)}handleAction(t,e=!1){this.proxy&&!e||(this.ctx.eventHub.emit(Nb.hyperlinkTrigger,t),this.execAction(t))}execAction(t){var e;if(this.ctx.eventHub.emit(Nb.userInput),"ppaction://hlinksldjump"===t.action){const i=(null!==(e=null==t?void 0:t.target)&&void 0!==e?e:"").match(/slide(\d+)\.xml/);i&&i[1]&&this.ctx.eventHub.emit(Nb.requestGotoSlide,Number(i[1]))}else if("ppaction://hlinkshowjump?jump=nextslide"===t.action)this.ctx.eventHub.emit(Nb.requestNextSlide);else if("ppaction://hlinkshowjump?jump=previousslide"===t.action)this.ctx.eventHub.emit(Nb.requestPrevSlide);else if("ppaction://hlinkshowjump?jump=firstslide"===t.action)this.ctx.eventHub.emit(Nb.requestGotoSlide,1);else if("ppaction://hlinkshowjump?jump=lastslide"===t.action)this.ctx.eventHub.emit(Nb.requestGotoSlide,-1);else if("ppaction://hlinkshowjump?jump=lastslideviewed"===t.action){const t=this.ctx.lastViewedIndex;this.ctx.eventHub.emit(Nb.requestGotoSlide,t)}else"ppaction://hlinkshowjump?jump=endshow"===t.action&&this.ctx.eventHub.emit(Nb.requestGotoSlide,-1)}}function oy(t,e,i=5){return Math.abs(t-e)<=Math.pow(10,-i)}function ay(t){return Math.floor(1e6*t)/1e6}class ly{constructor(){this.point={x:0,y:0},this.slope=Math.PI/4}static fromPointSlope(t,e){const i=new ly;return i.point=t,i.slope=e,i}resolveY(t){return Math.tan(this.slope)*(t-this.point.x)+this.point.y}distanceToLinearEquation(t){return oy(this.slope,t.slope)?this.distanceToPoint(t.point):-1}distanceToPoint(t){let e=0;if(Math.tan(this.slope)*(t.x-this.point.x)+this.point.y===t.y)return 0;e=this.slope>=Math.PI/2?this.slope-Math.PI/2:Math.PI/2+this.slope;const i=ly.fromPointSlope(t,e),n=this.crossPoint(i);return n?Math.ceil(Math.sqrt(Math.pow(n.x-t.x,2)+Math.pow(n.y-t.y,2))):0}crossPoint(t){if(oy(t.slope,this.slope))return null;let e=0,i=0;const n=Math.tan(t.slope),r=Math.tan(this.slope),{x:s,y:o}=this.point,{x:a,y:l}=t.point;return oy(this.slope,Math.PI/2)?(e=this.point.x,i=n*(e-a)+l):oy(t.slope,Math.PI/2)?(e=t.point.x,i=r*(e-s)+o):oy(this.slope,Math.PI)||oy(this.slope,0)?(i=this.point.y,e=(i-l)/n+a):oy(t.slope,Math.PI)||oy(t.slope,0)?(i=t.point.y,e=(i-o)/r+s):(e=(n*a-l+o-r*s)/(n-r),i=r*(e-s)+o),{x:e,y:i}}}class hy{constructor(t,e,i){var n,r,s,o,a,l;this.scaleExt={x:1,y:1},this.scaleOrigin={x:1,y:1},this.designScale={x:1,y:1},this.bound=new Mu(0,0,1,1),this.pptX=0,this.pptY=0,this.presetSubType=0,this.designWidth=0,this.designHeight=0,this.designX=0,this.designY=0,this.hasPreset=!1,this.container=new pd,this.ctx=e,this.style=new ry(this.container,!!t.hardHidden,t.rotation||0),this.designGlobalPosition={x:i.x+(null!==(r=null===(n=t.position)||void 0===n?void 0:n.x)&&void 0!==r?r:0),y:i.y+(null!==(o=null===(s=t.position)||void 0===s?void 0:s.y)&&void 0!==o?o:0)},this.container.interactive=!0,(t.hlinkClick||t.hlinkHover)&&(this.hyperlink=new sy(this.container,this.ctx),t.hlinkHover&&(null===(a=this.hyperlink)||void 0===a||a.addAction(t.hlinkHover,"hover")),t.hlinkClick&&(null===(l=this.hyperlink)||void 0===l||l.addAction(t.hlinkClick,"click"))),this.ctx.clock.waitUntil(()=>{try{return!!this.container.width}catch(t){return!1}},3e3).then(()=>{try{this.designWidth=this.designWidth||this.container.width}catch(t){}}),this.ctx.clock.waitUntil(()=>{try{return!!this.container.height}catch(t){return!1}},3e3).then(()=>{try{this.designHeight=this.designHeight||this.container.height}catch(t){}})}updateScale(){this.container&&(this.container.scale.x=this.designScale.x*this.scaleExt.x*this.scaleOrigin.x,this.container.scale.y=this.designScale.y*this.scaleExt.y*this.scaleOrigin.y)}updateTransform(t){var e,i,n,r,s,o,a,l;this.designWidth=t.width,this.designHeight=t.height,this.designX=null!==(i=null===(e=t.position)||void 0===e?void 0:e.x)&&void 0!==i?i:0,this.designY=null!==(r=null===(n=t.position)||void 0===n?void 0:n.y)&&void 0!==r?r:0;const h=this.designWidth/2,c=this.designHeight/2;this.container.width=this.designWidth,this.container.height=this.designHeight,this.container.pivot.x=h,this.container.pivot.y=c;const u=null!==(o=null===(s=t.position)||void 0===s?void 0:s.x)&&void 0!==o?o:0,d=null!==(l=null===(a=t.position)||void 0===a?void 0:a.y)&&void 0!==l?l:0;this.container.x=u+h,this.container.y=d+c,t.scale&&(this.designScale={x:t.scale.x,y:t.scale.y},this.container.scale.x=t.scale.x,this.container.scale.y=t.scale.y),t.rotation&&(this.container.rotation=t.rotation);const p=new Jv;p.drawRect(0,0,this.designWidth,this.designHeight),this.container.addChild(p),this.json.hardHidden&&(this.container.visible=!1),this.bound.x=u,this.bound.y=d,this.bound.width=this.designWidth,this.bound.height=this.designHeight}get scale(){return this.scaleOrigin}set scale(t){this.scaleOrigin.x=t.x,this.scaleOrigin.y=t.y,this.updateScale()}get design_ppt_w(){return ay(this.designWidth/this.ctx.stageWidth)}get design_ppt_h(){return ay((this.designHeight||this.container.height)/this.ctx.stageHeight)}get design_ppt_x(){return ay(this.designX/this.ctx.stageWidth)}get design_ppt_y(){return ay(this.designY/this.ctx.stageHeight)}get ppt_w(){return this.scaleExt.x*this.scaleOrigin.x*this.designWidth/this.ctx.stageWidth}set ppt_w(t){this.designWidth&&(this.scaleExt.x=t*this.ctx.stageWidth/this.designWidth,this.updateScale())}get ppt_h(){const t=this.designHeight||this.container.height;return this.scaleExt.y*this.scaleOrigin.y*t/this.ctx.stageHeight}set ppt_h(t){this.designHeight&&(this.scaleExt.y=t*this.ctx.stageHeight/this.designHeight,this.updateScale())}get ppt_x(){return(this.container.position.x-this.container.pivot.x)/this.ctx.stageWidth}set ppt_x(t){this.pptX=t;const e=544===this.presetSubType?this.scaleExt.x:1;this.container.position.x=t*this.ctx.stageWidth+this.container.pivot.x*e}get ppt_y(){return(this.container.position.y-this.container.pivot.y)/this.ctx.stageHeight}set ppt_y(t){this.pptY=t;const e=544===this.presetSubType?this.scaleExt.y:1;this.container.position.y=t*this.ctx.stageHeight+this.container.pivot.y*e}get r(){return this.container.rotation}set r(t){this.container.rotation=t}set xshear(t){this.container.skew.x=t}get xshear(){return this.container.skew.x}set yshear(t){this.container.skew.y=t}get yshear(){return this.container.skew.y}}var cy=i(90),uy=i.n(cy);class dy{constructor(t){if(this._isInit=!1,this.h=0,this.s=0,this.l=0,this.a=1,t){this._isInit=!0;const e=t.match(/-?[0-9]+/g);e&&(this.h=parseInt(e[0],10),this.s=parseInt(e[1],10)/100,this.l=parseInt(e[2],10)/100)}}isInit(){return this._isInit}by(t,e){e.h=Math.max(Math.min(this.h+t.h,359),0),e.s=Math.max(Math.min(this.s+t.s,1),0),e.l=Math.max(Math.min(this.l+t.l,1),0),e.a=Math.max(Math.min(this.a+t.a,1),0)}fromHexString(t){const[e,i,n,r]=my(t);let s=0,o=0,a=0;const l=Math.max(e,i,n),h=Math.min(e,i,n),c=l-h;a=(l+h)/2,0===c?s=0:l===e?s=(i-n)/c%6*60:l===i?s=60*((n-e)/c+2):l===n&&(s=60*((e-i)/c+4)),o=0===c?0:c/(1-Math.abs(2*a-1)),this.h=s,this.s=o,this.l=a,this.a=r}interpolationFrom(t,e,i){const n=t.h+(this.h-t.h)*e,r=t.s+(this.s-t.s)*e,s=t.l+(this.l-t.l)*e,o=t.a+(this.a-t.a)*e;i.h=Math.max(Math.min(n,359),0),i.s=Math.max(Math.min(r,1),0),i.l=Math.max(Math.min(s,1),0),i.a=Math.max(Math.min(o,1),0)}toHexString(){let t=[0,0,0,0];const{h:e,s:i,l:n}=this;if(e<360&&e>=0&&i<=1&&i>=0&&n<=1&&n>=0){let r,s,o;const a=(1-Math.abs(2*n-1))*i,l=a*(1-Math.abs(e/60%2-1)),h=n-a/2;[r,s,o]=e>=0&&e<60?[a,l,0]:e>=60&&e<120?[l,a,0]:e>=120&&e<180?[0,a,l]:e>=180&&e<240?[0,l,a]:e>=240&&e<300?[l,0,a]:[a,0,l],t=[r+h,s+h,o+h,this.a]}return gy(t)}}class py{constructor(t){this._isInit=!1,this.r=0,this.g=0,this.b=0,this.a=0,t&&(this._isInit=!0,this.fromHexString(t))}fromHexString(t){const[e,i,n,r]=my(t);this.r=e,this.g=i,this.b=n,this.a=r}isInit(){return this._isInit}interpolationFrom(t,e,i){i.r=t.r+(this.r-t.r)*e,i.g=t.g+(this.g-t.g)*e,i.b=t.b+(this.b-t.b)*e,i.a=t.a+(this.a-t.a)*e}by(t,e){e.r=Math.min(Math.max(this.r+t.r,0),255),e.g=Math.min(Math.max(this.g+t.g,0),255),e.b=Math.min(Math.max(this.b+t.b,0),255),e.a=Math.min(Math.max(this.a+t.a,0),1)}toHexString(){return gy([this.r,this.g,this.b,this.a])}}function fy(t){const e=t.substring(1);return[parseInt(e.substring(0,6),16),parseInt(e.substring(6,8),16)/255]}function my(t){return 0===(t=t.replace(/^#/,"")).substring(6,8).length&&(t+="FF"),[parseInt(t.substring(0,2).padStart(8,"0"),16)/255,parseInt(t.substring(2,4).padStart(8,"0"),16)/255,parseInt(t.substring(4,6).padStart(8,"0"),16)/255,parseInt(t.substring(6,8).padStart(8,"0"),16)/255]}function gy(t){return"#"+Math.round(255*t[0]).toString(16).padStart(2,"0")+Math.round(255*t[1]).toString(16).padStart(2,"0")+Math.round(255*t[2]).toString(16).padStart(2,"0")+Math.round(255*t[3]).toString(16).padStart(2,"0")}function vy(t,e,i){const n=my(t),r=my(e),s=Math.round(255*(n[0]+(r[0]-n[0])*i)),o=Math.round(255*(n[1]+(r[1]-n[1])*i)),a=Math.round(255*(n[2]+(r[2]-n[2])*i)),l=Math.round(255*(n[3]+(r[3]-n[3])*i));return"#"+s.toString(16).padStart(2,"0")+o.toString(16).padStart(2,"0")+a.toString(16).padStart(2,"0")+l.toString(16).padStart(2,"0")}class _y extends Wp{constructor(){super(void 0,"\nvarying vec2 vTextureCoord;\n\nuniform vec4 color;\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n\n if (texColor.a > 0.0) {\n vec4 resultColor = color;\n resultColor = resultColor * texColor.a;\n gl_FragColor = resultColor;\n } else {\n gl_FragColor = texColor;\n }\n}\n",{color:new Float32Array([0,0,0,0]),active:0}),this.currentColor="#FFFFFFFF",this.designColor="#FFFFFFFF"}set color(t){this.currentColor=t;const e=my(t);this.uniforms.color=Float32Array.from(e)}get color(){return this.currentColor}}const yy=new y_.ColorMatrixFilter;yy.matrix=[1,0,0,0,-.2,0,1,0,0,-.2,0,0,1,0,-.2,0,0,0,1,0];const xy=new y_.ColorMatrixFilter;xy.matrix=[1,0,0,0,-.1,0,1,0,0,-.1,0,0,1,0,-.1,0,0,0,1,0];const by=new y_.ColorMatrixFilter;by.matrix=[1,0,0,0,.2,0,1,0,0,.2,0,0,1,0,.2,0,0,0,1,0];const Ty=new y_.ColorMatrixFilter;Ty.matrix=[1,0,0,0,.1,0,1,0,0,.1,0,0,1,0,.1,0,0,0,1,0];const Ey={darken:yy,darkenLess:xy,lightenLess:Ty,lighten:by};class wy extends hy{constructor(t,e,i){super({position:{x:t.x,y:t.y},width:t.width,height:t.height},e,i),this.fillColorFilter=new _y,this.fill=new ny(this),this.json=t,this.ctx=e,this.parentGlobalPos=i,this.global={x:i.x+t.x,y:i.y+t.y},this.updateTransform({position:{x:t.x,y:t.y},width:t.width,height:t.height})}get fillActive(){var t,e;return(null!==(e=null===(t=this.container.filters)||void 0===t?void 0:t.length)&&void 0!==e?e:-1)>0}set fillActive(t){var e,i;t?(null!==(i=null===(e=this.container.filters)||void 0===e?void 0:e.indexOf(this.fillColorFilter))&&void 0!==i?i:-1)<0&&(this.container.filters=[this.fillColorFilter]):this.container.filters=[]}get renderContainer(){return this.container}get interactiveContainer(){return this.container}clearOnSlideChange(){}initOnReuse(){}getTextElement(){return null}getBgElement(){return null}get ppt_x(){return this.global.x/this.ctx.stageWidth}set ppt_x(t){const e=t*this.ctx.stageWidth-this.global.x,i=544===this.presetSubType?this.scaleExt.x:1;this.container.position.x=this.designX+e+this.container.pivot.x*i}get ppt_y(){return this.global.y/this.ctx.stageHeight}set ppt_y(t){const e=t*this.ctx.stageHeight-this.global.y,i=544===this.presetSubType?this.scaleExt.y:1;this.container.position.y=this.designY+e+this.container.pivot.y*i}get design_ppt_x(){return ay(this.global.x/this.ctx.stageWidth)}get design_ppt_y(){return ay(this.global.y/this.ctx.stageHeight)}}class Sy{constructor(t,e,i,n,r,s,o,a,l,h,c){this.ctx=t,this.type=e,this.lineWidth=i,this.width=n,this.height=r,this.fillColor=s,this.isHorz=o,this.renderContainer=new pd,this.ghcTextureId=`${a}-text-p${l}-l${h}-u${c}-underLine`}createPaths(){if("ww"===this.type)return null;{let t=`M 0,0 L ${9525*this.width},0`,[e,i]=[this.width,this.lineWidth];return this.isHorz||(t="M 0,0 L 0,"+9525*this.height,[e,i]=[this.lineWidth,this.height]),{paths:[{id:A_(),path:t,fill:"norm",hasStroke:!0,scale:{x:1,y:1},hash:H_()(t)}],width:e,height:i}}}getLineStyle(){const t={width:this.lineWidth};return"dotted"===this.type&&(t.dash=""+this.lineWidth),t}preRender(){const t=this.createPaths();if(t){const{paths:e,width:i,height:n}=t,r=e.reduce((t,e)=>t+e.hash,"");this.ctx.graphicsTexture.addGraphics(this.ghcTextureId,e,r,{x:0,y:0},i,n,this.getLineStyle(),this.ctx.objectPoolGroup,!1,null,this.fillColor)}}render(){if(this.ghcTextureId){const t=this.ctx.graphicsTexture.getGraphicsData(this.ghcTextureId);t&&(this.sprite=new fm,this.sprite.texture=t.texture,this.sprite.pivot.x=t.pivot.x)}}destroy(){var t;null===(t=this.sprite)||void 0===t||t.destroy({texture:!0})}}const My=134217729;function Ay(t,e,i,n,r){let s,o,a,l,h=e[0],c=n[0],u=0,d=0;c>h==c>-h?(s=h,h=e[++u]):(s=c,c=n[++d]);let p=0;if(u<t&&d<i)for(c>h==c>-h?(o=h+s,a=s-(o-h),h=e[++u]):(o=c+s,a=s-(o-c),c=n[++d]),s=o,0!==a&&(r[p++]=a);u<t&&d<i;)c>h==c>-h?(o=s+h,l=o-s,a=s-(o-l)+(h-l),h=e[++u]):(o=s+c,l=o-s,a=s-(o-l)+(c-l),c=n[++d]),s=o,0!==a&&(r[p++]=a);for(;u<t;)o=s+h,l=o-s,a=s-(o-l)+(h-l),h=e[++u],s=o,0!==a&&(r[p++]=a);for(;d<i;)o=s+c,l=o-s,a=s-(o-l)+(c-l),c=n[++d],s=o,0!==a&&(r[p++]=a);return 0===s&&0!==p||(r[p++]=s),p}function Py(t,e){let i=e[0];for(let n=1;n<t;n++)i+=e[n];return i}function Ry(t){return new Float64Array(t)}const Iy=Ry(4),Cy=Ry(8),Ly=Ry(12),Ny=Ry(16),Oy=Ry(4);function Dy(t,e,i,n,r,s){const o=(e-s)*(i-r),a=(t-r)*(n-s),l=o-a;if(0===o||0===a||o>0!=a>0)return l;const h=Math.abs(o+a);return Math.abs(l)>=33306690738754716e-32*h?l:-function(t,e,i,n,r,s,o){let a,l,h,c,u,d,p,f,m,g,v,_,y,x,b,T,E,w;const S=t-r,M=i-r,A=e-s,P=n-s;x=S*P,d=My*S,p=d-(d-S),f=S-p,d=My*P,m=d-(d-P),g=P-m,b=f*g-(x-p*m-f*m-p*g),T=A*M,d=My*A,p=d-(d-A),f=A-p,d=My*M,m=d-(d-M),g=M-m,E=f*g-(T-p*m-f*m-p*g),v=b-E,u=b-v,Iy[0]=b-(v+u)+(u-E),_=x+v,u=_-x,y=x-(_-u)+(v-u),v=y-T,u=y-v,Iy[1]=y-(v+u)+(u-T),w=_+v,u=w-_,Iy[2]=_-(w-u)+(v-u),Iy[3]=w;let R=Py(4,Iy),I=22204460492503146e-32*o;if(R>=I||-R>=I)return R;if(u=t-S,a=t-(S+u)+(u-r),u=i-M,h=i-(M+u)+(u-r),u=e-A,l=e-(A+u)+(u-s),u=n-P,c=n-(P+u)+(u-s),0===a&&0===l&&0===h&&0===c)return R;if(I=11093356479670487e-47*o+33306690738754706e-32*Math.abs(R),R+=S*c+P*a-(A*h+M*l),R>=I||-R>=I)return R;x=a*P,d=My*a,p=d-(d-a),f=a-p,d=My*P,m=d-(d-P),g=P-m,b=f*g-(x-p*m-f*m-p*g),T=l*M,d=My*l,p=d-(d-l),f=l-p,d=My*M,m=d-(d-M),g=M-m,E=f*g-(T-p*m-f*m-p*g),v=b-E,u=b-v,Oy[0]=b-(v+u)+(u-E),_=x+v,u=_-x,y=x-(_-u)+(v-u),v=y-T,u=y-v,Oy[1]=y-(v+u)+(u-T),w=_+v,u=w-_,Oy[2]=_-(w-u)+(v-u),Oy[3]=w;const C=Ay(4,Iy,4,Oy,Cy);x=S*c,d=My*S,p=d-(d-S),f=S-p,d=My*c,m=d-(d-c),g=c-m,b=f*g-(x-p*m-f*m-p*g),T=A*h,d=My*A,p=d-(d-A),f=A-p,d=My*h,m=d-(d-h),g=h-m,E=f*g-(T-p*m-f*m-p*g),v=b-E,u=b-v,Oy[0]=b-(v+u)+(u-E),_=x+v,u=_-x,y=x-(_-u)+(v-u),v=y-T,u=y-v,Oy[1]=y-(v+u)+(u-T),w=_+v,u=w-_,Oy[2]=_-(w-u)+(v-u),Oy[3]=w;const L=Ay(C,Cy,4,Oy,Ly);x=a*c,d=My*a,p=d-(d-a),f=a-p,d=My*c,m=d-(d-c),g=c-m,b=f*g-(x-p*m-f*m-p*g),T=l*h,d=My*l,p=d-(d-l),f=l-p,d=My*h,m=d-(d-h),g=h-m,E=f*g-(T-p*m-f*m-p*g),v=b-E,u=b-v,Oy[0]=b-(v+u)+(u-E),_=x+v,u=_-x,y=x-(_-u)+(v-u),v=y-T,u=y-v,Oy[1]=y-(v+u)+(u-T),w=_+v,u=w-_,Oy[2]=_-(w-u)+(v-u),Oy[3]=w;const N=Ay(L,Ly,4,Oy,Ny);return Ny[N-1]}(t,e,i,n,r,s,h)}Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(8),Ry(8),Ry(8),Ry(4),Ry(8),Ry(8),Ry(8),Ry(12);Ry(192),Ry(192);Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(8),Ry(8),Ry(8),Ry(8),Ry(8),Ry(8),Ry(8),Ry(8),Ry(8),Ry(4),Ry(4),Ry(4),Ry(8),Ry(16),Ry(16),Ry(16),Ry(32),Ry(32),Ry(48),Ry(64);Ry(1152),Ry(1152);Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(4),Ry(24),Ry(24),Ry(24),Ry(24),Ry(24),Ry(24),Ry(24),Ry(24),Ry(24),Ry(24),Ry(1152),Ry(1152),Ry(1152),Ry(1152),Ry(1152),Ry(2304),Ry(2304),Ry(3456),Ry(5760),Ry(8),Ry(8),Ry(8),Ry(16),Ry(24),Ry(48),Ry(48),Ry(96),Ry(192),Ry(384),Ry(384),Ry(384),Ry(768);Ry(96),Ry(96),Ry(96),Ry(1152);const Fy=Math.pow(2,-52),Uy=new Uint32Array(512);class ky{static from(t,e=Vy,i=Wy){const n=t.length,r=new Float64Array(2*n);for(let s=0;s<n;s++){const n=t[s];r[2*s]=e(n),r[2*s+1]=i(n)}return new ky(r)}constructor(t){const e=t.length>>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const i=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*i),this._halfedges=new Int32Array(3*i),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:i,_hullTri:n,_hullHash:r}=this,s=t.length>>1;let o=1/0,a=1/0,l=-1/0,h=-1/0;for(let e=0;e<s;e++){const i=t[2*e],n=t[2*e+1];i<o&&(o=i),n<a&&(a=n),i>l&&(l=i),n>h&&(h=n),this._ids[e]=e}const c=(o+l)/2,u=(a+h)/2;let d,p,f,m=1/0;for(let e=0;e<s;e++){const i=By(c,u,t[2*e],t[2*e+1]);i<m&&(d=e,m=i)}const g=t[2*d],v=t[2*d+1];m=1/0;for(let e=0;e<s;e++){if(e===d)continue;const i=By(g,v,t[2*e],t[2*e+1]);i<m&&i>0&&(p=e,m=i)}let _=t[2*p],y=t[2*p+1],x=1/0;for(let e=0;e<s;e++){if(e===d||e===p)continue;const i=Hy(g,v,_,y,t[2*e],t[2*e+1]);i<x&&(f=e,x=i)}let b=t[2*f],T=t[2*f+1];if(x===1/0){for(let e=0;e<s;e++)this._dists[e]=t[2*e]-t[0]||t[2*e+1]-t[1];jy(this._ids,this._dists,0,s-1);const e=new Uint32Array(s);let i=0;for(let t=0,n=-1/0;t<s;t++){const r=this._ids[t];this._dists[r]>n&&(e[i++]=r,n=this._dists[r])}return this.hull=e.subarray(0,i),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(Dy(g,v,_,y,b,T)<0){const t=p,e=_,i=y;p=f,_=b,y=T,f=t,b=e,T=i}const E=function(t,e,i,n,r,s){const o=i-t,a=n-e,l=r-t,h=s-e,c=o*o+a*a,u=l*l+h*h,d=.5/(o*h-a*l);return{x:t+(h*c-a*u)*d,y:e+(o*u-l*c)*d}}(g,v,_,y,b,T);this._cx=E.x,this._cy=E.y;for(let e=0;e<s;e++)this._dists[e]=By(t[2*e],t[2*e+1],E.x,E.y);jy(this._ids,this._dists,0,s-1),this._hullStart=d;let w=3;i[d]=e[f]=p,i[p]=e[d]=f,i[f]=e[p]=d,n[d]=0,n[p]=1,n[f]=2,r.fill(-1),r[this._hashKey(g,v)]=d,r[this._hashKey(_,y)]=p,r[this._hashKey(b,T)]=f,this.trianglesLen=0,this._addTriangle(d,p,f,-1,-1,-1);for(let s,o,a=0;a<this._ids.length;a++){const l=this._ids[a],h=t[2*l],c=t[2*l+1];if(a>0&&Math.abs(h-s)<=Fy&&Math.abs(c-o)<=Fy)continue;if(s=h,o=c,l===d||l===p||l===f)continue;let u=0;for(let t=0,e=this._hashKey(h,c);t<this._hashSize&&(u=r[(e+t)%this._hashSize],-1===u||u===i[u]);t++);u=e[u];let m,g=u;for(;m=i[g],Dy(h,c,t[2*g],t[2*g+1],t[2*m],t[2*m+1])>=0;)if(g=m,g===u){g=-1;break}if(-1===g)continue;let v=this._addTriangle(g,l,i[g],-1,-1,n[g]);n[l]=this._legalize(v+2),n[g]=v,w++;let _=i[g];for(;m=i[_],Dy(h,c,t[2*_],t[2*_+1],t[2*m],t[2*m+1])<0;)v=this._addTriangle(_,l,m,n[l],-1,n[_]),n[l]=this._legalize(v+2),i[_]=_,w--,_=m;if(g===u)for(;m=e[g],Dy(h,c,t[2*m],t[2*m+1],t[2*g],t[2*g+1])<0;)v=this._addTriangle(m,l,g,-1,n[g],n[m]),this._legalize(v+2),n[m]=v,i[g]=g,w--,g=m;this._hullStart=e[l]=g,i[g]=e[_]=l,i[l]=_,r[this._hashKey(h,c)]=l,r[this._hashKey(t[2*g],t[2*g+1])]=g}this.hull=new Uint32Array(w);for(let t=0,e=this._hullStart;t<w;t++)this.hull[t]=e,e=i[e];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,e){return Math.floor(function(t,e){const i=t/(Math.abs(t)+Math.abs(e));return(e>0?3-i:1+i)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:i,coords:n}=this;let r=0,s=0;for(;;){const o=i[t],a=t-t%3;if(s=a+(t+2)%3,-1===o){if(0===r)break;t=Uy[--r];continue}const l=o-o%3,h=a+(t+1)%3,c=l+(o+2)%3,u=e[s],d=e[t],p=e[h],f=e[c];if(Gy(n[2*u],n[2*u+1],n[2*d],n[2*d+1],n[2*p],n[2*p+1],n[2*f],n[2*f+1])){e[t]=f,e[o]=u;const n=i[c];if(-1===n){let e=this._hullStart;do{if(this._hullTri[e]===c){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,n),this._link(o,i[s]),this._link(s,c);const a=l+(o+1)%3;r<Uy.length&&(Uy[r++]=a)}else{if(0===r)break;t=Uy[--r]}}return s}_link(t,e){this._halfedges[t]=e,-1!==e&&(this._halfedges[e]=t)}_addTriangle(t,e,i,n,r,s){const o=this.trianglesLen;return this._triangles[o]=t,this._triangles[o+1]=e,this._triangles[o+2]=i,this._link(o,n),this._link(o+1,r),this._link(o+2,s),this.trianglesLen+=3,o}}function By(t,e,i,n){const r=t-i,s=e-n;return r*r+s*s}function Gy(t,e,i,n,r,s,o,a){const l=t-o,h=e-a,c=i-o,u=n-a,d=r-o,p=s-a,f=c*c+u*u,m=d*d+p*p;return l*(u*m-f*p)-h*(c*m-f*d)+(l*l+h*h)*(c*p-u*d)<0}function Hy(t,e,i,n,r,s){const o=i-t,a=n-e,l=r-t,h=s-e,c=o*o+a*a,u=l*l+h*h,d=.5/(o*h-a*l),p=(h*c-a*u)*d,f=(o*u-l*c)*d;return p*p+f*f}function jy(t,e,i,n){if(n-i<=20)for(let r=i+1;r<=n;r++){const n=t[r],s=e[n];let o=r-1;for(;o>=i&&e[t[o]]>s;)t[o+1]=t[o--];t[o+1]=n}else{let r=i+1,s=n;zy(t,i+n>>1,r),e[t[i]]>e[t[n]]&&zy(t,i,n),e[t[r]]>e[t[n]]&&zy(t,r,n),e[t[i]]>e[t[r]]&&zy(t,i,r);const o=t[r],a=e[o];for(;;){do{r++}while(e[t[r]]<a);do{s--}while(e[t[s]]>a);if(s<r)break;zy(t,r,s)}t[i+1]=t[s],t[s]=o,n-r+1>=s-i?(jy(t,e,r,n),jy(t,e,i,s-1)):(jy(t,e,i,s-1),jy(t,e,r,n))}}function zy(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function Vy(t){return t[0]}function Wy(t){return t[1]}function Xy(t,e,i){let n=null;const r=new pd;if(t.stopList.sort((t,e)=>t.pos-e.pos),!t.stopList.find(t=>0===t.pos)){const e=t.stopList[0];t.stopList.unshift({pos:0,color:e.color})}if(!t.stopList.find(t=>1===t.pos)){const e=t.stopList[t.stopList.length-1];t.stopList.push({pos:1,color:e.color})}const s=t=>{const e=[];for(let i=0,n=t.length;i<n-1;i++){const n=t[i],r=t[i+1],s=n.pos+.5*(r.pos-n.pos),o=vy(n.color,r.color,.5),a=2*i;e[a]=n,e[a+1]={color:o,pos:s},e[a+2]=r}return e};if(t.stopList=s(t.stopList),t.stopList=s(t.stopList),n=t.line?Yy(t,e,i):t.path?function(t,e,i){var n,r,s;const o=[],a={x:0,y:0};if("circle"===(null===(n=t.path)||void 0===n?void 0:n.path)||"rect"===(null===(r=t.path)||void 0===r?void 0:r.path)||"shape"===(null===(s=t.path)||void 0===s?void 0:s.path)){const n=e/2,r=i/2,s=Math.sqrt(n*n+r*r);t.stopList.forEach(t=>{if(0===t.pos)o.push({point:{x:0,y:0},color:t.color});else{const e=s*t.pos,i=new Xo;i.absellipse(0,0,e,e,0,2*Math.PI,!1,0),i.getPoints(50).forEach(e=>{o.push({point:{x:e.x,y:e.y},color:t.color})})}a.x=n,a.y=r})}return{points:o,position:a}}(t,e,i):Yy(t,e,i),n){const t=[],s=[],{position:o,points:a}=n,l=ky.from(a,t=>t.point.x,t=>t.point.y);for(let e=0;e<l.triangles.length;e+=3)t.push(a[l.triangles[e]].point.x,a[l.triangles[e]].point.y),t.push(a[l.triangles[e+1]].point.x,a[l.triangles[e+1]].point.y),t.push(a[l.triangles[e+2]].point.x,a[l.triangles[e+2]].point.y),s.push(...my(a[l.triangles[e]].color)),s.push(...my(a[l.triangles[e+1]].color)),s.push(...my(a[l.triangles[e+2]].color));const h=new tp;h.addAttribute("aVertexPosition",t,2),h.addAttribute("aColor",s,4);const c=zp.from("\n precision mediump float;\n attribute vec2 aVertexPosition;\n attribute vec4 aColor;\n uniform mat3 translationMatrix;\n uniform mat3 projectionMatrix;\n varying vec4 vColor;\n void main() {\n vColor = aColor;\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n }","precision mediump float; \n varying vec4 vColor;\n void main() {\n float alpha = vColor.a;\n vec4 color = vColor;\n color.a = 1.0;\n gl_FragColor = color * alpha;\n }\n "),u=new Jv;u.drawRect(0,0,e+1,i+1),r.mask=u,r.addChild(u);const d=new _v(h,c);d.position.x=o.x,d.position.y=o.y,r.addChild(d)}return r}function Yy(t,e,i){const n=e/2,r=i/2,s=[{x:-n,y:r},{x:-n,y:-r},{x:n,y:r},{x:n,y:-r}],o=[ly.fromPointSlope({x:-n,y:0},Math.PI/2),ly.fromPointSlope({x:0,y:r},0),ly.fromPointSlope({x:n,y:0},Math.PI/2),ly.fromPointSlope({x:0,y:-r},0)],a=[],l=t.stopList.slice(1,t.stopList.length-1).map(s=>{var l,h,c;const u=2*Math.PI;let d=null!==(h=null===(l=t.line)||void 0===l?void 0:l.ang)&&void 0!==h?h:0;for(;d>u;)d-=u;for(;d<0;)d+=u;const p={x:0,y:0};oy(d,Math.PI/2)?(p.x=0,p.y=i/2-s.pos*i):oy(d,0)?(p.x=s.pos*e-e/2,p.y=0):(p.x=s.pos*e-e/2,p.y=i/2-s.pos*i),d>Math.PI/2&&d<=Math.PI&&(p.x*=-1),d>Math.PI&&d<=2*Math.PI&&(p.y*=-1);const f=ly.fromPointSlope(p,Math.PI/2-((null===(c=t.line)||void 0===c?void 0:c.ang)||0)),m=o.map(t=>f.crossPoint(t)).filter(t=>t&&t.x<=n&&t.x>=-n&&t.y<=r&&t.y>=-r).map(t=>({point:t,color:s.color})).sort((t,e)=>e.point.y-t.point.y);a.push(...m);let g=Math.abs(m[1].point.x-m[0].point.x)/10;for(let t=20;t--;){const e=t%2==0?1:-1,i=p.x+e*g,o=f.resolveY(i);i<=n&&i>=-n&&o<=r&&o>=-r&&a.push({point:{x:i,y:o},color:s.color}),g+=g}return f});let h=[],c=[];t:for(let e=0;e<s.length;e++){const i=s[e];for(let e=0;e<l.length-1;e++){const n=l[e],r=l[e+1],s=n.distanceToLinearEquation(r),o=n.distanceToPoint(i),h=r.distanceToPoint(i);if(o<s&&h<s){const n=t.stopList.slice(1,t.stopList.length-1)[e],r=t.stopList.slice(1,t.stopList.length-1)[e+1],l=vy(n.color,r.color,o/s);a.splice(e+1,0,{point:i,color:l});continue t}}const n=l[0],r=l[l.length-1],o=n.distanceToPoint(i),u=r.distanceToPoint(i);o<=u?h.push({point:i,dis:o}):c.push({point:i,dis:u})}h=h.sort((t,e)=>e.dis-t.dis);const u=h.map((e,i)=>{if(0===i)return{point:e.point,color:t.stopList[0].color};{const i=t.stopList[0].color,n=t.stopList[1].color;return{point:e.point,color:vy(i,n,1-(0===h[0].dis?1:e.dis/h[0].dis))}}}).sort((t,e)=>e.point.y-t.point.y);c=c.sort((t,e)=>e.dis-t.dis);const d=c.map((e,i)=>{if(0===i)return{point:e.point,color:t.stopList[t.stopList.length-1].color};{const i=t.stopList[t.stopList.length-2].color,n=t.stopList[t.stopList.length-1].color;return{point:e.point,color:vy(i,n,0===c[0].dis?0:e.dis/c[0].dis)}}}).sort((t,e)=>e.point.y-t.point.y),p=u.concat(...a).concat(d);for(let t=0;t<p.length;t++)p[t].point.x+=n,p[t].point.y=-p[t].point.y+r;return{points:p,position:{x:0,y:0}}}const qy="\nvec3 rgb2hsl(vec3 rgb) {\n float cMax = max(max(rgb.r, rgb.g), rgb.b);\n float cMin = min(min(rgb.r, rgb.g), rgb.b);\n float delta = cMax - cMin;\n \n float h = 0.0;\n if (delta == 0.0) {\n h = 0.0;\n } else if (cMax == rgb.r) {\n h = 60.0 * mod(((rgb.g - rgb.b) / delta), 6.0);\n } else if (cMax == rgb.g ) {\n h = 60.0 * ((rgb.b - rgb.r) / delta + 2.0);\n } else if (cMax == rgb.b) {\n h = 60.0 * ((rgb.r - rgb.g) / delta + 4.0);\n }\n \n float l = (cMax + cMin) / 2.0;\n \n float s = 0.0;\n if (delta == 0.0) {\n s = 0.0;\n } else {\n s = delta / (1.0 - abs(2.0 * l - 1.0));\n }\n \n return vec3(h, s, l);\n}\n",Zy=[qy],Jy={biLevel:"\nvec4 transform(vec4 texColor, float arg) {\n mat3 rgb2yuv = mat3(\n 0.2126, 0.7152, 0.0722,\n -0.09991, -0.33609, 0.43600,\n 0.615, -0.5586, -0.05639\n );\n vec3 yuv = texColor.rgb * rgb2yuv;\n if (yuv.x >= 0.49 || texColor.a < 0.9) {\n return vec4(1.0, 1.0, 1.0, 1.0) * texColor.a;\n } else {\n return vec4(0.0, 0.0, 0.0, 1.0) * texColor.a;\n }\n}\n",alphaModFix:"\nvec4 transform(vec4 texColor, float arg) {\n return texColor * arg;\n}\n",alphaBiLevel:"\nvec4 transform(vec4 texColor, float arg) {\n vec4 result = vec4(texColor);\n result.rgb = result.rgb / texColor.a;\n if (texColor.a < arg) {\n result.a = 0.0;\n } else {\n result.a = 1.0;\n }\n return result;\n}\n",alphaCeiling:"\nvec4 transform(vec4 texColor, float arg) {\n vec4 result = vec4(texColor);\n result.rgb = result.rgb / texColor.a;\n if (texColor.a > 0.0) {\n result.a = 1.0;\n }\n return result;\n}\n",alphaFloor:"\nvec4 transform(vec4 texColor, float arg) {\n vec4 result = vec4(texColor);\n result.rgb = result.rgb / texColor.a;\n if (texColor.a < 1.0) {\n result.a = 0.0;\n }\n return result;\n}\n",grayscl:"\nvec4 transform(vec4 texColor, float arg) {\n float avg = (texColor.r + texColor.g + texColor.b) / 3.0;\n return vec4(avg, avg, avg, texColor.a);\n}\n"};class Ky extends Wp{constructor(t,e){var i;super(void 0,(i=Jy[t],`\nvarying vec2 vTextureCoord;\n\nuniform float arg;\nuniform sampler2D uSampler;\n\n${Zy.map(t=>t+"\n").join("\n")}\n\n${i}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg);\n}\n`),{arg:e})}}const $y=[qy],Qy={clrChange:"\nvec4 transform(vec4 texColor, vec4 arg1, vec4 arg2) {\n float epsilon = 0.001;\n vec3 colorDiff = arg1.rgb - (texColor.rgb / max(texColor.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n if (colorDistance < epsilon) {\n arg2.rgb *= arg2.a;\n return arg2;\n } else {\n return texColor;\n }\n}\n",changeBulletColor:"\nvec4 transform(vec4 texColor, vec4 arg1, vec4 arg2) {\n if (texColor.a == 0.0) {\n return texColor;\n } else {\n return arg2;\n }\n}\n",duotone:"\nvec4 transform(vec4 texColor, vec4 arg1, vec4 arg2) {\n float avg = (texColor.r + texColor.g + texColor.b) / 3.0;\n\n vec3 hsl = rgb2hsl(vec3(avg, avg, avg));\n\n vec3 result = arg2.rgb * hsl.z + arg1.rgb * (1.0 - hsl.z);\n\n return vec4(result * texColor.a, texColor.a);\n}\n"};class tx extends Wp{constructor(t,e,i){var n;super(void 0,(n=Qy[t],`\nvarying vec2 vTextureCoord;\n\nuniform vec4 arg1;\nuniform vec4 arg2;\nuniform sampler2D uSampler;\n\n${$y.map(t=>t+"\n").join("\n")}\n\n${n}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg1, arg2);\n}\n`),{arg1:Float32Array.from(e),arg2:Float32Array.from(i)})}}const ex=[qy],ix={lum:"\nvec4 transform(vec4 texColor, float arg1, float arg2) {\n vec3 rgb = texColor.rgb / texColor.a;\n\n // 对比度\n float C = arg2 * 255.0;\n float F = (259.0 * (255.0 + C)) / (255.0 * (259.0 - C));\n rgb.rgb = F * (rgb.rgb - 0.5) + 0.5;\n\n // 亮度\n rgb.rgb += arg1;\n\n rgb.rgb *= texColor.a;\n return vec4(rgb, texColor.a);\n}\n"};class nx extends Wp{constructor(t,e,i){var n;super(void 0,(n=ix[t],`\nvarying vec2 vTextureCoord;\n\nuniform float arg1;\nuniform float arg2;\nuniform sampler2D uSampler;\n\n${ex.map(t=>t+"\n").join("\n")}\n\n${n}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg1, arg2);\n}\n`),{arg1:e,arg2:i})}}const rx=[qy],sx={alphaInv:"\nvec4 transform(vec4 texColor, vec4 arg1) {\n float alpha = 1.0 - texColor.a;\n arg1.rgb = arg1.rgb * alpha;\n arg1.a = alpha;\n return arg1;\n}\n"};class ox extends Wp{constructor(t,e){var i;super(void 0,(i=sx[t],`\nvarying vec2 vTextureCoord;\n\nuniform vec4 arg1;\nuniform sampler2D uSampler;\n\n${rx.map(t=>t+"\n").join("\n")}\n\n${i}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg1);\n}\n`),{arg1:Float32Array.from(e)})}}class ax{constructor(t,e,i,n,r){this.ctx=t,this.fillStyle=e,this.width=i,this.height=n,this.config=r,this.clonedObjects=[],this._displayObject=null,this.gradientHash=H_()(`${JSON.stringify(e)}${Math.ceil(i)}${Math.ceil(n)}`)}get displayObject(){return this._displayObject||(this._displayObject=this.createDisplayObject()),this._displayObject}set displayObject(t){this._displayObject&&this._displayObject.destroy({children:!0,texture:!0}),this._displayObject=t}get hasFill(){return!!this.fillStyle&&"noFill"!==this.fillStyle.fillType}createDisplayObject(){var t;if(!this.fillStyle)return null;if(this.config.useSlideBackgroundFill&&this.ctx.bgTexture){const t=new fm;return t.texture=this.ctx.bgTexture,t}if("solidFill"===this.fillStyle.fillType||"noFill"===this.fillStyle.fillType)return null;if("gradientFill"===this.fillStyle.fillType){const t=new fm;let e=ax.gradientPool.get(this.gradientHash);if(!e){const t=Xy(this.fillStyle,this.width,this.height),i=Wd.create({width:this.width,height:this.height,resolution:this.ctx.renderer.resolution});this.ctx.renderer.render(t,{renderTexture:i}),e=i,ax.gradientPool.set(this.gradientHash,e),t.destroy({children:!0,texture:!0})}return t.texture=e,t}if("blipFill"===this.fillStyle.fillType){const{src:e,filters:i}=this.fillStyle,n=this.ctx.spriteTexture.getTexture(e),r=this.ctx.spriteTexture.getFrameData(e);if(n){const e=new fm;if(e.texture=n,i.length>0&&this.config.useFilter&&(this.ctx.featureList||{}).filter&&(e.filters=function(t,e){const i=[];return t.forEach(t=>{const n=((null==e?void 0:e.filter)||[]).indexOf(t.type)>=0;if(["biLevel","alphaBiLevel","alphaCeiling","alphaModFix","alphaFloor","grayscl"].indexOf(t.type)>=0&&n)i.push(new Ky(t.type,t.args[0]||0));else if(["clrChange","changeBulletColor","duotone"].indexOf(t.type)>=0&&n){const e=my(t.args[0]),n=my(t.args[1]);i.push(new tx(t.type,e,n))}else if("lum"===t.type&&n)i.push(new nx(t.type,t.args[0],t.args[1]));else if("alphaInv"===t.type&&n){const e=my(t.args[0]);i.push(new ox(t.type,e))}}),i}(i,this.ctx.featureList)),this.config.fillFloat){const{l:i,t:n,r:r,b:s}=this.config.fillFloat.fillRect,o=this.width*(1-i-r),a=this.height*(1-n-s),l=null!==(t=this.config.shapeRotation)&&void 0!==t?t:0,h=new Jv;h.drawRect(0,0,o,a),h.pivot.x=o/2,h.pivot.y=a/2,h.rotation=l;const c=h.getBounds(),u=c.width,d=c.height;e.width=u,e.height=d,e.anchor.x=.5,e.anchor.y=.5,e.rotation=-1*l,e.name="math-texture",0===l?(e.position.x=u/2+i*this.width,e.position.y=d/2+n*this.width):(e.position.x=this.width/2,e.position.y=this.height/2)}else e.width=this.width,e.height=this.height,r.rotate&&(e.position.x=this.width/2,e.position.y=this.height/2,e.anchor.x=.5,e.anchor.y=.5,e.rotation=r.rotate/180*Math.PI);return e}}else if("gifFill"===this.fillStyle.fillType){const{src:t,delays:e}=this.fillStyle,i=this.ctx.spriteTexture.getGifFrames(t).map((t,i)=>({texture:t,time:e[i]||20})),n=new Qv(i,!0);n.name=A_(),n.width=this.width,n.height=this.height;const r=this.fillStyle.loop;let s=1;return n.onLoop=()=>{s+=1,r>0&&s>r&&n.gotoAndStop(n.totalFrames)},n}return null}isSolidFill(){var t;return"solidFill"===(null===(t=this.fillStyle)||void 0===t?void 0:t.fillType)}getSolidFillColor(){var t;return"solidFill"===(null===(t=this.fillStyle)||void 0===t?void 0:t.fillType)?this.fillStyle.color:"#000000"}getClonedDisplayObject(){const t=this.createDisplayObject();return this.clonedObjects.push(t),t}destroy(){var t;null===(t=this._displayObject)||void 0===t||t.destroy(),this._displayObject=null,this.clonedObjects.forEach(t=>{null==t||t.destroy()}),this.clonedObjects=[]}}ax.gradientPool=new Map;var lx=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class hx extends wy{constructor(t,e,i){var n;super(t,e,i),this.textureContainer=new pd,this.underline=null,this.cacheSprite=new fm;const{shapeId:r,paragraphIndex:s,lineIndex:o,unitIndex:a,lineHeight:l,width:h,underLine:c,fill:u,height:d,isHorz:p,lineWidth:f}=t,m="solidFill"===(null===(n=null==u?void 0:u.fill)||void 0===n?void 0:n.fillType)?u.fill.color:null;if(c){const t=p?l/16:f/16;this.underline=new Sy(e,c.type,t,h,d,m,p,r,s,o,a)}this.textGraphics=this.createTextGraphics(),this.textFill=this.createTextFill(),this.strokeGraphics=this.createStrokeGraphics(),this.strokeFill=this.createStrokeFill()}createStrokeFill(){const{stroke:t,lineWidth:e,lineHeight:i}=this.json;return new ax(this.ctx,null==t?void 0:t.fill,e,i,{useFilter:!1,useSlideBackgroundFill:!1})}createStrokeGraphics(){const{stroke:t}=this.json,e=(null==t?void 0:t.key)?{fillType:"blipFill",src:t.key,filters:[]}:void 0;return new ax(this.ctx,e,(null==t?void 0:t.width)||0,(null==t?void 0:t.height)||0,{useFilter:!1,useSlideBackgroundFill:!1})}createTextFill(){const{isHorz:t,fill:e,lineWidth:i,lineHeight:n,fillLineHeight:r}=this.json;return t?new ax(this.ctx,null==e?void 0:e.fill,i,Math.max(r,n),{useFilter:!1,useSlideBackgroundFill:!1}):new ax(this.ctx,null==e?void 0:e.fill,r,n,{useFilter:!1,useSlideBackgroundFill:!1})}createTextGraphics(){var t;const{fill:e,content:i}=this.json;let n="#000000";"solidFill"===(null===(t=null==e?void 0:e.fill)||void 0===t?void 0:t.fillType)&&(n=e.fill.color);const r=(null==e?void 0:e.key)?{fillType:"blipFill",src:e.key,filters:[{type:"changeBulletColor",args:["#000000",n]}]}:void 0;return new ax(this.ctx,r,(null==e?void 0:e.width)||0,(null==e?void 0:e.height)||0,{useFilter:"◾"===i,useSlideBackgroundFill:!1})}getIterateEntry(){return null}getBgElement(){return null}updateTransform(t){var e,i,n,r;const{isHorz:s}=this.json;t.position={x:s&&null!==(i=null===(e=t.position)||void 0===e?void 0:e.x)&&void 0!==i?i:0,y:s?0:null!==(r=null===(n=t.position)||void 0===n?void 0:n.y)&&void 0!==r?r:0},t.width=s?this.json.width:this.json.lineWidth,t.height=s?this.json.lineHeight:this.json.height,super.updateTransform(t)}preRender(){var t;null===(t=this.underline)||void 0===t||t.preRender()}render(t){t.addSubMTask(()=>lx(this,void 0,void 0,(function*(){this.doRender()})),"@TextUnitImpl[doRender]")}doRender(){let t=!1;const{lineWidth:e,lineHeight:i,baseLine:n,isHorz:r,underline:s,height:o,width:a,highlightColor:l,x:h,y:c,content:u,fillLineHeight:d,fill:p}=this.json;let f=!1!==this.json.needFill;if(p&&p.fill&&"solidFill"!==p.fill.fillType&&(f=!0),l){const t=new Jv,[n,s]=fy(l);t.beginFill(n,s),t.drawRect(0,0,r?a:e,r?i:o),t.endFill(),this.textureContainer.addChild(t)}if(this.textGraphics.displayObject){const e=this.textGraphics.displayObject;if(r&&(e.position.y=c>0?c:0),f){const i=this.textFill.displayObject;if(i)i.mask=e,i.addChild(e),i.position.x=-h,e.position.x+=h,t=!0,this.textureContainer.addChild(i);else if(this.textFill.isSolidFill()){const i=new _y;i.color=this.textFill.getSolidFillColor(),e.filters=[i],t=!0,this.textureContainer.addChild(e)}}else this.textureContainer.addChild(e)}if(this.strokeGraphics.displayObject){const e=this.strokeGraphics.displayObject;if(f){const i=this.strokeFill.displayObject;if(i)i.mask=e,i.addChild(e),r?i.position.y=c>0?c:0:i.position.x=h,this.textureContainer.addChild(i);else if(this.strokeFill.isSolidFill()){r?e.position.y=c>0?c:0:e.position.x=h;const i=new _y;i.color=this.strokeFill.getSolidFillColor(),e.filters=[i],t=!0,this.textureContainer.addChild(e)}}else r?e.position.y=c>0?c:0:e.position.x=h,this.textureContainer.addChild(e)}if(this.underline&&(this.underline.render(),this.underline.sprite)){r?(this.underline.sprite.position.y=s?s-i/16:n,this.underline.sprite.position.x=0):(this.underline.sprite.position.x=0,this.underline.sprite.position.y=0);const t=this.textFill.getClonedDisplayObject();t?(t.mask=this.underline.sprite,t.addChild(this.underline.sprite),this.textureContainer.addChild(t)):this.textureContainer.addChild(this.underline.sprite)}if(t){const t=Wd.create({width:r?a:e,height:r?Math.max(d,i):o,resolution:this.ctx.renderer.resolution});this.ctx.renderer.render(this.textureContainer,{renderTexture:t}),this.cacheSprite.texture=t,r&&c<0&&(this.cacheSprite.position.y=c),this.container.addChild(this.cacheSprite)}else this.container.addChild(this.textureContainer);this.container.name=u}destroy(){this.textFill.destroy(),this.textGraphics.destroy(),this.strokeFill.destroy(),this.strokeGraphics.destroy(),this.cacheSprite.texture.destroy(!0),this.cacheSprite.destroy(),this.textureContainer.destroy(),this.container.destroy()}}var cx=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class ux extends wy{constructor(){super(...arguments),this.units=[],this.isHorz=!0}getIterateElements(){return this.units}getIterateEntry(t,e,i){return this.units[e]?this.units[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",i),null)}preRender(){}createUnits(t,e,i,n){for(let r=0,s=this.json.textUnits.length;r<s;r++)n.addSubMTask(()=>cx(this,void 0,void 0,(function*(){const n=this.json.textUnits[r],{height:s,width:o,fillHeight:a,baseline:l,y:h,underline:c}=this.json,u=new hx(Object.assign(Object.assign({},n),{lineHeight:s,lineWidth:o,baseLine:l-h,underline:c,fillLineHeight:a||s,isHorz:this.isHorz,shapeId:t,paragraphIndex:e,lineIndex:i,unitIndex:r}),this.ctx,this.global);u.preRender(),this.units.push(u)})),"@TextLineImpl[createUnits]")}render(t){for(const e of this.units.reverse())e.render(t),t.addSubMTask(()=>cx(this,void 0,void 0,(function*(){this.container.addChild(e.container)})),"@TextLineImpl[container.addChild]")}destroy(){this.units.forEach(t=>{t.destroy()}),this.container.destroy({children:!1})}}var dx=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class px extends wy{constructor(){super(...arguments),this.iterateElements=[],this.lines=[],this.isHorz=!0}getIterateElements(){if(this.iterateElements.length>0)return this.iterateElements;const t=this.lines.reduce((t,e)=>t=t.concat(e.getIterateElements()),[]);return this.iterateElements=t,t}getIterateEntry(t,e,i){const n=this.getIterateElements();return n[e]?n[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",i),null)}preRender(){}createLines(t,e,i){for(let n=0,r=this.json.lines.length;n<r;n++)i.addSubMTask(()=>dx(this,void 0,void 0,(function*(){const r=this.json.lines[n],s=new ux(r,this.ctx,this.global);s.isHorz=this.isHorz,s.container.name="line-"+n,s.createUnits(t,e,n,i),this.lines.push(s)})),"@TextParagraphImpl[createLines]")}render(t){for(const e of this.lines)e.render(t),t.addSubMTask(()=>dx(this,void 0,void 0,(function*(){this.container.addChild(e.container)})),"@TextParagraphImpl[container.addChild]")}destroy(){this.lines.forEach(t=>{t.destroy()}),this.container.destroy({children:!1})}}var fx=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class mx{constructor(t,e,i,n){this.iterateElements=[],this.paragraphs=[],this.container=new pd,this.json=t,this.ctx=e,this.parentGlobalPos=n,this.iterateType=i,this.container.name="textBody",this.global={x:this.parentGlobalPos.x+t.position.x,y:this.parentGlobalPos.y+t.position.y},this.container.position.x=t.position.x,this.container.position.y=t.position.y,this.container.scale.x=t.scale.x,this.container.scale.y=t.scale.y;const r=new Jv;r.drawRect(0,0,t.width,t.height),this.container.addChild(r)}get width(){return this.json.width}get height(){return this.json.height}get x(){return this.json.position.x}get y(){return this.json.position.y}getTextElement(t,e){return"paragraph"===t?this.paragraphs[e[0]]:null}getIterateEntry(t,e){return this.iterateElements[t]?this.iterateElements[t]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",e),null)}destroy(){this.paragraphs.forEach(t=>{t.destroy()})}createParagraphs(t,e){for(let i=0,n=this.json.paragraphs.length;i<n;i++)e.addSubMTask(()=>fx(this,void 0,void 0,(function*(){var n;const r=this.json.paragraphs[i],s=new px(r,this.ctx,this.global);s.isHorz=null===(n=this.json.isHorz)||void 0===n||n,s.createLines(t,i,e),e.addSubMTask(()=>fx(this,void 0,void 0,(function*(){this.iterateElements=this.iterateElements.concat(s.getIterateElements()),s.container.name="段落-"+i,this.paragraphs.push(s)})),"@TextBodyImpl[paragraphs.push]")})),"@TextBodyImpl[createParagraphs]")}render(t){for(const e of this.paragraphs)e.render(t),t.addSubMTask(()=>fx(this,void 0,void 0,(function*(){this.container.addChild(e.container)})),"@TextBodyImpl[container.addChild]");t.addSubMTask(()=>fx(this,void 0,void 0,(function*(){const{width:t}=this.container;this.container.scale.x<0&&(this.container.x+=-1*t)})),"@TextBodyImpl[reset width]")}}class gx{constructor(t){this.scaleX=1,this.scaleY=1,this.pivot={x:0,y:0},this.paths=[],this.hash="",this.width=0,this.height=0,this.graphicsId="",this.textureId="",this.id=t.id,this.type=t.type,this.heightSize=t.heightSize,this.widthSize=t.widthSize,this.fillStyle=t.fillStyle||{fillType:"solidFill",color:"#ffffffff"},this.lineWidth=t.lineWidth||1,this.position=t.position||{x:0,y:0},this.rotate=t.rotation||1,this.path=this.getUnitPath(),this.setScaleFromLineWidth(),this.setScaleFromSize(),this.generatePaths(),this.setPivot()}setPivot(){switch(this.type){case"oval":case"diamond":this.pivot={x:this.width/2,y:this.height/2};break;case"triangle":this.pivot={x:.7*this.width,y:this.height/2};break;case"arrow":case"stealth":default:this.pivot={x:this.width,y:this.height/2}}}generatePaths(){this.hash="arrow-"+H_()(this.path+this.scaleX+this.scaleY),this.paths=[{id:this.id,path:this.path,fill:"norm",hasStroke:!1,hash:this.hash,scale:{x:this.scaleX,y:this.scaleY}}]}getUnitPath(){switch(this.type){case"stealth":return"M 0,0 L 95250,47625 L 0,95250 L 28575,47625 C C";case"oval":return"M 0,47625 A 47625,47625,-3.14159265,6.2831853 C C";case"diamond":return"M 47625,0 L 95250,47625 L 47625,95250 L 0,47625 C C";case"arrow":return"M 9525,0 L 95250,47625 L 9525,95250 L 0,85725 L 68389.5,47625 L 0,9525 C C";case"triangle":return"M 0,0 L 95250,47625 L 0,95250 C C";default:return""}}setScaleFromLineWidth(){switch(this.type){case"stealth":case"oval":case"diamond":case"arrow":case"triangle":this.scaleX*=.29*this.lineWidth+.7,this.scaleY*=.29*this.lineWidth+.7;break;default:throw new Error("can't match any arrow type!")}}setScaleFromSize(){switch(this.type){case"stealth":case"oval":case"diamond":case"arrow":case"triangle":this.scaleX*=1,this.scaleY*=1;break;default:throw new Error("can't match any arrow type!")}switch(this.widthSize){case"sm":this.scaleX*=3/4;break;case"lg":this.scaleX*=1.25;break;case"med":this.scaleX*=1}switch(this.heightSize){case"sm":this.scaleY*=3/4;break;case"lg":this.scaleY*=1.25;break;case"med":this.scaleY*=1}this.width=10*this.scaleX,this.height=10*this.scaleY}}class vx{constructor(t,e,i,n,r,s,o,a,l,h,c){this.id=t,this.ctx=e,this.paths=i,this.hash=n,this.nept=r,this.width=s,this.height=o,this.lineStyle=a,this.shouldFill=l,this.bgColor=h,this.lnColor=c,this.clonedObjects=[],this._displayObject=null,this.isRectangle=!1,this.isPureRect=!1,this.isColoredPureRect=!1,this.isRectangle=this.rectangleDetect(i),this.isRectangle&&l?this.bgColor?this.isColoredPureRect=!0:this.isPureRect=!0:this.ctx.graphicsTexture.addGraphics(this.id,this.paths,this.hash,this.nept,this.width,this.height,this.lineStyle,this.ctx.objectPoolGroup,this.shouldFill,this.bgColor,this.lnColor)}get displayObject(){return this._displayObject}pointDis(t,e){return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)}rectangleDetect(t){if(1!==t.length)return!1;const e=t[0].path.trim().split(" ");if(10!==e.length)return!1;const i=[],n=[];for(let t=0;t<e.length;t+=2){const r=e[t],s=e[t+1],[o,a]=s.split(",").map(t=>Number(t)/100);i.push(r),n.push({x:o,y:a})}if("MLLLC"!==i.join(""))return!1;for(let t=0;t<3;t++){const e=n[t],i=n[t+1];if(e.x!==i.x&&e.y!==i.y)return!1}const r=n.slice(0,4).reduce((t,e)=>t+e.x,0)/4,s=n.slice(0,4).reduce((t,e)=>t+e.y,0)/4;if(Number.isNaN(r)||Number.isNaN(s))return!1;const o={x:r,y:s};return oy(this.pointDis(o,n[0]),this.pointDis(o,n[1]))&&oy(this.pointDis(o,n[0]),this.pointDis(o,n[2]))&&oy(this.pointDis(o,n[0]),this.pointDis(o,n[3]))&&this.pointDis(o,n[0])===this.pointDis(o,n[1])}createDisplayObject(){if(this.isPureRect){const t=new Jv;return t.beginFill(0,1),t.drawRect(0,0,this.width,this.height),t}if(this.isColoredPureRect&&this.bgColor){const t=new Jv,[e,i]=fy(this.bgColor);return t.beginFill(e,i),t.drawRect(0,0,this.width,this.height),t}{const t=new fm,e=this.ctx.graphicsTexture.getGraphicsData(this.id);return e?(t.texture=e.texture,t.pivot.x=e.pivot.x,t.pivot.y=e.pivot.y,t):null}}getClonedDisplayObject(){const t=this.createDisplayObject();return this.clonedObjects.push(t),t}render(){this._displayObject=this.createDisplayObject()}isNeedMask(t,e){let i=!1;return this._displayObject&&(i=!(this.isRectangle&&Math.abs(t-this._displayObject.width)<2&&Math.abs(e-this._displayObject.height)<2&&this.shouldFill)),i}addArrows(t){var e;null===(e=this._displayObject)||void 0===e||e.addChild(t)}destroy(){var t;null===(t=this._displayObject)||void 0===t||t.destroy(),this._displayObject=null,this.clonedObjects.forEach(t=>{null==t||t.destroy()}),this.clonedObjects=[]}}var _x=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};const yx={pivot:{x:0,y:0},width:0,height:0};class xx extends hy{constructor(t,e,i,n){var r;super(t,e,i),this.renderContainer=new pd,this.needCacheAsBitMap=!1,this.backgroundGraphics=null,this.effectList=[],this.strokeGraphics=null,this.arrowList=[],this.fillColorFilter=new _y,this.strokeColorFilter=new _y,this.id="",this.fill=new ny(this),this.stroke=new ey(this),this.effectObject=null,this.effectContainer=new pd,this.effectDisposer=()=>{},this.json=t,this.json.fillStyle&&"groupFill"===this.json.fillStyle.fillType&&n&&(this.json.fillStyle=n),this.id=t.id;const{fillStyle:s,lineStyle:o}=this.json;this.container.sortableChildren=!0,this.container.name=t.id+"_container_[Shape]",this.effectContainer.name="effect-container",this.effectContainer.zIndex=1,this.container.addChild(this.effectContainer),this.renderContainer.name=t.id+"_render_container_[Shape]",this.generateArrowList(),this.backgroundFill=this.createBackgroundFill(),this.backgroundGraphics=this.createBackgroundGraphics(),this.strokeFill=this.createStrokeFill(),this.strokeGraphics=this.createStrokeGraphics(),this.ctx.timingTargets.addTarget(this.id,this),"solidFill"===(null==s?void 0:s.fillType)&&(this.fillColorFilter.currentColor=s.color,this.fillColorFilter.designColor=s.color),"solidFill"===(null===(r=null==o?void 0:o.fill)||void 0===r?void 0:r.fillType)&&(this.strokeColorFilter.currentColor=o.fill.color,this.strokeColorFilter.designColor=o.fill.color),this.updateTransform(this.json),t.textBody&&(this.text=new mx(t.textBody,this.ctx,t.textBody.iterateType,{x:this.designGlobalPosition.x,y:this.designGlobalPosition.y})),this.container.hitArea=new Iu(1,1,this.json.width,this.json.height),this.ctx.slideScopeEventHub.once("slide-render",t=>{if(this.ctx.slideIndex===t&&this.effectObject){const t=this.getEffectTexture();t&&this.effectObject.createFrame(1,t)}})}get interactiveContainer(){return this.renderContainer}get strokeActive(){var t,e,i,n,r,s,o;return this.strokeFill.displayObject?(null!==(i=null===(e=null===(t=this.strokeFill.displayObject)||void 0===t?void 0:t.filters)||void 0===e?void 0:e.length)&&void 0!==i?i:-1)>0:(null!==(o=null===(s=null===(r=null===(n=this.strokeGraphics)||void 0===n?void 0:n.displayObject)||void 0===r?void 0:r.filters)||void 0===s?void 0:s.length)&&void 0!==o?o:-1)>0}set strokeActive(t){var e,i,n,r,s,o;const{displayObject:a}=this.strokeFill;t?a&&(null!==(i=null===(e=a.filters)||void 0===e?void 0:e.indexOf(this.strokeColorFilter))&&void 0!==i?i:-1)<0?a.filters=[this.strokeColorFilter]:(null===(n=this.strokeGraphics)||void 0===n?void 0:n.displayObject)&&(null!==(s=null===(r=this.strokeGraphics.displayObject.filters)||void 0===r?void 0:r.indexOf(this.strokeColorFilter))&&void 0!==s?s:-1)<0&&(this.strokeGraphics.displayObject.filters=[this.strokeColorFilter]):a?a.filters=[]:(null===(o=this.strokeGraphics)||void 0===o?void 0:o.displayObject)&&(this.strokeGraphics.displayObject.filters=[])}get fillActive(){var t,e,i,n,r,s,o;return this.backgroundFill.displayObject?(null!==(i=null===(e=null===(t=this.backgroundFill.displayObject)||void 0===t?void 0:t.filters)||void 0===e?void 0:e.length)&&void 0!==i?i:-1)>0:(null!==(o=null===(s=null===(r=null===(n=this.backgroundGraphics)||void 0===n?void 0:n.displayObject)||void 0===r?void 0:r.filters)||void 0===s?void 0:s.length)&&void 0!==o?o:-1)>0}set fillActive(t){var e,i,n,r,s,o;t?this.backgroundFill.displayObject&&(null!==(i=null===(e=this.backgroundFill.displayObject.filters)||void 0===e?void 0:e.indexOf(this.fillColorFilter))&&void 0!==i?i:-1)<0?this.backgroundFill.displayObject.filters=[this.fillColorFilter]:(null===(n=this.backgroundGraphics)||void 0===n?void 0:n.displayObject)&&(null!==(s=null===(r=this.backgroundGraphics.displayObject.filters)||void 0===r?void 0:r.indexOf(this.fillColorFilter))&&void 0!==s?s:-1)<0&&(this.backgroundGraphics.displayObject.filters=[this.fillColorFilter]):this.backgroundFill.displayObject?this.backgroundFill.displayObject.filters=[]:(null===(o=this.backgroundGraphics)||void 0===o?void 0:o.displayObject)&&(this.backgroundGraphics.displayObject.filters=[])}getTextElement(t,e){var i,n;return null!==(n=null===(i=this.text)||void 0===i?void 0:i.getTextElement(t,e))&&void 0!==n?n:null}getBgElement(){return this}getIterateEntry(t,e,i){return 0===e?this:"el"===t?(this.ctx.eventHub.emit("IterateTimeNodeEnd",i),null):this.text?this.text.getIterateEntry(e-1,i)||null:(this.ctx.eventHub.emit("IterateTimeNodeEnd",i),null)}getEffectTexture(){if(0===this.effectContainer.children.length)return null;const t=Wd.create({width:this.json.width,height:this.json.height,resolution:this.ctx.renderer.resolution});return this.ctx.renderer.render(this.effectContainer,{renderTexture:t}),t}createStrokeGraphics(){var t,e,i,n;const{id:r,geometry:s,lineStyle:o}=this.json,{width:a,height:l,pivot:h}=(null==s?void 0:s.lineTransform)||yx,c=a||this.json.width,u=l||this.json.height,d="solidFill"===(null===(t=null==o?void 0:o.fill)||void 0===t?void 0:t.fillType)?o.fill.color:null;return o&&"noFill"!==(null===(e=o.fill)||void 0===e?void 0:e.fillType)?new vx(r+"-path-graphics",this.ctx,null!==(i=null==s?void 0:s.paths)&&void 0!==i?i:[],null!==(n=null==s?void 0:s.hash)&&void 0!==n?n:"",h||{x:0,y:0},c,u,o,!1,null,d):null}createStrokeFill(){const[t,e]=this.calculateFillObjectOffset(),{geometry:i,lineStyle:n,width:r,height:s}=this.json,o=(null==i?void 0:i.lineTransform)||yx,a=z_()(null==n?void 0:n.width)?n.width:1;return new ax(this.ctx,null==n?void 0:n.fill,(o.width||r)+a+t,Math.max((o.height||s)+a,e),{useFilter:!0,useSlideBackgroundFill:!1})}createBackgroundGraphics(){var t;const{geometry:e,lineStyle:i,fillStyle:n,id:r}=this.json,{width:s,height:o,pivot:a}=(null==e?void 0:e.lineTransform)||yx,l=s||this.json.width,h=o||this.json.height,c="solidFill"===(null==n?void 0:n.fillType)?n.color:null;return n&&"noFill"!==n.fillType||this.json.isPicture?new vx(r+"-bg-graphics",this.ctx,null!==(t=null==e?void 0:e.paths)&&void 0!==t?t:[],(null==e?void 0:e.hash)||"",a||{x:0,y:0},l,h,i,!0,c,null):null}createBackgroundFill(){var t,e;const{fillStyle:i,width:n,height:r,lineStyle:s,geometry:o}=this.json,a=(null==o?void 0:o.fillTransform)||yx;return new ax(this.ctx,i,(a.width||n)+(null!==(t=null==s?void 0:s.width)&&void 0!==t?t:0),(a.height||r)+(null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0),{useFilter:!0,useSlideBackgroundFill:this.json.useBgFill,fillFloat:this.json.fillFloat,shapeRotation:this.json.rotation})}createBackground(){var t,e,i,n,r,s,o,a;const{pivot:l,width:h,height:c}=(null===(t=this.json.geometry)||void 0===t?void 0:t.fillTransform)||yx,{displayObject:u}=this.backgroundFill;u?(this.json.useBgFill&&(null===(i=this.backgroundGraphics)||void 0===i?void 0:i.displayObject)?(this.needCacheAsBitMap=!0,u.mask=this.backgroundGraphics.displayObject,u.pivot.x=(null===(n=this.json.position)||void 0===n?void 0:n.x)||0,u.pivot.y=(null===(r=this.json.position)||void 0===r?void 0:r.y)||0,this.effectContainer.addChild(this.backgroundGraphics.displayObject)):"gifFill"===(null===(s=this.json.fillStyle)||void 0===s?void 0:s.fillType)?(u.height=c||this.designHeight,u.width=h||this.designWidth,u instanceof Qv&&u.play(),(null===(o=this.backgroundGraphics)||void 0===o?void 0:o.isNeedMask(u.width,u.height))&&(u.mask=this.backgroundGraphics.displayObject,this.backgroundGraphics.displayObject&&this.effectContainer.addChild(this.backgroundGraphics.displayObject))):(null===(a=this.backgroundGraphics)||void 0===a?void 0:a.isNeedMask(u.width,u.height))&&(this.json.fillFloat||(this.needCacheAsBitMap=!0,u.mask=this.backgroundGraphics.displayObject,this.backgroundGraphics.displayObject&&this.effectContainer.addChild(this.backgroundGraphics.displayObject))),this.json.fillFloat||(u.x=l.x,u.y=l.y),this.effectContainer.addChild(u)):this.backgroundFill.hasFill&&(null===(e=this.backgroundGraphics)||void 0===e?void 0:e.displayObject)&&this.effectContainer.addChild(this.backgroundGraphics.displayObject)}createPathFill(){var t,e,i;const{displayObject:n}=this.strokeFill,r=null===(t=this.strokeGraphics)||void 0===t?void 0:t.displayObject,[s,o]=this.calculateFillObjectOffset();n?((null===(e=this.strokeGraphics)||void 0===e?void 0:e.isNeedMask(n.width,n.height))&&r&&(this.needCacheAsBitMap=!0,n.pivot.x=r.pivot.x,n.pivot.y=r.pivot.y,r.pivot.x=0,r.pivot.y=0,n.mask=r,n.addChild(r),n.position.x=-s/2,n.position.y=-o/2,r.position.x=s/2,r.position.y=o/2),this.effectContainer.addChild(n)):this.strokeFill.hasFill&&(null===(i=this.strokeGraphics)||void 0===i?void 0:i.displayObject)&&this.effectContainer.addChild(this.strokeGraphics.displayObject)}createFilledPathMask(){var t,e,i;const n=(null===(e=null===(t=this.json.geometry)||void 0===t?void 0:t.paths)||void 0===e?void 0:e.filter(t=>"none"!==t.fill&&"norm"!==t.fill))||[];for(const t of n){const e=this.ctx.graphicsTexture.getGraphicsData(t.id);if(e){const n=new fm(e.texture);n.pivot.x=e.pivot.x,n.pivot.y=e.pivot.y;const r=this.backgroundFill.getClonedDisplayObject(),s=null===(i=this.backgroundGraphics)||void 0===i?void 0:i.getClonedDisplayObject(),o=r||s;o&&(this.backgroundFill.displayObject&&(o.pivot.x=this.backgroundFill.displayObject.pivot.x,o.pivot.y=this.backgroundFill.displayObject.pivot.y),o.mask=n,o.filters=[Ey[t.fill]],this.needCacheAsBitMap=!0,this.effectContainer.addChild(o),this.effectContainer.addChild(n))}}}createArrow(){this.arrowList.length&&this.arrowList.forEach(t=>{var e;const i=this.ctx.graphicsTexture.getGraphicsData(t.graphicsId);if(i){const{texture:n}=i,r=new fm(n);r.pivot.x=t.pivot.x,r.pivot.y=t.pivot.y,r.position.x=t.position.x,r.position.y=t.position.y,r.rotation=t.rotate/180*Math.PI,null===(e=this.backgroundGraphics)||void 0===e||e.addArrows(r)}})}generateArrowList(){var t,e;const{lineArrowList:i,lineStyle:n,id:r}=this.json,s="solidFill"===(null===(t=null==n?void 0:n.fill)||void 0===t?void 0:t.fillType)?n.fill.color:null;null===(e=i||[])||void 0===e||e.forEach((t,e)=>{var i,o;const a=new gx(Object.assign(Object.assign({},t),{fillStyle:null==n?void 0:n.fill,lineWidth:null!==(i=null==n?void 0:n.width)&&void 0!==i?i:0}));a.graphicsId=`${r}-arrow-${e}-graphics`,a.textureId=`${r}-arrow-${e}-fill`,this.ctx.graphicsTexture.addGraphics(a.graphicsId,null!==(o=a.paths)&&void 0!==o?o:[],a.hash,{x:0,y:0},a.width,a.height,void 0,this.ctx.objectPoolGroup,!0,s,null),this.arrowList.push(a)})}calculateFillObjectOffset(){let[t,e]=[0,0];return this.arrowList.length&&(t=this.arrowList.reduce((t,e)=>Math.max(t,e.width),0),e=this.arrowList.reduce((t,e)=>Math.max(t,e.height),0)),[t,e]}preRender(t){var e,i,n;const{lineStyle:r,geometry:s}=this.json,{width:o,height:a}=(null==s?void 0:s.lineTransform)||yx,l=o||this.json.width,h=a||this.json.height,c=(null===(e=null==s?void 0:s.paths)||void 0===e?void 0:e.filter(t=>"none"!==t.fill&&"norm"!==t.fill))||[],u="solidFill"===(null===(i=null==r?void 0:r.fill)||void 0===i?void 0:i.fillType)?r.fill.color:null;t.addSubMTask(()=>_x(this,void 0,void 0,(function*(){for(const t of c)this.ctx.graphicsTexture.addGraphics(t.id,[t],t.hash,((null==s?void 0:s.lineTransform)||yx).pivot,l,h,r,this.ctx.objectPoolGroup,!0,null,u)})),"@ShapeImpl[addGraphics]"),null===(n=this.text)||void 0===n||n.createParagraphs(this.json.id,t)}subClassRender(){}render(t){t.addSubMTask(()=>_x(this,void 0,void 0,(function*(){var t,e;null===(t=this.strokeGraphics)||void 0===t||t.render(),null===(e=this.backgroundGraphics)||void 0===e||e.render(),this.createBackground(),this.subClassRender(),this.createFilledPathMask(),this.createPathFill(),this.createArrow()})),"@ShapeImpl[render]"),this.text&&this.text.render(t),t.addSubMTask(()=>_x(this,void 0,void 0,(function*(){var t,e,i,n,r,s,o,a,l;if("wd"===(null===(t=this.json.textBody)||void 0===t?void 0:t.iterateType)||"lt"===(null===(e=this.json.textBody)||void 0===e?void 0:e.iterateType))this.renderContainer.addChild(this.container),this.text&&(this.text.container.scale.y=null!==(n=null===(i=this.json.scale)||void 0===i?void 0:i.y)&&void 0!==n?n:1,this.text.container.position.x+=(null!==(s=null===(r=this.json.position)||void 0===r?void 0:r.x)&&void 0!==s?s:0)+this.text.x,this.text.container.position.y+=(null!==(a=null===(o=this.json.position)||void 0===o?void 0:o.y)&&void 0!==a?a:0)+this.text.y,-1===this.text.container.scale.y&&(this.text.container.position.y+=this.text.height),this.renderContainer.addChild(this.text.container));else{if(this.text){if(uy()(this.json.textRotateWithShape)&&!this.json.textRotateWithShape){const t=this.json.rotation||0;this.text.container.rotation=-t;const{width:e}=this.text;this.text.container.position.x=e}this.text.container.zIndex=100;const t=null===(l=this.json.effectList)||void 0===l?void 0:l.find(t=>"outerShadow"===t.type);t&&1!==t.sx?this.container.addChild(this.text.container):this.effectContainer.addChild(this.text.container)}this.renderContainer.addChild(this.container)}if(this.needCacheAsBitMap,"background"===this.json.id&&this.ctx.hasBackgroundFillShape){const t=Wd.create({width:this.json.width,height:this.json.height,resolution:Math.ceil(this.ctx.renderer.resolution)});this.ctx.renderer.render(this.renderContainer,{renderTexture:t}),this.ctx.bgTexture=t}})),"@ShapeImpl[post.render]")}clearOnSlideChange(){}initOnReuse(){}destroy(){var t,e,i,n;null===(t=this.text)||void 0===t||t.destroy(),this.fillColorFilter.destroy(),this.strokeColorFilter.destroy(),this.backgroundFill.destroy(),null===(e=this.backgroundGraphics)||void 0===e||e.destroy(),this.strokeFill.destroy(),null===(i=this.strokeGraphics)||void 0===i||i.destroy(),this.renderContainer.destroy(),null===(n=this.arrowRenderTexture)||void 0===n||n.destroy(!0),this.arrowList=[],this.effectDisposer()}}var bx=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};function Tx(t,e){for(const i in e)t.style[i]=e[i]}class Ex{constructor(t){var e,i;this.progress=document.createElement("div"),this.totalTime=document.createElement("span"),this.playButton=document.createElement("div"),this.pauseButton=document.createElement("div"),this.currentTime=document.createElement("span"),this.mediaController=document.createElement("div"),this.currentProgress=document.createElement("div"),this.medianIsEnd=!1,this.pickBookmarkIndex=0,this.playCallBackList=[],this.duration=0,this.start=0,this.end=0,this.changeMediaProgress=t=>{if(this.ctx.isPlayerPaused())return void this.ctx.logger.info("Media controller prevent seek event with paused state",this.ctx.taskId);t.stopPropagation();const e=t.offsetX/this.progress.clientWidth*this.duration;this.medianIsEnd=!1,"interactive"!==this.ctx.mode&&this.jumpToTime(e),"local"!==this.ctx.mode&&this.ctx.eventHub.emit(Nb.mediaSeek,{id:this.targetId,time:e,isPlaying:this.media.isPlaying})},this.jumpToTime=(t=0)=>{const e=Math.floor(t)+this.start;this.media.currentTime!==e&&(this.media.currentTime=e,this.changeBookmarkIndex(e,e>this.media.currentTime))},this.showController=t=>{t.stopPropagation(),this.show()},this.getMediaDuration=()=>{this.duration&&!Number.isNaN(this.duration)||(this.duration=this.media.duration,this.start&&(this.duration-=this.start,this.jumpToTime()),this.end&&(this.duration-=this.end)),this.totalTime.innerText=Ex.formatTime(this.duration)},this.playMedia=()=>bx(this,void 0,void 0,(function*(){this.playButton.style.display="none",this.pauseButton.style.display="block",yield this.media.play(),this.medianIsEnd&&(this.medianIsEnd=!1,this.jumpToTime()),this.playCallBackList.forEach(t=>{t()})})),this.pauseMedia=()=>bx(this,void 0,void 0,(function*(){this.playButton.style.display="block",this.pauseButton.style.display="none",yield this.media.pause()})),this.onMouseOut=t=>{t.stopPropagation(),this.mediaController.style.display="none"},this.mediaTimeUpdate=()=>bx(this,void 0,void 0,(function*(){const t=this.media.currentTime-this.start;if(this.duration>0&&(t>this.duration||this.media.ended)&&(yield this.pauseMedia(),this.medianIsEnd=!0),this.currentTime.innerText=Ex.formatTime(t),this.currentProgress.style.flex=(t/this.duration).toString(),!this.bookmarkList||0===this.bookmarkList.length)return;const e=this.bookmarkList[this.pickBookmarkIndex];e&&e.time.toFixed(0)===this.media.currentTime.toFixed(0)&&(this.ctx.timingEventHub.emit(`shape ${this.shapeId} onMediaBookmark ${e.name}`),this.pickBookmarkIndex+=1)})),this.onPauseMedia=()=>{this.playButton.style.display="block",this.pauseButton.style.display="none"},this.onPlayMedia=()=>{this.playButton.style.display="none",this.pauseButton.style.display="block",this.playCallBackList.forEach(t=>{t()})},this.playMediaFromCtrl=()=>{this.ctx.isPlayerPaused()?this.ctx.logger.info("Media controller prevent play event with paused state",this.ctx.taskId):("interactive"!==this.ctx.mode&&this.playMedia(),"local"!==this.ctx.mode&&this.ctx.eventHub.emit(Nb.mediaPlay,{id:this.targetId,time:this.media.currentTime-this.start}))},this.pauseMediaFromCtrl=()=>{this.ctx.isPlayerPaused()?this.ctx.logger.info("Media controller prevent pause event with paused state",this.ctx.taskId):("interactive"!==this.ctx.mode&&this.pauseMedia(),"local"!==this.ctx.mode&&this.ctx.eventHub.emit(Nb.mediaPause,{id:this.targetId,time:this.media.currentTime-this.start}))},this.targetId=t.targetId,this.ctx=t.ctx,this.height=t.height,this.width=t.width,this.target=t.target,this.media=t.media,this.info=t.info,this.shapeId=t.shapeId,this.canvasElement=t.canvasElement,this.getMedianContainer(),this.createMediaController(),this.info.cut&&(this.start=null!==(e=this.info.cut.start)&&void 0!==e?e:0,this.end=null!==(i=this.info.cut.end)&&void 0!==i?i:0),this.info.bookmarkList&&(this.bookmarkList=this.info.bookmarkList.sort((t,e)=>t.time-e.time))}getMedianContainer(){var t;let e=null===(t=this.canvasElement.parentElement)||void 0===t?void 0:t.querySelector(".median-container");e||(e=document.createElement("div"),e.className="median-container",this.canvasElement.parentElement.appendChild(e)),this.container=e}static formatTime(t){let e="00:00";if(t){const i=Math.floor(t/60),n=String(i<0?0:i).padStart(2,"0"),r=Math.floor(t%60);e=`${n}:${String(r<0?0:r).padStart(2,"0")}`}return e}generatePlayButton(t=20,e=20){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttributeNS(null,"viewBox","0 0 512 512"),i.setAttributeNS(null,"height",t.toString()),i.setAttributeNS(null,"width",e.toString());const n=document.createElementNS("http://www.w3.org/2000/svg","polyline");return n.setAttributeNS(null,"points","35 0, 477 256, 35 512"),n.setAttributeNS(null,"fill","#000000"),i.appendChild(n),i}generatePauseButton(t=20,e=20){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");Tx(i,{height:"20px"}),i.setAttributeNS(null,"viewBox","0 0 512 512"),i.setAttributeNS(null,"height",t.toString()),i.setAttributeNS(null,"width",e.toString());const n=document.createElementNS("http://www.w3.org/2000/svg","rect");n.setAttributeNS(null,"x","35"),n.setAttributeNS(null,"y","0"),n.setAttributeNS(null,"width","148"),n.setAttributeNS(null,"height","512");const r=n.cloneNode(!0);return r.setAttributeNS(null,"x","330"),i.append(n,r),i}createButton(){const t={marginLeft:"15px",marginRight:"10px",fontSize:"0",height:"20px"};Tx(this.playButton,Object.assign(Object.assign({},t),{display:"block"}));const e=this.generatePlayButton();Tx(e,{height:"20px"}),this.playButton.appendChild(e),Tx(this.pauseButton,Object.assign(Object.assign({},t),{display:"none"}));const i=this.generatePauseButton();Tx(i,{height:"20px"}),this.pauseButton.appendChild(i)}createTimer(){const t=document.createElement("div");Tx(t,{width:"100px"}),this.currentTime.innerText="00:00";const e=document.createElement("span");return e.innerText="/",t.append(this.currentTime,e,this.totalTime),t}createProgress(){Tx(this.progress,{flex:"1",position:"relative",marginRight:"10px"});const t=document.createElement("div");Tx(t,{background:"#D9D9D9",position:"relative",height:"10px",display:"flex"}),this.progress.appendChild(t),Tx(this.currentProgress,{background:"#4F4F4F",top:"0px",left:"0",height:"10px",flex:"0"}),t.appendChild(this.currentProgress)}changeBookmarkIndex(t,e){if(this.bookmarkList&&0!==this.bookmarkList.length){if(this.pickBookmarkIndex>0)for(let e=0;e<this.pickBookmarkIndex;e++)if(this.bookmarkList[e].time>t){this.pickBookmarkIndex=e;break}if(e){let e=this.pickBookmarkIndex-1;for(let i=0;i<this.bookmarkList.length;i++)this.bookmarkList[i].time<t&&(e=i);for(let t=this.pickBookmarkIndex;t<=e;t++){const e=this.bookmarkList[t];e&&this.ctx.timingEventHub.emit(`shape ${this.shapeId} onMediaBookmark ${e.name}`)}this.pickBookmarkIndex=e+1}}}bindEvent(){this.mediaController.addEventListener("mouseover",this.showController,!1),this.mediaController.addEventListener("mouseout",this.onMouseOut,!1),this.progress.addEventListener("mousedown",this.changeMediaProgress,!1),this.playButton.addEventListener("click",this.playMediaFromCtrl,!1),this.pauseButton.addEventListener("click",this.pauseMediaFromCtrl,!1),this.media.on("durationchange",this.getMediaDuration,!1),this.media.on("timeupdate",this.mediaTimeUpdate,!1),this.media.on("pause",this.onPauseMedia,!1),this.media.on("play",this.onPlayMedia,!1)}setControllerPosition(){var t;const{target:e}=this,{stageWidth:i,stageHeight:n}=this.ctx,r=e.getGlobalPosition(),s=Number(null===(t=this.container)||void 0===t?void 0:t.getAttribute("data-scale")),o=i*s,a=1/s*(300>o?o/300:1);r.y=r.y+this.height-50,r.x=Math.max(r.x,0),r.x=Math.min(r.x,i-300*a),r.y=Math.max(r.y,0),r.y=Math.min(r.y,n-50),Tx(this.mediaController,{height:"50px",borderRadius:"25px",width:"300px",flexDirection:"row",alignItems:"center",position:"absolute",left:r.x+"px",top:r.y+"px",display:"none",background:"#fff",zIndex:"2",border:"1px solid #ccc",transform:`scale(${a})`,transformOrigin:"0 100%"})}createMediaController(){this.setControllerPosition(),this.createButton();const t=this.createTimer();this.createProgress(),this.mediaController.append(this.playButton,this.pauseButton,t,this.progress),this.container.appendChild(this.mediaController),this.bindEvent()}addPlayCallBack(t){this.playCallBackList.push(t)}unbindEvent(){this.mediaController.removeEventListener("mouseover",this.showController,!1),this.mediaController.removeEventListener("mouseout",this.onMouseOut,!1),this.progress.removeEventListener("mousedown",this.changeMediaProgress,!1),this.playButton.removeEventListener("click",this.playMediaFromCtrl,!1),this.pauseButton.removeEventListener("click",this.pauseMediaFromCtrl,!1),this.media.removeAllListeners()}show(){this.setControllerPosition(),this.mediaController.style.display="flex"}hide(){this.mediaController.style.display="none"}destroy(){var t;this.unbindEvent(),this.playCallBackList=[],null===(t=this.container)||void 0===t||t.removeChild(this.mediaController)}}var wx=i(91);class Sx extends $a.a{constructor(t,e){super(),this.isGlobalPause=!1,this.lastTime=-1,this.howl=null,this.rctClient=null,this.url=t,this.runningAudio=e,Ob.RtcAudioClazz?(this.rctClient=new Ob.RtcAudioClazz(t),this.rctClient.on("load",()=>this.emit("load")),this.rctClient.on("pause",()=>this.emit("pause")),this.rctClient.on("play",()=>this.emit("play"))):(this.howl=new wx.Howl({src:[t]}),this.howl.on("load",()=>this.emit("load")),this.howl.on("pause",()=>this.emit("pause")),this.howl.on("play",()=>this.emit("play")))}startTimeChangeEmit(){this.currentTime!==this.lastTime&&(this.lastTime=this.currentTime,this.emit("timeupdate")),this.isEnded||setTimeout(()=>this.startTimeChangeEmit(),300)}play(){var t,e,i;this.runningAudio.has(this.url)&&(null===(t=this.runningAudio.get(this.url))||void 0===t||t.stop(),this.runningAudio.delete(this.url)),this.lastTime=-1,null===(e=this.howl)||void 0===e||e.play(),null===(i=this.rctClient)||void 0===i||i.play(),this.startTimeChangeEmit(),this.runningAudio.set(this.url,this)}pause(){var t,e;null===(t=this.howl)||void 0===t||t.pause(),null===(e=this.rctClient)||void 0===e||e.pause(),this.runningAudio.has(this.url)&&this.runningAudio.delete(this.url)}globalPause(){this.isPaused||(this.isGlobalPause=!0,this.pause())}globalResume(){this.isGlobalPause&&(this.isGlobalPause=!1,this.play())}stop(){var t;null===(t=this.howl)||void 0===t||t.stop(),this.rctClient&&(this.rctClient.pause(),this.rctClient.currentTime=0),this.runningAudio.has(this.url)&&this.runningAudio.delete(this.url)}destroy(){var t,e,i,n,r,s,o;null===(t=this.howl)||void 0===t||t.pause(),null===(e=this.howl)||void 0===e||e.unload(),null===(i=this.rctClient)||void 0===i||i.pause(),null===(n=this.rctClient)||void 0===n||n.destroy(),null===(r=this.rctClient)||void 0===r||r.removeAllListeners("load"),null===(s=this.rctClient)||void 0===s||s.removeAllListeners("play"),null===(o=this.rctClient)||void 0===o||o.removeAllListeners("pause"),this.runningAudio.has(this.url)&&this.runningAudio.delete(this.url)}get currentTime(){return this.rctClient?this.rctClient.currentTime:this.howl?this.howl.seek():-1}set currentTime(t){this.rctClient?this.rctClient.currentTime=t:this.howl&&this.howl.seek(t)}get duration(){return this.rctClient?this.rctClient.duration:this.howl?this.howl.duration():0}get isEnded(){return Math.abs(this.currentTime-this.duration)<.001}get isPaused(){return this.rctClient?this.rctClient.isPaused:!!this.howl&&this.howl.playing()}volume(t){this.rctClient?this.rctClient.volume(t):this.howl&&this.howl.volume(t)}}var Mx=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class Ax extends $a.a{constructor(t){var e,i;super(),this.type="video",this.sprite=new fm,this.isPlaying=!1,this.isGlobalPause=!1,this.updateVolume=t=>{Ob.RtcAudioClazz?this.rtcAudio.volume(t):this.videoResource.source&&(this.videoResource.source.volume=t)},this.id=t.id,this.start=null===(e=t.video.cut)||void 0===e?void 0:e.start,this.end=null===(i=t.video.cut)||void 0===i?void 0:i.end,this.container=t.container,this.ctx=t.ctx,this.ctx.medias[this.id]=this;let n=t.video.src;this.ctx.loaderDelegate&&(n=this.ctx.loaderDelegate.redirectMedia(n),this.ctx.logger.info(`redirect media url from ${t.video.src} to ${n} by delegate.`,t.ctx.taskId)),this.videoResource=new Dd(n,{autoLoad:!0,autoPlay:!1,updateFPS:30,crossorigin:!0});let r=t.video.src.replace(/4$/,"3");this.ctx.loaderDelegate&&(r=this.ctx.loaderDelegate.redirectMedia(r),this.ctx.logger.info(`redirect media url from ${t.video.src.replace(/4$/,"3")} to ${r} by delegate.`,t.ctx.taskId)),this.rtcAudio=new Sx(r,t.ctx.runningAudio);const{video:s,width:o,height:a,target:l}=t;this.controller=new Ex({targetId:t.id,shapeId:t.shapeId,ctx:t.ctx,width:o,height:a,target:l,media:this,info:s,canvasElement:t.canvasElement}),this.controller.addPlayCallBack(()=>{this.sprite.width=o,this.sprite.height=a,this.ctx.clock.setTimeout(()=>{this.sprite.visible=!0},50)});const h=new Ad(null,{height:a,width:o});h.resource=this.videoResource,this.videoResource.bind(h),this.sprite=new fm,this.sprite.visible=!1,this.sprite.texture=new Vd(h),this.sprite.interactive=!0,this.container.addChild(this.sprite),this.sprite.on("mouseover",t=>{t.stopPropagation(),this.controller.show()}),this.sprite.on("mouseout",t=>{t.stopPropagation(),this.controller.hide()}),["durationchange","timeupdate","pause","play"].forEach(t=>{this.videoResource.source.addEventListener(t,()=>{"timeupdate"!==t||this.isPlaying||this.pause(),this.emit(t)})}),this.ctx.activeMedia.add(this),this.ctx.volumeAdjuster.on("update",this.updateVolume)}get currentTime(){var t,e;return null!==(e=null===(t=this.videoResource.source)||void 0===t?void 0:t.currentTime)&&void 0!==e?e:0}set currentTime(t){Ob.RtcAudioClazz&&(this.rtcAudio.currentTime=t),this.videoResource.source&&(this.videoResource.source.currentTime=t)}get paused(){var t,e;return null===(e=null===(t=this.videoResource.source)||void 0===t?void 0:t.paused)||void 0===e||e}get ended(){var t,e;return null===(e=null===(t=this.videoResource.source)||void 0===t?void 0:t.ended)||void 0===e||e}get duration(){var t,e;return null!==(e=null===(t=this.videoResource.source)||void 0===t?void 0:t.duration)&&void 0!==e?e:0}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){var t;return Mx(this,void 0,void 0,(function*(){this.isPlaying=!0,this.updateVolume(this.ctx.volumeAdjuster.volume),yield this.load(),yield this.ctx.clock.waitUntil(()=>{const t=this.videoResource.source;return!!(t&&t.videoWidth>0)},3e3);const e=this.videoResource.source;e&&e.videoWidth<=0||(Ob.RtcAudioClazz?(this.videoResource.source.volume=0,this.rtcAudio.once("play",()=>{var t;null===(t=this.videoResource.source)||void 0===t||t.play()}),this.rtcAudio.play()):yield null===(t=this.videoResource.source)||void 0===t?void 0:t.play())}))}load(){return this.videoResource.load()}pause(){var t;this.isPlaying=!1,Ob.RtcAudioClazz?(this.rtcAudio.once("pause",()=>{var t;null===(t=this.videoResource.source)||void 0===t||t.pause()}),this.rtcAudio.pause()):null===(t=this.videoResource.source)||void 0===t||t.pause()}globalPause(){this.isPlaying&&(this.isGlobalPause=!0,this.pause())}globalResume(){this.isGlobalPause&&(this.isGlobalPause=!1,this.play())}togglePause(){this.isPlaying?this.pause():this.play()}seek(t){this.controller.jumpToTime(t)}stop(){this.seek(0),this.pause()}destroy(){var t;this.ctx.volumeAdjuster.removeListener("update",this.updateVolume),this.sprite.interactive=!1,this.sprite.destroy({texture:!0,baseTexture:!0}),null===(t=this.videoResource)||void 0===t||t.destroy(),this.rtcAudio.destroy(),this.controller.destroy(),this.ctx.activeMedia.delete(this)}}var Px=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class Rx extends $a.a{constructor(t){super(),this.type="audio",this.isPlaying=!1,this.isGlobalPause=!1,this.updateVolume=t=>{this.audioPlayer.volume(t)},this.id=t.id;let e=t.audio.src;t.ctx.loaderDelegate&&(e=t.ctx.loaderDelegate.redirectMedia(e),t.ctx.logger.info(`redirect media url from ${t.audio.src} to ${e} by delegate.`,t.ctx.taskId)),this.audioPlayer=new Sx(e,t.ctx.runningAudio),t.audio.cut&&(this.start=t.audio.cut.start,this.end=t.audio.cut.end),this.ctx=t.ctx,this.ctx.medias[this.id]=this;const{width:i,height:n,target:r}=t;this.controller=new Ex({targetId:t.id,shapeId:t.shapeId,ctx:t.ctx,height:n,width:i,target:r,media:this,info:t.audio,canvasElement:t.canvasElement}),this.audioPlayer.on("load",()=>this.emit("durationchange")),this.audioPlayer.on("timeupdate",()=>this.emit("timeupdate")),this.audioPlayer.on("pause",()=>this.emit("pause")),this.audioPlayer.on("play",()=>this.emit("play")),this.ctx.activeMedia.add(this),this.ctx.volumeAdjuster.on("update",this.updateVolume)}get currentTime(){return this.audioPlayer.currentTime}set currentTime(t){this.audioPlayer.currentTime=t}get paused(){return this.audioPlayer.isPaused}get isPaused(){return this.audioPlayer.isPaused}get ended(){return this.audioPlayer.isEnded}get duration(){return this.audioPlayer.duration}load(){return Promise.resolve()}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){return Px(this,void 0,void 0,(function*(){this.ctx.isPlayerPaused()?this.ctx.logger.info("Audio player prevent play event with paused state",this.ctx.taskId):(this.updateVolume(this.ctx.volumeAdjuster.volume),this.isPlaying=!0,this.audioPlayer.play())}))}pause(){this.ctx.isPlayerPaused()?this.ctx.logger.info("Audio player prevent pause event with paused state",this.ctx.taskId):(this.isPlaying=!1,this.audioPlayer.pause())}globalPause(){this.isPlaying&&(this.isGlobalPause=!0,this.pause())}globalResume(){this.isGlobalPause&&(this.isGlobalPause=!1,this.play())}togglePause(){this.isPlaying?this.pause():this.play()}seek(t){this.ctx.isPlayerPaused()?this.ctx.logger.info("Audio player prevent seek event with paused state",this.ctx.taskId):this.controller.jumpToTime(t)}stop(){this.seek(0),this.pause()}destroy(){this.ctx.volumeAdjuster.removeListener("update",this.updateVolume),this.audioPlayer.pause(),this.controller.destroy(),this.ctx.activeMedia.delete(this)}}class Ix extends xx{constructor(t,e,i,n){super(Object.assign(Object.assign({},t),{type:"Shape",useBgFill:!1,textRotateWithShape:!0,isPicture:!0}),e,i,n),this.isInteractiveOutside=!1,this.cmd=new iy(this),this.media=null==t?void 0:t.media,this.container.name=t.id+"_container_[Picture]",this.renderContainer.name=t.id+"_render_container_[Picture]",this.picFill=new ax(this.ctx,t.picFill,t.width,t.height,{useFilter:!0,useSlideBackgroundFill:!1})}applyCommand(t,e){var i,n,r,s,o;if("call"===e)if(/playFrom\(([0-9.]+)\)/.test(t)){const e=t.match(/playFrom\(([0-9.]+)\)/),n=Number(e[1]||"0");null===(i=this.mediaPlayer)||void 0===i||i.play().then(()=>{var t;null===(t=this.mediaPlayer)||void 0===t||t.seek(n)})}else"custom-pause"===t?null===(n=this.mediaPlayer)||void 0===n||n.pause():"togglePause"===t?null===(r=this.mediaPlayer)||void 0===r||r.togglePause():"stop"===t&&(null===(s=this.mediaPlayer)||void 0===s||s.pause(),null===(o=this.mediaPlayer)||void 0===o||o.seek(0))}renderPic(){var t,e,i,n,r,s;const{displayObject:o}=this.picFill;if(o){o.name=this.json.id+"_pic_fill_[Picture]";const a=null===(t=this.backgroundGraphics)||void 0===t?void 0:t.getClonedDisplayObject();if((null===(e=this.backgroundGraphics)||void 0===e?void 0:e.isNeedMask(o.width,o.height))&&a&&(o.mask=a,this.effectContainer.addChild(a)),o.width=this.designWidth,o.height=this.designHeight,o instanceof Qv&&this.ctx.slideScopeEventHub.once("slide-render",t=>{var e;this.ctx.slideIndex===t&&(null===(e=this.effectObject)||void 0===e||e.setFrameCount(o.totalFrames),o.play(),o.onFrameChange=t=>{if(this.effectObject)if(this.effectObject.hasFrame(t))this.effectObject.updateFrame(t);else{const e=this.getEffectTexture();e&&this.effectObject.createFrame(t,e)}})}),this.effectContainer.addChild(o),"video"===(null===(i=this.media)||void 0===i?void 0:i.type)&&this.media.src){if(this.mediaPlayer=new Ax({id:this.json.id+"-video",shapeId:this.json.id,ctx:this.ctx,video:this.media,height:this.designHeight,width:this.designWidth,target:o,container:this.effectContainer,canvasElement:this.ctx.view}),(null===(n=this.mediaPlayer)||void 0===n?void 0:n.sprite)&&a){const t=null===(r=this.backgroundGraphics)||void 0===r?void 0:r.getClonedDisplayObject();t&&(this.mediaPlayer.sprite.mask=t,this.container.addChild(t))}}else"audio"===(null===(s=this.media)||void 0===s?void 0:s.type)&&this.media.src&&(this.mediaPlayer=new Rx({id:this.json.id+"-audio",shapeId:this.json.id,ctx:this.ctx,audio:this.media,height:this.designHeight,width:this.designWidth,target:o,canvasElement:this.ctx.view}));this.mediaPlayer&&(this.isInteractiveOutside=!!this.container.interactive,this.container.interactive=!0,this.container.on("mouseover",()=>{this.mediaPlayer.showController()}),this.container.on("mouseout",()=>{this.mediaPlayer.hideController()},!1))}}preRender(t){super.preRender(t)}subClassRender(){this.renderPic()}clearOnSlideChange(){super.clearOnSlideChange(),this.mediaPlayer&&(this.container.interactive=!1,this.mediaPlayer.stop(),this.mediaPlayer.hideController())}initOnReuse(){super.initOnReuse(),this.mediaPlayer&&(this.container.interactive=!0)}destroy(){this.mediaPlayer&&(this.picFill.displayObject&&!this.isInteractiveOutside&&(this.container.interactive=!1),this.mediaPlayer.destroy(),this.mediaPlayer=void 0),this.picFill.destroy()}}var Cx=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class Lx extends hy{constructor(t,e,i,n,r){super(t,e,i),this.children=[],this.cacheSprite=new fm,this.cacheContainer=new pd,this.json=t,this.json.fillStyle&&"groupFill"===this.json.fillStyle.fillType&&n&&(this.json.fillStyle=n),this.container.name=t.id+"_container_[Container]",this.cacheContainer.name=t.id+"_cache_container_[Container]",this.ctx.timingTargets.addTarget(t.id,this),this.updateTransform(this.json),this.fillObject=new ax(this.ctx,t.fillStyle,t.width,t.height,{useFilter:!1,useSlideBackgroundFill:!1}),this.createChildren(r)}createChildren(t){var e,i,n,r;const s={x:null!==(i=null===(e=this.json.position)||void 0===e?void 0:e.x)&&void 0!==i?i:0,y:null!==(r=null===(n=this.json.position)||void 0===n?void 0:n.y)&&void 0!==r?r:0};for(let e=0,i=this.json.children.length;e<i;e++)t.addSubMTask(()=>Cx(this,void 0,void 0,(function*(){const i=this.json.children[e];let n=null;"Shape"===(null==i?void 0:i.type)?n=new xx(i,this.ctx,s,this.json.fillStyle):"Picture"===(null==i?void 0:i.type)?n=new Ix(i,this.ctx,s,this.json.fillStyle):"Container"===(null==i?void 0:i.type)&&(n=new Lx(i,this.ctx,s,this.json.fillStyle,t)),n&&this.children.push(n)})),"@ContainerImpl[child.init]")}get interactiveContainer(){return this.container}get renderContainer(){return this.container}preRender(t){for(const e of this.children)t.addSubMTask(()=>Cx(this,void 0,void 0,(function*(){e.preRender(t)})),"@ContainerImpl[child.preRender]")}getBgElement(){return null}getIterateEntry(t,e,i){return 0===e?this:(this.ctx.eventHub.emit("IterateTimeNodeEnd",i),null)}getTextElement(){return null}render(t){for(const e of this.children)e.render(t),t.addSubMTask(()=>Cx(this,void 0,void 0,(function*(){var t;this.cacheContainer.addChild(e.renderContainer),(e.json.hlinkHover||e.json.hlinkClick)&&(null===(t=e.hyperlink)||void 0===t||t.addProxy(this.container))})),"@ContainerImpl[child.render]");t.addSubMTask(()=>Cx(this,void 0,void 0,(function*(){this.container.addChild(this.cacheContainer)})),"@ContainerImpl[child.append]")}clearOnSlideChange(){this.children.forEach(t=>t.clearOnSlideChange())}initOnReuse(){this.children.forEach(t=>t.initOnReuse())}isChildrenInteractive(){for(const t of this.json.children)if("Container"===(null==t?void 0:t.type)||"Stage"===(null==t?void 0:t.type)||(null==t?void 0:t.hlinkHover)||(null==t?void 0:t.hlinkClick))return!0;return!1}destroy(){this.cacheSprite&&this.cacheSprite.destroy({texture:!0}),this.children.forEach(t=>t.destroy()),this.container.destroy({children:!0,texture:!0,baseTexture:!0}),this.cacheContainer.destroy({children:!0,texture:!0,baseTexture:!0})}}class Nx extends $a.a{constructor(t,e,i,n){super(),this.cond={},this.timeoutIds=[],this.condHandle=(t,e={})=>{if(t)if(t.delay&&t.delay>0){const i=this.ctx.clock.setTimeout(()=>{t.event&&(this.cond[t.event]=!0,this.detectTrigger(e))},t.delay);this.timeoutIds.push(i)}else this.cond[t.event]=!0,this.detectTrigger(e);else this.detectTrigger(e)},this.id=t,this.ctx=n,this.eventHubs=i,e.forEach(t=>{this.addCond(t)})}setTriggerParams(t){this.triggerParams=t}addCond(t){const e=e=>{this.condHandle(t,e)};t.event&&(/^shape/.test(t.event)||/^time/.test(t.event)?(this.cond[t.event]=!1,this.eventHubs.global.addListener(t.event,e)):/^runtime/.test(t.event)?(this.cond[t.event]=!1,this.eventHubs.runtime.addListener(t.event,e)):/^self/.test(t.event)?t.delay&&t.delay>0&&(this.cond[t.event]=!1,this.eventHubs.runtime.addListener(t.event,e)):this.cond[t.event]=!1)}isTrigger(){return Object.keys(this.cond).every(t=>!!this.cond[t])}isTriggerWithoutParent(){return Object.keys(this.cond).filter(t=>"self"!==t).every(t=>!!this.cond[t])}detectTrigger(t){if(Object.keys(this.cond).every(t=>!!this.cond[t])){Object.keys(this.cond).forEach(t=>{this.cond[t]=!1});const e=this.triggerParams;this.triggerParams=void 0,this.emit("active",e,t)}}reset(){Object.keys(this.cond).forEach(t=>{this.cond[t]=!1}),this.timeoutIds.forEach(t=>this.ctx.clock.clearTimeout(t))}}class Ox extends $a.a{constructor(t){super(),this.isTimeNodeEndSync=!1,this.interactiveListeners=[],this.runtimeNodeEventHub=new $a.a,this._currentSeqIndex=0,this._currentSeqState="idle",this.isForward=!0,this.autoPlay=!1,this.handlePrev=(t=!1)=>{var e,i,n,r,s,o;this.hasPrev()||!this.isMainSeq?"idle"===this.currentSeqState?(this.decrSeqIndex(),null===(e=this.commonTimeNode.children[this.currentSeqIndex])||void 0===e||e.commonTimeNode.seekToStart(),null===(i=this.commonTimeNode.children[this.currentSeqIndex])||void 0===i||i.commonTimeNode.clearSubList(),this.currentSeqState="idle"):"running"===this.currentSeqState?(null===(n=this.commonTimeNode.children[this.currentSeqIndex])||void 0===n||n.commonTimeNode.seekToStart(),null===(r=this.commonTimeNode.children[this.currentSeqIndex])||void 0===r||r.commonTimeNode.clearSubList(),this.currentSeqState="idle"):"end"===this.currentSeqState&&(this.currentSeqIndex>=this.commonTimeNode.children.length&&(this.currentSeqIndex=this.commonTimeNode.children.length-1),null===(s=this.commonTimeNode.children[this.currentSeqIndex])||void 0===s||s.commonTimeNode.seekToStart(),null===(o=this.commonTimeNode.children[this.currentSeqIndex])||void 0===o||o.commonTimeNode.clearSubList(),this.currentSeqState="idle"):this.globalEventHub.emit("c:prev slide",t)},this.handleNext=(t=!1)=>{var e,i,n,r;this.isTimeNodeEndSync&&(this.isTimeNodeEndSync=!1,this.currentSeqState="idle",this.currentSeqIndex=0),this.hasNext()||!this.isMainSeq?"idle"===this.currentSeqState?null===(e=this.commonTimeNode.children[this.currentSeqIndex])||void 0===e||e.commonTimeNode.startTimeNodeForce():"running"===this.currentSeqState?(null===(i=this.commonTimeNode.children[this.currentSeqIndex])||void 0===i||i.commonTimeNode.seekToEnd(!1,!0),this.currentSeqState="end",this.incrSeqIndex(),null===(n=this.commonTimeNode.children[this.currentSeqIndex])||void 0===n||n.commonTimeNode.startTimeNodeForce()):"end"===this.currentSeqState&&(this.incrSeqIndex(),null===(r=this.commonTimeNode.children[this.currentSeqIndex])||void 0===r||r.commonTimeNode.startTimeNodeForce()):this.globalEventHub.emit("c:next slide",t)};const{json:e,iterateType:i,isIterate:n,isSub:r,parent:s,ctx:o,eventHub:a,iterateIndex:l,iterateId:h,isInInteractiveSeq:c}=t;this.isMainSeq="mainSeq"===e.ctn.nodeType,this.isInteractiveSeq="interactiveSeq"===e.ctn.nodeType,this.id=e.ctn.id,this.isIterate=n,this.json=e,this.ctx=o,this.globalEventHub=a,this.commonTimeNode=new lb({json:e.ctn,isSub:r,eventHubs:{global:a,runtime:this.runtimeNodeEventHub},ctx:o,parent:s,isIterate:!1,iterateType:i,iterateIndex:l,iterateId:h,isInInteractiveSeq:c||this.isInteractiveSeq}),this.bindShapeEvent(),this.nextConds=new Nx("mainSeq",e.nextCondLst,{global:a,runtime:this.runtimeNodeEventHub},this.ctx),this.prevConds=new Nx("mainSeq",e.preCondLst,{global:a,runtime:this.runtimeNodeEventHub},this.ctx),this.commonTimeNode.on("timeNodeRestart",()=>{this.currentSeqIndex=0,this.currentSeqState="idle"}),this.commonTimeNode.on("childTimeNodeStart",t=>{const e=this.commonTimeNode.children.findIndex(e=>e.commonTimeNode.uuid===t.id);e>=0&&(this.currentSeqIndex=e),this.currentSeqState="running",this.isMainSeq&&this.ctx.eventHub.emit(Nb.mainSeqStepStart,e)}),this.commonTimeNode.on("childTimeNodeEnd",t=>{const e=this.commonTimeNode.children.findIndex(e=>e.commonTimeNode.uuid===t.id);e>=0&&(this.currentSeqIndex=e),this.currentSeqState="end",this.autoPlay&&this.ctx.clock.setTimeout(()=>{this.handleNext()}),this.isMainSeq&&this.ctx.eventHub.emit(Nb.mainSeqStepEnd,e)}),this.commonTimeNode.on("timeNodeEndSync",()=>{this.isTimeNodeEndSync=!0,this.commonTimeNode.resetForRepeat()}),this.commonTimeNode.on("timeNodeDestroy",()=>{this.interactiveListeners.forEach(([t,e])=>{t&&e&&t.interactiveContainer.removeListener("pointerdown",e)}),this.interactiveListeners=[]}),this.nextConds.on("active",(t,e)=>{this.handleNext(e)}),this.prevConds.on("active",(t,e)=>{this.handlePrev(e)})}get currentSeqIndex(){return this._currentSeqIndex}set currentSeqIndex(t){this._currentSeqIndex=t,this.isMainSeq?this.ctx.eventHub.emit(Nb.mainSeqStepChange,t):this.isInteractiveSeq&&this.ctx.eventHub.emit(Nb.interactiveSeqStateChange,{id:this.json.ctn.id,state:{step:t,state:this._currentSeqState}})}get currentSeqState(){return this._currentSeqState}set currentSeqState(t){this._currentSeqState=t,this.isMainSeq?this.ctx.eventHub.emit(Nb.mainSeqStateChange,t):this.isInteractiveSeq&&this.ctx.eventHub.emit(Nb.interactiveSeqStateChange,{id:this.json.ctn.id,state:{step:this._currentSeqIndex,state:t}})}get stepLength(){return this.commonTimeNode.children.length}get currentStep(){return this.currentSeqIndex}get currentState(){return this.currentSeqState}startAutoPlay(){this.autoPlay=!0,this.commonTimeNode.children[0].commonTimeNode.startTimeNodeForce()}incrSeqIndex(){this.currentSeqIndex+1<=this.commonTimeNode.children.length&&(this.currentSeqIndex+=1)}decrSeqIndex(){this.currentSeqIndex-1>=-1&&(this.currentSeqIndex-=1)}hasPrev(){return!(this.currentSeqIndex<=0&&"idle"===this.currentSeqState)}hasNext(){return!(this.currentSeqIndex>=this.commonTimeNode.children.length||this.currentSeqIndex===this.commonTimeNode.children.length-1&&"end"===this.currentSeqState)}bindShapeEvent(){"interactiveSeq"===this.json.ctn.nodeType&&this.json.nextCondLst.forEach(t=>{if(/^shape/.test(t.event)){const e=t.event.split(" ")[1];if(e){const t=this.ctx.timingTargets.getTargetById(e);if(t){t.interactiveContainer.interactive=!0,t.interactiveContainer.cursor="pointer";const i=()=>{this.ctx.eventHub.emit(Nb.userInput);const t=`shape ${e} onClick`,{mode:i}=this.ctx;"interactive"!==i&&"sync"!==i||this.ctx.eventHub.emit(Nb.interactiveSeqAction,{action:t,seqId:this.json.ctn.id}),"sync"!==i&&"local"!==i||this.globalEventHub.emit(t)};t.interactiveContainer.on("pointerdown",i),this.interactiveListeners.push([t,i])}}}})}setCurrentStep(t,e){this.isInteractiveSeq&&0===this.commonTimeNode.applyCount&&(this.commonTimeNode.applyCount=1);let i=t;this.commonTimeNode.seekToStart();const{length:n}=this.commonTimeNode.children;if(-1===i&&(i=n-1),0!==i||"start"!==e){if(i>=0&&i<n)for(let t=0;t<=i;t++){const n=this.commonTimeNode.children[t];t!==i?n.commonTimeNode.seekToEnd(!1,!0):"start"===e?n.commonTimeNode.seekToStart():"end"===e&&n.commonTimeNode.seekToEnd(!1,!0)}this.currentSeqIndex=i,this.currentSeqState="start"===e?"idle":"end"}}}function Dx(t,e,i){const n=e.split(".");n.reduce((r,s,o)=>{if(r)return o!==n.length-1?r[s]:void(r[s]=i);console.warn(`${t} not support ${e}`)},t)}function Fx(t,e){if(!e)return null;return e.split(".").reduce((i,n)=>{if(i)return i[n];console.warn(`${t} not support ${e}`)},t)}class Ux{constructor(t){this.timingTarget=null,this.runtimeNodeEventHub=new $a.a,this.basicOnTimeNodeEnd=()=>{if(this.isConflict){const{target:t}=this.json.cBhvr,e=this.getTargetId(t);this.ctx.conflictTimeNodeManager.removeRunningTimeNode(e,this.modifyAttrKey)}},this.basicOnTimeLineStart=()=>{if(this.isConflict){const{target:t}=this.json.cBhvr;if("next"===this.activeWhenConflict){const e=this.getTargetId(t);this.ctx.conflictTimeNodeManager.addRunningTimeNode(e,this.modifyAttrKey,this.commonTimeNode)}else"prev"===this.activeWhenConflict&&this.commonTimeNode.dispose()}};const{isIterate:e,isSub:i,json:n,ctx:r,parent:s,eventHub:o,iterateType:a,iterateIndex:l,iterateId:h,isInInteractiveSeq:c}=t;this.json=n,this.id=n.cBhvr.ctn.id,this.ctx=r,this.globalEventHub=o,this.commonTimeNode=new lb({json:n.cBhvr.ctn,isSub:i,eventHubs:{global:o,runtime:this.runtimeNodeEventHub},ctx:r,parent:s,isIterate:e,iterateType:a,iterateIndex:l,iterateId:h,isInInteractiveSeq:c}),this.timingTarget=this.ctx.timingTargets.getTarget(n.cBhvr.target,e,{type:a,index:l,id:h}),this.commonTimeNode.on("seekToStart",()=>this.onSeekToStart()),this.commonTimeNode.on("seekToEnd",()=>this.onSeekToEnd()),this.commonTimeNode.on("timelineStart",this.basicOnTimeLineStart),this.commonTimeNode.on("timeNodeEnd",this.basicOnTimeNodeEnd)}getTargetId(t){let e=t.id;return"shape"===t.type&&t.txEl&&(e=`${e}-txEl-${t.txEl.range[0]}`),this.commonTimeNode.isIterate&&(e=`${e}-iterate-${this.commonTimeNode.iterateIndex}`),e}}class kx extends Ux{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.updateStartValue=()=>{this.timingTarget&&(this.startVal=Fx(this.timingTarget,this.json.cBhvr.attrList[0]))},this.onSeekToStart=()=>{const t=this.json.cBhvr.attrList[0];null!==this.startVal&&this.timingTarget&&Dx(this.timingTarget,t,this.startVal)},this.onSeekToEnd=()=>{const t=this.json.cBhvr.attrList[0],e=this.json.cBhvr.to||this.json.to;e&&this.timingTarget&&Dx(this.timingTarget,t,e)},this.commonTimeNode.on("timeNodeStart",this.updateStartValue),this.commonTimeNode.on("timeNodeCreate",this.updateStartValue),this.commonTimeNode.on("timeUpdate",({duration:t,delta:e})=>{if(e/t>=1){const t=this.json.cBhvr.attrList[0];this.json.cBhvr.attrList.length>1&&console.warn("this.json.cBhvr.attrList.length > 0");const e=this.json.cBhvr.to||this.json.to;e&&this.timingTarget&&Dx(this.timingTarget,t,e)}})}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}}var Bx=function(t,e,i,n){var r,s=arguments.length,o=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,i,o):r(e,i))||o);return s>3&&o&&Object.defineProperty(e,i,o),o};class Gx{constructor(t,e){this.math={pi:Math.PI,e:Math.E,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,ceil:Math.ceil,cos:Math.cos,cosh:Math.cosh,deg:t=>t/Math.PI*180,exp:Math.exp,floor:Math.floor,ln:Math.log,max:Math.max,min:Math.min,rad:t=>t/180*Math.PI,rand:Math.random,sin:Math.sin,sinh:Math.sinh,sqrt:Math.sqrt,tan:Math.tan,tanh:Math.tanh},this.timingTarget=e,this.val=t.val.value,this.time=t.time,t.fmla&&(this.fmla=this.parseFmla(t.fmla))}parseFmla(t){let e=t.replace(/#ppt_h/g,`(${this.timingTarget.design_ppt_h})`);return e=e.replace(/#ppt_w/g,`(${this.timingTarget.design_ppt_w})`),e=e.replace(/#ppt_x/g,`(${this.timingTarget.design_ppt_x})`),e=e.replace(/#ppt_y/g,`(${this.timingTarget.design_ppt_y})`),e=e.replace(/ppt_w/g,"vars.ppt_w"),e=e.replace(/ppt_h/g,"vars.ppt_h"),e=e.replace(/ppt_x/g,"vars.ppt_x"),e=e.replace(/ppt_y/g,"vars.ppt_y"),e=e.replace(/#/g,"vars."),["abs","acos","asin","atan","ceil","cos","cosh","deg","exp","floor","ln","max","min","rad","rand","sin","sinh","sqrt","tan","tanh","pi","e"].forEach(t=>{const i=new RegExp(`([^a-z])${t}([^a-z])`,"g");e=e.replace(i,(e,i,n)=>`${i}math.${t}${n}`)}),new Function("vars","math","$","return "+e)}}class Hx extends Gx{constructor(t,e,i){super(t,e),this.value=t.val.value,i&&(this.fmla=this.parseFmla(i))}resolveValue(){return this.value}interpolationFrom(t,e,i){const n=t.resolveValue(i),r=n+(this.resolveValue()-n)*e;return t.fmla?t.fmla(i,this.math,r):r}}Bx([E_()],Hx.prototype,"interpolationFrom",null);class jx extends Gx{constructor(t,e){var i;super(t,e),this.value=null===(i=t.val)||void 0===i?void 0:i.value}interpolationFrom(t,e,i){let n=t.resolveValue(i);return e>this.time&&(n=this.resolveValue()),n}resolveValue(){return this.value||""}}Bx([E_()],jx.prototype,"interpolationFrom",null);class zx extends Gx{constructor(t,e){super(t,e),this.fn=this.parseFmla(this.val)}resolveValue(t){return this.fn(t,this.math,1)}interpolationFrom(t,e,i){const n=t.resolveValue(i),r=n+(this.resolveValue(i)-n)*e;return t.fmla?t.fmla(i,this.math,r):r}}Bx([E_()],zx.prototype,"interpolationFrom",null);class Vx extends Gx{constructor(t,e){super(t,e),this.value=t.val.value}interpolationFrom(t,e){return vy(t.resolveValue(),this.value,e)}resolveValue(){return this.value}}Bx([E_()],Vx.prototype,"interpolationFrom",null);class Wx extends Ux{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.startVal=null,this.vars={ppt_x:0,ppt_y:0,ppt_w:0,ppt_h:0},this.keyFrames=[],this.isColorAnim=!1,this.onTimeNodeStart=()=>{this.timingTarget&&(this.startVal=Fx(this.timingTarget,this.json.cBhvr.attrList[0]))},this.updateVars=()=>{var t,e,i,n;(null===(t=this.timingTarget)||void 0===t?void 0:t.ppt_h)&&(this.vars.ppt_h=this.timingTarget.ppt_h),(null===(e=this.timingTarget)||void 0===e?void 0:e.ppt_w)&&(this.vars.ppt_w=this.timingTarget.ppt_w),(null===(i=this.timingTarget)||void 0===i?void 0:i.ppt_x)&&(this.vars.ppt_x=this.timingTarget.ppt_x),(null===(n=this.timingTarget)||void 0===n?void 0:n.ppt_y)&&(this.vars.ppt_y=this.timingTarget.ppt_y),this.isColorAnim},this.onTimeUpdate=({duration:t,delta:e})=>{const i=e/t,n=this.keyFrames.findIndex(t=>i<=t[0]),{attrList:r}=this.json.cBhvr;if(n<0){const t=this.keyFrames[this.keyFrames.length-1];return void(this.timingTarget&&r&&r[0]&&Dx(this.timingTarget,r[0],t[1].resolveValue(this.vars)))}const s=n-1,o=this.keyFrames[n],a=this.keyFrames[s]||o,l=o[0]-a[0]==0?1:(i-a[0])/(o[0]-a[0]),h=o[1].interpolationFrom(a[1],l,this.vars);this.timingTarget&&r&&r[0]&&Dx(this.timingTarget,r[0],h)},this.onSeekToStart=()=>{null!==this.startVal&&this.timingTarget&&Dx(this.timingTarget,this.json.cBhvr.attrList[0],this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.initKeyFrames(),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timelineStart",this.updateVars),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart)}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}initKeyFrames(){var t;const{valueType:e}=this.json;if(this.json.tavLst.length<=0)if(this.json.to){if(this.json.from||this.startVal){const t={time:0,val:{type:"string",value:this.json.from||this.startVal.toString()},fmla:""};if("num"===e&&this.timingTarget){const e=new zx(t,this.timingTarget);this.keyFrames.push([t.time,e])}}const t={time:1,val:{type:"string",value:this.json.to},fmla:""};if("num"===e&&this.timingTarget){const e=new zx(t,this.timingTarget);this.keyFrames.push([t.time,e])}}else if(this.json.by){const i={time:0,val:{type:"string",value:this.json.cBhvr.attrList[0]},fmla:""};if("num"===e&&this.timingTarget){const t=new zx(i,this.timingTarget);this.keyFrames.push([i.time,t])}const n={time:1,val:{type:"string",value:((null===(t=i.val)||void 0===t?void 0:t.value)||"")+"+"+this.json.by},fmla:""};if("num"===e&&this.timingTarget){const t=new zx(n,this.timingTarget);this.keyFrames.push([n.time,t])}}if(this.json.tavLst.length>0)for(const t of this.json.tavLst)if(t.val&&this.timingTarget){let i=null;"string"===t.val.type?"num"===e?i=new zx(t,this.timingTarget):"str"===e&&(i=new jx(t,this.timingTarget)):"number"===t.val.type?i=new Hx(t,this.timingTarget):"color"===t.val.type?(this.isColorAnim=!0,i=new Vx(t,this.timingTarget)):"boolean"===t.val.type&&console.warn("not implements"),i&&this.keyFrames.push([t.time,i])}}}var Xx=i(92),Yx=i.n(Xx),qx=i(93),Zx=i.n(qx);class Jx extends Wp{constructor(){super(Zx.a,Yx.a,{percent:0,direction:1,transition:0})}set transition(t){this.uniforms.transition=t}set percent(t){this.uniforms.percent=t}set direction(t){this.uniforms.direction=t}}var Kx=i(94),$x=i.n(Kx);class Qx extends Wp{constructor(){super(void 0,$x.a,{percent:0,transition:1})}set transition(t){this.uniforms.transition=Math.pow(t,t)}set percent(t){this.uniforms.percent=t}}class tb extends Ux{constructor(t){var e;super(t),this.filterType="",this.isConflict=!0,this.activeWhenConflict="prev",this.onTimeUpdate=({duration:t,delta:e})=>{const i=e/t;this.filter&&(this.filter.percent=this.commonTimeNode.applyTimeFilter(i)),i>=1&&this.timingTarget&&this.ctx.clock.setTimeout(()=>{this.timingTarget&&(this.timingTarget.container.filters=[])})},this.onSeekToStart=()=>{this.timingTarget&&(this.timingTarget.container.filters=[])},this.onSeekToEnd=()=>{this.timingTarget&&(this.timingTarget.container.filters=[])},this.commonTimeNode.on("timelineStart",()=>{this.filter&&this.timingTarget&&(this.timingTarget.container.filters=[this.filter])}),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate);let i=0;"out"===t.json.transition?i=-1:"in"===t.json.transition&&(i=1);const n=null===(e=t.json.filter)||void 0===e?void 0:e.match(/^([a-zA-Z]+)(\((.+)\))?/);if(n){const t=n[1],e=n[3];if("wipe"===t){const i=new Jx;"up"===e?i.direction=1:"down"===e?i.direction=2:"left"===e?i.direction=3:"right"===e&&(i.direction=4),this.filter=i,this.filterType=`${t}-${e}`}else if("fade"===t){const e=new Qx;this.filter=e,this.filterType=""+t}this.filter&&(this.filter.transition=i)}}get modifyAttrKey(){return this.filterType}}class eb extends Ux{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.startPos=null,this.onTimeNodeStart=()=>{var t,e;this.startPos={x:(null===(t=this.timingTarget)||void 0===t?void 0:t.ppt_x)||0,y:(null===(e=this.timingTarget)||void 0===e?void 0:e.ppt_y)||0}},this.onTimeUpdate=({duration:t,delta:e})=>{var i;const n=e/t,r=null===(i=this.path)||void 0===i?void 0:i.getPoint(n);this.timingTarget&&r&&(this.timingTarget.ppt_x=r.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=r.y+ +this.timingTarget.design_ppt_y)},this.onSeekToStart=()=>{this.timingTarget&&this.startPos&&(this.timingTarget.ppt_x=this.startPos.x,this.timingTarget.ppt_y=this.startPos.y)},this.onSeekToEnd=()=>{var t,e,i;const n=null!==(e=null===(t=this.commonTimeNode.json)||void 0===t?void 0:t.spd)&&void 0!==e?e:1,r=null===(i=this.path)||void 0===i?void 0:i.getPoint(n>0?1:0);this.timingTarget&&r&&(this.timingTarget.ppt_x=r.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=r.y+this.timingTarget.design_ppt_y)},this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.createPath()}get modifyAttrKey(){return"motion"}createPath(){var t;const e=new Xo,i=null===(t=this.json.path)||void 0===t?void 0:t.match(/[MLCmlc][^MLCmlc]+/g);if(i)for(const t of i){const[i,...n]=t.trim().replace(/\s+/g," ").split(" ");if("M"===i){const[t,i]=n.map(t=>Number(t));e.moveTo(t,i)}else if("L"===i){const[t,i]=n.map(t=>Number(t));e.lineTo(t,i)}else if("C"===i){const[t,i,r,s,o,a]=n.map(t=>Number(t));e.bezierCurveTo(t,i,r,s,o,a)}else if("Z"===i)e.closePath();else if("E"===i)console.warn("not implements");else if("c"===i){const[t,i,r,s,o,a]=n.map(t=>Number(t)),l=e.currentPoint;e.bezierCurveTo(t+l.x,i+l.y,r+l.x,s+l.y,o+l.x,a+l.y)}else if("l"===i){const t=e.currentPoint,[i,r]=n.map(t=>Number(t));e.lineTo(i+t.x,r+t.y)}else if("m"===i){const t=e.currentPoint,[i,r]=n.map(t=>Number(t));e.moveTo(i+t.x,r+t.y)}}this.path=e}}class ib extends Ux{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.startVal=null,this.onTimelineStart=t=>{t.isReverse||this.updateCurrentValue()},this.onTimeUpdate=({duration:t,delta:e})=>{var i,n,r,s,o;const a=e/t,l={x:1,y:1};if(this.to){const t=null!==(i=this.from)&&void 0!==i?i:{x:null!==(r=null===(n=this.startVal)||void 0===n?void 0:n.x)&&void 0!==r?r:1,y:null!==(o=null===(s=this.startVal)||void 0===s?void 0:s.y)&&void 0!==o?o:1};l.x=t.x+(this.to.x-t.x)*a,l.y=t.y+(this.to.y-t.y)*a}else if(this.by){const t={x:this.by.x,y:this.by.y};l.x=1+(t.x-1)*a,l.y=1+(t.y-1)*a}this.timingTarget&&(this.timingTarget.scale=l)},this.onTimeNodeStart=()=>{this.timingTarget&&(this.startVal={x:this.timingTarget.scale.x,y:this.timingTarget.scale.y})},this.onSeekToStart=()=>{this.timingTarget&&this.startVal&&(this.timingTarget.scale=this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.from=t.json.from,this.to=t.json.to,this.by=t.json.by,this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart)}get modifyAttrKey(){return"scale"}updateCurrentValue(){this.timingTarget&&(this.current={x:this.timingTarget.scale.x,y:this.timingTarget.scale.y})}}class nb extends Ux{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.isTimelineStart=!1,this.startColorString=null,this.currentColorString="#FFFFFFFF",this.onTimelineStart=t=>{if(this.isTimelineStart)return;this.isTimelineStart=!0,t.isReverse||this.updateCurrentValue(),this.from.isInit()||this.from.fromHexString(this.currentColorString),this.to.isInit()||this.from.by(this.by,this.to);const[e]=this.json.cBhvr.attrList[0].split(".");Dx(this.timingTarget,e+".on","true")},this.onTimeNodeEnd=()=>{if("remove"===this.json.cBhvr.ctn.fill){const[t]=this.json.cBhvr.attrList[0].split(".");Dx(this.timingTarget,t+".on","false")}this.isTimelineStart=!1},this.onSeekToStart=()=>{var t;if(this.timingTarget&&(this.onTimeUpdate({duration:1,delta:0}),(null===(t=this.timingTarget.fill)||void 0===t?void 0:t.designColor.toUpperCase())===this.from.toHexString().toUpperCase())){const[t]=this.json.cBhvr.attrList[0].split(".");Dx(this.timingTarget,t+".on","false")}},this.onTimeNodeStart=()=>{if(this.timingTarget){const t=Fx(this.timingTarget,this.json.cBhvr.attrList[0]);t&&(this.startColorString=t)}},this.onTimeUpdate=({delta:t,duration:e})=>{const i=t/e;this.to.interpolationFrom(this.from,i,this.target),this.timingTarget&&Dx(this.timingTarget,this.json.cBhvr.attrList[0],this.target.toHexString())},this.onSeekToEnd=()=>{this.isTimelineStart||this.onTimelineStart({isReverse:!1,activeCount:0,id:""}),this.onTimeUpdate({duration:1,delta:1})},"rgb"===this.json.clrSpc?(this.from=new py(this.json.from),this.to=new py(this.json.to),this.by=new py(this.json.by),this.target=new py):(this.from=new dy(this.json.from),this.to=new dy(this.json.to),this.by=new dy(this.json.by),this.target=new dy),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeNodeEnd",this.onTimeNodeEnd),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate)}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}updateCurrentValue(){if(this.timingTarget){const t=Fx(this.timingTarget,this.json.cBhvr.attrList[0]);t&&(this.currentColorString=t)}}}class rb extends Ux{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.lastVal=null,this.onTimelineStart=t=>{this.lastVal=null,t.isReverse||this.updateCurrentValue()},this.onTimeUpdate=({duration:t,delta:e})=>{const i=e/t;let n=0,r=0;if(void 0!==this.from&&void 0!==this.to){n=this.from,r=this.to;const t=n+(r-n)*i;this.timingTarget&&(this.timingTarget.r=t)}else if(void 0!==this.by){this.lastVal||(this.lastVal=0);const t=this.by*i-this.lastVal;this.lastVal=this.by*i,this.timingTarget&&(this.timingTarget.r+=t)}},this.onTimeNodeStart=()=>{var t;z_()(null===(t=this.timingTarget)||void 0===t?void 0:t.r)&&(this.startVal=this.timingTarget.r)},this.onSeekToStart=()=>{this.timingTarget&&null!==this.startVal&&(this.timingTarget.r=this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.from=this.json.from,this.to=this.json.to,this.by=this.json.by,this.by?this.isConflict=!1:this.isConflict=!0,this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate)}get modifyAttrKey(){return"rotate"}updateCurrentValue(){var t;this.currentVal=null===(t=this.timingTarget)||void 0===t?void 0:t.r}}class sb extends Ux{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.isApplied=!1,this.onTimeUpdate=()=>{var t,e;const{cmd:i,cmdType:n}=this.json;!this.isApplied&&i&&n&&(this.isApplied=!0,null===(e=null===(t=this.timingTarget)||void 0===t?void 0:t.cmd)||void 0===e||e.applyCommand(i,n))},this.onSeekToStart=()=>{var t,e;null===(e=null===(t=this.timingTarget)||void 0===t?void 0:t.cmd)||void 0===e||e.applyCommand("custom-pause","call")},this.onSeekToEnd=()=>{},this.commonTimeNode.on("timeNodeStart",()=>{this.isApplied=!1}),this.commonTimeNode.on("timeNodeEnd",()=>{this.isApplied=!1}),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("seekToStart",this.onSeekToStart),this.commonTimeNode.on("seekToEnd",this.onSeekToEnd)}get modifyAttrKey(){var t,e,i,n;return(null!==(e=null===(t=this.json)||void 0===t?void 0:t.cmd)&&void 0!==e?e:"")+(null!==(n=null===(i=this.json)||void 0===i?void 0:i.cmdType)&&void 0!==n?n:"")}}class ob{constructor(t){this.runtimeNodeEventHub=new $a.a,this.onVolumeUpdate=t=>{this.audio.volume(t)},this.stopAudio=()=>{this.audio.stop()},this.destroy=()=>{this.stopAudio(),this.audio.destroy(),this.ctx.activeMedia.delete(this.audio),this.ctx.volumeAdjuster.off("update",this.onVolumeUpdate)};const{json:e,isIterate:i,isSub:n,eventHub:r,ctx:s,parent:o,iterateType:a,iterateIndex:l,iterateId:h,isInInteractiveSeq:c}=t;this.json=e,this.id=e.cMediaNode.ctn.id,this.commonTimeNode=new lb({json:e.cMediaNode.ctn,isSub:n,eventHubs:{global:r,runtime:this.runtimeNodeEventHub},ctx:s,parent:o,isIterate:i,iterateType:a,iterateIndex:l,iterateId:h,isInInteractiveSeq:c});let u=e.cMediaNode.tgtEl;s.loaderDelegate&&(u=s.loaderDelegate.redirectMedia(u),s.logger.info(`redirect media url from ${e.cMediaNode.tgtEl} to ${u} by delegate.`,s.taskId)),this.audio=new Sx(u,s.runningAudio),s.activeMedia.add(this.audio),this.commonTimeNode.on("timelineStart",()=>{this.audio.volume(s.volumeAdjuster.volume),this.audio.play()}),this.commonTimeNode.on("seekToStart",this.stopAudio),this.commonTimeNode.on("seekToEnd",this.stopAudio),this.commonTimeNode.on("timeNodeDestroy",this.destroy),this.ctx=s,this.ctx.volumeAdjuster.on("update",this.onVolumeUpdate)}}var ab=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class lb extends $a.a{constructor(t){var e,i;super(),this.uuid=A_(),this.isSub=!1,this.isShadow=!1,this.startCount=0,this.applyCount=0,this.isReverse=!1,this.isConflictDispose=!1,this.isIterateEnd=!1,this.parentTimeNode=null,this.isActive=!1,this.isDestroy=!1,this.shouldSeekOnStart=!1,this.repeatTimeoutId="",this.iterateShadows=[],this.isEndEventsEmitted=!1,this.tmFilter=[],this.timeDelta=0,this.isIterate=!1,this.iterateType="el",this.iterateIndex=0,this.children=[],this.subList=[],this.duration=0,this.isNegativeSpeed=!1,this.handleEndCond=()=>{this.isActive&&(this.isActive=!1,this.isInfiniteRepeat()?this.repeatTimeNodeEnd():this.seekToEnd(!1,!0))},this.handleActive=(t=!0)=>{if(this.isActive=!0,this.isConflictDispose=!1,this.applyCount+=1,this.json.iterate||this.emit("timeNodeStart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.startCount>0&&this.json.restart){if("never"===this.json.restart)return;"whenNotActive"!==this.json.restart&&"always"!==this.json.restart||(this.seekToStart(),this.emit("timeNodeRestart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.startTimeLine(t))}else this.startTimeLine(t)},this.updateTimeLine=t=>{const e=t/(Ac.TARGET_FPMS||.06);this.timeDelta+=e,this.duration-this.timeDelta<=e&&(this.timeDelta=this.duration),this.timeDelta<this.duration?this.emit("timeUpdate",{delta:this.isReverse||this.isNegativeSpeed?this.duration-this.timeDelta:this.timeDelta,duration:this.duration,isReverse:this.isReverse}):(this.emit("timeUpdate",{delta:this.isReverse||this.isNegativeSpeed?0:this.duration,duration:this.duration,isReverse:this.isReverse}),this.onTimeLineEnd())},this.handleEnd=(t=!1)=>{(this.isTimeNodeEnd()||t)&&(this.isActive=!1,this.isSub&&this.destroy(),this.emitEndEvents())};const{isSub:n,isIterate:r,ctx:s,eventHubs:o,parent:a,json:l,iterateType:h,iterateId:c,iterateIndex:u,isInInteractiveSeq:d}=t;this.isSub=n,this.isInInteractiveSeq=d,this.isIterate=r,this.parentTimeNode=a,this.json=l,this.ctx=s,this.iterateIndex=u,this.eventHubs=o,this.iterateType=h,this.iterateId=c,this.tmFilter=null!==(i=null===(e=l.tmFilter)||void 0===e?void 0:e.split(";").map(t=>t.split(",").map(t=>parseFloat(t.trim()))))&&void 0!==i?i:[];const p=Number(this.json.dur),f=this.json.spd||1;this.isNegativeSpeed=f<0,Number.isNaN(p)||(this.duration=p/Math.abs(f)),this.uuid+="--"+this.json.id,this.setPreStyle(),l.childTnLst&&this.createChildren(l.childTnLst),this.startConds=new Nx(this.json.id||"",l.stCondLst,o,this.ctx),this.endConds=new Nx(this.json.id||"",l.endCondLst,o,this.ctx),l.endSync&&(this.endSync=new Nx(this.json.id||"",[l.endSync],o,this.ctx),this.endSync.on("active",()=>{var t;"interactiveSeq"===this.json.nodeType&&(this.isActive=!1,this.shouldSeekOnStart=!0,this.emit("timeNodeEndSync"),null===(t=this.endSync)||void 0===t||t.reset())})),this.startConds.on("active",t=>{this.isActive||(this.shouldSeekOnStart&&(this.shouldSeekOnStart=!1,this.seekToStart()),this.handleActive(t))}),this.endConds.on("active",()=>{this.handleEndCond(),this.children.forEach(t=>t.commonTimeNode.handleEndCond())}),this.parentTimeNode&&this.parentTimeNode.on("timeNodeStart",()=>{this.applyCount=0}),this.isSub&&"nextClick"===this.json.masterRel&&this.startConds.addCond({event:"shape slide onNext"}),this.json.iterate&&!1===this.isIterate&&this.createIterateShadow()}createIterateShadow(){const t=A_();let e=!0,i=0;const n=i=>{i===t&&(e=!1,this.ctx.eventHub.removeListener("IterateTimeNodeEnd",n))};for(this.ctx.eventHub.on("IterateTimeNodeEnd",n);e;){const e=JSON.parse(JSON.stringify(this.json)),n=new lb({json:e,isSub:!1,eventHubs:this.eventHubs,ctx:this.ctx,parent:null,isIterate:!0,iterateType:e.iterate.type,iterateIndex:i,iterateId:t,isInInteractiveSeq:this.isInInteractiveSeq});this.iterateShadows[i]=n,i+=1}}isInfiniteRepeat(){return this.json.repeatCount>999999998}getReverse(){return this.isReverse}setReverse(t){this.isReverse=t}createTimeNode(t,e){let i=null;const n={json:t,isSub:e,isIterate:this.isIterate,eventHub:this.eventHubs.global,ctx:this.ctx,parent:this,iterateType:this.iterateType,iterateIndex:this.iterateIndex,iterateId:this.iterateId,isInInteractiveSeq:this.isInInteractiveSeq};return"seq"===t.type?i=new Ox(n):"par"===t.type?i=new hb(n):"set"===t.type?i=new kx(n):"anim"===t.type?i=new Wx(n):"animEffect"===t.type?i=new tb(n):"animMotion"===t.type?i=new eb(n):"animScale"===t.type?i=new ib(n):"animClr"===t.type?i=new nb(n):"animRot"===t.type?i=new rb(n):"cmd"===t.type?i=new sb(n):"audio"===t.type&&(i=new ob(n)),i}createSubList(t){this.subList&&this.subList.forEach(t=>t.commonTimeNode.destroy()),this.subList=[],t.forEach(t=>{const e=this.createTimeNode(t,!0);e&&this.subList.push(e)})}bindCommonTimeNodeEvent(t){t.commonTimeNode.on("timeNodeStart",t=>{this.emit("childTimeNodeStart",t)}),t.commonTimeNode.on("timeNodeEnd",t=>{this.emit("childTimeNodeEnd",t),this.children.every(t=>t.commonTimeNode.isTimeNodeEndWhenDetectEndSync())&&(this.json.iterate||this.allChildrenEndHandle())})}createChildren(t){function e(t){return(e=t,function(t){var e;return!!(null===(e=t)||void 0===e?void 0:e.cBhvr)}(e)?e.cBhvr.ctn:function(t){var e,i;return!!(null===(i=null===(e=t)||void 0===e?void 0:e.cMediaNode)||void 0===i?void 0:i.ctn)}(e)?e.cMediaNode.ctn:e.ctn).presetOrder;var e}if(t&&t[0]&&e(t[0])){[...t].sort((t,i)=>{var n,r;return(null!==(n=e(t))&&void 0!==n?n:0)-(null!==(r=e(i))&&void 0!==r?r:0)}).forEach(e=>{const i=t.findIndex(t=>t===e),n=this.createTimeNode(e,!1);n&&(this.bindCommonTimeNodeEvent(n),this.children[i]=n)})}else t.forEach(t=>{const e=this.createTimeNode(t,!1);e&&(this.bindCommonTimeNodeEvent(e),this.children.push(e))})}playReverse(){this.isReverse=!0,this.startReverseTimeLine(),this.children.forEach(t=>t.commonTimeNode.playReverse())}allChildrenEndHandle(){if(!this.isDestroy){if(this.json.autoRev&&!this.isReverse)return this.isReverse=!0,void this.playReverse();this.isReverse&&(this.isReverse=!1),this.json.repeatCount&&this.json.repeatCount>this.applyCount?this.repeatTimeoutId=this.ctx.clock.setTimeout(()=>{this.seekToStart(!1),this.resetForRepeat(),this.startTimeNodeRepeat()}):(this.json.iterate&&!this.isIterate&&(this.isIterateEnd=!0),this.eventHubs.runtime.emit("runtime all end"),this.startSubList(),this.handleEnd())}}resetForRepeat(){this.isInInteractiveSeq&&this.isInfiniteRepeat()&&this.repeatTimeNodeEnd(),this.timeDelta=0,this.children.forEach(t=>t.commonTimeNode.resetForRepeat())}startSubList(){this.subList.forEach(t=>t.commonTimeNode.startTimeNode())}startReverseTimeLine(){this.isEndEventsEmitted=!1,this.timeDelta=0;const t=1e3/this.ctx.ticker.maxFPS;this.duration<=t&&this.duration>0?(this.emit("timeUpdate",{delta:this.duration,duration:this.duration,isReverse:this.isReverse}),this.ctx.eventHub.emit(Nb.animateEnd),this.ctx.ticker.remove(this.updateTimeLine)):this.duration>t&&(this.ctx.eventHub.emit(Nb.animateStart),this.ctx.ticker.add(this.updateTimeLine))}startTimeLine(t=!0){if(t&&(this.isEndEventsEmitted=!1,this.eventHubs.global.emit(`time ${this.json.id} begin`),this.eventHubs.global.emit(`time ${this.json.id} onBegin`),this.eventHubs.runtime.emit(`runtime ${this.json.id} begin`)),this.json.iterate)return void this.startIterate();this.timeDelta=0,this.emit("timelineStart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse});const e=1e3/this.ctx.ticker.maxFPS;this.duration<=e&&this.duration>0?(this.timeDelta=this.isReverse?0:this.duration,this.emit("timeUpdate",{delta:this.timeDelta,duration:this.duration,isReverse:this.isReverse}),this.emit("timelineEnd",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.ctx.ticker.addOnce(()=>{this.onTimeLineEnd()})):this.duration>e&&(this.ctx.eventHub.emit(Nb.animateStart),this.updateTimeLine(0),this.ctx.ticker.add(this.updateTimeLine))}startIterate(){return ab(this,void 0,void 0,(function*(){if(this.json.iterate){this.isIterateEnd=!1;for(const t of this.iterateShadows){if(this.isIterateEnd)break;t.children.forEach(t=>{t.commonTimeNode.startTimeNode()}),t.applyCount+=1,yield this.ctx.clock.delay(this.json.iterate.interval)}this.onTimeLineEnd()}}))}applyTimeFilter(t){if(!this.tmFilter.every(t=>z_()(t[0])&&z_()(t[1])))return t;for(let e=0;e<this.tmFilter.length;e++){const i=this.tmFilter[e];if(t<i[0]){const n=this.tmFilter[e-1];return(t-n[0])/(i[0]-n[0])*(i[1]-n[1])+n[1]}}return this.tmFilter.length>0?this.tmFilter[this.tmFilter.length-1][1]:t}isNatureTimeEnd(){return this.duration>=0&&this.timeDelta>=this.duration}findTargets(){const t=[],e=i=>{i.forEach(i=>{var n,r,s;i.cBhvr&&i.cBhvr.target&&t.findIndex(t=>t.id===i.cBhvr.target.id)<0&&t.push(i.cBhvr.target),(null===(r=null===(n=null==i?void 0:i.cBhvr)||void 0===n?void 0:n.ctn)||void 0===r?void 0:r.childTnLst)&&i.cBhvr.ctn.childTnLst.length>0&&e(i.cBhvr.ctn.childTnLst),(null===(s=null==i?void 0:i.ctn)||void 0===s?void 0:s.childTnLst)&&i.ctn.childTnLst.length>0&&e(i.ctn.childTnLst)})};return e(this.json.childTnLst||[]),t}setPreStyle(){this.json.presetClass&&this.findTargets().forEach(t=>{if(this.json.iterate){let e=0,i=!0;for(;i;){const n=this.ctx.timingTargets.getTarget(t,!0,{type:this.json.iterate.type,index:e,id:""});n&&(this.setPreStyleForTarget(n),e+=1),i=!!n}}else{const e=this.ctx.timingTargets.getTarget(t,!1);e&&this.setPreStyleForTarget(e)}})}setPreStyleForTarget(t){var e,i;if(t&&this.json.presetSubtype&&(t.presetSubType=this.json.presetSubtype),t&&!t.hasPreset)if("entr"===this.json.presetClass){const n=null===(i=null===(e=this.json)||void 0===e?void 0:e.childTnLst)||void 0===i?void 0:i.filter(t=>"set"===t.type&&"visible"===t.to);(null==n?void 0:n.length)&&(t.hasPreset=!0,t.style.visibility="hidden")}else("exit"===this.json.presetClass||"path"===this.json.presetClass||"emph"===this.json.presetClass)&&(t.hasPreset=!0,t.style.visibility="visible")}startTimeNodeRepeat(){this.timeDelta=0,this.isActive=!0,this.applyCount+=1,this.startTimeLine(!1),this.json.iterate||this.emit("timeNodeRepeat",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse})}startTimeNodeForce(){this.json.subTnLst&&this.createSubList(this.json.subTnLst),this.timeDelta=0,this.isActive=!0,this.handleActive(!1)}startTimeNode(t=!0){if(this.isDestroy)return;this.collectStartValue(),this.timeDelta=0,this.isReverse=!1,this.json.subTnLst&&this.createSubList(this.json.subTnLst),this.startConds.setTriggerParams(t);const e=this.json.stCondLst.filter(t=>/^self/.test(t.event||""))[0];e&&this.startConds.condHandle(e);const i=this.json.endCondLst.filter(t=>/^self/.test(t.event||""))[0];i&&this.endConds.condHandle(i),this.startConds.condHandle()}onTimeLineEnd(){this.dispose(),(0===this.children.length||this.json.iterate)&&this.allChildrenEndHandle()}clearSubList(){this.subList.forEach(t=>t.commonTimeNode.destroy())}seekToStart(t=!0){if(this.isEndEventsEmitted=!1,this.isActive=!1,this.dispose(),this.timeDelta=0,this.emit("seekToStart"),this.json.iterate&&!this.isIterate)return this.isIterateEnd=!0,void this.iterateShadows.forEach(e=>e.seekToStart(t));if(t)for(let t=this.subList.length-1;t>=0;t--){const e=this.subList[t];null==e||e.commonTimeNode.seekToStart()}for(let t=this.children.length-1;t>=0;t--){const e=this.children[t];null==e||e.commonTimeNode.seekToStart()}if(this.children.length>1)for(let t=this.children.length-1;t>=0;t--){const e=this.children[t];null==e||e.commonTimeNode.seekToStart()}}repeatTimeNodeEnd(){this.dispose(),this.children.forEach(t=>{t.commonTimeNode.isActive=!1,t.commonTimeNode.dispose()})}dispose(t=!1){this.isConflictDispose=t,this.ctx.clock.clearTimeout(this.repeatTimeoutId),this.ctx.eventHub.emit(Nb.animateEnd);try{this.ctx.ticker.remove(this.updateTimeLine)}catch(t){}this.startConds.reset(),this.endConds.reset()}seekToEnd(t,e=!1){if(this.isInfiniteRepeat())return;!this.isActive&&this.applyCount<=0&&this.collectStartValue(),this.applyCount=this.json.repeatCount,this.json.autoRev&&(this.isReverse=!0),this.timeDelta=this.duration,this.isActive=!1,this.dispose();const i=this.json.autoRev||t;if(i?this.emit("seekToStart"):this.emit("seekToEnd"),this.json.iterate&&!this.isIterate)return this.isIterateEnd=!0,void this.iterateShadows.forEach(t=>t.seekToEnd(i,e));0===this.children.length&&(this.eventHubs.runtime.emit("runtime all end"),this.handleEnd()),this.children.forEach(t=>t.commonTimeNode.seekToEnd(i,e)),e&&this.json.subTnLst&&(this.subList.length<=0&&this.createSubList(this.json.subTnLst),this.subList.forEach(t=>t.commonTimeNode.seekToEnd(!1)),this.clearSubList())}isTimeNodeEndWhenDetectEndSync(){if(this.isInInteractiveSeq&&this.isInfiniteRepeat())return!0;let t=!0;return this.children.length>0&&(t=t&&this.children.every(t=>t.commonTimeNode.isTimeNodeEndWhenDetectEndSync())),this.json.repeatCount&&(t=t&&this.applyCount>=this.json.repeatCount),this.json.autoRev&&(t=t&&!this.isReverse),t=t&&this.isNatureTimeEnd(),!!this.isConflictDispose||(!(!this.isIterateEnd||!this.json.iterate)||t)}isTimeNodeEnd(){let t=!0;return this.children.length>0&&(t=t&&this.children.every(t=>t.commonTimeNode.isTimeNodeEnd())),this.json.repeatCount&&(t=t&&this.applyCount>=this.json.repeatCount),this.json.autoRev&&(t=t&&!this.isReverse),t=t&&this.isNatureTimeEnd(),!!this.isConflictDispose||(!(!this.isIterateEnd||!this.json.iterate)||t)}emitEndEvents(){this.isEndEventsEmitted||(this.isEndEventsEmitted=!0,this.eventHubs.global.emit(`time ${this.json.id} end`),this.eventHubs.global.emit(`time ${this.json.id} onEnd`),this.eventHubs.runtime.emit(`runtime ${this.json.id} end`),this.emit("timeNodeEnd",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}))}collectStartValue(){this.emit("timeNodeCreate"),this.children.forEach(t=>t.commonTimeNode.collectStartValue())}destroy(){this.emit("timeNodeDestroy"),this.isDestroy=!0,this.dispose(),this.startConds.removeAllListeners(),this.endConds.removeAllListeners(),this.children.forEach(t=>t.commonTimeNode.destroy()),this.clearSubList()}}class hb extends $a.a{constructor(t){super(),this.isRunning=!1,this.runtimeNodeEventHub=new $a.a;const{json:e,iterateType:i,isIterate:n,isSub:r,parent:s,ctx:o,eventHub:a,iterateIndex:l,iterateId:h,isInInteractiveSeq:c}=t;this.id=e.ctn.id,this.json=e,this.ctx=o,this.isIterate=n,this.globalEventHub=a,this.commonTimeNode=new lb({json:e.ctn,isSub:r,eventHubs:{global:a,runtime:this.runtimeNodeEventHub},ctx:o,parent:s,isIterate:!1,iterateType:i,iterateIndex:l,iterateId:h,isInInteractiveSeq:c}),this.commonTimeNode.on("timeNodeStart",()=>{this.commonTimeNode.children.forEach(t=>{t.commonTimeNode.setReverse(this.commonTimeNode.getReverse()),t.commonTimeNode.startTimeNode()}),this.isRunning||(this.isRunning=!0,this.globalEventHub.emit(`runtime ${this.id} begin`),this.emit("begin"))}),this.commonTimeNode.on("timeNodeRepeat",()=>{this.commonTimeNode.children.forEach(t=>{t.commonTimeNode.startTimeNode(!1)})}),this.commonTimeNode.on("timeNodeEnd",()=>{this.commonTimeNode.isTimeNodeEnd()&&this.isRunning&&(this.isRunning=!1,this.globalEventHub.emit(`runtime ${this.id} end`),this.emit("end"))})}}var cb=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class ub{constructor(t,e,i){this.json=t,this.ctx=i,this.globalEventHub=e;const n=t.timeNodeList.find(t=>"par"===t.type&&"tmRoot"===t.ctn.nodeType);n&&(this.tmRoot=new hb({json:n,isSub:!1,isIterate:!1,eventHub:e,ctx:i,parent:null,iterateType:"el",iterateIndex:0,iterateId:"",isInInteractiveSeq:!1}),this.mainSeq=this.tmRoot.commonTimeNode.children.find(t=>{var e,i,n;return"seq"===(null===(e=t.json)||void 0===e?void 0:e.type)&&"mainSeq"===(null===(n=null===(i=t.json)||void 0===i?void 0:i.ctn)||void 0===n?void 0:n.nodeType)}))}findSeq(t){var e;return null===(e=this.tmRoot)||void 0===e?void 0:e.commonTimeNode.children.find(e=>{var i,n,r;return"seq"===(null===(i=e.json)||void 0===i?void 0:i.type)&&(null===(r=null===(n=e.json)||void 0===n?void 0:n.ctn)||void 0===r?void 0:r.id)===t})}start(){var t,e;return cb(this,void 0,void 0,(function*(){this.json.autoPlayMainSeq?(yield this.ctx.clock.delay(16),null===(t=this.mainSeq)||void 0===t||t.commonTimeNode.startTimeNode()):null===(e=this.mainSeq)||void 0===e||e.commonTimeNode.startTimeNode()}))}setMainSeqApplied(){this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1)}collectMainSeqStartValue(){var t;null===(t=this.mainSeq)||void 0===t||t.commonTimeNode.collectStartValue()}setMainSeqStep(t,e){var i;-1===t&&this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1),null===(i=this.mainSeq)||void 0===i||i.setCurrentStep(t,e)}destroy(){var t;this.globalEventHub.removeAllListeners(),null===(t=this.tmRoot)||void 0===t||t.commonTimeNode.destroy()}hasMainSeq(){return!!this.mainSeq&&this.mainSeq.commonTimeNode.children.length>0}currentMainSeqState(){return this.mainSeq?this.mainSeq.currentState:null}currentMainSeqStep(){return this.mainSeq?this.mainSeq.currentStep:0}currentMainSeqLength(){return this.mainSeq?this.mainSeq.stepLength:0}mainSeqHasNextStep(){return!!this.mainSeq&&this.mainSeq.hasNext()}mainSeqHasPrevStep(){return!!this.mainSeq&&this.mainSeq.hasPrev()}seekInteractiveSeqToEnd(t){const e=this.findSeq(t);e&&e.commonTimeNode.seekToEnd(!1,!0)}setInteractiveSeqState(t,e,i){const n=this.findSeq(t);n&&n.setCurrentStep(e,i)}resetAllInteractiveSeq(){var t;((null===(t=this.tmRoot)||void 0===t?void 0:t.commonTimeNode.children.filter(t=>{var e,i,n;return"seq"===(null===(e=t.json)||void 0===e?void 0:e.type)&&"interactiveSeq"===(null===(n=null===(i=t.json)||void 0===i?void 0:i.ctn)||void 0===n?void 0:n.nodeType)}))||[]).forEach(t=>{t.setCurrentStep(0,"start")})}applyInteractiveAction(t){this.globalEventHub.emit(t)}}var db=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class pb extends Lx{constructor(t,e,i,n){super({id:"stage",width:t.width,height:t.height,type:"Container",children:t.children},e,i,void 0,n),this.isRendered=!1,this.isTimingStartValueCollected=!1,this.json=t,e.hasBackgroundFillShape=this.detectUseBackgroundFill(this.json),this.container.visible=!1,this.ctx=e;const r=new Jv;r.beginFill(16777215),r.drawRect(0,0,t.width,t.height),r.endFill(),this.container.addChild(r)}detectUseBackgroundFill(t){return!!t&&("Picture"===t.type||"Shape"===t.type?t.useBgFill:!(!t.children||!Array.isArray(t.children))&&t.children.some(t=>this.detectUseBackgroundFill(t)))}initOnReuse(){super.initOnReuse(),this.ctx.timingEventHub.on("c:prev slide",t=>{this.ctx.eventHub.emit(Nb.requestPrevSlide,t)}),this.ctx.timingEventHub.on("c:next slide",t=>{this.ctx.eventHub.emit(Nb.requestNextSlide,t)})}get interactiveContainer(){return this.container}render(t){if(this.isRendered)return;this.collectAnimatedIds().forEach(t=>this.ctx.animatedIds.add(t)),this.isRendered=!0,super.render(t),t.addSubMTask(()=>db(this,void 0,void 0,(function*(){this.ctx.eventHub.emit("StageRenderEnd")})),"@StageImpl[emit.StageRenderEnd]")}isListTimeNode(t){return["excel","seq","par"].indexOf(t.type)>=0}isAnimatedTimeNode(t){return!!t.cBhvr}collectAnimatedIdsForTimeNode(t,e){var i;this.isListTimeNode(t)?null===(i=t.ctn.childTnLst)||void 0===i||i.forEach(t=>{this.collectAnimatedIdsForTimeNode(t,e)}):this.isAnimatedTimeNode(t)&&e.push(t.cBhvr.target.id)}collectAnimatedIds(){const t=[];return this.json.timing&&this.json.timing.timeNodeList.forEach(e=>{this.collectAnimatedIdsForTimeNode(e,t)}),t}createTiming(){this.json.timing&&!this.timing&&(this.timing=new ub(this.json.timing,this.ctx.timingEventHub,this.ctx))}startTiming(){var t;return(null===(t=this.timing)||void 0===t?void 0:t.start())||Promise.resolve()}setMainSeqApplied(){var t;null===(t=this.timing)||void 0===t||t.setMainSeqApplied()}setMainSeqStep(t,e){var i;null===(i=this.timing)||void 0===i||i.setMainSeqStep(t,e)}collectMainSeqStartValue(){var t;this.isTimingStartValueCollected||(this.isTimingStartValueCollected=!0,null===(t=this.timing)||void 0===t||t.collectMainSeqStartValue())}hasTiming(){return!!this.timing}clearOnSlideChange(){this.ctx.eventHub.removeAllListeners(),this.ctx.timingEventHub.removeAllListeners(),super.clearOnSlideChange()}clearOnTransactionEnd(){var t,e;this.ctx.timingTargets.getTargets().forEach(t=>{t.hasPreset=!1}),null===(t=this.timing)||void 0===t||t.resetAllInteractiveSeq(),null===(e=this.timing)||void 0===e||e.destroy(),this.timing=void 0}destroy(){var t,e;this.isTimingStartValueCollected=!1,this.isRendered=!1,this.ctx.eventHub.removeAllListeners(),this.ctx.graphicsTexture.destroy(),null===(t=this.ctx.bgTexture)||void 0===t||t.destroy(!0),this.ctx.spriteTexture.destroy(),this.ctx.timingEventHub.removeAllListeners(),null===(e=this.timing)||void 0===e||e.destroy(),this.timing=void 0,super.destroy()}mainSeqStep(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.currentMainSeqStep())&&void 0!==e?e:0}mainSeqLength(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.currentMainSeqLength())&&void 0!==e?e:0}mainSeqHasNextStep(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.mainSeqHasNextStep())&&void 0!==e&&e}mainSeqHasPrevStep(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.mainSeqHasPrevStep())&&void 0!==e&&e}mainSeqState(){return this.timing?this.timing.currentMainSeqState():null}nextStep(t=!1){var e;this.hasTiming()&&(null===(e=this.timing)||void 0===e?void 0:e.hasMainSeq())?(this.ctx.timingEventHub.emit("shape slide onStopAudio"),this.ctx.timingEventHub.emit("shape slide onNext",t)):this.ctx.eventHub.emit(Nb.requestNextSlide,t)}prevStep(t=!1){var e;this.hasTiming()&&(null===(e=this.timing)||void 0===e?void 0:e.hasMainSeq())?(this.ctx.timingEventHub.emit("shape slide onStopAudio"),this.ctx.timingEventHub.emit("shape slide onPrev",t)):this.ctx.eventHub.emit(Nb.requestPrevSlide,t)}applyInteractiveAction(t){var e;null===(e=this.timing)||void 0===e||e.applyInteractiveAction(t)}seekInteractiveSeqToEnd(t){var e;null===(e=this.timing)||void 0===e||e.seekInteractiveSeqToEnd(t)}setInteractiveSeqState(t,e,i){var n;null===(n=this.timing)||void 0===n||n.setInteractiveSeqState(t,e,i)}setMediaState(t,e){return db(this,void 0,void 0,(function*(){const i=this.ctx.medias[t];i&&(e?yield i.play():yield i.pause())}))}setMediaCurrentTime(t,e){const i=this.ctx.medias[t];i&&i.seek(e)}}class fb{constructor(t){this.ticker=t,this.tasks=[],this.couldRunning=!1,this.applyNext=()=>{const t=this.tasks[0];t&&t.applyNext()},t.add(this.applyNext)}addTask(t){this.tasks.push(t),t.once("task-finish",()=>{const e=this.tasks.indexOf(t);e>=0&&this.tasks.splice(e,1)}),t.once("task-error",()=>{const e=this.tasks.indexOf(t);e>=0&&this.tasks.splice(e,1)})}start(){this.couldRunning=!0}stop(){this.couldRunning=!1}}var mb=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};const gb=t=>new Promise(e=>setTimeout(e,t));class vb extends $a.a{constructor(t,e,i){super(),this.slideIndex=t,this.taskId=e,this.logger=i,this.uuid=A_(),this.isCancel=!1,this.tasks=[]}addMTask(t,e){this.tasks.push({fn:t,state:"wait",sub:[],name:e})}addSubMTask(t,e){let i=this.tasks.findIndex(t=>"running"===t.state);i<0&&(i=0),this.tasks[i].sub.push({fn:t,state:"wait",sub:[],name:e})}cancel(){this.tasks=[],this.isCancel=!0}applyNext(){if(this.tasks.some(t=>"running"===t.state))return;if(this.tasks.some(t=>"error"===t.state))return;if(this.tasks.every(t=>"finish"===t.state))return void(this.isCancel||this.emit("task-finish"));const t=this.tasks.find(t=>"wait"===t.state);t&&(t.state="running",t.fn.apply(null).then(()=>{if(t.state="finish",t.sub.length>0){const e=this.tasks.findIndex(e=>e===t);this.tasks.splice(e+1,0,...t.sub)}}).catch(e=>{t.state="error",this.logger.error(`${e} ${e.stack}`,this.taskId),this.emit("task-error",T_.transform(e),this.slideIndex)}))}applyAll(){return mb(this,void 0,void 0,(function*(){for(;!this.tasks.every(t=>"finish"===t.state);)if(this.tasks.some(t=>"running"===t.state))yield gb(16);else{if(this.tasks.some(t=>"error"===t.state))return;{const t=this.tasks.find(t=>"wait"===t.state);if(t){t.state="running";try{if((yield I_(()=>t.fn.apply(null),6e4))===P_)throw new T_(b_.RuntimeError,`subtask ${t.name} apply timeout`);if(t.state="finish",t.sub.length>0){const e=this.tasks.findIndex(e=>e===t);this.tasks.splice(e+1,0,...t.sub)}}catch(e){let i;i=(null==e?void 0:e.errorType)?e:new T_(b_.RuntimeError,`subtask ${t.name} error. ${e}`),t.state="error",this.logger.error(`${e} ${e.stack}`,this.taskId),this.emit("task-error",T_.transform(i),this.slideIndex);break}}}}!this.isCancel&&this.tasks.every(t=>"finish"===t.state)&&this.emit("task-finish")}))}}var _b=i(95);const yb=new(i.n(_b).a),xb=yb.getDevice(),bb=yb.getBrowser(),Tb=yb.getOS(),Eb={isDesktop(){let t=!0;return"mobile"===xb.type&&(t=!1),/Samsung/.test(bb.name||"")&&(t=!1),window.__nativeTags&&window.__nativeTags.platform&&(t=!1),t},isIOS(){let t=!1;return window.__nativeTags&&window.__nativeTags.platform&&/^ios/i.test(window.__nativeTags.platform)&&(t=!0),Tb.name&&/iOS/.test(Tb.name)&&(t=!0),t},isAndroid(){let t=!1;return window.__nativeTags&&window.__nativeTags.platform&&/^android/i.test(window.__nativeTags.platform)&&(t=!0),Tb.name&&/android/i.test(Tb.name)&&(t=!0),t},isLowGpuMemory(){var t,e;const i=null!==(e=null===(t=window.__nativeTags)||void 0===t?void 0:t.platform)&&void 0!==e?e:"";if(i){const t=i.split(" ");if(t[1]){if(/^iPad/.test(t[1])){const e=t[1].match(/^iPad(\d+)/);return!(e&&e[1]&&parseInt(e[1],10)>=6)}if(/^iPhone/.test(t[1])){const e=t[1].match(/^iPhone(\d+)/);return!(e&&e[1]&&parseInt(e[1],10)>=9)}return!1}return!1}return!0}};var wb=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class Sb{constructor(t,e){if(this.renderer=t,this.localStorage=e,this.outputData=new Map,this.loadingSdfKeys=new Set,!Sb.worker){const t=new Blob(['\nself.onmessage = function(e) {\n var data = e.data.data;\n var key = e.data.key;\n var height = Math.ceil(e.data.height);\n var width = Math.ceil(e.data.width);\n if (!data || !key) {\n return;\n }\n var maxDis = 0;\n var d = [];\n var p = [];\n var maxInt = Number.MAX_SAFE_INTEGER || 255 * 255 * 255;\n var setD = function(x, y, v) { d[y * width + x] = v; };\n var getD = function(x, y) { return d[y * width + x]; };\n var setP = function(x, y, v) { p[y * width + x] = v; };\n var getP = function(x, y) { return p[y * width + x]; };\n var isContains = function(x, y) { return x >= 0 && x < width && y >= 0 && y < height; };\n var isInterior = function(x, y) { return data[(y * width + x) * 4 + 3] > 10; };\n for (var y = 0; y < height; ++ y) {\n for (var x = 0; x < width; ++ x) {\n var c = isInterior(x, y);\n var t = isContains(x, y - 1) ? isInterior(x, y - 1) : false;\n var b = isContains(x, y + 1) ? isInterior(x, y + 1) : false;\n var l = isContains(x - 1, y) ? isInterior(x - 1, y) : false;\n var r = isContains(x + 1, y) ? isInterior(x + 1, y) : false;\n if (c !== t || c !== b || c !== l || c !== r) {\n setD(x, y, 0);\n setP(x, y, [x, y]);\n } else {\n setD(x, y, maxInt);\n setP(x, y, [-1, -1]);\n }\n }\n }\n \n var f = function (x, y, dir) {\n var d1 = 1;\n var d2 = Math.sqrt(2);\n var dx;\n var dy;\n var od;\n switch (dir) {\n case "TL": dx = -1; dy = -1; od = d2; break;\n case "T": dx = 0; dy = -1; od = d1; break;\n case "TR": dx = 1; dy = -1; od = d2; break;\n case "L": dx = -1; dy = 0; od = d1; break;\n case "R": dx = 1; dy = 0; od = d1; break;\n case "BL": dx = -1; dy = 1; od = d2; break;\n case "B": dx = 0; dy = 1; od = d1; break;\n case "BR": dx = 1; dy = 1; od = d2; break;\n }\n var b = isContains(x + dx, y + dy);\n var cb = b ? getD(x + dx, y + dy) : maxInt;\n if (cb + od < getD(x, y)) {\n var p = b ? getP(x + dx, y + dy) : [-1, -1];\n var dis = Math.sqrt(Math.pow(x - p[0], 2) + Math.pow(y - p[1], 2));\n setP(x, y, p);\n setD(x, y, dis);\n if (dis > maxDis) {\n maxDis = dis;\n }\n }\n };\n \n for (var y = 0; y < height; ++ y) {\n for (var x = 0; x < width; ++ x) {\n var dirs = ["TL", "T", "TR", "L"];\n for (var i = 0; i < dirs.length; ++ i) {\n var dir = dirs[i];\n f(x, y, dir);\n }\n }\n }\n\n for (var y = height - 1; y >= 0; -- y) {\n for (var x = width - 1; x >= 0; -- x) {\n var dirs = ["R", "BL", "B", "BR"];\n for (var i = 0; i < dirs.length; ++ i) {\n var dir = dirs[i];\n f(x, y, dir);\n }\n }\n }\n\n var outputData = [];\n for (var y = 0; y < height; ++ y) {\n for (var x = 0; x < width; ++ x) {\n outputData.push(isInterior(x, y) ? 255: 0);\n outputData.push(0);\n outputData.push(0);\n outputData.push(Math.ceil(getD(x, y) / maxDis * 255));\n }\n }\n self.postMessage({\n key, outputData, maxDis\n });\n};\n'],{type:"text/javascript"});Sb.worker=new Worker(URL.createObjectURL(t)),Sb.worker.onmessage=t=>{this.outputData.set(t.data.key,{data:t.data.outputData,maxDis:t.data.maxDis})},this.outputData.set("111","222")}}createSdfByWorker(t,e,i,n,r,s,o,a){const l=document.createElement("canvas");l.width=r,l.height=s;const h=l.getContext("2d");if(!h||!Sb.worker)return;h.drawImage(o,t,e,i,n);const{data:c}=h.getImageData(0,0,r,s);Sb.worker.postMessage({data:c,key:a,width:r,height:s})}createSdf(t,e,i){const n=document.createElement("canvas");n.width=t,n.height=e;const r=n.getContext("2d");if(!r)return{src:"",maxDis:1};r.drawImage(i,0,0);let s=0;const{data:o}=r.getImageData(0,0,t,e),a=[],l=[],h=function(e,i,n){a[i*t+e]=n},c=function(e,i){return a[i*t+e]},u=function(e,i,n){l[i*t+e]=n},d=function(e,i){return l[i*t+e]},p=function(i,n){return i>=0&&i<t&&n>=0&&n<e},f=function(e,i){return o[4*(i*t+e)+3]>10};for(let i=0;i<e;++i)for(let e=0;e<t;++e){const t=f(e,i),n=!!p(e,i-1)&&f(e,i-1),r=!!p(e,i+1)&&f(e,i+1),s=!!p(e-1,i)&&f(e-1,i),o=!!p(e+1,i)&&f(e+1,i);t!==n||t!==r||t!==s||t!==o?(h(e,i,0),u(e,i,[e,i])):(h(e,i,Number.MAX_SAFE_INTEGER),u(e,i,[-1,-1]))}const m=function(t,e,i){const n=Math.sqrt(2);let r,o,a;switch(i){case"TL":r=-1,o=-1,a=n;break;case"T":r=0,o=-1,a=1;break;case"TR":r=1,o=-1,a=n;break;case"L":r=-1,o=0,a=1;break;case"R":r=1,o=0,a=1;break;case"BL":r=-1,o=1,a=n;break;case"B":r=0,o=1,a=1;break;case"BR":r=1,o=1,a=n}const l=p(t+r,e+o);if((l?c(t+r,e+o):Number.MAX_SAFE_INTEGER)+a<c(t,e)){const i=l?d(t+r,e+o):[-1,-1],n=Math.sqrt(Math.pow(t-i[0],2)+Math.pow(e-i[1],2));u(t,e,i),h(t,e,n),n>s&&(s=n)}};for(let i=0;i<e;++i)for(let e=0;e<t;++e){const t=["TL","T","TR","L"];for(const n of t)m(e,i,n)}for(let i=e-1;i>=0;--i)for(let e=t-1;e>=0;--e){const t=["R","BL","B","BR"];for(const n of t)m(e,i,n)}const g=[];for(let i=0;i<e;++i)for(let e=0;e<t;++e)g.push(0,0,0,Math.ceil(c(e,i)/s*255));return r.putImageData(new ImageData(Uint8ClampedArray.from(g),t,e),0,0),{src:n.toDataURL("image/png"),maxDis:s}}getSdf(t,e,i){return wb(this,void 0,void 0,(function*(){const n=Math.ceil(e.width),r=Math.ceil(e.height),s=Math.ceil(e.width-t.width)/2,o=Math.ceil(e.height-t.height)/2;let a=yield this.localStorage.getItem(`sdf-${i}-src`),l=yield this.localStorage.getItem(`sdf-${i}-maxDis`);if(!(a&&l||this.loadingSdfKeys.has(i))){this.loadingSdfKeys.add(i);const e=this.renderer.plugins.extract.image(t,"image/png");e.addEventListener("load",()=>{this.createSdfByWorker(s,o,t.width,t.height,n,r,e,i)}),e.addEventListener("error",()=>null),yield function(t,e){return M_(this,void 0,void 0,(function*(){const i=Date.now();for(;!t()&&Date.now()-i<e;)yield R_(16)}))}(()=>!!this.outputData.has(i),2e3),this.loadingSdfKeys.delete(i);const h=this.outputData.get(i);if(h){this.outputData.delete(i);const t=document.createElement("canvas");t.width=n,t.height=r;const e=t.getContext("2d");if(!e)return null;e.putImageData(new ImageData(Uint8ClampedArray.from(h.data),n,r),0,0),a=t.toDataURL("image/png"),l=h.maxDis,this.localStorage.setItem(`sdf-${i}-src`,a).catch(()=>{}),this.localStorage.setItem(`sdf-${i}-maxDis`,l).catch(()=>{})}}if(!a||!l)return null;return document.createElement("img").src=a,Vd.fromURL(a).then(t=>({texture:t,maxDis:l})).catch(()=>null)}))}}Sb.worker=null;var Mb=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class Ab{constructor(t,e,i,n,r,s,o,a,l,h,c,u,d,p){this.loader=t,this.mode=e,this.renderer=i,this.ticker=n,this.view=r,this.clock=s,this.objPoolGroup=o,this.errorChannel=a,this.localstorage=l,this.logger=h,this.loaderDelegate=c,this.isPlayerPaused=u,this.maxResolution=d,this.volumeAdjuster=p,this.currentStageIndex=0,this.cacheCount=Eb.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 fb(n),this.sdfManager=new Sb(i,l)}setResourceData(t,e){this.taskId=t,this.url=e}createCtx(t){const{task:e}=this.stageStates[t];e.addMTask(()=>Mb(this,void 0,void 0,(function*(){const e=new B_(this.loader),i=new $a.a,n={taskId:this.taskId,mode:this.mode,renderer:this.renderer,graphicsTexture:new J_,stageWidth:0,stageHeight:0,ticker:this.ticker,timingTargets:new $_(i),eventHub:i,view:this.view,medias:Object.create(null),lastViewedIndex:0,conflictTimeNodeManager:new K_,clock:this.clock,spriteTexture:e,slideIndex:t,objectPoolGroup:this.objPoolGroup,hasBackgroundFillShape:!1,slideScopeEventHub:new $a.a,logger:this.logger,sdfManager:this.sdfManager,loaderDelegate:this.loaderDelegate,runningAudio:this.runningAudio,activeMedia:this.activeMedia,isPlayerPaused:this.isPlayerPaused,timingEventHub:new $a.a,maxResolution:this.maxResolution,animatedIds:new Set,volumeAdjuster:this.volumeAdjuster};this.stageCtxs[t]=n})),"@StagePool[createCtx]")}loadStageJson(t){const{task:e}=this.stageStates[t];e.addMTask(()=>Mb(this,void 0,void 0,(function*(){const e=yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/slide-${t}.json`);this.stageJsons[t]=e,this.stageCtxs[t].stageWidth=e.width,this.stageCtxs[t].stageHeight=e.height,this.stageCtxs[t].featureList=e.featureList})),"@StagePool[loadStageJson]")}loadSpriteSheets(t){const{task:e}=this.stageStates[t];e.addMTask(()=>{const i=this.stageJsons[t],{spriteTexture:n,stageWidth:r,stageHeight:s}=this.stageCtxs[t],{coloredSheets:o,sheets:a}=i,l=o||a;return l&&l.forEach(t=>{e.addSubMTask(()=>{let e=1;if(r>this.maxResolution.x||s>this.maxResolution.y){e=this.maxResolution.x/r;const t=e*s;t>this.maxResolution.y&&(e*=this.maxResolution.y/t)}return n.loadSpriteSheetItem(this.url,this.taskId,t,e)},"@StagePool[spriteTexture.loadSpriteSheetItem]")}),Promise.resolve()},"@StagePool[loadSpriteSheets]")}createStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>{const i=this.stageJsons[t],n=this.stageCtxs[t],r=new pb(i,n,{x:0,y:0},e);return this.stageImpls[t]=r,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(()=>Mb(this,void 0,void 0,(function*(){const i=this.stageCtxs[t];i.graphicsTexture.pack().forEach((t,n)=>{e.addSubMTask(()=>i.graphicsTexture.render(t,n,this.objPoolGroup),"@StagePool[graphicsTexture.render]")})})),"@StagePool[createGraphicsTexture]")}renderStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>Mb(this,void 0,void 0,(function*(){const i=this.stageImpls[t];yield i.render(e)})),"@StagePool[renderStage]")}destroyStageByIndex(t){"load"===this.stageStates[t].state&&this.stageStates[t].task.cancel(),delete this.stageStates[t];this.stageImpls[t].destroy(),delete this.stageImpls[t],delete this.stageCtxs[t]}destroyStage(){Object.keys(this.stageImpls).forEach(t=>{const e=parseInt(t,10);Math.abs(this.currentStageIndex-e)>this.cacheCount&&this.destroyStageByIndex(e)})}destroyAllStage(){Object.keys(this.stageImpls).forEach(t=>{const e=parseInt(t,10);this.destroyStageByIndex(e)})}preload(t,e=!1){if(this.stageImpls[t]||this.stageStates[t])return Promise.resolve();const i=new vb(t,this.taskId,this.logger);return i.on("task-error",(t,e)=>{delete this.stageStates[e],delete this.stageImpls[e],delete this.stageCtxs[e],this.errorChannel.emit("error",t,e)}),this.stageStates[t]={state:"load",task:i},this.createCtx(t),this.loadStageJson(t),this.loadSpriteSheets(t),this.createStage(t),this.preRenderStage(t),this.createGraphicsTexture(t),this.renderStage(t),this.microTaskManager.addTask(i),e?i.applyAll():new Promise(e=>{i.once("task-finish",()=>{this.stageStates[t].state="finish";Object.keys(this.stageStates).length>2*this.cacheCount+1&&this.destroyStage(),e()})})}getStageJson(t){return this.stageJsons[t]||null}getStage(t){return Mb(this,void 0,void 0,(function*(){this.currentStageIndex=t;const e=this.stageStates[t];return"finish"===(null==e?void 0:e.state)&&this.stageImpls[t]?this.stageImpls[t]:"load"===(null==e?void 0:e.state)?(yield e.task.applyAll(),this.stageImpls[t]):(yield this.preload(t,!0),this.stageImpls[t])}))}destroy(){this.runningAudio.clear()}}var Pb=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};class Rb{constructor(t){var e;this.logger=t,this.taskId="",this.isIndexDBReady=!1,this.memoryCache=new Map,null===(e=Rb.localCache)||void 0===e||e.ready(()=>{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 Pb(this,void 0,void 0,(function*(){let e=null;return this.couldUseIndexDBCache&&Rb.localCache&&(e=yield I_(()=>Rb.localCache.getItem(`${this.taskId}/${t}`),500)),e=e===P_?null:e,e||this.memoryCache.get(t)||null}))}setItem(t,e,i=!1){return Pb(this,void 0,void 0,(function*(){if(!this.couldUseIndexDBCache)return i&&this.memoryCache.set(t,e),Promise.resolve();if(Rb.localCache){(yield I_(()=>Rb.localCache.setItem(`${this.taskId}/${t}`,e).catch(()=>{i&&this.memoryCache.set(t,e)}),500))===P_&&i&&this.memoryCache.set(t,e)}}))}dispose(){var t;this.memoryCache=new Map,this.couldUseIndexDBCache&&(null===(t=Rb.localCache)||void 0===t||t.keys().then(t=>{t.filter(t=>t.indexOf(this.taskId)>=0).forEach(t=>{var e;null===(e=Rb.localCache)||void 0===e||e.removeItem(t).catch(()=>{})})}))}}Rb.localCache=null;try{Rb.localCache=a.createInstance({name:"slide_local_cache",driver:a.INDEXEDDB,version:1})}catch(t){}class Ib extends $a.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 Cb=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};window.PIXI=r,n.skipHello();const Lb={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"},Nb={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",requestNextSlide:"requestNextSlide",requestPrevSlide:"requestPrevSlide",requestGotoSlide:"requestGotoSlide",userInput:"userInput"};class Ob extends $a.a{constructor(t,e={}){super(),this.errorChannel=new $a.a,this.transactionPlayer=null,this.isForward=!0,this.drawCall=0,this.scale=1,this._isPaused=!1,this.maxResolution=new wu(0,0),this.fps=new x_,this.designWidth=0,this.designHeight=0,this.currentIndex=0,this.slideCount=0,this.runtime={drawCall:0,fps:0},this.isPlayerPaused=()=>this._isPaused,this.onWebGLLost=()=>{this.errorChannel.emit("error",new T_(b_.CanvasCrash,"webgl context lost."))},this.logger=t.logger,this.mode=t.mode,this.volumeAdjuster=t.volumeAdjuster,this.localStorage=new Rb(this.logger),this.config={minFPS:il()(e.minFPS)?30:e.minFPS,maxFPS:il()(e.maxFPS)?40:e.maxFPS,resolution:il()(e.resolution)?1:e.resolution,autoFPS:!il()(e.autoFPS)&&e.autoFPS,autoResolution:!il()(e.autoResolution)&&e.autoResolution,transactionBgColor:il()(e.transactionBgColor)?0:e.transactionBgColor,maxResolutionLevel:this.getMaxResolution(e.maxResolutionLevel)},this.updateMaxResolutionLevel(this.config.maxResolutionLevel),this.loader=new N_(this.localStorage,t.useLocalCache,this.logger,t.resourceTimeout,t.loadDelegate),this.app=new vm({antialias:!0,autoDensity:!1,backgroundColor:16777215}),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 i=this.app.renderer,{drawElements:n}=i.gl;i.gl.drawElements=(...t)=>{n.call(i.gl,...t),this.drawCall+=1},this.fps.on("update",t=>{if(t<this.config.minFPS){if(this.config.autoResolution){const t=.7*this.scale,e=this.app.renderer.resolution,i=Math.max(t,e-.1);i>=t&&this.updateResolution(i)}}else if(t>this.config.maxFPS&&this.config.autoResolution){const t=this.scale*this.config.resolution,e=this.app.renderer.resolution,i=Math.min(t,e+.1);i<=this.config.resolution&&this.updateResolution(i)}}),this.app.ticker.add(()=>{this.runtime.drawCall=this.drawCall,this.runtime.fps=Math.floor(this.app.ticker.minFPS),this.drawCall=0},null,fd.LOW),this.clock=new D_(this.app.ticker),this.objPoolGroup=A_(),this.stagePool=new Ab(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,this.isPlayerPaused,this.maxResolution,this.volumeAdjuster),this.app.view.addEventListener("webglcontextlost",this.onWebGLLost);try{this.transactionPlayer=new Sh}catch(t){/Error creating WebGL context/.test(t.message)?this.errorChannel.emit("error",new T_(b_.CanvasCrash,"webgl context lost.")):this.errorChannel.emit("error",new T_(b_.RuntimeWarn,t.message))}}get view(){return this.app.renderer?this.app.view:null}get nextSlideIndex(){var t;return(null===(t=this.currentStage)||void 0===t?void 0:t.json.nextIndex)?this.currentStage.json.nextIndex:this.currentIndex+1}get prevSlideIndex(){var t;return(null===(t=this.currentStage)||void 0===t?void 0:t.json.prevIndex)?this.currentStage.json.prevIndex:this.currentIndex-1}getMaxResolution(t){return!il()(t)&&Number.isInteger(t)?(t<1&&(t=1),t>4&&(t=4),t):Ob.platform.isAndroid()||Ob.platform.isIOS()?2:4}updateMaxResolutionLevel(t){t<1&&(t=1),t>4&&(t=4);const e=[999999,960,1280,1920,3200][t],i=[999999,540,720,1080,1800][t];this.maxResolution.set(e,i)}updateConfig(t){il()(t.maxFPS)||(this.config.maxFPS=t.maxFPS),il()(t.minFPS)||(this.config.minFPS=t.minFPS),il()(t.resolution)||(this.config.resolution=t.resolution,this.updateResolution(this.scale*this.config.resolution)),il()(t.autoFPS)||(this.config.autoFPS=t.autoFPS),il()(t.autoResolution)||(this.config.autoResolution=t.autoResolution),il()(t.transactionBgColor)||(this.config.transactionBgColor=t.transactionBgColor),this.taskId&&this.logger.info("ppt player update config: "+JSON.stringify(this.config),this.taskId),il()(t.maxResolutionLevel)||(this.config.maxResolutionLevel=t.maxResolutionLevel,this.updateMaxResolutionLevel(this.config.maxResolutionLevel))}preload(t){return Cb(this,void 0,void 0,(function*(){t<1||t>this.slideCount||(this.logger.info(`preload slide ${t} begin`,this.taskId),yield this.stagePool.preload(t),this.logger.info(`preload slide ${t} end`,this.taskId))}))}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(e=>{t.on(e,(...t)=>{this.emit(e,...t)})})}renderSlide(t){var e,i,n;return Cb(this,void 0,void 0,(function*(){if(this._isPaused)return void this.logger.info("ppt play prevent render slide with paused state",this.taskId);this.logger.info("render slide "+t,this.taskId),this.emit(Nb.renderStart,t);const r=yield this.stagePool.getStage(t);if(!r)return;this.translateEvent(r.ctx.eventHub,[Nb.mainSeqStepChange,Nb.mainSeqStateChange,Nb.hyperlinkTrigger,Nb.interactiveSeqAction,Nb.mainSeqStepStart,Nb.mainSeqStepEnd,Nb.animateStart,Nb.animateEnd,Nb.mediaPlay,Nb.mediaPause,Nb.mediaSeek,Nb.requestGotoSlide,Nb.requestNextSlide,Nb.requestPrevSlide,Nb.interactiveSeqStateChange,Nb.userInput]),this.currentIndex=Number(t);const{width:s,height:o,slideCount:a}=r.json;this.slideCount=a,this.designWidth=s,this.designHeight=o,null===(e=this.currentStage)||void 0===e||e.clearOnSlideChange();const l=this.currentStage;this.currentStage=r,r.initOnReuse(),r.createTiming(),r.container.visible=!0,r.collectMainSeqStartValue(),this.isForward?r.setMainSeqStep(0,"start"):r.setMainSeqStep(-1,"end");let h=!1;if(r.json.transition&&r.json.transition.type&&this.app.stage.children.length>0&&this.view){let{transition:t}=r.json;!this.isForward&&(null==l?void 0:l.json.transition)&&(t=l.json.transition),this.initTransactionPlayer(t);const e=new ps(this.view);null===(i=this.transactionPlayer)||void 0===i||i.setPrevTexture(e),h=!0}if(this.app.stage.addChild(r.container),this.updateResolution(this.config.resolution*this.scale),l&&(l.clearOnTransactionEnd(),this.app.stage.removeChild(l.container)),r.json.transition&&r.json.transition.type&&this.app.stage.children.length>0&&this.view&&this.transactionPlayer&&h){const t=new ps(this.view);this.transactionPlayer.setNextTexture(t),yield this.transactionPlayer.play();const e=this.transactionPlayer.renderer.domElement;if(this.view.parentElement&&e)try{this.view.parentElement.removeChild(e)}catch(t){}null===(n=this.transactionPlayer)||void 0===n||n.dispose()}this.isForward?yield r.startTiming():r.setMainSeqApplied(),r.ctx.slideScopeEventHub.emit("slide-render",r.ctx.slideIndex),this.emit(Nb.renderEnd,t),this.emit(Nb.slideChange,t),this.preload(t+1).catch(e=>{this.errorChannel.emit("error",T_.transform(e),t+1)}),this.preload(t-1).catch(e=>{this.errorChannel.emit("error",T_.transform(e),t-1)})}))}renderToBase64(t,e,i){return Cb(this,void 0,void 0,(function*(){const n=yield this.stagePool.getStage(t);if(n){const{width:r,height:s}=n.json;this.designWidth=r,this.designHeight=s;const o=Wd.create({width:this.designWidth,height:this.designHeight,resolution:e});n.container.visible=!0,this.app.renderer.render(n.container,{renderTexture:o});const a=this.app.renderer.plugins.extract.base64(o,i);return this.stagePool.destroyStageByIndex(t),a}return"__null__"}))}getBase64(t){if(!t.container.transform)return null;const e=Wd.create({width:this.designWidth,height:this.designHeight,resolution:1});this.app.renderer.render(t.container,{renderTexture:e});const i=this.app.renderer.plugins.extract.base64(e,"image/jpeg");return e.destroy(!0),i}initTransactionPlayer(t){var e,i,n,r,s;const o=null===(e=this.view)||void 0===e?void 0:e.parentElement;if(this.view&&o&&Lb[t.type]&&this.transactionPlayer){const e=null===(i=this.transactionPlayer)||void 0===i?void 0:i.renderer.domElement;this.transactionPlayer.initPlayer({reverse:!this.isForward,stageWidth:this.view.width,stageHeight:this.view.height,presetType:Lb[t.type],duration:null===(r=null===(n=this.currentStage)||void 0===n?void 0:n.json.transition)||void 0===r?void 0:r.dur,delay:0,clearColor:this.config.transactionBgColor,maxFPS:Math.ceil(null!==(s=this.config.maxFPS)&&void 0!==s?s:60),options:t.options}),e&&(e.style.position="absolute",e.style.zIndex="9",e.style.left="0",e.style.top="0",e.style.width=this.view.style.width,e.style.height=this.view.style.height),o.appendChild(e)}}scaleView(t,e,i){var n;this.view&&(this.view.style.width=Math.floor(this.designWidth*t)+"px",this.view.style.height=Math.floor(this.designHeight*t)+"px");const r=null===(n=this.transactionPlayer)||void 0===n?void 0:n.renderer.domElement;if(r&&this.view&&(r.style.width=this.view.style.width,r.style.height=this.view.style.height),e){this.scale=t;const e=this.scale*this.config.resolution;this.updateResolution(e,i)}}updateResolution(t,e){this.app.ticker.addOnce(()=>{let i=Eb.isDesktop()?t:1;for(;i*this.designWidth>this.maxResolution.x||i*this.designHeight>this.maxResolution.y;)i-=.1;this.app.renderer.resolution=i,this.app.renderer.plugins.interaction.resolution=this.app.renderer.resolution,this.app.renderer.resize(this.designWidth,this.designHeight),tl()(e)&&e()})}nextStep(t=!1){var e;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{null===(e=this.currentStage)||void 0===e||e.nextStep(t)}catch(t){this.errorChannel.emit("error",T_.transform(t),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{null===(e=this.currentStage)||void 0===e||e.prevStep(t)}catch(t){this.errorChannel.emit("error",T_.transform(t),this.currentIndex)}}}mainSeqLength(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqLength())&&void 0!==e?e:0}mainSeqStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqStep())&&void 0!==e?e:0}setMainSeqStep(t,e){var i;null===(i=this.currentStage)||void 0===i||i.setMainSeqStep(t,e)}mainSeqState(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqState())&&void 0!==e?e:null}mainSeqHasNextStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqHasNextStep())&&void 0!==e&&e}mainSeqHasPrevStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqHasPrevStep())&&void 0!==e&&e}nextTick(t){this.app.ticker.addOnce(()=>{t()},fd.LOW)}applyInteractiveAction(t){var e;null===(e=this.currentStage)||void 0===e||e.applyInteractiveAction(t)}seekInteractiveSeqToEnd(t){var e;null===(e=this.currentStage)||void 0===e||e.seekInteractiveSeqToEnd(t)}setInteractiveSeqState(t,e,i){var n;null===(n=this.currentStage)||void 0===n||n.setInteractiveSeqState(t,e,i)}setMediaState(t,e){var i;return Cb(this,void 0,void 0,(function*(){yield null===(i=this.currentStage)||void 0===i?void 0:i.setMediaState(t,e)}))}setMediaCurrentTime(t,e){var i;null===(i=this.currentStage)||void 0===i||i.setMediaCurrentTime(t,e)}pause(){var t;this.app.ticker.stop(),null===(t=this.currentStage)||void 0===t||t.ctx.activeMedia.forEach(t=>{t.globalPause()}),this._isPaused=!0}resume(){var t;this._isPaused=!1,this.app.ticker.start(),null===(t=this.currentStage)||void 0===t||t.ctx.activeMedia.forEach(t=>{t.globalResume()})}getSnapshot(){return this.currentStage&&this.getBase64(this.currentStage)||""}clearLocalCache(){this.localStorage.dispose()}static clearLocalCache(){var t;null===(t=Rb.localCache)||void 0===t||t.clear().catch(()=>{})}destroy(){var t,e;try{this.app.view.removeEventListener("webglcontextlost",this.onWebGLLost);try{this.app.renderer.filter.texturePool.clear(!0)}catch(t){}Y_.collectObjectByGroup(this.objPoolGroup),q_.collectObjectByGroup(this.objPoolGroup),null===(t=this.transactionPlayer)||void 0===t||t.destroy(),this.loader.destroy(),this.fps.destroy(),this.stagePool.destroyAllStage(),this.stagePool.destroy();try{this.app.renderer.gl.getExtension("WEBGL_lose_context").loseContext()}catch(t){}this.app.destroy(!0,{children:!0,texture:!0,baseTexture:!0}),null===(e=Sb.worker)||void 0===e||e.terminate()}catch(t){}}}Ob.platform=Eb,Ob.RtcAudioClazz=null;var Db=new Map;function Fb(t){var e=Db.get(t.hookPoint)||[];e.push(t),Db.set(t.hookPoint,e)}var Ub,kb=i(96),Bb=i.n(kb),Gb=i(34),Hb=i.n(Gb),jb=[],zb="ResizeObserver loop completed with undelivered notifications.";!function(t){t.BORDER_BOX="border-box",t.CONTENT_BOX="content-box",t.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"}(Ub||(Ub={}));var Vb,Wb=function(t){return Object.freeze(t)},Xb=function(t,e){this.inlineSize=t,this.blockSize=e,Wb(this)},Yb=function(){function t(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Wb(this)}return t.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}},t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t}(),qb=function(t){return t instanceof SVGElement&&"getBBox"in t},Zb=function(t){if(qb(t)){var e=t.getBBox(),i=e.width,n=e.height;return!i&&!n}var r=t,s=r.offsetWidth,o=r.offsetHeight;return!(s||o||t.getClientRects().length)},Jb=function(t){var e;if(t instanceof Element)return!0;var i=null===(e=null==t?void 0:t.ownerDocument)||void 0===e?void 0:e.defaultView;return!!(i&&t instanceof i.Element)},Kb="undefined"!=typeof window?window:{},$b=new WeakMap,Qb=/auto|scroll/,tT=/^tb|vertical/,eT=/msie|trident/i.test(Kb.navigator&&Kb.navigator.userAgent),iT=function(t){return parseFloat(t||"0")},nT=function(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=!1),new Xb((i?e:t)||0,(i?t:e)||0)},rT=Wb({devicePixelContentBoxSize:nT(),borderBoxSize:nT(),contentBoxSize:nT(),contentRect:new Yb(0,0,0,0)}),sT=function(t,e){if(void 0===e&&(e=!1),$b.has(t)&&!e)return $b.get(t);if(Zb(t))return $b.set(t,rT),rT;var i=getComputedStyle(t),n=qb(t)&&t.ownerSVGElement&&t.getBBox(),r=!eT&&"border-box"===i.boxSizing,s=tT.test(i.writingMode||""),o=!n&&Qb.test(i.overflowY||""),a=!n&&Qb.test(i.overflowX||""),l=n?0:iT(i.paddingTop),h=n?0:iT(i.paddingRight),c=n?0:iT(i.paddingBottom),u=n?0:iT(i.paddingLeft),d=n?0:iT(i.borderTopWidth),p=n?0:iT(i.borderRightWidth),f=n?0:iT(i.borderBottomWidth),m=u+h,g=l+c,v=(n?0:iT(i.borderLeftWidth))+p,_=d+f,y=a?t.offsetHeight-_-t.clientHeight:0,x=o?t.offsetWidth-v-t.clientWidth:0,b=r?m+v:0,T=r?g+_:0,E=n?n.width:iT(i.width)-b-x,w=n?n.height:iT(i.height)-T-y,S=E+m+x+v,M=w+g+y+_,A=Wb({devicePixelContentBoxSize:nT(Math.round(E*devicePixelRatio),Math.round(w*devicePixelRatio),s),borderBoxSize:nT(S,M,s),contentBoxSize:nT(E,w,s),contentRect:new Yb(u,l,E,w)});return $b.set(t,A),A},oT=function(t,e,i){var n=sT(t,i),r=n.borderBoxSize,s=n.contentBoxSize,o=n.devicePixelContentBoxSize;switch(e){case Ub.DEVICE_PIXEL_CONTENT_BOX:return o;case Ub.BORDER_BOX:return r;default:return s}},aT=function(t){var e=sT(t);this.target=t,this.contentRect=e.contentRect,this.borderBoxSize=Wb([e.borderBoxSize]),this.contentBoxSize=Wb([e.contentBoxSize]),this.devicePixelContentBoxSize=Wb([e.devicePixelContentBoxSize])},lT=function(t){if(Zb(t))return 1/0;for(var e=0,i=t.parentNode;i;)e+=1,i=i.parentNode;return e},hT=function(){var t=1/0,e=[];jb.forEach((function(i){if(0!==i.activeTargets.length){var n=[];i.activeTargets.forEach((function(e){var i=new aT(e.target),r=lT(e.target);n.push(i),e.lastReportedSize=oT(e.target,e.observedBox),r<t&&(t=r)})),e.push((function(){i.callback.call(i.observer,n,i.observer)})),i.activeTargets.splice(0,i.activeTargets.length)}}));for(var i=0,n=e;i<n.length;i++){(0,n[i])()}return t},cT=function(t){jb.forEach((function(e){e.activeTargets.splice(0,e.activeTargets.length),e.skippedTargets.splice(0,e.skippedTargets.length),e.observationTargets.forEach((function(i){i.isActive()&&(lT(i.target)>t?e.activeTargets.push(i):e.skippedTargets.push(i))}))}))},uT=function(){var t,e=0;for(cT(e);jb.some((function(t){return t.activeTargets.length>0}));)e=hT(),cT(e);return jb.some((function(t){return t.skippedTargets.length>0}))&&("function"==typeof ErrorEvent?t=new ErrorEvent("error",{message:zb}):((t=document.createEvent("Event")).initEvent("error",!1,!1),t.message=zb),window.dispatchEvent(t)),e>0},dT=[],pT=function(t){if(!Vb){var e=0,i=document.createTextNode("");new MutationObserver((function(){return dT.splice(0).forEach((function(t){return t()}))})).observe(i,{characterData:!0}),Vb=function(){i.textContent="".concat(e?e--:e++)}}dT.push(t),Vb()},fT=0,mT={attributes:!0,characterData:!0,childList:!0,subtree:!0},gT=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],vT=function(t){return void 0===t&&(t=0),Date.now()+t},_T=!1,yT=new(function(){function t(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return t.prototype.run=function(t){var e=this;if(void 0===t&&(t=250),!_T){_T=!0;var i,n=vT(t);i=function(){var i=!1;try{i=uT()}finally{if(_T=!1,t=n-vT(),!fT)return;i?e.run(1e3):t>0?e.run(t):e.start()}},pT((function(){requestAnimationFrame(i)}))}},t.prototype.schedule=function(){this.stop(),this.run()},t.prototype.observe=function(){var t=this,e=function(){return t.observer&&t.observer.observe(document.body,mT)};document.body?e():Kb.addEventListener("DOMContentLoaded",e)},t.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),gT.forEach((function(e){return Kb.addEventListener(e,t.listener,!0)})))},t.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),gT.forEach((function(e){return Kb.removeEventListener(e,t.listener,!0)})),this.stopped=!0)},t}()),xT=function(t){!fT&&t>0&&yT.start(),!(fT+=t)&&yT.stop()},bT=function(){function t(t,e){this.target=t,this.observedBox=e||Ub.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return t.prototype.isActive=function(){var t,e=oT(this.target,this.observedBox,!0);return t=this.target,qb(t)||function(t){switch(t.tagName){case"INPUT":if("image"!==t.type)break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1}(t)||"inline"!==getComputedStyle(t).display||(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},t}(),TT=function(t,e){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=e},ET=new WeakMap,wT=function(t,e){for(var i=0;i<t.length;i+=1)if(t[i].target===e)return i;return-1},ST=function(){function t(){}return t.connect=function(t,e){var i=new TT(t,e);ET.set(t,i)},t.observe=function(t,e,i){var n=ET.get(t),r=0===n.observationTargets.length;wT(n.observationTargets,e)<0&&(r&&jb.push(n),n.observationTargets.push(new bT(e,i&&i.box)),xT(1),yT.schedule())},t.unobserve=function(t,e){var i=ET.get(t),n=wT(i.observationTargets,e),r=1===i.observationTargets.length;n>=0&&(r&&jb.splice(jb.indexOf(i),1),i.observationTargets.splice(n,1),xT(-1))},t.disconnect=function(t){var e=this,i=ET.get(t);i.observationTargets.slice().forEach((function(i){return e.unobserve(t,i.target)})),i.activeTargets.splice(0,i.activeTargets.length)},t}(),MT=function(){function t(t){if(0===arguments.length)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if("function"!=typeof t)throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");ST.connect(this,t)}return t.prototype.observe=function(t,e){if(0===arguments.length)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Jb(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");ST.observe(this,t,e)},t.prototype.unobserve=function(t){if(0===arguments.length)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Jb(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");ST.unobserve(this,t)},t.prototype.disconnect=function(){ST.disconnect(this)},t.toString=function(){return"function ResizeObserver () { [polyfill code] }"},t}(),AT=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))},PT=function(t,e){var i,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},RT=function(){function t(t,e,i,n,r){this.state="idle",this.index=-1,this.slideIndex=-1,this.fn=i,this.index=t,this.slideIndex=e,this.eventHub=n,this.id=r}return t.prototype.apply=function(){return AT(this,void 0,void 0,(function(){var t;return PT(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]}}))}))},t}(),IT=function(){function t(){var t=this;this.eventHub=new $a.a,this.tasks=[],this.index=0,this.eventHub.on("task-end",(function(e){var i,n=t.tasks.findIndex((function(t){return t.index===e.index})),r=n+1;r>=0&&(null===(i=t.tasks[r])||void 0===i||i.apply()),n>=0&&(t.tasks.splice(n,1),t.replaceIdleTask()),t.eventHub.emit("task-end-"+e.id)})),this.eventHub.on("task-error",(function(e){var i=e.task,n=t.tasks.findIndex((function(t){return t.index===i.index}));n>=0&&(t.tasks.splice(n,1),t.replaceIdleTask())}))}return t.prototype.replaceIdleTask=function(){for(var t,e=this,i=new Set,n=0,r=this.tasks.length;n<r;n++)"idle"===this.tasks[n].state&&"idle"===(null===(t=this.tasks[n+1])||void 0===t?void 0:t.state)&&i.add(n);Array.from(i).forEach((function(t){e.tasks.splice(t,1)}))},t.prototype.addTask=function(t,e,i){var n=new RT(this.index++,e,t,this.eventHub,i);this.tasks.push(n),this.tasks.sort((function(t,e){return t.index-e.index})),this.replaceIdleTask(),1===this.tasks.length&&n.apply()},t.prototype.hasStartTask=function(){return this.tasks.some((function(t){return"start"===t.state}))},t.prototype.destroy=function(){this.eventHub.removeAllListeners()},t}();function CT(t,e){var i=t.__state.conversionName.toString(),n=Math.round(t.r),r=Math.round(t.g),s=Math.round(t.b),o=t.a,a=Math.round(t.h),l=t.s.toFixed(1),h=t.v.toFixed(1);if(e||"THREE_CHAR_HEX"===i||"SIX_CHAR_HEX"===i){for(var c=t.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===i?"rgb("+n+","+r+","+s+")":"CSS_RGBA"===i?"rgba("+n+","+r+","+s+","+o+")":"HEX"===i?"0x"+t.hex.toString(16):"RGB_ARRAY"===i?"["+n+","+r+","+s+"]":"RGBA_ARRAY"===i?"["+n+","+r+","+s+","+o+"]":"RGB_OBJ"===i?"{r:"+n+",g:"+r+",b:"+s+"}":"RGBA_OBJ"===i?"{r:"+n+",g:"+r+",b:"+s+",a:"+o+"}":"HSV_OBJ"===i?"{h:"+a+",s:"+l+",v:"+h+"}":"HSVA_OBJ"===i?"{h:"+a+",s:"+l+",v:"+h+",a:"+o+"}":"unknown format"}var LT=Array.prototype.forEach,NT=Array.prototype.slice,OT={BREAK:{},extend:function(t){return this.each(NT.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(i){this.isUndefined(e[i])||(t[i]=e[i])}.bind(this))}),this),t},defaults:function(t){return this.each(NT.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(i){this.isUndefined(t[i])&&(t[i]=e[i])}.bind(this))}),this),t},compose:function(){var t=NT.call(arguments);return function(){for(var e=NT.call(arguments),i=t.length-1;i>=0;i--)e=[t[i].apply(this,e)];return e[0]}},each:function(t,e,i){if(t)if(LT&&t.forEach&&t.forEach===LT)t.forEach(e,i);else if(t.length===t.length+0){var n,r=void 0;for(r=0,n=t.length;r<n;r++)if(r in t&&e.call(i,t[r],r)===this.BREAK)return}else for(var s in t)if(e.call(i,t[s],s)===this.BREAK)return},defer:function(t){setTimeout(t,0)},debounce:function(t,e,i){var n=void 0;return function(){var r=this,s=arguments;function o(){n=null,i||t.apply(r,s)}var a=i||!n;clearTimeout(n),n=setTimeout(o,e),a&&t.apply(r,s)}},toArray:function(t){return t.toArray?t.toArray():NT.call(t)},isUndefined:function(t){return void 0===t},isNull:function(t){return null===t},isNaN:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){return isNaN(t)})),isArray:Array.isArray||function(t){return t.constructor===Array},isObject:function(t){return t===Object(t)},isNumber:function(t){return t===t+0},isString:function(t){return t===t+""},isBoolean:function(t){return!1===t||!0===t},isFunction:function(t){return t instanceof Function}},DT=[{litmus:OT.isString,conversions:{THREE_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString()+e[1].toString()+e[2].toString()+e[2].toString()+e[3].toString()+e[3].toString(),0)}},write:CT},SIX_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9]{6})$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString(),0)}},write:CT},CSS_RGB:{read:function(t){var e=t.match(/^rgb\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3])}},write:CT},CSS_RGBA:{read:function(t){var e=t.match(/^rgba\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3]),a:parseFloat(e[4])}},write:CT}}},{litmus:OT.isNumber,conversions:{HEX:{read:function(t){return{space:"HEX",hex:t,conversionName:"HEX"}},write:function(t){return t.hex}}}},{litmus:OT.isArray,conversions:{RGB_ARRAY:{read:function(t){return 3===t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2]}},write:function(t){return[t.r,t.g,t.b]}},RGBA_ARRAY:{read:function(t){return 4===t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2],a:t[3]}},write:function(t){return[t.r,t.g,t.b,t.a]}}}},{litmus:OT.isObject,conversions:{RGBA_OBJ:{read:function(t){return!!(OT.isNumber(t.r)&&OT.isNumber(t.g)&&OT.isNumber(t.b)&&OT.isNumber(t.a))&&{space:"RGB",r:t.r,g:t.g,b:t.b,a:t.a}},write:function(t){return{r:t.r,g:t.g,b:t.b,a:t.a}}},RGB_OBJ:{read:function(t){return!!(OT.isNumber(t.r)&&OT.isNumber(t.g)&&OT.isNumber(t.b))&&{space:"RGB",r:t.r,g:t.g,b:t.b}},write:function(t){return{r:t.r,g:t.g,b:t.b}}},HSVA_OBJ:{read:function(t){return!!(OT.isNumber(t.h)&&OT.isNumber(t.s)&&OT.isNumber(t.v)&&OT.isNumber(t.a))&&{space:"HSV",h:t.h,s:t.s,v:t.v,a:t.a}},write:function(t){return{h:t.h,s:t.s,v:t.v,a:t.a}}},HSV_OBJ:{read:function(t){return!!(OT.isNumber(t.h)&&OT.isNumber(t.s)&&OT.isNumber(t.v))&&{space:"HSV",h:t.h,s:t.s,v:t.v}},write:function(t){return{h:t.h,s:t.s,v:t.v}}}}}],FT=void 0,UT=void 0,kT=function(){UT=!1;var t=arguments.length>1?OT.toArray(arguments):arguments[0];return OT.each(DT,(function(e){if(e.litmus(t))return OT.each(e.conversions,(function(e,i){if(FT=e.read(t),!1===UT&&!1!==FT)return UT=FT,FT.conversionName=i,FT.conversion=e,OT.BREAK})),OT.BREAK})),UT},BT=void 0,GT={hsv_to_rgb:function(t,e,i){var n=Math.floor(t/60)%6,r=t/60-Math.floor(t/60),s=i*(1-e),o=i*(1-r*e),a=i*(1-(1-r)*e),l=[[i,a,s],[o,i,s],[s,i,a],[s,o,i],[a,s,i],[i,s,o]][n];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(t,e,i){var n=Math.min(t,e,i),r=Math.max(t,e,i),s=r-n,o=void 0;return 0===r?{h:NaN,s:0,v:0}:(o=t===r?(e-i)/s:e===r?2+(i-t)/s:4+(t-e)/s,(o/=6)<0&&(o+=1),{h:360*o,s:s/r,v:r/255})},rgb_to_hex:function(t,e,i){var n=this.hex_with_component(0,2,t);return n=this.hex_with_component(n,1,e),n=this.hex_with_component(n,0,i)},component_from_hex:function(t,e){return t>>8*e&255},hex_with_component:function(t,e,i){return i<<(BT=8*e)|t&~(255<<BT)}},HT="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jT=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},zT=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),VT=function t(e,i,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,i);if(void 0===r){var s=Object.getPrototypeOf(e);return null===s?void 0:t(s,i,n)}if("value"in r)return r.value;var o=r.get;return void 0!==o?o.call(n):void 0},WT=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},XT=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},YT=function(){function t(){if(jT(this,t),this.__state=kT.apply(this,arguments),!1===this.__state)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return zT(t,[{key:"toString",value:function(){return CT(this)}},{key:"toHexString",value:function(){return CT(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),t}();function qT(t,e,i){Object.defineProperty(t,e,{get:function(){return"RGB"===this.__state.space||YT.recalculateRGB(this,e,i),this.__state[e]},set:function(t){"RGB"!==this.__state.space&&(YT.recalculateRGB(this,e,i),this.__state.space="RGB"),this.__state[e]=t}})}function ZT(t,e){Object.defineProperty(t,e,{get:function(){return"HSV"===this.__state.space||YT.recalculateHSV(this),this.__state[e]},set:function(t){"HSV"!==this.__state.space&&(YT.recalculateHSV(this),this.__state.space="HSV"),this.__state[e]=t}})}YT.recalculateRGB=function(t,e,i){if("HEX"===t.__state.space)t.__state[e]=GT.component_from_hex(t.__state.hex,i);else{if("HSV"!==t.__state.space)throw new Error("Corrupted color state");OT.extend(t.__state,GT.hsv_to_rgb(t.__state.h,t.__state.s,t.__state.v))}},YT.recalculateHSV=function(t){var e=GT.rgb_to_hsv(t.r,t.g,t.b);OT.extend(t.__state,{s:e.s,v:e.v}),OT.isNaN(e.h)?OT.isUndefined(t.__state.h)&&(t.__state.h=0):t.__state.h=e.h},YT.COMPONENTS=["r","g","b","h","s","v","hex","a"],qT(YT.prototype,"r",2),qT(YT.prototype,"g",1),qT(YT.prototype,"b",0),ZT(YT.prototype,"h"),ZT(YT.prototype,"s"),ZT(YT.prototype,"v"),Object.defineProperty(YT.prototype,"a",{get:function(){return this.__state.a},set:function(t){this.__state.a=t}}),Object.defineProperty(YT.prototype,"hex",{get:function(){return"HEX"!==this.__state.space&&(this.__state.hex=GT.rgb_to_hex(this.r,this.g,this.b),this.__state.space="HEX"),this.__state.hex},set:function(t){this.__state.space="HEX",this.__state.hex=t}});var JT=function(){function t(e,i){jT(this,t),this.initialValue=e[i],this.domElement=document.createElement("div"),this.object=e,this.property=i,this.__onChange=void 0,this.__onFinishChange=void 0}return zT(t,[{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()}}]),t}(),KT={};OT.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},(function(t,e){OT.each(t,(function(t){KT[t]=e}))}));var $T=/(\d+(\.\d+)?)px/;function QT(t){if("0"===t||OT.isUndefined(t))return 0;var e=t.match($T);return OT.isNull(e)?0:parseFloat(e[1])}var tE={makeSelectable:function(t,e){void 0!==t&&void 0!==t.style&&(t.onselectstart=e?function(){return!1}:function(){},t.style.MozUserSelect=e?"auto":"none",t.style.KhtmlUserSelect=e?"auto":"none",t.unselectable=e?"on":"off")},makeFullscreen:function(t,e,i){var n=i,r=e;OT.isUndefined(r)&&(r=!0),OT.isUndefined(n)&&(n=!0),t.style.position="absolute",r&&(t.style.left=0,t.style.right=0),n&&(t.style.top=0,t.style.bottom=0)},fakeEvent:function(t,e,i,n){var r=i||{},s=KT[e];if(!s)throw new Error("Event type "+e+" not supported.");var o=document.createEvent(s);switch(s){case"MouseEvents":var a=r.x||r.clientX||0,l=r.y||r.clientY||0;o.initMouseEvent(e,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=o.initKeyboardEvent||o.initKeyEvent;OT.defaults(r,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),h(e,r.bubbles||!1,r.cancelable,window,r.ctrlKey,r.altKey,r.shiftKey,r.metaKey,r.keyCode,r.charCode);break;default:o.initEvent(e,r.bubbles||!1,r.cancelable||!0)}OT.defaults(o,n),t.dispatchEvent(o)},bind:function(t,e,i,n){var r=n||!1;return t.addEventListener?t.addEventListener(e,i,r):t.attachEvent&&t.attachEvent("on"+e,i),tE},unbind:function(t,e,i,n){var r=n||!1;return t.removeEventListener?t.removeEventListener(e,i,r):t.detachEvent&&t.detachEvent("on"+e,i),tE},addClass:function(t,e){if(void 0===t.className)t.className=e;else if(t.className!==e){var i=t.className.split(/ +/);-1===i.indexOf(e)&&(i.push(e),t.className=i.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return tE},removeClass:function(t,e){if(e)if(t.className===e)t.removeAttribute("class");else{var i=t.className.split(/ +/),n=i.indexOf(e);-1!==n&&(i.splice(n,1),t.className=i.join(" "))}else t.className=void 0;return tE},hasClass:function(t,e){return new RegExp("(?:^|\\s+)"+e+"(?:\\s+|$)").test(t.className)||!1},getWidth:function(t){var e=getComputedStyle(t);return QT(e["border-left-width"])+QT(e["border-right-width"])+QT(e["padding-left"])+QT(e["padding-right"])+QT(e.width)},getHeight:function(t){var e=getComputedStyle(t);return QT(e["border-top-width"])+QT(e["border-bottom-width"])+QT(e["padding-top"])+QT(e["padding-bottom"])+QT(e.height)},getOffset:function(t){var e=t,i={left:0,top:0};if(e.offsetParent)do{i.left+=e.offsetLeft,i.top+=e.offsetTop,e=e.offsetParent}while(e);return i},isActive:function(t){return t===document.activeElement&&(t.type||t.href)}},eE=function(t){function e(t,i){jT(this,e);var n=XT(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),r=n;return n.__prev=n.getValue(),n.__checkbox=document.createElement("input"),n.__checkbox.setAttribute("type","checkbox"),tE.bind(n.__checkbox,"change",(function(){r.setValue(!r.__prev)}),!1),n.domElement.appendChild(n.__checkbox),n.updateDisplay(),n}return WT(e,t),zT(e,[{key:"setValue",value:function(t){var i=VT(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),i}},{key:"updateDisplay",value:function(){return!0===this.getValue()?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0,this.__prev=!0):(this.__checkbox.checked=!1,this.__prev=!1),VT(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(JT),iE=function(t){function e(t,i,n){jT(this,e);var r=XT(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),s=n,o=r;if(r.__select=document.createElement("select"),OT.isArray(s)){var a={};OT.each(s,(function(t){a[t]=t})),s=a}return OT.each(s,(function(t,e){var i=document.createElement("option");i.innerHTML=e,i.setAttribute("value",t),o.__select.appendChild(i)})),r.updateDisplay(),tE.bind(r.__select,"change",(function(){var t=this.options[this.selectedIndex].value;o.setValue(t)})),r.domElement.appendChild(r.__select),r}return WT(e,t),zT(e,[{key:"setValue",value:function(t){var i=VT(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),i}},{key:"updateDisplay",value:function(){return tE.isActive(this.__select)?this:(this.__select.value=this.getValue(),VT(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this))}}]),e}(JT),nE=function(t){function e(t,i){jT(this,e);var n=XT(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),r=n;function s(){r.setValue(r.__input.value)}return n.__input=document.createElement("input"),n.__input.setAttribute("type","text"),tE.bind(n.__input,"keyup",s),tE.bind(n.__input,"change",s),tE.bind(n.__input,"blur",(function(){r.__onFinishChange&&r.__onFinishChange.call(r,r.getValue())})),tE.bind(n.__input,"keydown",(function(t){13===t.keyCode&&this.blur()})),n.updateDisplay(),n.domElement.appendChild(n.__input),n}return WT(e,t),zT(e,[{key:"updateDisplay",value:function(){return tE.isActive(this.__input)||(this.__input.value=this.getValue()),VT(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(JT);function rE(t){var e=t.toString();return e.indexOf(".")>-1?e.length-e.indexOf(".")-1:0}var sE=function(t){function e(t,i,n){jT(this,e);var r=XT(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),s=n||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,OT.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=rE(r.__impliedStep),r}return WT(e,t),zT(e,[{key:"setValue",value:function(t){var i=t;return void 0!==this.__min&&i<this.__min?i=this.__min:void 0!==this.__max&&i>this.__max&&(i=this.__max),void 0!==this.__step&&i%this.__step!=0&&(i=Math.round(i/this.__step)*this.__step),VT(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,i)}},{key:"min",value:function(t){return this.__min=t,this}},{key:"max",value:function(t){return this.__max=t,this}},{key:"step",value:function(t){return this.__step=t,this.__impliedStep=t,this.__precision=rE(t),this}}]),e}(JT);var oE=function(t){function e(t,i,n){jT(this,e);var r=XT(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i,n));r.__truncationSuspended=!1;var s=r,o=void 0;function a(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function l(t){var e=o-t.clientY;s.setValue(s.getValue()+e*s.__impliedStep),o=t.clientY}function h(){tE.unbind(window,"mousemove",l),tE.unbind(window,"mouseup",h),a()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),tE.bind(r.__input,"change",(function(){var t=parseFloat(s.__input.value);OT.isNaN(t)||s.setValue(t)})),tE.bind(r.__input,"blur",(function(){a()})),tE.bind(r.__input,"mousedown",(function(t){tE.bind(window,"mousemove",l),tE.bind(window,"mouseup",h),o=t.clientY})),tE.bind(r.__input,"keydown",(function(t){13===t.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,a())})),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return WT(e,t),zT(e,[{key:"updateDisplay",value:function(){var t,i,n;return this.__input.value=this.__truncationSuspended?this.getValue():(t=this.getValue(),i=this.__precision,n=Math.pow(10,i),Math.round(t*n)/n),VT(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(sE);function aE(t,e,i,n,r){return n+(t-e)/(i-e)*(r-n)}var lE=function(t){function e(t,i,n,r,s){jT(this,e);var o=XT(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i,{min:n,max:r,step:s})),a=o;function l(t){t.preventDefault();var e=a.__background.getBoundingClientRect();return a.setValue(aE(t.clientX,e.left,e.right,a.__min,a.__max)),!1}function h(){tE.unbind(window,"mousemove",l),tE.unbind(window,"mouseup",h),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(t){var e=t.touches[0].clientX,i=a.__background.getBoundingClientRect();a.setValue(aE(e,i.left,i.right,a.__min,a.__max))}function u(){tE.unbind(window,"touchmove",c),tE.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return o.__background=document.createElement("div"),o.__foreground=document.createElement("div"),tE.bind(o.__background,"mousedown",(function(t){document.activeElement.blur(),tE.bind(window,"mousemove",l),tE.bind(window,"mouseup",h),l(t)})),tE.bind(o.__background,"touchstart",(function(t){if(1!==t.touches.length)return;tE.bind(window,"touchmove",c),tE.bind(window,"touchend",u),c(t)})),tE.addClass(o.__background,"slider"),tE.addClass(o.__foreground,"slider-fg"),o.updateDisplay(),o.__background.appendChild(o.__foreground),o.domElement.appendChild(o.__background),o}return WT(e,t),zT(e,[{key:"updateDisplay",value:function(){var t=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*t+"%",VT(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(sE),hE=function(t){function e(t,i,n){jT(this,e);var r=XT(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),s=r;return r.__button=document.createElement("div"),r.__button.innerHTML=void 0===n?"Fire":n,tE.bind(r.__button,"click",(function(t){return t.preventDefault(),s.fire(),!1})),tE.addClass(r.__button,"button"),r.domElement.appendChild(r.__button),r}return WT(e,t),zT(e,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),e}(JT),cE=function(t){function e(t,i){jT(this,e);var n=XT(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i));n.__color=new YT(n.getValue()),n.__temp=new YT(0);var r=n;n.domElement=document.createElement("div"),tE.makeSelectable(n.domElement,!1),n.__selector=document.createElement("div"),n.__selector.className="selector",n.__saturation_field=document.createElement("div"),n.__saturation_field.className="saturation-field",n.__field_knob=document.createElement("div"),n.__field_knob.className="field-knob",n.__field_knob_border="2px solid ",n.__hue_knob=document.createElement("div"),n.__hue_knob.className="hue-knob",n.__hue_field=document.createElement("div"),n.__hue_field.className="hue-field",n.__input=document.createElement("input"),n.__input.type="text",n.__input_textShadow="0 1px 1px ",tE.bind(n.__input,"keydown",(function(t){13===t.keyCode&&u.call(this)})),tE.bind(n.__input,"blur",u),tE.bind(n.__selector,"mousedown",(function(){tE.addClass(this,"drag").bind(window,"mouseup",(function(){tE.removeClass(r.__selector,"drag")}))})),tE.bind(n.__selector,"touchstart",(function(){tE.addClass(this,"drag").bind(window,"touchend",(function(){tE.removeClass(r.__selector,"drag")}))}));var s,o=document.createElement("div");function a(t){p(t),tE.bind(window,"mousemove",p),tE.bind(window,"touchmove",p),tE.bind(window,"mouseup",h),tE.bind(window,"touchend",h)}function l(t){f(t),tE.bind(window,"mousemove",f),tE.bind(window,"touchmove",f),tE.bind(window,"mouseup",c),tE.bind(window,"touchend",c)}function h(){tE.unbind(window,"mousemove",p),tE.unbind(window,"touchmove",p),tE.unbind(window,"mouseup",h),tE.unbind(window,"touchend",h),d()}function c(){tE.unbind(window,"mousemove",f),tE.unbind(window,"touchmove",f),tE.unbind(window,"mouseup",c),tE.unbind(window,"touchend",c),d()}function u(){var t=kT(this.value);!1!==t?(r.__color.__state=t,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function d(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function p(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=r.__saturation_field.getBoundingClientRect(),i=t.touches&&t.touches[0]||t,n=i.clientX,s=i.clientY,o=(n-e.left)/(e.right-e.left),a=1-(s-e.top)/(e.bottom-e.top);return a>1?a=1:a<0&&(a=0),o>1?o=1:o<0&&(o=0),r.__color.v=a,r.__color.s=o,r.setValue(r.__color.toOriginal()),!1}function f(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=r.__hue_field.getBoundingClientRect(),i=1-((t.touches&&t.touches[0]||t).clientY-e.top)/(e.bottom-e.top);return i>1?i=1:i<0&&(i=0),r.__color.h=360*i,r.setValue(r.__color.toOriginal()),!1}return OT.extend(n.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),OT.extend(n.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:n.__field_knob_border+(n.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),OT.extend(n.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),OT.extend(n.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),OT.extend(o.style,{width:"100%",height:"100%",background:"none"}),dE(o,"top","rgba(0,0,0,0)","#000"),OT.extend(n.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(s=n.__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%);",OT.extend(n.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:n.__input_textShadow+"rgba(0,0,0,0.7)"}),tE.bind(n.__saturation_field,"mousedown",a),tE.bind(n.__saturation_field,"touchstart",a),tE.bind(n.__field_knob,"mousedown",a),tE.bind(n.__field_knob,"touchstart",a),tE.bind(n.__hue_field,"mousedown",l),tE.bind(n.__hue_field,"touchstart",l),n.__saturation_field.appendChild(o),n.__selector.appendChild(n.__field_knob),n.__selector.appendChild(n.__saturation_field),n.__selector.appendChild(n.__hue_field),n.__hue_field.appendChild(n.__hue_knob),n.domElement.appendChild(n.__input),n.domElement.appendChild(n.__selector),n.updateDisplay(),n}return WT(e,t),zT(e,[{key:"updateDisplay",value:function(){var t=kT(this.getValue());if(!1!==t){var e=!1;OT.each(YT.COMPONENTS,(function(i){if(!OT.isUndefined(t[i])&&!OT.isUndefined(this.__color.__state[i])&&t[i]!==this.__color.__state[i])return e=!0,{}}),this),e&&OT.extend(this.__color.__state,t)}OT.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var i=this.__color.v<.5||this.__color.s>.5?255:0,n=255-i;OT.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("+i+","+i+","+i+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,dE(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),OT.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+i+","+i+","+i+")",textShadow:this.__input_textShadow+"rgba("+n+","+n+","+n+",.7)"})}}]),e}(JT),uE=["-moz-","-o-","-webkit-","-ms-",""];function dE(t,e,i,n){t.style.background="",OT.each(uE,(function(r){t.style.cssText+="background: "+r+"linear-gradient("+e+", "+i+" 0%, "+n+" 100%); "}))}var pE=function(t,e){var i=e||document,n=document.createElement("style");n.type="text/css",n.innerHTML=t;var r=i.getElementsByTagName("head")[0];try{r.appendChild(n)}catch(t){}},fE='<div id="dg-save" class="dg dialogue">\n\n Here\'s the new load parameter for your <code>GUI</code>\'s constructor:\n\n <textarea id="dg-new-constructor"></textarea>\n\n <div id="dg-save-locally">\n\n <input id="dg-local-storage" type="checkbox"/> Automatically save\n values to <code>localStorage</code> on exit.\n\n <div id="dg-local-explain">The values saved to <code>localStorage</code> will\n override those passed to <code>dat.GUI</code>\'s constructor. This makes it\n easier to work incrementally, but <code>localStorage</code> is fragile,\n and your friends may not see the same values you do.\n\n </div>\n\n </div>\n\n</div>',mE=function(t,e){var i=t[e];return OT.isArray(arguments[2])||OT.isObject(arguments[2])?new iE(t,e,arguments[2]):OT.isNumber(i)?OT.isNumber(arguments[2])&&OT.isNumber(arguments[3])?OT.isNumber(arguments[4])?new lE(t,e,arguments[2],arguments[3],arguments[4]):new lE(t,e,arguments[2],arguments[3]):OT.isNumber(arguments[4])?new oE(t,e,{min:arguments[2],max:arguments[3],step:arguments[4]}):new oE(t,e,{min:arguments[2],max:arguments[3]}):OT.isString(i)?new nE(t,e):OT.isFunction(i)?new hE(t,e,""):OT.isBoolean(i)?new eE(t,e):null};var gE=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,1e3/60)},vE=function(){function t(){jT(this,t),this.backgroundElement=document.createElement("div"),OT.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"}),tE.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),OT.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 e=this;tE.bind(this.backgroundElement,"click",(function(){e.hide()}))}return zT(t,[{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(),OT.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 e(){t.domElement.style.display="none",t.backgroundElement.style.display="none",tE.unbind(t.domElement,"webkitTransitionEnd",e),tE.unbind(t.domElement,"transitionend",e),tE.unbind(t.domElement,"oTransitionEnd",e)};tE.bind(this.domElement,"webkitTransitionEnd",e),tE.bind(this.domElement,"transitionend",e),tE.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-tE.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-tE.getHeight(this.domElement)/2+"px"}}]),t}();pE(function(t){if(t&&"undefined"!=typeof window){var e=document.createElement("style");return e.setAttribute("type","text/css"),e.innerHTML=t,document.head.appendChild(e),t}}(".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}\n"));var _E=function(){try{return!!window.localStorage}catch(t){return!1}}(),yE=void 0,xE=!0,bE=void 0,TE=!1,EE=[],wE=function t(e){var i=this,n=e||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),tE.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],n=OT.defaults(n,{closeOnTop:!1,autoPlace:!0,width:t.DEFAULT_WIDTH}),n=OT.defaults(n,{resizable:n.autoPlace,hideable:n.autoPlace}),OT.isUndefined(n.load)?n.load={preset:"Default"}:n.preset&&(n.load.preset=n.preset),OT.isUndefined(n.parent)&&n.hideable&&EE.push(this),n.resizable=OT.isUndefined(n.parent)&&n.resizable,n.autoPlace&&OT.isUndefined(n.scrollable)&&(n.scrollable=!0);var r,s=_E&&"true"===localStorage.getItem(IE(this,"isLocal")),o=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 i.parent?i.getRoot().preset:n.load.preset},set:function(t){i.parent?i.getRoot().preset=t:n.load.preset=t,function(t){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].value===t.preset&&(t.__preset_select.selectedIndex=e)}(this),i.revert()}},width:{get:function(){return n.width},set:function(t){n.width=t,DE(i,t)}},name:{get:function(){return n.name},set:function(t){n.name=t,a&&(a.innerHTML=n.name)}},closed:{get:function(){return n.closed},set:function(e){n.closed=e,n.closed?tE.addClass(i.__ul,t.CLASS_CLOSED):tE.removeClass(i.__ul,t.CLASS_CLOSED),this.onResize(),i.__closeButton&&(i.__closeButton.innerHTML=e?t.TEXT_OPEN:t.TEXT_CLOSED)}},load:{get:function(){return n.load}},useLocalStorage:{get:function(){return s},set:function(t){_E&&(s=t,t?tE.bind(window,"unload",o):tE.unbind(window,"unload",o),localStorage.setItem(IE(i,"isLocal"),t))}}}),OT.isUndefined(n.parent)){if(this.closed=n.closed||!1,tE.addClass(this.domElement,t.CLASS_MAIN),tE.makeSelectable(this.domElement,!1),_E&&s){i.useLocalStorage=!0;var l=localStorage.getItem(IE(this,"gui"));l&&(n.load=JSON.parse(l))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=t.TEXT_CLOSED,tE.addClass(this.__closeButton,t.CLASS_CLOSE_BUTTON),n.closeOnTop?(tE.addClass(this.__closeButton,t.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(tE.addClass(this.__closeButton,t.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),tE.bind(this.__closeButton,"click",(function(){i.closed=!i.closed}))}else{void 0===n.closed&&(n.closed=!0);var h=document.createTextNode(n.name);tE.addClass(h,"controller-name"),a=SE(i,h);tE.addClass(this.__ul,t.CLASS_CLOSED),tE.addClass(a,"title"),tE.bind(a,"click",(function(t){return t.preventDefault(),i.closed=!i.closed,!1})),n.closed||(this.closed=!1)}n.autoPlace&&(OT.isUndefined(n.parent)&&(xE&&(bE=document.createElement("div"),tE.addClass(bE,"dg"),tE.addClass(bE,t.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(bE),xE=!1),bE.appendChild(this.domElement),tE.addClass(this.domElement,t.CLASS_AUTO_PLACE)),this.parent||DE(i,n.width)),this.__resizeHandler=function(){i.onResizeDebounced()},tE.bind(window,"resize",this.__resizeHandler),tE.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),tE.bind(this.__ul,"transitionend",this.__resizeHandler),tE.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),n.resizable&&OE(this),o=function(){_E&&"true"===localStorage.getItem(IE(i,"isLocal"))&&localStorage.setItem(IE(i,"gui"),JSON.stringify(i.getSaveObject()))},this.saveToLocalStorageIfPossible=o,n.parent||((r=i.getRoot()).width+=1,OT.defer((function(){r.width-=1})))};function SE(t,e,i){var n=document.createElement("li");return e&&n.appendChild(e),i?t.__ul.insertBefore(n,i):t.__ul.appendChild(n),t.onResize(),n}function ME(t){tE.unbind(window,"resize",t.__resizeHandler),t.saveToLocalStorageIfPossible&&tE.unbind(window,"unload",t.saveToLocalStorageIfPossible)}function AE(t,e){var i=t.__preset_select[t.__preset_select.selectedIndex];i.innerHTML=e?i.value+"*":i.value}function PE(t,e){var i=t.getRoot(),n=i.__rememberedObjects.indexOf(e.object);if(-1!==n){var r=i.__rememberedObjectIndecesToControllers[n];if(void 0===r&&(r={},i.__rememberedObjectIndecesToControllers[n]=r),r[e.property]=e,i.load&&i.load.remembered){var s=i.load.remembered,o=void 0;if(s[t.preset])o=s[t.preset];else{if(!s.Default)return;o=s.Default}if(o[n]&&void 0!==o[n][e.property]){var a=o[n][e.property];e.initialValue=a,e.setValue(a)}}}}function RE(t,e,i,n){if(void 0===e[i])throw new Error('Object "'+e+'" has no property "'+i+'"');var r=void 0;if(n.color)r=new cE(e,i);else{var s=[e,i].concat(n.factoryArgs);r=mE.apply(t,s)}n.before instanceof JT&&(n.before=n.before.__li),PE(t,r),tE.addClass(r.domElement,"c");var o=document.createElement("span");tE.addClass(o,"property-name"),o.innerHTML=r.property;var a=document.createElement("div");a.appendChild(o),a.appendChild(r.domElement);var l=SE(t,a,n.before);return tE.addClass(l,wE.CLASS_CONTROLLER_ROW),r instanceof cE?tE.addClass(l,"color"):tE.addClass(l,HT(r.getValue())),function(t,e,i){if(i.__li=e,i.__gui=t,OT.extend(i,{options:function(e){if(arguments.length>1){var n=i.__li.nextElementSibling;return i.remove(),RE(t,i.object,i.property,{before:n,factoryArgs:[OT.toArray(arguments)]})}if(OT.isArray(e)||OT.isObject(e)){var r=i.__li.nextElementSibling;return i.remove(),RE(t,i.object,i.property,{before:r,factoryArgs:[e]})}},name:function(t){return i.__li.firstElementChild.firstElementChild.innerHTML=t,i},listen:function(){return i.__gui.listen(i),i},remove:function(){return i.__gui.remove(i),i}}),i instanceof lE){var n=new oE(i.object,i.property,{min:i.__min,max:i.__max,step:i.__step});OT.each(["updateDisplay","onChange","onFinishChange","step","min","max"],(function(t){var e=i[t],r=n[t];i[t]=n[t]=function(){var t=Array.prototype.slice.call(arguments);return r.apply(n,t),e.apply(i,t)}})),tE.addClass(e,"has-slider"),i.domElement.insertBefore(n.domElement,i.domElement.firstElementChild)}else if(i instanceof oE){var r=function(e){if(OT.isNumber(i.__min)&&OT.isNumber(i.__max)){var n=i.__li.firstElementChild.firstElementChild.innerHTML,r=i.__gui.__listening.indexOf(i)>-1;i.remove();var s=RE(t,i.object,i.property,{before:i.__li.nextElementSibling,factoryArgs:[i.__min,i.__max,i.__step]});return s.name(n),r&&s.listen(),s}return e};i.min=OT.compose(r,i.min),i.max=OT.compose(r,i.max)}else i instanceof eE?(tE.bind(e,"click",(function(){tE.fakeEvent(i.__checkbox,"click")})),tE.bind(i.__checkbox,"click",(function(t){t.stopPropagation()}))):i instanceof hE?(tE.bind(e,"click",(function(){tE.fakeEvent(i.__button,"click")})),tE.bind(e,"mouseover",(function(){tE.addClass(i.__button,"hover")})),tE.bind(e,"mouseout",(function(){tE.removeClass(i.__button,"hover")}))):i instanceof cE&&(tE.addClass(e,"color"),i.updateDisplay=OT.compose((function(t){return e.style.borderLeftColor=i.__color.toString(),t}),i.updateDisplay),i.updateDisplay());i.setValue=OT.compose((function(e){return t.getRoot().__preset_select&&i.isModified()&&AE(t.getRoot(),!0),e}),i.setValue)}(t,l,r),t.__controllers.push(r),r}function IE(t,e){return document.location.href+"."+e}function CE(t,e,i){var n=document.createElement("option");n.innerHTML=e,n.value=e,t.__preset_select.appendChild(n),i&&(t.__preset_select.selectedIndex=t.__preset_select.length-1)}function LE(t,e){e.style.display=t.useLocalStorage?"block":"none"}function NE(t){var e=t.__save_row=document.createElement("li");tE.addClass(t.domElement,"has-save"),t.__ul.insertBefore(e,t.__ul.firstChild),tE.addClass(e,"save-row");var i=document.createElement("span");i.innerHTML=" ",tE.addClass(i,"button gears");var n=document.createElement("span");n.innerHTML="Save",tE.addClass(n,"button"),tE.addClass(n,"save");var r=document.createElement("span");r.innerHTML="New",tE.addClass(r,"button"),tE.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",tE.addClass(s,"button"),tE.addClass(s,"revert");var o=t.__preset_select=document.createElement("select");if(t.load&&t.load.remembered?OT.each(t.load.remembered,(function(e,i){CE(t,i,i===t.preset)})):CE(t,"Default",!1),tE.bind(o,"change",(function(){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].innerHTML=t.__preset_select[e].value;t.preset=this.value})),e.appendChild(o),e.appendChild(i),e.appendChild(n),e.appendChild(r),e.appendChild(s),_E){var a=document.getElementById("dg-local-explain"),l=document.getElementById("dg-local-storage");document.getElementById("dg-save-locally").style.display="block","true"===localStorage.getItem(IE(0,"isLocal"))&&l.setAttribute("checked","checked"),LE(t,a),tE.bind(l,"change",(function(){t.useLocalStorage=!t.useLocalStorage,LE(t,a)}))}var h=document.getElementById("dg-new-constructor");tE.bind(h,"keydown",(function(t){!t.metaKey||67!==t.which&&67!==t.keyCode||yE.hide()})),tE.bind(i,"click",(function(){h.innerHTML=JSON.stringify(t.getSaveObject(),void 0,2),yE.show(),h.focus(),h.select()})),tE.bind(n,"click",(function(){t.save()})),tE.bind(r,"click",(function(){var e=prompt("Enter a new preset name.");e&&t.saveAs(e)})),tE.bind(s,"click",(function(){t.revert()}))}function OE(t){var e=void 0;function i(i){return i.preventDefault(),t.width+=e-i.clientX,t.onResize(),e=i.clientX,!1}function n(){tE.removeClass(t.__closeButton,wE.CLASS_DRAG),tE.unbind(window,"mousemove",i),tE.unbind(window,"mouseup",n)}function r(r){return r.preventDefault(),e=r.clientX,tE.addClass(t.__closeButton,wE.CLASS_DRAG),tE.bind(window,"mousemove",i),tE.bind(window,"mouseup",n),!1}t.__resize_handle=document.createElement("div"),OT.extend(t.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),tE.bind(t.__resize_handle,"mousedown",r),tE.bind(t.__closeButton,"mousedown",r),t.domElement.insertBefore(t.__resize_handle,t.domElement.firstElementChild)}function DE(t,e){t.domElement.style.width=e+"px",t.__save_row&&t.autoPlace&&(t.__save_row.style.width=e+"px"),t.__closeButton&&(t.__closeButton.style.width=e+"px")}function FE(t,e){var i={};return OT.each(t.__rememberedObjects,(function(n,r){var s={},o=t.__rememberedObjectIndecesToControllers[r];OT.each(o,(function(t,i){s[i]=e?t.initialValue:t.getValue()})),i[r]=s})),i}wE.toggleHide=function(){TE=!TE,OT.each(EE,(function(t){t.domElement.style.display=TE?"none":""}))},wE.CLASS_AUTO_PLACE="a",wE.CLASS_AUTO_PLACE_CONTAINER="ac",wE.CLASS_MAIN="main",wE.CLASS_CONTROLLER_ROW="cr",wE.CLASS_TOO_TALL="taller-than-window",wE.CLASS_CLOSED="closed",wE.CLASS_CLOSE_BUTTON="close-button",wE.CLASS_CLOSE_TOP="close-top",wE.CLASS_CLOSE_BOTTOM="close-bottom",wE.CLASS_DRAG="drag",wE.DEFAULT_WIDTH=245,wE.TEXT_CLOSED="Close Controls",wE.TEXT_OPEN="Open Controls",wE._keydownHandler=function(t){"text"===document.activeElement.type||72!==t.which&&72!==t.keyCode||wE.toggleHide()},tE.bind(window,"keydown",wE._keydownHandler,!1),OT.extend(wE.prototype,{add:function(t,e){return RE(this,t,e,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(t,e){return RE(this,t,e,{color:!0})},remove:function(t){this.__ul.removeChild(t.__li),this.__controllers.splice(this.__controllers.indexOf(t),1);var e=this;OT.defer((function(){e.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&&bE.removeChild(this.domElement);var t=this;OT.each(this.__folders,(function(e){t.removeFolder(e)})),tE.unbind(window,"keydown",wE._keydownHandler,!1),ME(this)},addFolder:function(t){if(void 0!==this.__folders[t])throw new Error('You already have a folder in this GUI by the name "'+t+'"');var e={name:t,parent:this};e.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[t]&&(e.closed=this.load.folders[t].closed,e.load=this.load.folders[t]);var i=new wE(e);this.__folders[t]=i;var n=SE(this,i.domElement);return tE.addClass(n,"folder"),i},removeFolder:function(t){this.__ul.removeChild(t.domElement.parentElement),delete this.__folders[t.name],this.load&&this.load.folders&&this.load.folders[t.name]&&delete this.load.folders[t.name],ME(t);var e=this;OT.each(t.__folders,(function(e){t.removeFolder(e)})),OT.defer((function(){e.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 t=this.getRoot();if(t.scrollable){var e=tE.getOffset(t.__ul).top,i=0;OT.each(t.__ul.childNodes,(function(e){t.autoPlace&&e===t.__save_row||(i+=tE.getHeight(e))})),window.innerHeight-e-20<i?(tE.addClass(t.domElement,wE.CLASS_TOO_TALL),t.__ul.style.height=window.innerHeight-e-20+"px"):(tE.removeClass(t.domElement,wE.CLASS_TOO_TALL),t.__ul.style.height="auto")}t.__resize_handle&&OT.defer((function(){t.__resize_handle.style.height=t.__ul.offsetHeight+"px"})),t.__closeButton&&(t.__closeButton.style.width=t.width+"px")},onResizeDebounced:OT.debounce((function(){this.onResize()}),50),remember:function(){if(OT.isUndefined(yE)&&((yE=new vE).domElement.innerHTML=fE),this.parent)throw new Error("You can only call remember on a top level GUI.");var t=this;OT.each(Array.prototype.slice.call(arguments),(function(e){0===t.__rememberedObjects.length&&NE(t),-1===t.__rememberedObjects.indexOf(e)&&t.__rememberedObjects.push(e)})),this.autoPlace&&DE(this,this.width)},getRoot:function(){for(var t=this;t.parent;)t=t.parent;return t},getSaveObject:function(){var t=this.load;return t.closed=this.closed,this.__rememberedObjects.length>0&&(t.preset=this.preset,t.remembered||(t.remembered={}),t.remembered[this.preset]=FE(this)),t.folders={},OT.each(this.__folders,(function(e,i){t.folders[i]=e.getSaveObject()})),t},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=FE(this),AE(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(t){this.load.remembered||(this.load.remembered={},this.load.remembered.Default=FE(this,!0)),this.load.remembered[t]=FE(this),this.preset=t,CE(this,t,!0),this.saveToLocalStorageIfPossible()},revert:function(t){OT.each(this.__controllers,(function(e){this.getRoot().load.remembered?PE(t||this.getRoot(),e):e.setValue(e.initialValue),e.__onFinishChange&&e.__onFinishChange.call(e,e.getValue())}),this),OT.each(this.__folders,(function(t){t.revert(t)})),t||AE(this.getRoot(),!1)},listen:function(t){var e=0===this.__listening.length;this.__listening.push(t),e&&function t(e){0!==e.length&&gE.call(window,(function(){t(e)}));OT.each(e,(function(t){t.updateDisplay()}))}(this.__listening)},updateDisplay:function(){OT.each(this.__controllers,(function(t){t.updateDisplay()})),OT.each(this.__folders,(function(t){t.updateDisplay()}))}});var UE=wE,kE=function(){function t(t){this.player=t}return Object.defineProperty(t.prototype,"frameRate",{get:function(){return this.player.fps.value},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"drawFrames",{get:function(){return this.player.runtime.fps},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"drawCall",{get:function(){return this.player.runtime.drawCall},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolution",{get:function(){return this.player.config.resolution},set:function(t){this.player.updateConfig({resolution:t})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var t,e;return(null===(t=this.player.view)||void 0===t?void 0:t.width)+"*"+(null===(e=this.player.view)||void 0===e?void 0:e.height)},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minFPS",{get:function(){return this.player.config.minFPS},set:function(t){this.player.updateConfig({minFPS:t})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxFPS",{get:function(){return this.player.config.maxFPS},set:function(t){this.player.updateConfig({maxFPS:t})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"autoResolution",{get:function(){return this.player.config.autoResolution},set:function(t){this.player.updateConfig({autoResolution:t})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"autoFPS",{get:function(){return this.player.config.autoFPS},set:function(t){this.player.updateConfig({autoFPS:t})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"backgroundColor",{get:function(){return this.player.config.transactionBgColor},set:function(t){this.player.updateConfig({transactionBgColor:t})},enumerable:!1,configurable:!0}),t}(),BE=function(){function t(t,e){var i;this.config=new kE(t),this.anchor=e,i=this.createControllerGUI(),this.gui=i[0],this.controller=i[1],this.createStats()}return t.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)},t.prototype.createControllerGUI=function(){var t=new UE({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"),transactionBgColor:t.addColor(this.config,"backgroundColor")};return[t,e]},t.prototype.destroy=function(){try{window.clearInterval(this.stateId),this.anchor.removeChild(this.gui.domElement),this.gui.destroy()}catch(t){}},t}(),GE=function(){function t(t){var e=this;this.tasks=[],this.isDestroy=!1,this.isScheduling=!1,this.schedule=function(){e.isScheduling=!0;var t=e.tasks.shift();t&&!e.isDestroy&&e.fn(t).then((function(){e.tasks.length>0?window.requestAnimationFrame(e.schedule):e.isScheduling=!1}))},this.fn=t}return t.prototype.destroy=function(){this.isDestroy=!0},t.prototype.addTask=function(t){this.tasks.push(t),this.isScheduling||this.schedule()},t}(),HE=function(){function t(t){this.autoUnlock=Object.create(null),this.locks=Object.create(null),this.available=!1,this.available=t}return t.prototype.addLock=function(t,e){var i=this;this.available&&(this.locks[t]=e,this.autoUnlock[t]=window.setTimeout((function(){delete i.locks[t]}),3e3))},t.prototype.unlock=function(t,e){this.available&&e&&this.locks[t]&&this.locks[t]===e&&(window.clearTimeout(this.autoUnlock[t]),delete this.locks[t])},t.prototype.isLocked=function(t){return!!this.available&&!!this.locks[t]},t}(),jE=function(){function t(){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?window.requestAnimationFrame(t.schedule):t.isScheduling=!1})).catch((function(){t.tasks.length>0?window.requestAnimationFrame(t.schedule):t.isScheduling=!1})))}}return t.prototype.getRunningTask=function(){return this.tasks[0]&&"running"===this.tasks[0].status?this.tasks[0]:null},t.prototype.addTask=function(t,e){var i={type:t,status:"wait",fn:e},n=this.getRunningTask();n&&t===n.type||(this.tasks=this.tasks.filter((function(e){return e.type!==t})),this.tasks.push(i),this.isScheduling||this.schedule())},t.prototype.destroy=function(){this.isDestroy=!0},t}(),zE=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))},VE=function(t,e){var i,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}};function WE(t,e,i){return zE(this,void 0,void 0,(function(){var n,r,s,o;return VE(this,(function(a){switch(a.label){case 0:return n=document.createElement("div"),(r=new rw({anchor:n,renderOptions:{minFPS:1,maxFPS:1,resolution:1},mode:"local",interactive:!1})).setResource(t,e),[4,r.getSlideCountAsync()];case 1:if(s=a.sent(),i)return[3,6];o=1,a.label=2;case 2:return o<=s?[4,r.player.stagePool.preload(o,!0)]:[3,5];case 3:a.sent(),a.label=4;case 4:return o++,[3,2];case 5:return[3,6];case 6:return r.destroy(),[2]}}))}))}var XE=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),YE=function(){return(YE=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},qE=function(t,e,i,n){var r,s=arguments.length,o=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,i,o):r(e,i))||o);return s>3&&o&&Object.defineProperty(e,i,o),o},ZE=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))},JE=function(t,e){var i,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},KE=window.ResizeObserver||MT,$E=function(t){return new Promise((function(e){return setTimeout(e,t)}))};function QE(t,e){return ZE(this,void 0,void 0,(function(){var i;return JE(this,(function(n){switch(n.label){case 0:i=Date.now(),n.label=1;case 1:return!t()&&Date.now()-i<e?[4,$E(50)]:[3,3];case 2:return n.sent(),i=Date.now(),[3,1];case 3:return[2]}}))}))}var tw={syncDispatch:"syncDispatch",syncReceive:"syncReceive",syncEventLag:"syncEventLag",renderStart:"renderStart",renderEnd:"renderEnd",renderError:"renderError",slideChange:"slideChange",mainSeqStepStart:"mainSeqStepStart",mainSeqStepEnd:"mainSeqStepEnd",animateStart:"animateStart",animateEnd:"animateEnd",stateChange:"stateChange"},ew={taskId:"",url:"",currentSlideIndex:-1,mainSeqStep:-1,mainSeqState:null,mediaState:Object.create(null),interactiveSeqState:Object.create(null)},iw="";try{iw="0.7.1"}catch(t){iw="dev"}var nw=null;try{nw=a.createInstance({name:"__slide_local_log__",driver:a.INDEXEDDB,version:1})}catch(t){}var rw=function(t){function e(i){var n=t.call(this)||this;return n.iosResetCache=[],n.needClearCacheImage=!1,n.version=iw,n.__slideState=Hb()(ew),n.userInputTime=0,n.isSyncingSlideState=!1,n.frozenTaskManager=new jE,n.randomId=o(),n.resize=!1,n.isAnimating=!1,n.renderingTaskManager=new IT,n.isLoading=!1,n.interactive=!0,n.renderingIndex=0,n.frameWidth=1,n.frameHeight=1,n.frame=document.createElement("div"),n.canvasContainer=document.createElement("div"),n.medianController=document.createElement("div"),n.frameResizeObserver=new KE((function(){return n.frameResizeHandler()})),n.timestamp=function(){return Date.now()},n.mode="local",n.enableGlobalClick=!1,n.lastEmitedState=null,n.playerController=null,n.isInitResized=!1,n.cacheImage=document.createElement("img"),n.isTouchStart=!1,n.touchStartId=void 0,n.taskId="",n.volumeAdjuster=new Ib,n.designWidth=0,n.designHeight=0,n._slideCount=0,n._dispatchIncrId=0,n._receiveIncrId=0,n.recoverHandler=function(t){if("@slide/_recover_"===t.data.type&&t.data.slideId===n.randomId){var e=t.data,i=e.recoverBy,r=e.payload;if(!r)return;"renderOtherPage"===i&&r.slideIndex?n.renderSlide(r.slideIndex):"reloadCurrentPage"===i&&n.renderSlide(n.renderingIndex)}},n.userInputHandle=function(){n.userInputTime=Date.now()},n.handleViewClick=function(){setTimeout((function(){var t=Date.now();Math.abs(t-n.userInputTime)>500&&n.enableGlobalClick&&n.nextStep()}))},n.handleViewTouchStart=function(){window.clearTimeout(n.touchStartId),n.isTouchStart=!0,n.touchStartId=setTimeout((function(){n.isTouchStart=!1}),350)},n.handleViewTouchEnd=function(){n.isTouchStart&&(n.isTouchStart=!1,n.handleViewClick())},n.handleSlideRef=function(){console.log(n),window.__slide=n},n.receiveSyncHandler=function(t){return ZE(n,void 0,void 0,(function(){var e,i,n,r,s=this;return JE(this,(function(o){switch(o.label){case 0:return z_()(t.incrId)&&(t.incrId&&t.incrId-this._receiveIncrId!=1&&this.emit(tw.syncEventLag),this._receiveIncrId=t.incrId||0),this.logger.info("sync receive "+JSON.stringify(t),this.taskId),"nextStep"!==t.type?[3,1]:(this.mainSeqStep!==t.next-1&&this.mainSeqStep+1!==this.mainSeqLength&&this.player?(this.setMainSeqStep(t.next,"start"),this.player.nextTick((function(){s.doNextStep(!0)}))):this.doNextStep(!0),[3,6]);case 1:return"prevStep"!==t.type?[3,2]:(0===this.mainSeqStep&&"idle"===this.mainSeqState||this.mainSeqStep===t.next+1||this.mainSeqStep+1===this.mainSeqLength?this.doPrevStep(!0):(this.setMainSeqStep(t.next+1,"start"),null===(e=this.player)||void 0===e||e.nextTick((function(){s.doPrevStep(!0)}))),[3,6]);case 2:return"interactiveAnim"!==t.type?[3,3]:(this.player?this.player.applyInteractiveAction(t.action):this.__slideState.interactiveSeqState[t.seqId]?this.__slideState.interactiveSeqState[t.seqId].step+=1:this.__slideState.interactiveSeqState[t.seqId]={step:0,state:"end"},[3,6]);case 3:return"renderSlide"!==t.type?[3,5]:[4,this.doRenderSlide(t.index,t.isForward)];case 4:return o.sent(),[3,6];case 5:"mediaPlay"===t.type?(null===(i=this.player)||void 0===i||i.setMediaState(t.id,!0),this.__slideState.mediaState[t.id]=t.state):"mediaPause"===t.type?(null===(n=this.player)||void 0===n||n.setMediaState(t.id,!1),this.__slideState.mediaState[t.id]=t.state):"mediaSeek"===t.type&&(null===(r=this.player)||void 0===r||r.setMediaCurrentTime(t.id,t.time),this.__slideState.mediaState[t.id]=t.state),o.label=6;case 6:return[2]}}))}))},n.handlePrevSlide=function(t){return void 0===t&&(t=!1),ZE(n,void 0,void 0,(function(){var e;return JE(this,(function(i){return this.player?((e=this.player.prevSlideIndex)>=1&&(this.config.navigatorDelegate?this.config.navigatorDelegate.gotoPage(e):t?this.doRenderSlide(e,!1):this.renderSlide(e,!1)),[2]):[2]}))}))},n.handleNextSlide=function(t){return void 0===t&&(t=!1),ZE(n,void 0,void 0,(function(){var e;return JE(this,(function(i){return this.player?((e=this.player.nextSlideIndex)<=this.slideCount&&(this.config.navigatorDelegate?this.config.navigatorDelegate.gotoPage(e):t?this.doRenderSlide(e,!0):this.renderSlide(e,!0)),[2]):[2]}))}))},n.handleGotoSlide=function(t){if(t<=n.slideCount&&t>=1){var e=n.slideState.currentSlideIndex<=t;n.renderSlide(t,e)}else-1===t&&n.renderSlide(n.slideCount,!0)},n.config=n.initSlideConfig(i),n.logger={info:function(t,i){var r;e._tempLog+="INFO - "+(new Date).toISOString()+" - {"+n.randomId+"}["+i+"] "+t+"\n";var s=null===(r=n.config.logger)||void 0===r?void 0:r.info;s&&s("["+i+"] "+t)},warn:function(t,i){var r;e._tempLog+="WARN - "+(new Date).toISOString()+" - {"+n.randomId+"}["+i+"] "+t+"\n";var s=null===(r=n.config.logger)||void 0===r?void 0:r.warn;s&&s("["+i+"] "+t)},error:function(t,i){var r;e._tempLog+="ERROR - "+(new Date).toISOString()+" - {"+n.randomId+"}["+i+"] "+t+"\n";var s=null===(r=n.config.logger)||void 0===r?void 0:r.error;s&&s("["+i+"] "+t)}},n.logger.info("new slide",n.taskId),n.anchor=n.config.anchor,n.syncQueue=new GE(n.receiveSyncHandler),n.lock=new HE("interactive"===n.mode),n.cacheImage.style.position="absolute",n.cacheImage.style.zIndex="100",n.setMedianControllerAttribute(),n.canvasContainer.style.position="relative",n.canvasContainer.appendChild(n.medianController),n.frame.appendChild(n.canvasContainer),n.frameResizeObserver.observe(n.frame),n.on(tw.syncReceive,(function(t){n.lock.unlock(t.type,t.uuid),n.syncQueue.addTask(t)})),n.renderingTaskManager.eventHub.on("task-error",(function(t){var e=t.error,i=t.task,r=T_.transform(e);r.errorType===b_.RuntimeWarn?n.logger.warn(r.message,n.taskId):n.logger.error(r.message,n.taskId),n.isLoading=!1,n.reportError(r,i.slideIndex)})),window.addEventListener("__slide_ref__",n.handleSlideRef),n.resizeView=ty()(n.resizeView.bind(n),50),n.player=n.initPlayer(n.config),n.config.controller&&n.createController(),n.player.view&&n.canvasContainer.appendChild(n.player.view),n.handleViewClick=ty()(n.handleViewClick,300),n.player.errorChannel.on("error",(function(t,e){var i=T_.transform(t);i.errorType===b_.RuntimeWarn?n.logger.warn(i.message,n.taskId):n.logger.error(i.message,n.taskId),n.isLoading=!1,e===n.renderingIndex&&n.reportError(t,e)})),window.addEventListener("message",n.recoverHandler),n}var i,n;return XE(e,t),e.flushLog=function(t){return void 0===t&&(t=!1),ZE(this,void 0,void 0,(function(){return JE(this,(function(i){switch(i.label){case 0:return e._tempLog.length>131072||t&&e._tempLog.length>0?[4,null==nw?void 0:nw.setItem("run_time_log_"+e._tempLogIndex,e._tempLog)]:[3,2];case 1:i.sent(),e._tempLog="",e._tempLogIndex+=1,i.label=2;case 2:return[2]}}))}))},Object.defineProperty(e.prototype,"dispatchIncrId",{get:function(){return this._dispatchIncrId++},enumerable:!1,configurable:!0}),e.prototype.reportError=function(t,e){this.emit(tw.renderError,{error:t,index:e}),window.postMessage({type:"@slide/_error_",errorType:t.errorType,errorMsg:t.errorMsg,slideId:this.randomId,slideIndex:e,customMessage:"@slide/_error_"})},e.prototype.initSlideConfig=function(t){return t.timestamp&&(this.timestamp=t.timestamp),t.rtcAudio&&(Ob.RtcAudioClazz=t.rtcAudio),this.mode=t.mode,this.anchor=t.anchor,this.anchor.appendChild(this.frame),this.enableGlobalClick=!il()(t.enableGlobalClick)&&t.enableGlobalClick,this.resize=t.resize||!1,this.interactive=t.interactive,this.frame.style.cssText=t.fixedFrameSize?"width:"+t.fixedFrameSize.width+"px;height:"+t.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;",t.fixedFrameSize&&(this.frameWidth=t.fixedFrameSize.width,this.frameHeight=t.fixedFrameSize.height),t},e.prototype.initPlayer=function(t){var e,i,n,r=this,s=new Ob({mode:this.mode,useLocalCache:!!il()(this.config.useLocalCache)||this.config.useLocalCache,logger:this.logger,resourceTimeout:il()(this.config.resourceTimeout)?15e3:this.config.resourceTimeout,loadDelegate:this.config.loaderDelegate,volumeAdjuster:this.volumeAdjuster});return s.setInteractive(this.interactive),s.updateConfig(t.renderOptions||{}),s.on(Nb.renderStart,(function(t){r.isLoading=!0,r.emit(tw.renderStart,t)})),s.on(Nb.renderEnd,(function(t){r.isLoading=!1,r.player&&(r.designHeight=r.player.designHeight,r.designWidth=r.player.designWidth,r.cacheImage.style.width=r.player.designWidth+"px",r.cacheImage.style.height=r.player.designHeight+"px",r._slideCount=r.player.slideCount),r.emit(tw.renderEnd,t)})),s.on(Nb.slideChange,(function(t){r.__slideState.currentSlideIndex=t,r.emitStateChange(),r.emit(tw.slideChange,t)})),s.on(Nb.mainSeqStateChange,(function(t){r.__slideState.mainSeqState=t,r.emitStateChange()})),s.on(Nb.mainSeqStepChange,(function(t){r.__slideState.mainSeqStep=t,r.emitStateChange()})),s.on(Nb.interactiveSeqStateChange,(function(t){var e=t.id,i=t.state;r.__slideState.interactiveSeqState[e]=i,r.emitStateChange()})),s.on(Nb.animateStart,(function(){!0!==r.isAnimating&&(r.isAnimating=!0,r.emit(tw.animateStart))})),s.on(Nb.animateEnd,(function(){!1!==r.isAnimating&&(r.isAnimating=!1,r.emit(tw.animateEnd))})),s.on(Nb.interactiveSeqAction,(function(t){var e=t.action,i=t.seqId;r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"interactiveAnim",action:e,seqId:i}),r.emitStateChange()})),s.on(Nb.mainSeqStepStart,(function(t){r.emit(tw.mainSeqStepStart,t)})),s.on(Nb.mainSeqStepEnd,(function(t){r.emit(tw.mainSeqStepEnd,t)})),s.on(Nb.mediaPlay,(function(t){var e={type:"play",time:r.timestamp()-1e3*t.time};r.__slideState.mediaState[t.id]=e,r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaPlay",id:t.id,state:e}),r.emitStateChange()})),s.on(Nb.mediaPause,(function(t){var e={type:"pause",time:t.time};r.__slideState.mediaState[t.id]=e,r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaPause",id:t.id,state:e}),r.emitStateChange()})),s.on(Nb.mediaSeek,(function(t){var e={type:"pause",time:0};t.isPlaying?(e.type="play",r.__slideState.mediaState[t.id]?e.time=r.__slideState.mediaState[t.id].time-1e3*t.time:e.time=r.timestamp()-1e3*t.time,r.__slideState.mediaState[t.id]=e):(e.type="pause",e.time=t.time,r.__slideState.mediaState[t.id]=e),r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaSeek",id:t.id,time:t.time,state:e}),r.emitStateChange()})),s.on(Nb.requestPrevSlide,(function(t){r.handlePrevSlide(t)})),s.on(Nb.requestNextSlide,(function(t){r.handleNextSlide(t)})),s.on(Nb.requestGotoSlide,(function(t){r.config.navigatorDelegate?r.config.navigatorDelegate.gotoPage(t):r.handleGotoSlide(t)})),null===(e=s.view)||void 0===e||e.addEventListener("touchend",this.handleViewTouchEnd),null===(i=s.view)||void 0===i||i.addEventListener("touchstart",this.handleViewTouchStart),null===(n=s.view)||void 0===n||n.addEventListener("click",this.handleViewClick),s.on(Nb.userInput,this.userInputHandle),s},e.prototype.createController=function(){this.player&&(this.playerController=new BE(this.player,this.frame))},e.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"},e.prototype.frameResizeHandler=function(){if(!this.config.fixedFrameSize){var t=this.frame.getBoundingClientRect(),e=t.width,i=t.height;this.frameWidth=e,this.frameHeight=i,this.resizeView()}},e.prototype.updateFixedFrameSize=function(t,e,i){this.config.fixedFrameSize&&(this.frameWidth=t,this.frameHeight=e,this.frame.style.width=t+"px",this.frame.style.height=e+"px",this.resizeView(i))},e.prototype.resizeView=function(t){var e,i,n=this,r=this.width,s=this.height;if(r>0&&s>0){var o=this.frameWidth/r,a=o*s;a>this.frameHeight&&(o*=this.frameHeight/a),null===(e=this.player)||void 0===e||e.scaleView(o,this.resize,t),this.cacheImage.style.transform="scale("+o+")",this.medianController.style.transform="scale("+o+")",this.medianController.setAttribute("data-scale",o.toString()),this.isInitResized||(this.isInitResized=!0,null===(i=this.player)||void 0===i||i.clock.setTimeout((function(){n.frame.style.visibility="visible"}),32))}},e.prototype.setSlideState=function(t){var e,i,n;return ZE(this,void 0,void 0,(function(){var r,s=this;return JE(this,(function(o){switch(o.label){case 0:return this.isSyncingSlideState=!0,this.logger.info("stateChange receive "+JSON.stringify(t),this.taskId),t.taskId&&t.taskId!==this.__slideState.taskId&&(this.__slideState.taskId=t.taskId,null===(e=this.player)||void 0===e||e.setResourceData(t.taskId,this.__slideState.url)),t.url&&t.url!==this.__slideState.url&&(this.__slideState.url=t.url,null===(i=this.player)||void 0===i||i.setResourceData(this.__slideState.taskId,t.url)),Number.isInteger(t.currentSlideIndex)&&t.currentSlideIndex!==this.__slideState.currentSlideIndex?(this.__slideState.currentSlideIndex=t.currentSlideIndex,[4,this.doRenderSlide(t.currentSlideIndex)]):[3,2];case 1:o.sent(),o.label=2;case 2:return[4,null===(n=this.player)||void 0===n?void 0:n.clock.waitUntil((function(){var e,i;return(null===(e=s.player)||void 0===e?void 0:e.currentIndex)===t.currentSlideIndex&&(null===(i=s.player)||void 0===i?void 0:i.currentStage)}),3e3)];case 3:return o.sent(),r=!1,Number.isInteger(t.mainSeqStep)&&t.mainSeqStep!==this.__slideState.mainSeqStep&&(r=!0,this.__slideState.mainSeqStep=t.mainSeqStep),t.mainSeqState&&t.mainSeqState!==this.__slideState.mainSeqState&&(r=!0,this.__slideState.mainSeqState=t.mainSeqState),r&&this.setMainSeqStep(this.__slideState.mainSeqStep,"idle"===this.__slideState.mainSeqState?"start":"end"),t.mediaState&&(this.initMedia(t),this.__slideState.mediaState=t.mediaState),t.interactiveSeqState&&(this.initInteractiveSeq(t),this.__slideState.interactiveSeqState=t.interactiveSeqState),this.isSyncingSlideState=!1,[2]}}))}))},e.prototype.initInteractiveSeq=function(t){var e;for(var i in t.interactiveSeqState){var n=t.interactiveSeqState[i];null===(e=this.player)||void 0===e||e.setInteractiveSeqState(i,n.step,"idle"===n.state?"start":"end")}},e.prototype.initMedia=function(t){var e,i,n=this,r=function(r){var o=t.mediaState[r],a=s.__slideState.mediaState[r];if(a&&o.type===a.type&&o.time===a.time)return"continue";"play"===o.type?null===(e=s.player)||void 0===e||e.setMediaState(r,!0).then((function(){var t,e=n.timestamp();null===(t=n.player)||void 0===t||t.setMediaCurrentTime(r,(e-o.time)/1e3)})):null===(i=s.player)||void 0===i||i.setMediaState(r,!1).then((function(){var t;null===(t=n.player)||void 0===t||t.setMediaCurrentTime(r,o.time)}))},s=this;for(var o in t.mediaState)r(o)},Object.defineProperty(e.prototype,"slideCount",{get:function(){return this._slideCount},enumerable:!1,configurable:!0}),e.prototype.getSizeAsync=function(){return ZE(this,void 0,void 0,(function(){var t;return JE(this,(function(e){switch(e.label){case 0:if(this.width>0&&this.height>0)return[2,[this.width,this.height]];e.label=1;case 1:return e.trys.push([1,4,,5]),[4,fetch(this.__slideState.url+"/"+this.__slideState.taskId+"/jsonOutput/slide-1.json")];case 2:return[4,e.sent().json()];case 3:return[2,[(t=e.sent()).width,t.height]];case 4:return e.sent(),[2,[0,0]];case 5:return[2]}}))}))},e.prototype.getSlideCountAsync=function(){return ZE(this,void 0,void 0,(function(){return JE(this,(function(t){switch(t.label){case 0:if(this._slideCount>0)return[2,this._slideCount];t.label=1;case 1:return t.trys.push([1,4,,5]),[4,fetch(this.__slideState.url+"/"+this.__slideState.taskId+"/jsonOutput/slide-1.json")];case 2:return[4,t.sent().json()];case 3:return[2,t.sent().slideCount];case 4:return t.sent(),[2,0];case 5:return[2]}}))}))},Object.defineProperty(e.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(e.prototype,"mainSeqLength",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.mainSeqLength())||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mainSeqStep",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.mainSeqStep())||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mainSeqState",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.mainSeqState())||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderOptions",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.config)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"drawCall",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.runtime.drawCall)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderFps",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.runtime.fps)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"runtimeFps",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.fps.value)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"view",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.view)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.designWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.designHeight},enumerable:!1,configurable:!0}),e.prototype.updateRenderOption=function(t){this.player&&(this.player.updateConfig(t),this.renderOptions&&(this.config.renderOptions=this.renderOptions))},e.prototype.setResource=function(t,e){var i;this.taskId=t,null===(i=this.player)||void 0===i||i.setResourceData(t,e),this.__slideState.taskId=t,this.__slideState.url=e,this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"setResource",taskId:t,url:e})},e.prototype._renderSlide=function(t){var e;return ZE(this,void 0,void 0,(function(){var i=this;return JE(this,(function(n){switch(n.label){case 0:return this.renderingIndex=t,this.player&&t===this.player.currentIndex?[2]:((Ob.platform.isIOS()||Ob.platform.isAndroid())&&this.iosResetCache.indexOf(t)<0&&this.iosResetCache.push(t),[4,null===(e=this.player)||void 0===e?void 0:e.renderSlide(t)]);case 1:return n.sent(),this.__slideState.currentSlideIndex=t,this.resizeView(),this.__slideState.interactiveSeqState={},this.emitStateChange(),setTimeout((function(){var t,e;if("hidden"===(null===(e=null===(t=i.player)||void 0===t?void 0:t.view)||void 0===e?void 0:e.style.visibility)&&(i.player.view.style.visibility="visible"),"hidden"===i.frame.style.visibility&&(i.frame.style.visibility="visible"),i.needClearCacheImage)try{i.frame.removeChild(i.cacheImage)}catch(t){}}),100),[2]}}))}))},e.prototype.renderSlide=function(t,e){if(void 0===e&&(e=!0),this.player){var i=Number(t);(i!==this.player.currentIndex||this.renderingTaskManager.hasStartTask())&&(i>this.slideCount&&this.slideCount>0||this.poseRenderSlide(i,e))}},e.prototype.needCreateNewPlayer=function(){var t=Ob.platform.isLowGpuMemory()?15:30;return(Ob.platform.isIOS()||Ob.platform.isAndroid())&&this.iosResetCache.length>t},e.prototype.poseRenderSlide=function(t,e){"interactive"===this.mode?this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:t,isForward:e}):"sync"===this.mode?(this.doRenderSlide(t,e),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:t,isForward:e})):this.doRenderSlide(t,e)},e.prototype.doRenderSlide=function(t,e){var i,n,r,s=this;if(void 0===e&&(e=!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 o=this.player.getSnapshot();this.cacheImage.src=o,this.frame.appendChild(this.cacheImage),this.player.destroy(),null===(i=this.playerController)||void 0===i||i.destroy(),this.player=this.iosNewPlayer,this.iosNewPlayer=void 0,(null===(n=this.config)||void 0===n?void 0:n.controller)&&this.createController(),this.needClearCacheImage=!0,(null===(r=null==this?void 0:this.player)||void 0===r?void 0:r.view)&&(this.player.view.style.visibility="hidden",this.canvasContainer.appendChild(this.player.view))}var a=Math.random().toString(32).substr(2);return this.player.isForward=e,this.renderingTaskManager.addTask((function(){return s._renderSlide(t)}),t,a),new Promise((function(t){s.renderingTaskManager.eventHub.once("task-end-"+a,t)}))},e.prototype.nextStep=function(){!this.isLoading&&this.player&&this.interactive?this.player.mainSeqHasNextStep()?"interactive"===this.mode?this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"nextStep",next:this.player.mainSeqStep()+1}):"sync"===this.mode?(this.doNextStep(),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"nextStep",next:this.player.mainSeqStep()})):this.doNextStep():this.handleNextSlide():this.logger.info("prevent nextStep. "+this.isLoading+" "+this.player+" "+this.interactive,this.taskId)},e.prototype.doNextStep=function(t){if(void 0===t&&(t=!1),this.player){this.player.nextStep(t);var e=this.player.mainSeqStep();this.__slideState.mainSeqStep=e,this.emitStateChange()}},e.prototype.prevStep=function(){!this.isLoading&&this.player&&this.interactive?this.player.mainSeqHasPrevStep()?"interactive"===this.mode?this.emitSyncDispatch({type:"prevStep",slideIndex:this.__slideState.currentSlideIndex,next:this.player.mainSeqStep()-1}):"sync"===this.mode?(this.doPrevStep(),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"prevStep",next:this.player.mainSeqStep()})):this.doPrevStep():this.handlePrevSlide():this.logger.info("prevent nextStep. "+this.isLoading+" "+this.player+" "+this.interactive,this.taskId)},e.prototype.doPrevStep=function(t){if(void 0===t&&(t=!1),this.player){this.player.prevStep(t);var e=this.player.mainSeqStep();this.__slideState.mainSeqStep=e,this.emitStateChange()}},e.prototype.isSlideStateReady=function(t){return t.taskId.length>0&&t.url.length>0&&t.currentSlideIndex>0},e.prototype.emitStateChange=function(){if("local"!==this.mode&&!this.isSyncingSlideState){var t=this.slideState;!Bb()(this.lastEmitedState,t)&&this.isSlideStateReady(t)&&(this.lastEmitedState=t,this.emit(tw.stateChange,t),this.logger.info("stateChange dispatch "+JSON.stringify(this.slideState),this.taskId))}},e.prototype.emitSyncDispatch=function(t){if(!this.lock.isLocked(t.type)){var e=Math.random().toString(32).substr(2);this.lock.addLock(t.type,e);var i=YE(YE({},t),{uuid:e});"sync"===this.config.mode&&(i.incrId=this.dispatchIncrId),this.emit(tw.syncDispatch,i),this.logger.info("sync dispatch "+JSON.stringify(i),this.taskId)}},e.prototype.setMainSeqStep=function(t,e){var i;null===(i=this.player)||void 0===i||i.setMainSeqStep(t,e)},e.prototype.setInteractive=function(t){var e;this.interactive=t,null===(e=this.player)||void 0===e||e.setInteractive(t)},e.prototype.pause=function(){var t;null===(t=this.player)||void 0===t||t.pause()},e.prototype.resume=function(){var t;null===(t=this.player)||void 0===t||t.resume()},e.prototype._doFrozen=function(){var t;return ZE(this,void 0,void 0,(function(){var e,i,n,r=this;return JE(this,(function(s){switch(s.label){case 0:return this.logger.info("frozen with player["+!!this.player+"]",this.taskId),this.view&&this.player?[4,this.player.clock.waitUntil((function(){return!r.isLoading}),6e4)]:[3,2];case 1:for(i in s.sent(),e=this.player.getSnapshot()||"",this.cacheImage.src=e,this.frame.appendChild(this.cacheImage),this.player.destroy(),null===(t=this.playerController)||void 0===t||t.destroy(),this.player=void 0,this.__slideState.mediaState)n=this.__slideState.mediaState[i],this.__slideState.mediaState[i]=YE(YE({},n),{frozenTime:this.timestamp()});s.label=2;case 2:return[2]}}))}))},e.prototype.frozen=function(){var t=this;this.frozenTaskManager.addTask("frozen",(function(){return t._doFrozen()}))},e.prototype._doRelease=function(){var t,e;return ZE(this,void 0,void 0,(function(){var i,n,r,s;return JE(this,(function(o){switch(o.label){case 0:if(this.logger.info("do release slide",this.taskId),this.player)return[2];for(n in this.player=this.initPlayer(this.config),(null===(t=this.config)||void 0===t?void 0:t.controller)&&this.createController(),this.player.view&&(this.canvasContainer.appendChild(this.player.view),this.player.view.style.visibility="hidden"),i=this.__slideState,this.__slideState=Hb()(ew),i.mediaState)"play"===(r=i.mediaState[n]).type&&(s=Math.max(null!==(e=r.frozenTime)&&void 0!==e?e:0,r.time),r.time=this.timestamp()-(s-r.time),r.frozenTime=void 0);return[4,this.setSlideState(i)];case 1:return o.sent(),[4,this.player.clock.delay(333)];case 2:o.sent(),this.player.view&&(this.player.view.style.visibility="visible");try{this.frame.removeChild(this.cacheImage)}catch(t){}return[2]}}))}))},e.prototype.release=function(){var t=this;this.frozenTaskManager.addTask("release",(function(){return t._doRelease()}))},e.prototype._doDestroy=function(){var t,e,i,n;this.logger.info("do destroy slide",this.taskId),this.playerController&&this.playerController.destroy(),this.frameResizeObserver.disconnect(),null===(t=this.player)||void 0===t||t.removeAllListeners(),null===(e=this.player)||void 0===e||e.destroy(),null===(i=this.player)||void 0===i||i.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("message",this.recoverHandler),this.removeAllListeners();try{(null===(n=this.player)||void 0===n?void 0:n.view)&&this.anchor.removeChild(this.player.view),this.anchor.removeChild(this.frame)}catch(t){}},e.prototype.waitLoadEnd=function(){return ZE(this,void 0,void 0,(function(){var t;return JE(this,(function(e){switch(e.label){case 0:t=0,e.label=1;case 1:return this.isLoading&&t<10?[4,$E(100)]:[3,3];case 2:return e.sent(),t+=1,[3,1];case 3:return[2]}}))}))},e.prototype.preload=function(t){return this.player?this.player.preload(t):Promise.resolve()},e.prototype.destroy=function(){var t=this;this.logger.info("pre destroy slide",""),this.isLoading?this.waitLoadEnd().then((function(){t._doDestroy()})):this._doDestroy()},e.prototype.clearSlideCache=function(){var t;null===(t=this.player)||void 0===t||t.clearLocalCache()},e.prototype.hasNextStep=function(){if(!this.player)return!1;var t=this.player.currentIndex===this.slideCount,e=0===this.mainSeqLength||this.mainSeqStep>=this.mainSeqLength-1,i="end"===this.mainSeqState||"running"===this.mainSeqState||null==this.mainSeqState;return!(t&&e&&i)},e.prototype.hasPrevStep=function(){if(!this.player)return!1;var t=1===this.player.currentIndex,e=0===this.mainSeqLength||0===this.mainSeqStep,i="idle"===this.mainSeqState||null===this.mainSeqState;return!(t&&e&&i)},e.prototype.updateGlobalVolume=function(t){this.volumeAdjuster.volume=t},e.prototype.getGlobalVolume=function(){return this.volumeAdjuster.volume},e.clearLocalCache=function(){Ob.clearLocalCache()},e.disposeLocalCache=function(){},i=e,e._tempLog="",e._tempLogIndex=1,e.usePlugin=Fb,e.handleLogReport=function(){return ZE(void 0,void 0,void 0,(function(){var t,n,r,s,o,a;return JE(i,(function(i){switch(i.label){case 0:return[4,e.flushLog(!0)];case 1:return i.sent(),nw?[4,nw.keys()]:[3,6];case 2:t=(i.sent()||[]).sort((function(t,e){return parseInt(t.replace("run_time_log_",""))-parseInt(e.replace("run_time_log_",""))})),n=0,r=t,i.label=3;case 3:return n<r.length?(s=r[n],o=s.replace("run_time_log_",""),[4,nw.getItem(s)]):[3,6];case 4:a=i.sent(),window.postMessage({type:"@slide/_report_log_",log:a,index:parseInt(o,10),total:t.length,customMessage:"@slide/_report_log_"}),i.label=5;case 5:return n++,[3,3];case 6:return[2]}}))}))},e.handleLogDownload=function(){return ZE(void 0,void 0,void 0,(function(){var t,n,r,s,o,a,l;return JE(i,(function(i){switch(i.label){case 0:return[4,e.flushLog(!0)];case 1:return i.sent(),t="",nw?[4,nw.keys()]:[3,6];case 2:n=(i.sent()||[]).sort((function(t,e){return parseInt(t.replace("run_time_log_",""))-parseInt(e.replace("run_time_log_",""))})),r=0,s=n,i.label=3;case 3:return r<s.length?(o=s[r],a=t,[4,nw.getItem(o)]):[3,6];case 4:t=a+(i.sent()||""),i.label=5;case 5:return r++,[3,3];case 6:return(l=document.createElement("a")).setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(t)),l.setAttribute("download","slide_log"),l.style.display="none",document.body.appendChild(l),l.click(),document.body.removeChild(l),[2]}}))}))},qE([(n="Slide.initConfig",function(t,e,i){var r=i.value;i.value=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var i=Db.get(n)||[],s=t,o=0,a=i;o<a.length;o++){var l=a[o];try{s=l.before(s)}catch(t){}if(!Array.isArray(s)||s.length!==t.length)throw new Error("plugin before hook return invalid args")}for(var h=r.bind(this).apply(void 0,s),c=0,u=i.reverse();c<u.length;c++){l=u[c];try{h=l.after(h)}catch(t){}if(!h)throw new Error("plugin after hook return undefined result")}return h}})],e.prototype,"initSlideConfig",null),e}($a.a);null==nw||nw.clear(),window.addEventListener("__slide_log__",rw.handleLogDownload),window.addEventListener("message",(function(t){"@slide/_request_log_"===t.data.type&&rw.handleLogReport().catch((function(){}))})),window.setInterval((function(){rw.flushLog().catch((function(){}))}),2e3)}]);
|