@netless/slide 0.1.33 → 0.1.38
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/lib/Slide.js +1 -1
- package/package.json +2 -2
package/lib/Slide.js
CHANGED
|
@@ -271,4 +271,4 @@ var Ka=function(t,e){return(Ka=Object.setPrototypeOf||{__proto__:[]}instanceof A
|
|
|
271
271
|
*
|
|
272
272
|
* pixi.js is licensed under the MIT License.
|
|
273
273
|
* http://www.opensource.org/licenses/mit-license
|
|
274
|
-
*/qi.registerPlugin("accessibility",ke),qi.registerPlugin("extract",dr),qi.registerPlugin("interaction",Ze),qi.registerPlugin("particle",No),qi.registerPlugin("prepare",Us),qi.registerPlugin("batch",ir),qi.registerPlugin("tilingSprite",qs),Fr.registerPlugin(pa),Fr.registerPlugin(Yr),Fr.registerPlugin(fo),Fr.registerPlugin(Co),Fr.registerPlugin(Hs),lr.registerPlugin(He),lr.registerPlugin(Ur);var ru={AlphaFilter:ga,BlurFilter:Ga,BlurFilterPass:Ua,ColorMatrixFilter:za,DisplacementFilter:Va,FXAAFilter:Xa,NoiseFilter:Ya};class ou{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 su{constructor(t){this.target=t}applyCommand(t,e){this.target.applyCommand(t,e)}}class au{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}}class uu{constructor(t,e){this.hardHidden=!1,this.target=t,!0===e&&(this.hardHidden=!0)}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}get visibility(){return this.target.visible?"visible":"hidden"}set visibility(t){this.visibility===t||this.hardHidden||(this.target.visible="visible"===t)}}class lu{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 n,i;"click"===e?null===(n=this.proxy)||void 0===n||n.addListener("click",e=>this.handleProxyAction(e,t)):"hover"===e&&(null===(i=this.proxy)||void 0===i||i.addListener("mouseover",e=>this.handleProxyAction(e,t)))})}handleProxyAction(t,e){var n;const i=t.data.global,r=this.object.getGlobalPosition(),o=i.x-r.x+this.object.pivot.x,s=i.y-r.y+this.object.pivot.y;(null===(n=this.hitArea)||void 0===n?void 0:n.contains(o,s))&&this.object.visible&&this.handleAction(e,!0)}getOriginHitArea(){return this.object.hitArea?this.object.hitArea:new ve(0,0,this.object.width,this.object.height)}handleAction(t,e=!1){this.proxy&&!e||(this.ctx.eventHub.emit(Uh.hyperlinkTrigger,t),this.execAction(t))}execAction(t){var e;if("ppaction://hlinksldjump"===t.action){const n=(null!==(e=null==t?void 0:t.target)&&void 0!==e?e:"").match(/slide(\d+)\.xml/);n&&n[1]&&this.ctx.eventHub.emit(Uh.requestGotoSlide,Number(n[1]))}else if("ppaction://hlinkshowjump?jump=nextslide"===t.action)this.ctx.eventHub.emit(Uh.requestNextSlide);else if("ppaction://hlinkshowjump?jump=previousslide"===t.action)this.ctx.eventHub.emit(Uh.requestPrevSlide);else if("ppaction://hlinkshowjump?jump=firstslide"===t.action)this.ctx.eventHub.emit(Uh.requestGotoSlide,1);else if("ppaction://hlinkshowjump?jump=lastslide"===t.action)this.ctx.eventHub.emit(Uh.requestGotoSlide,-1);else if("ppaction://hlinkshowjump?jump=lastslideviewed"===t.action){const t=this.ctx.lastViewedIndex;this.ctx.eventHub.emit(Uh.requestGotoSlide,t)}else"ppaction://hlinkshowjump?jump=endshow"===t.action&&this.ctx.eventHub.emit(Uh.requestGotoSlide,-1)}}function hu(t,e,n=5){return Math.abs(t-e)<=Math.pow(10,-n)}function cu(t){return Math.floor(1e6*t)/1e6}class du{constructor(){this.point={x:0,y:0},this.slope=Math.PI/4}static fromPointSlope(t,e){const n=new du;return n.point=t,n.slope=e,n}resolveY(t){return Math.tan(this.slope)*(t-this.point.x)+this.point.y}distanceToLinearEquation(t){return hu(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 n=du.fromPointSlope(t,e),i=this.crossPoint(n);return i?Math.ceil(Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2))):0}crossPoint(t){if(hu(t.slope,this.slope))return null;let e=0,n=0;const i=Math.tan(t.slope),r=Math.tan(this.slope),{x:o,y:s}=this.point,{x:a,y:u}=t.point;return hu(this.slope,Math.PI/2)?(e=this.point.x,n=i*(e-a)+u):hu(t.slope,Math.PI/2)?(e=t.point.x,n=r*(e-o)+s):hu(this.slope,Math.PI)||hu(this.slope,0)?(n=this.point.y,e=(n-u)/i+a):hu(t.slope,Math.PI)||hu(t.slope,0)?(n=t.point.y,e=(n-s)/r+o):(e=(i*a-u+s-r*o)/(i-r),n=r*(e-o)+s),{x:e,y:n}}}class fu{constructor(t,e,n){var i,r,o,s,a,u;this.scaleExt={x:1,y:1},this.scaleOrigin={x:1,y:1},this.designScale={x:1,y:1},this.bound=new fe(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 Fe,this.ctx=e,this.style=new uu(this.container,t.hardHidden),this.designGlobalPosition={x:n.x+(null!==(r=null===(i=t.position)||void 0===i?void 0:i.x)&&void 0!==r?r:0),y:n.y+(null!==(s=null===(o=t.position)||void 0===o?void 0:o.y)&&void 0!==s?s:0)},(t.hlinkClick||t.hlinkHover)&&(this.hyperlink=new lu(this.container,this.ctx),t.hlinkHover&&(null===(a=this.hyperlink)||void 0===a||a.addAction(t.hlinkHover,"hover")),t.hlinkClick&&(null===(u=this.hyperlink)||void 0===u||u.addAction(t.hlinkClick,"click")))}updateScale(){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,n,i,r,o,s,a,u;this.designWidth=t.width,this.designHeight=t.height,this.designX=null!==(n=null===(e=t.position)||void 0===e?void 0:e.x)&&void 0!==n?n:0,this.designY=null!==(r=null===(i=t.position)||void 0===i?void 0:i.y)&&void 0!==r?r:0;const l=this.designWidth/2,h=this.designHeight/2;this.container.width=this.designWidth,this.container.height=this.designHeight,this.container.pivot.x=l,this.container.pivot.y=h;const c=null!==(s=null===(o=t.position)||void 0===o?void 0:o.x)&&void 0!==s?s:0,d=null!==(u=null===(a=t.position)||void 0===a?void 0:a.y)&&void 0!==u?u:0;this.container.x=c+l,this.container.y=d+h,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 f=new hs;f.drawRect(0,0,this.designWidth,this.designHeight),this.container.addChild(f),this.json.hardHidden&&(this.container.visible=!1),this.bound.x=c,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 cu(this.designWidth/this.ctx.stageWidth)}get design_ppt_h(){return cu(this.designHeight/this.ctx.stageHeight)}get design_ppt_x(){return cu(this.designX/this.ctx.stageWidth)}get design_ppt_y(){return cu(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.scaleExt.x=t*this.ctx.stageWidth/this.designWidth,this.updateScale()}get ppt_h(){return this.scaleExt.y*this.scaleOrigin.y*this.designHeight/this.ctx.stageHeight}set ppt_h(t){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}}class pu{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,n,i,r]=vu(t);let o=0,s=0,a=0;const u=Math.max(e,n,i),l=Math.min(e,n,i),h=u-l;a=(u+l)/2,0===h?o=0:u===e?o=(n-i)/h%6*60:u===n?o=60*((i-e)/h+2):u===i&&(o=60*((e-n)/h+4)),s=0===h?0:h/(1-Math.abs(2*a-1)),this.h=o,this.s=s,this.l=a,this.a=r}interpolationFrom(t,e,n){const i=t.h+(this.h-t.h)*e,r=t.s+(this.s-t.s)*e,o=t.l+(this.l-t.l)*e,s=t.a+(this.a-t.a)*e;n.h=Math.max(Math.min(i,359),0),n.s=Math.max(Math.min(r,1),0),n.l=Math.max(Math.min(o,1),0),n.a=Math.max(Math.min(s,1),0)}toHexString(){let t=[0,0,0,0];const{h:e,s:n,l:i}=this;if(e<360&&e>=0&&n<=1&&n>=0&&i<=1&&i>=0){let r,o,s;const a=(1-Math.abs(2*i-1))*n,u=a*(1-Math.abs(e/60%2-1)),l=i-a/2;[r,o,s]=e>=0&&e<60?[a,u,0]:e>=60&&e<120?[u,a,0]:e>=120&&e<180?[0,a,u]:e>=180&&e<240?[0,u,a]:e>=240&&e<300?[u,0,a]:[a,0,u],t=[r+l,o+l,s+l,this.a]}return _u(t)}}class mu{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,n,i,r]=vu(t);this.r=e,this.g=n,this.b=i,this.a=r}isInit(){return this._isInit}interpolationFrom(t,e,n){n.r=t.r+(this.r-t.r)*e,n.g=t.g+(this.g-t.g)*e,n.b=t.b+(this.b-t.b)*e,n.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 _u([this.r,this.g,this.b,this.a])}}function gu(t){const e=t.substring(1);return[parseInt(e.substring(0,6),16),parseInt(e.substring(6,8),16)/255]}function vu(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 _u(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 yu(t,e,n){const i=vu(t),r=vu(e),o=Math.round(255*(i[0]+(r[0]-i[0])*n)),s=Math.round(255*(i[1]+(r[1]-i[1])*n)),a=Math.round(255*(i[2]+(r[2]-i[2])*n)),u=Math.round(255*(i[3]+(r[3]-i[3])*n));return"#"+o.toString(16).padStart(2,"0")+s.toString(16).padStart(2,"0")+a.toString(16).padStart(2,"0")+u.toString(16).padStart(2,"0")}class xu extends Ei{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"}set color(t){this.currentColor=t;const e=vu(t);this.uniforms.color=Float32Array.from(e)}get color(){return this.currentColor}}const bu=new ru.ColorMatrixFilter;bu.matrix=[1,0,0,0,-.2,0,1,0,0,-.2,0,0,1,0,-.2,0,0,0,1,0];const wu=new ru.ColorMatrixFilter;wu.matrix=[1,0,0,0,-.1,0,1,0,0,-.1,0,0,1,0,-.1,0,0,0,1,0];const Su=new ru.ColorMatrixFilter;Su.matrix=[1,0,0,0,.2,0,1,0,0,.2,0,0,1,0,.2,0,0,0,1,0];const Tu=new ru.ColorMatrixFilter;Tu.matrix=[1,0,0,0,.1,0,1,0,0,.1,0,0,1,0,.1,0,0,0,1,0];const Eu={darken:bu,darkenLess:wu,lightenLess:Tu,lighten:Su};var Mu=n(2),Au=n.n(Mu);class Pu{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"arrow":case"stealth":case"triangle":default:this.pivot={x:this.width,y:this.height/2}}}generatePaths(){this.hash="arrow-"+Au()(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 Cu extends fu{constructor(t,e,n){super({position:{x:t.x,y:t.y},width:t.width,height:t.height},e,n),this.fillColorFilter=new xu,this.fill=new au(this),this.json=t,this.ctx=e,this.parentGlobalPos=n,this.global={x:n.x+t.x,y:n.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,n;t?(null!==(n=null===(e=this.container.filters)||void 0===e?void 0:e.indexOf(this.fillColorFilter))&&void 0!==n?n:-1)<0&&(this.container.filters=[this.fillColorFilter]):this.container.filters=[]}get renderContainer(){return this.container}get interactiveContainer(){return this.container}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,n=544===this.presetSubType?this.scaleExt.x:1;this.container.position.x=this.designX+e+this.container.pivot.x*n}get ppt_y(){return this.global.y/this.ctx.stageHeight}set ppt_y(t){const e=t*this.ctx.stageHeight-this.global.y,n=544===this.presetSubType?this.scaleExt.y:1;this.container.position.y=this.designY+e+this.container.pivot.y*n}get design_ppt_x(){return cu(this.global.x/this.ctx.stageWidth)}get design_ppt_y(){return cu(this.global.y/this.ctx.stageHeight)}}var Ru=n(9),Iu=n.n(Ru);function Lu(){return Date.now().toString(32)+Math.random().toString(32).substring(2)}function Ou(t){const e=[],n=t.filter(t=>{const n=t.width<2048&&t.height<2048;return n||e.push(t),n}).sort((t,e)=>t.width*t.height-e.width*e.height);let i=n.length+1,r=2050,o=2050;const s=[];let a=null;for(;(r>2048||o>2048)&&n.length>0;)i-=1,a=Iu()(n.slice(0,i)),r=a.width,o=a.height;return a&&s.push(a),e.forEach(t=>{const e=Iu()([t]);s.push(e)}),i<n.length?s.concat(Ou(n.slice(i))):s}function Du(t,e,n){let i,r,o=e,s=n;0===o&&(o=s/1e4),0===s&&(s=o/1e4);const a=t%360;if(a%180==0)i=Math.cos(a*(Math.PI/180))*o,r=0;else if(a%90==0)i=0,r=-Math.sin(a*(Math.PI/180))*s;else{const t=Math.tan(a*Math.PI/180);i=o*s/Math.sqrt(Math.pow(s,2)+Math.pow(o*t,2)),(a>90&&a<270||a<-90&&a>-270)&&(i=-i),r=-t*i}return{x:i,y:r}}function Nu(t,e,n,i,r,o,s){const a={x:0,y:0},u=-o,l=Du((r=-r)/Math.PI*180,n,i),h=t.x-l.x,c=t.y-l.y;for(let t=0;t<51;t++){const o=Du((r+t/50*u)/Math.PI*180,n,i);o.x+=h,o.y+=c,t/50==1&&(a.x=o.x,a.y=o.y),o.x=o.x/9525*e.x,o.y=o.y/9525*e.y,s.lineTo(o.x,o.y)}return a}class Fu{constructor(t,e,n,i){this.renderContainer=new Fe,this.ctx=t,this.type=e,this.lineWidth=n,this.width=i}createPaths(){if("ww"===this.type)return null;{const t=`M 0,0 L ${9525*this.width},0`;return{paths:[{id:Lu(),path:t,fill:"norm",hasStroke:!0,scale:{x:1,y:1},hash:Au()(t)}],width:this.width,height:this.lineWidth}}}preRender(){const t=this.createPaths();if(t){const{paths:e,width:n,height:i}=t,r=e.reduce((t,e)=>t+e.hash,"");this.ghcTextureId=this.ctx.graphicsTexture.addGraphics(e,r,{x:0,y:0},n,i,{width:this.lineWidth},!1)}}render(){if(this.ghcTextureId){const t=this.ctx.graphicsTexture.getGraphicsData(this.ghcTextureId);t&&(this.sprite=new ms,this.sprite.pivot.x=t.pivot.x,this.sprite.texture=t.texture)}}destroy(){console.log("")}}var Bu=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class ku extends Cu{constructor(t,e,n){super(t,e,n),this.fillMaskSprite=new ms,this.fillSprite=new ms,this.strokeMaskSprite=new ms,this.strokeSprite=new ms,this.textureContainer=new Fe,this.underline=null;const{underLine:i,lineHeight:r,width:o}=this.json;i&&(this.underline=new Fu(e,i.type,r/16,o))}getIterateEntry(){return null}getBgElement(){return null}updateTransform(t){var e,n,i,r;const{isHorz:o}=this.json;t.position={x:o&&null!==(n=null===(e=t.position)||void 0===e?void 0:e.x)&&void 0!==n?n:0,y:o?0:null!==(r=null===(i=t.position)||void 0===i?void 0:i.y)&&void 0!==r?r:0},t.width=o?this.json.width:this.json.lineWidth,t.height=o?this.json.lineHeight:this.json.height,super.updateTransform(t)}preRender(){const{fill:t,stroke:e,lineWidth:n,lineHeight:i,content:r}=this.json;t&&(this.fillTextureId=this.ctx.fillTexture.addFill({fillType:"blipFill",src:t.key,filters:[{type:"changeBulletColor",args:["#000000","#FFA500"]}]},t.width,t.height,void 0,"◾"===r),t.fill&&"noFill"!==t.fill.fillType&&(this.fillBgId=this.ctx.fillTexture.addFill(t.fill,n,i))),e&&(this.strokeTextureId=this.ctx.fillTexture.addFill({fillType:"blipFill",src:e.key,filters:[]},e.width,e.height),e.fill&&"noFill"!==e.fill.fillType&&(this.strokeBgId=this.ctx.fillTexture.addFill(e.fill,n,i))),this.underline&&this.underline.preRender()}render(){var t;return Bu(this,void 0,void 0,(function*(){const{lineWidth:e,lineHeight:n,baseLine:i,isHorz:r,height:o,width:s,highlightColor:a,x:u,y:l,content:h}=this.json;if(a){const t=new hs,[i,u]=gu(a);t.beginFill(i,u),t.drawRect(0,0,r?s:e,r?n:o),t.endFill(),this.textureContainer.addChild(t)}if(this.fillBgId&&this.fillTextureId){const t=this.ctx.fillTexture.getTexture(this.fillTextureId);(null==t?void 0:t.texture)&&(this.fillMaskSprite.texture=t.texture,this.fillMaskSprite.scale.x=.5,this.fillMaskSprite.scale.y=.5);const e=this.ctx.fillTexture.getTexture(this.fillBgId);e.texture&&(this.fillSprite.texture=e.texture,this.fillSprite.mask=this.fillMaskSprite,this.fillSprite.addChild(this.fillMaskSprite),r?this.fillSprite.position.y=l:this.fillSprite.position.x=u,this.textureContainer.addChild(this.fillSprite))}if(this.strokeBgId&&this.strokeTextureId){const t=this.ctx.fillTexture.getTexture(this.strokeTextureId);(null==t?void 0:t.texture)&&(this.strokeMaskSprite.texture=t.texture,this.strokeMaskSprite.scale.x=.5,this.strokeMaskSprite.scale.y=.5);const e=this.ctx.fillTexture.getTexture(this.strokeBgId);(null==e?void 0:e.texture)&&(this.strokeSprite.texture=e.texture,this.strokeSprite.mask=this.strokeMaskSprite,this.strokeSprite.addChild(this.strokeMaskSprite),r?this.strokeSprite.position.y=l:this.strokeSprite.position.x=u,this.textureContainer.addChild(this.strokeSprite))}if(this.underline&&(this.underline.render(),this.underline.sprite&&this.fillMaskSprite)){let e=null;this.fillBgId&&(e=this.ctx.fillTexture.getTexture(this.fillBgId)),this.underline.sprite.position.y=i,this.underline.sprite.position.x=0;const n=new ms;n.texture=null!==(t=null==e?void 0:e.texture)&&void 0!==t?t:null,n.mask=this.underline.sprite,n.addChild(this.underline.sprite),this.textureContainer.addChild(n)}const c=Tn.create({width:r?s:e,height:r?n:o,resolution:2});this.ctx.renderer.render(this.textureContainer,{renderTexture:c});const d=new ms;d.texture=c,this.container.addChild(d),this.container.name=h}))}destroy(){this.textureContainer.destroy({texture:!0}),this.container.destroy({children:!0,texture:!0})}}var Uu=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class Gu extends Cu{constructor(){super(...arguments),this.units=[],this.isHorz=!0}getIterateElements(){return this.units}getIterateEntry(t,e,n){return this.units[e]?this.units[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null)}preRender(){for(let t=0,e=this.json.textUnits.length;t<e;t++){const e=this.json.textUnits[t];if(!e.content)continue;const{height:n,width:i,baseline:r}=this.json,o=new ku(Object.assign(Object.assign({},e),{lineHeight:n,lineWidth:i,baseLine:r,isHorz:this.isHorz}),this.ctx,this.global);o.preRender(),this.units.push(o)}}render(){return Uu(this,void 0,void 0,(function*(){for(const t of this.units.reverse())yield t.render(),this.container.addChild(t.container)}))}destroy(){this.units.forEach(t=>{t.destroy()}),this.container.destroy({children:!1})}}var Hu=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class zu extends Cu{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,n){const i=this.getIterateElements();return i[e]?i[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null)}preRender(){for(let t=0,e=this.json.lines.length;t<e;t++){const e=this.json.lines[t],n=new Gu(e,this.ctx,this.global);n.isHorz=this.isHorz,n.container.name="line-"+t,n.preRender(),this.lines.push(n)}}render(){return Hu(this,void 0,void 0,(function*(){for(const t of this.lines)yield t.render(),this.container.addChild(t.container)}))}destroy(){this.lines.forEach(t=>{t.destroy()}),this.container.destroy({children:!1})}}var ju=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class Vu{constructor(t,e,n,i){this.iterateElements=[],this.paragraphs=[],this.container=new Fe,this.json=t,this.ctx=e,this.parentGlobalPos=i,this.iterateType=n,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 hs;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()})}preRender(){var t;for(let e=0,n=this.json.paragraphs.length;e<n;e++){const n=this.json.paragraphs[e],i=new zu(n,this.ctx,this.global);i.isHorz=null===(t=this.json.isHorz)||void 0===t||t,i.preRender(),this.iterateElements=this.iterateElements.concat(i.getIterateElements()),i.container.name="段落-"+e,this.paragraphs.push(i)}}render(){return ju(this,void 0,void 0,(function*(){for(const t of this.paragraphs)yield t.render(),this.container.addChild(t.container);const{width:t}=this.container;this.container.scale.x<0&&(this.container.x+=-1*t)}))}}var Wu=n(19),Xu=n.n(Wu),qu=n(20),Yu=n.n(qu);const Zu={Reflection:class extends Ei{constructor(t){super(Xu.a,Yu.a,{uShapeFilterArea:new Float32Array([0,0,0,0]),uStartAlpha:t.startAlpha,uEndAlpha:t.endAlpha,uBlur:0}),this.json=t}}};var Ju=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};const Ku={pivot:{x:0,y:0},width:0,height:0};class $u extends fu{constructor(t,e,n){var i,r,o;super(t,e,n),this.renderContainer=new Fe,this.bgTextureId="",this.bgSprite=new ms,this.backgroundMaskTextureId="",this.filterAreaJustifies=[],this.backgroundMask=new ms,this.pathStrokeTextureId="",this.pathSprite=new ms,this.pathMask=new ms,this.pathMaskTextureId="",this.fillColorFilter=new xu,this.strokeColorFilter=new xu,this.id="",this.arrowList=[],this.fill=new au(this),this.stroke=new ou(this),this.updateFilterArea=()=>{const t=this.renderContainer.getBounds(!1),e=this.filterAreaJustifies.map(e=>e(t)),n=e.map(t=>t.width),i=e.map(t=>t.height),r=new fe(t.x,t.y,Math.max(...n),Math.max(...i));this.renderContainer.filterArea=r,this.renderContainer.filters.forEach(t=>{t.uniforms.uShapeFilterArea=new Float32Array(4),t.uniforms.uShapeFilterArea[0]=r.x,t.uniforms.uShapeFilterArea[1]=r.y,t.uniforms.uShapeFilterArea[2]=r.width,t.uniforms.uShapeFilterArea[3]=r.height})},this.json=t,this.id=t.id,this.container.name=t.id,this.renderContainer.name=t.id+"-render-container",this.fillStyle=t.fillStyle,this.lineStyle=t.lineStyle,this.geometry=t.geometry,this.ctx.timingTargets.addTarget(this.id,this),"solidFill"===(null===(i=this.fillStyle)||void 0===i?void 0:i.fillType)&&(this.fillColorFilter.currentColor=this.fillStyle.color),"solidFill"===(null===(o=null===(r=this.lineStyle)||void 0===r?void 0:r.fill)||void 0===o?void 0:o.fillType)&&(this.strokeColorFilter.currentColor=this.lineStyle.fill.color),this.pathSprite.name="path-fill",this.pathMask.name="path-mask",this.bgSprite.name="bg-fill",this.backgroundMask.name="bg-mask",this.updateTransform(this.json),t.textBody&&(this.text=new Vu(t.textBody,this.ctx,t.textBody.iterateType,{x:this.designGlobalPosition.x,y:this.designGlobalPosition.y})),this.container.hitArea=new ve(1,1,this.json.width,this.json.height)}get interactiveContainer(){return this.renderContainer}get strokeActive(){var t,e;return(null!==(e=null===(t=this.pathSprite.filters)||void 0===t?void 0:t.length)&&void 0!==e?e:-1)>0}set strokeActive(t){var e,n;t?(null!==(n=null===(e=this.pathSprite.filters)||void 0===e?void 0:e.indexOf(this.strokeColorFilter))&&void 0!==n?n:-1)<0&&(this.pathSprite.filters=[this.strokeColorFilter]):this.pathSprite.filters=[]}get fillActive(){var t,e;return(null!==(e=null===(t=this.bgSprite.filters)||void 0===t?void 0:t.length)&&void 0!==e?e:-1)>0}set fillActive(t){var e,n;t?(null!==(n=null===(e=this.bgSprite.filters)||void 0===e?void 0:e.indexOf(this.fillColorFilter))&&void 0!==n?n:-1)<0&&(this.bgSprite.filters=[this.fillColorFilter]):this.bgSprite.filters=[]}getTextElement(t,e){var n,i;return null!==(i=null===(n=this.text)||void 0===n?void 0:n.getTextElement(t,e))&&void 0!==i?i:null}getBgElement(){return this}getIterateEntry(t,e,n){return"el"===t||0===e?this:this.text?this.text.getIterateEntry(e-1,n)||null:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null)}createBackgroundMask(){return Ju(this,void 0,void 0,(function*(){const t=this.ctx.graphicsTexture.getGraphicsData(this.backgroundMaskTextureId);t&&(this.backgroundMask.texture=t.texture,this.backgroundMask.pivot.x=t.pivot.x,this.backgroundMask.pivot.y=t.pivot.y)}))}createBackground(){var t,e,n,i,r,o,s,a,u;const{pivot:l,width:h,height:c}=(null===(t=this.geometry)||void 0===t?void 0:t.fillTransform)||Ku;if(this.json.useBgFill&&this.ctx.bgTexture)return this.bgSprite.texture=this.ctx.bgTexture,this.bgSprite.mask=this.backgroundMask,this.container.addChild(this.backgroundMask),this.container.addChild(this.bgSprite),this.bgSprite.x=l.x,this.bgSprite.y=l.y,this.bgSprite.pivot.x=(null===(e=this.json.position)||void 0===e?void 0:e.x)||0,void(this.bgSprite.pivot.y=(null===(n=this.json.position)||void 0===n?void 0:n.y)||0);if("gifFill"===(null===(i=this.fillStyle)||void 0===i?void 0:i.fillType)){const t=this.ctx.fillTexture.getGifFrames(this.fillStyle.src),e=t.map((t,e)=>({texture:t,time:this.fillStyle.delays[e]||20}));this.bgSprite=new iu(e,!0),this.bgSprite.play();let n=1;const i=this.fillStyle.loop;this.bgSprite.onLoop=()=>{n+=1,i>0&&n>i&&this.bgSprite.gotoAndStop(t.length-1)},this.bgSprite.height=c||this.designHeight,this.bgSprite.width=h||this.designWidth,this.bgSprite.mask=this.backgroundMask,this.bgSprite.x=l.x,this.bgSprite.y=l.y,this.container.addChild(this.backgroundMask),this.container.addChild(this.bgSprite)}else if("groupFill"===(null===(r=this.fillStyle)||void 0===r?void 0:r.fillType)){if(this.groupFillTextureId){const t=this.ctx.fillTexture.getTexture(this.groupFillTextureId);t.texture&&(this.bgSprite.texture=t.texture,this.bgSprite.mask=this.backgroundMask,this.bgSprite.x=-1*(null!==(s=null===(o=this.json.position)||void 0===o?void 0:o.x)&&void 0!==s?s:0),this.bgSprite.y=-1*(null!==(u=null===(a=this.json.position)||void 0===a?void 0:a.y)&&void 0!==u?u:0),this.container.addChild(this.bgSprite),this.container.addChild(this.backgroundMask))}}else{const t=this.ctx.fillTexture.getTexture(this.bgTextureId);t.texture&&(this.bgSprite.texture=t.texture,this.bgSprite.mask=this.backgroundMask,this.container.addChild(this.backgroundMask),this.container.addChild(this.bgSprite),this.bgSprite.x=l.x,this.bgSprite.y=l.y,this.bgSprite.pivot.x=t.pivot.x,this.bgSprite.pivot.y=t.pivot.y)}}createPathFill(){const t=this.ctx.fillTexture.getTexture(this.pathStrokeTextureId);t.texture&&(this.pathSprite.texture=t.texture,this.pathSprite.pivot.x=this.pathMask.pivot.x,this.pathSprite.pivot.y=this.pathMask.pivot.y,this.pathMask.pivot.x=0,this.pathMask.pivot.y=0,this.pathSprite.mask=this.pathMask,this.pathSprite.addChild(this.pathMask),this.container.addChild(this.pathSprite))}createPathMask(){return Ju(this,void 0,void 0,(function*(){const t=this.ctx.graphicsTexture.getGraphicsData(this.pathMaskTextureId);if(t){const{texture:e,pivot:n}=t;this.pathMask.texture=e,this.pathMask.pivot.x=n.x,this.pathMask.pivot.y=n.y,this.pathMask.texture=e}}))}createFilledPathMask(){var t,e;return Ju(this,void 0,void 0,(function*(){const n=(null===(e=null===(t=this.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 ms(e.texture);n.pivot.x=e.pivot.x,n.pivot.y=e.pivot.y;const i=new ms(this.bgSprite.texture);i.pivot.x=this.bgSprite.pivot.x,i.pivot.y=this.bgSprite.pivot.y,i.mask=n,i.filters=[Eu[t.fill]],this.container.addChild(i),this.container.addChild(n)}}}))}createBackgroundTexture(){var t,e,n,i,r;if(this.fillStyle&&"gifFill"!==this.fillStyle.fillType&&"groupFill"!==this.fillStyle.fillType){const o=(null===(t=this.geometry)||void 0===t?void 0:t.fillTransform)||Ku,s=(null==o?void 0:o.width)||this.designWidth,a=(null==o?void 0:o.height)||this.designHeight;this.bgTextureId=this.ctx.fillTexture.addFill(this.fillStyle,s+(null!==(n=null===(e=this.lineStyle)||void 0===e?void 0:e.width)&&void 0!==n?n:0),a+(null!==(r=null===(i=this.lineStyle)||void 0===i?void 0:i.width)&&void 0!==r?r:0))}}createPathFillTexture(){var t,e;if((null===(t=this.lineStyle)||void 0===t?void 0:t.fill)&&"gifFill"!==this.lineStyle.fill.fillType&&"groupFill"!==this.lineStyle.fill.fillType){const{width:t,height:n}=(null===(e=this.geometry)||void 0===e?void 0:e.lineTransform)||Ku,i=Object(a.isNumber)(this.lineStyle.width)?this.lineStyle.width:1;this.pathStrokeTextureId=this.ctx.fillTexture.addFill(this.lineStyle.fill,(t||this.designWidth)+i,(n||this.designHeight)+i)}}createArrowFillTexture(){var t;null===(t=this.json.lineArrowList)||void 0===t||t.forEach(t=>{var e,n,i,r;const o=new Pu(Object.assign(Object.assign({},t),{fillStyle:null===(e=this.lineStyle)||void 0===e?void 0:e.fill,lineWidth:null!==(i=null===(n=this.lineStyle)||void 0===n?void 0:n.width)&&void 0!==i?i:0}));o.graphicsId=this.ctx.graphicsTexture.addGraphics(null!==(r=o.paths)&&void 0!==r?r:[],o.hash,o.pivot||{x:0,y:0},o.width,o.height,void 0,!0),o.textureId=this.ctx.fillTexture.addFill(o.fillStyle,o.width,o.height),this.arrowList.push(o)})}createArrow(){this.arrowList.forEach(t=>{const e=this.ctx.graphicsTexture.getGraphicsData(t.graphicsId),n=this.ctx.fillTexture.getTexture(t.textureId);if(e&&n.texture){const{texture:i,pivot:r}=e,o=new ms(i);o.pivot.x=r.x,o.pivot.y=r.y;const s=new ms(n.texture);s.addChild(o),s.mask=o,s.position.x=t.position.x,s.position.y=t.position.y,s.pivot.x=t.pivot.x+n.pivot.x,s.pivot.y=t.pivot.y+n.pivot.y,s.rotation=t.rotate/180*Math.PI,t.sprite=s,this.container.addChild(s)}})}preRender(){var t,e,n,i,r,o,s,a,u,l;this.createBackgroundTexture(),this.createPathFillTexture(),this.createArrowFillTexture();const{width:h,height:c,pivot:d}=(null===(t=this.geometry)||void 0===t?void 0:t.lineTransform)||Ku,f=h||this.designWidth,p=c||this.designHeight;(null===(e=this.geometry)||void 0===e?void 0:e.paths)&&this.geometry.paths.length>0&&(this.pathMaskTextureId=this.ctx.graphicsTexture.addGraphics(null!==(i=null===(n=this.geometry)||void 0===n?void 0:n.paths)&&void 0!==i?i:[],this.geometry.hash,d||{x:0,y:0},f,p,this.lineStyle,!1),this.backgroundMaskTextureId=this.ctx.graphicsTexture.addGraphics(null!==(o=null===(r=this.geometry)||void 0===r?void 0:r.paths)&&void 0!==o?o:[],this.geometry.hash,d||{x:0,y:0},f,p,this.lineStyle,!0));const m=(null===(a=null===(s=this.geometry)||void 0===s?void 0:s.paths)||void 0===a?void 0:a.filter(t=>"none"!==t.fill&&"norm"!==t.fill))||[];for(const t of m)this.ctx.graphicsTexture.addGraphics([t],t.hash,((null===(u=this.geometry)||void 0===u?void 0:u.lineTransform)||Ku).pivot,f,p,this.lineStyle,!0,t.id);null===(l=this.text)||void 0===l||l.preRender()}subClassRender(){return Ju(this,void 0,void 0,(function*(){}))}setupEffect(){const{effectList:t}=this.json;if(t&&t.length>0){const e=[];return t.forEach(t=>{"reflection"===t.type&&(this.filterAreaJustifies.push(t=>(t.height*=2,t)),e.push(new Zu.Reflection(t)))}),this.ctx.ticker.add(this.updateFilterArea,void 0,-20),this.renderContainer.filters=e,!0}return!1}render(){var t,e,n,i,r,o;return Ju(this,void 0,void 0,(function*(){if(yield this.createBackgroundMask(),yield this.createBackground(),yield this.subClassRender(),yield this.createFilledPathMask(),yield this.createPathMask(),yield this.createPathFill(),yield this.createArrow(),this.text&&(yield this.text.render()),"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.position.x=(null!==(i=null===(n=this.json.position)||void 0===n?void 0:n.x)&&void 0!==i?i:0)+this.text.x,this.text.container.position.y=(null!==(o=null===(r=this.json.position)||void 0===r?void 0:r.y)&&void 0!==o?o:0)+this.text.y,this.renderContainer.addChild(this.text.container));else{if(this.text){if(Object(a.isBoolean)(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.container.addChild(this.text.container)}this.renderContainer.addChild(this.container)}if(this.renderContainer.cacheAsBitmap=!!this.json.cacheAsBitMap,"background"===this.json.id){const t=Tn.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}}))}destroy(){this.bgSprite.destroy(),this.backgroundMask.destroy(),this.pathSprite.destroy(),this.pathMask.destroy(),this.fillColorFilter.destroy(),this.strokeColorFilter.destroy(),this.arrowList.forEach(t=>{var e;null===(e=t.sprite)||void 0===e||e.destroy()})}}var Qu=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};function tl(t,e){for(const n in e)t.style[n]=e[n]}class el{constructor(t){var e,n;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.playCallBackList=[],this.duration=0,this.start=0,this.end=0,this.changeMediaProgress=t=>{t.stopPropagation();const e=t.offsetX/this.progress.clientWidth*this.duration;this.jumpToTime(e),this.medianIsEnd=!1,this.ctx.eventHub.emit(Uh.mediaSeek,{id:this.targetId,time:this.media.currentTime-this.start,isPlaying:this.media.isPlaying})},this.jumpToTime=(t=0)=>{const e=Math.floor(t)+this.start;this.media.currentTime!==e&&(this.media.currentTime=e,(this.media.paused||this.media.ended)&&this.ctx.clock.setTimeout(()=>{this.media.play().then(()=>this.media.pause())},16))},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=el.formatTime(this.duration)},this.playMedia=()=>Qu(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=()=>Qu(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=()=>Qu(this,void 0,void 0,(function*(){const t=this.media.currentTime-this.start;this.duration>0&&(t>this.duration||this.media.ended)&&(yield this.pauseMedia(),this.medianIsEnd=!0),this.currentTime.innerText=el.formatTime(t),this.currentProgress.style.flex=(t/this.duration).toString()})),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.eventHub.emit(Uh.mediaPlay,{id:this.targetId,time:this.media.currentTime}),this.playMedia()},this.pauseMediaFromCtrl=()=>{this.ctx.eventHub.emit(Uh.mediaPause,{id:this.targetId,time:this.media.currentTime}),this.pauseMedia()},this.targetId=t.targetId,this.ctx=t.ctx,this.height=t.height,this.width=t.width,this.sprite=t.sprite,this.media=t.media,this.info=t.info,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!==(n=this.info.cut.end)&&void 0!==n?n:0)}getMedianContainer(){let t=document.getElementById("median-container");t||(t=document.createElement("div"),t.id="median-container",this.canvasElement.parentElement.appendChild(t)),this.container=t}static formatTime(t){let e="00:00";if(t){const n=Math.floor(t/60),i=String(n<0?0:n).padStart(2,"0"),r=Math.floor(t%60);e=`${i}:${String(r<0?0:r).padStart(2,"0")}`}return e}createButton(){const t={marginLeft:"15px",marginRight:"10px",fontSize:"0",height:"20px"};tl(this.playButton,Object.assign(Object.assign({},t),{display:"block"}));const e=document.createElement("img");tl(e,{height:"20px"}),e.src="https://convertcdn.netless.link/publicFiles/icon/play.png",this.playButton.appendChild(e),tl(this.pauseButton,Object.assign(Object.assign({},t),{display:"none"}));const n=document.createElement("img");tl(n,{height:"20px"}),n.src="https://convertcdn.netless.link/publicFiles/icon/pause.png",this.pauseButton.appendChild(n)}createTimer(){const t=document.createElement("div");tl(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(){tl(this.progress,{flex:"1",position:"relative",marginRight:"10px"});const t=document.createElement("div");tl(t,{background:"#D9D9D9",position:"relative",height:"10px",display:"flex"}),this.progress.appendChild(t),tl(this.currentProgress,{background:"#4F4F4F",top:"0px",left:"0",height:"10px",flex:"0"}),t.appendChild(this.currentProgress)}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{sprite:e}=this,{stageWidth:n,stageHeight:i}=this.ctx,r=e.getGlobalPosition(),o=1/Number(null===(t=this.container)||void 0===t?void 0:t.getAttribute("data-scale"));r.y=r.y+this.height-50,r.x=Math.max(r.x,0),r.x=Math.min(r.x,n-300*o),r.y=Math.max(r.y,0),r.y=Math.min(r.y,i-50),tl(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(${o})`,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.progress.removeEventListener("mousedown",this.changeMediaProgress,!1),this.playButton.removeEventListener("click",()=>this.playMedia(),!1),this.pauseButton.removeEventListener("click",()=>this.pauseMedia(),!1),this.media.removeListener("durationchange",this.getMediaDuration,!1),this.media.removeListener("timeupdate",this.mediaTimeUpdate,!1),this.media.removeListener("pause",this.onPauseMedia,!1),this.media.removeListener("play",this.onPlayMedia,!1)}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 nl=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class il extends s.a{constructor(t){var e,n;super(),this.type="video",this.sprite=new ms,this.isPlaying=!1,this.id=t.id,this.video=t.video,this.start=null===(e=t.video.cut)||void 0===e?void 0:e.start,this.end=null===(n=t.video.cut)||void 0===n?void 0:n.end,this.container=t.container,this.ctx=t.ctx,this.ctx.medias[this.id]=this,this.videoResource=new fn(this.video.src,{autoLoad:!0,autoPlay:!1,updateFPS:30,crossorigin:!0});const{video:i,width:r,height:o,sprite:s}=t;this.controller=new el({targetId:t.id,ctx:t.ctx,width:r,height:o,sprite:s,media:this,info:i,canvasElement:t.canvasElement}),this.controller.addPlayCallBack(()=>{this.sprite.width=r,this.sprite.height=o,this.ctx.clock.setTimeout(()=>{this.sprite.visible=!0},50)});const a=new on(null,{height:o,width:r});a.resource=this.videoResource,this.videoResource.bind(a),this.sprite=new ms,this.sprite.visible=!1,this.sprite.texture=new wn(a),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)})})}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){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 nl(this,void 0,void 0,(function*(){this.isPlaying=!0,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||(yield null===(t=this.videoResource.source)||void 0===t?void 0:t.play())}))}load(){return this.videoResource.load()}pause(){var t;this.isPlaying=!1,null===(t=this.videoResource.source)||void 0===t||t.pause()}togglePause(){this.isPlaying?this.pause():this.play()}seek(t){this.controller.jumpToTime(t)}destroy(){var t;this.sprite.interactive=!1,this.sprite.destroy({texture:!0,baseTexture:!0}),null===(t=this.videoResource)||void 0===t||t.destroy(),this.controller.destroy()}}var rl=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class ol extends s.a{constructor(t){super(),this.type="audio",this.isPlaying=!1,this.id=t.id,this.audio=t.audio,this.container=t.container,this.container=t.container,this.audioEl=document.createElement("audio"),this.audioEl.src=this.audio.src,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:e,height:n,sprite:i}=t;this.controller=new el({targetId:t.id,ctx:t.ctx,height:n,width:e,sprite:i,media:this,info:this.audio,canvasElement:t.canvasElement}),["durationchange","timeupdate","pause","play"].forEach(t=>{this.audioEl.addEventListener(t,()=>{this.emit(t)})})}get currentTime(){return this.audioEl.currentTime}set currentTime(t){this.audioEl.currentTime=t}get paused(){return this.audioEl.paused}get ended(){return this.audioEl.ended}get duration(){return this.audioEl.duration}load(){return Promise.resolve()}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){return rl(this,void 0,void 0,(function*(){this.isPlaying=!0;try{yield this.audioEl.play()}catch(t){console.debug("[PPT Player]: refuse to play()")}}))}pause(){this.isPlaying=!1,this.audioEl.pause()}togglePause(){this.isPlaying?this.pause():this.play()}seek(t){this.controller.jumpToTime(t)}destroy(){this.audioEl.pause(),this.controller.destroy()}}var sl=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class al extends $u{constructor(t,e,n){super(Object.assign(Object.assign({},t),{type:"Shape",useBgFill:!1,textRotateWithShape:!0}),e,n),this.picTextureId="",this.picSprite=new ms,this.picMask=new ms,this.cmd=new su(this),this.picFill=t.picFill,this.media=null==t?void 0:t.media}applyCommand(t,e){var n,i,r,o,s;if("call"===e)if(/playFrom\(([0-9.]+)\)/.test(t)){const e=t.match(/playFrom\(([0-9.]+)\)/),i=Number(e[1]||"0");null===(n=this.mediaPlayer)||void 0===n||n.play().then(()=>{var t;null===(t=this.mediaPlayer)||void 0===t||t.seek(i)})}else"custom-pause"===t?null===(i=this.mediaPlayer)||void 0===i||i.pause():"togglePause"===t?null===(r=this.mediaPlayer)||void 0===r||r.togglePause():"stop"===t&&(null===(o=this.mediaPlayer)||void 0===o||o.pause(),null===(s=this.mediaPlayer)||void 0===s||s.seek(0))}renderPic(){var t,e,n;return sl(this,void 0,void 0,(function*(){const i=this.ctx.fillTexture.getTexture(this.picTextureId);i.texture&&(this.picSprite.texture=i.texture),this.picMask.texture=this.backgroundMask.texture,this.picSprite.mask=this.picMask,this.picSprite.width=this.designWidth,this.picSprite.height=this.designHeight,this.container.addChild(this.picSprite),this.container.addChild(this.picMask),"video"===(null===(t=this.media)||void 0===t?void 0:t.type)?(this.mediaPlayer=new il({id:this.json.id+"-video",ctx:this.ctx,video:this.media,height:this.designHeight,width:this.designWidth,sprite:this.picSprite,container:this.container,canvasElement:this.ctx.view}),(null===(e=this.mediaPlayer)||void 0===e?void 0:e.sprite)&&(this.mediaPlayer.sprite.mask=this.picMask)):"audio"===(null===(n=this.media)||void 0===n?void 0:n.type)&&(this.mediaPlayer=new ol({id:this.json.id+"-audio",ctx:this.ctx,audio:this.media,height:this.designHeight,width:this.designWidth,sprite:this.picSprite,container:this.container,canvasElement:this.ctx.view})),this.mediaPlayer&&(this.picSprite.interactive=!0,this.picSprite.on("mouseover",()=>{this.mediaPlayer.showController()}),this.picSprite.on("mouseout",()=>{this.mediaPlayer.hideController()},!1))}))}preRender(){if(super.preRender(),"gifFill"!==this.picFill.fillType)this.picTextureId=this.ctx.fillTexture.addFill(this.picFill,this.designWidth,this.designHeight);else{let t=1;const e=this.ctx.fillTexture.getGifFrames(this.picFill.src),n=e.map((t,e)=>({texture:t,time:this.picFill.delays[e]||20}));this.picSprite=new iu(n,!0),this.picSprite.play();const i=this.picFill.loop;this.picSprite.onLoop=()=>{t+=1,i>0&&t>i&&this.picSprite.gotoAndStop(e.length-1)}}}subClassRender(){return sl(this,void 0,void 0,(function*(){yield this.renderPic()}))}destroy(){this.mediaPlayer&&(this.picSprite.interactive=!1,this.mediaPlayer.destroy(),this.mediaPlayer=void 0),this.picSprite.destroy(),this.picMask.destroy()}}var ul=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class ll extends fu{constructor(t,e,n){var i,r,o,s;super(t,e,n),this.children=[],this.cacheSprite=new ms,this.json=t,this.container.name=t.id,this.ctx.timingTargets.addTarget(t.id,this);const a={x:null!==(r=null===(i=t.position)||void 0===i?void 0:i.x)&&void 0!==r?r:0,y:null!==(s=null===(o=t.position)||void 0===o?void 0:o.y)&&void 0!==s?s:0};t.children.forEach(t=>{let e=null;"Shape"===(null==t?void 0:t.type)?e=new $u(t,this.ctx,a):"Picture"===(null==t?void 0:t.type)?e=new al(t,this.ctx,a):"Container"===(null==t?void 0:t.type)&&(e=new ll(t,this.ctx,a)),e&&this.children.push(e)}),this.updateTransform(this.json)}get interactiveContainer(){return this.container}get renderContainer(){return this.container}preRender(){if(this.json.fillStyle)if("groupFill"===this.json.fillStyle.fillType)this.fillTextureId=this.groupFillTextureId;else{const{fillStyle:t,width:e,height:n}=this.json;this.fillTextureId=this.ctx.fillTexture.addFill(t,e,n)}for(const t of this.children)t.groupFillTextureId=this.fillTextureId,t.preRender()}getBgElement(){return null}getIterateEntry(t,e,n){return 0===e?this:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null)}getTextElement(){return null}render(){var t;return ul(this,void 0,void 0,(function*(){const e=new Fe;for(const n of this.children)yield n.render(),n.renderContainer&&e.addChild(n.renderContainer),(n.json.hlinkHover||n.json.hlinkClick)&&(null===(t=n.hyperlink)||void 0===t||t.addProxy(this.container));this.container.addChild(e),this.json.cacheAsTexture&&(!function(t,e,n,i){const r=t.getBounds(),o=Math.min(r.x,e.x,r.x+r.width,e.x+e.width),s=Math.max(r.x,e.x,r.x+r.width,e.x+e.width),a=Math.min(r.y,e.y,r.y+r.height,e.y+e.height),u=s-o,l=Math.max(r.y,e.y,r.y+r.height,e.y+e.height)-a,h=e.x-r.x>0?e.x-r.x:0,c=e.y-r.y>0?e.y-r.y:0,d=Tn.create({width:u,height:l,resolution:Math.ceil(i.renderer.resolution)});t.position.x=h,t.position.y=c,i.renderer.render(t,{renderTexture:d}),n.texture=d,n.position.x=-h,n.position.y=-c}(e,new fe(this.designX,this.designY,this.designWidth,this.designHeight),this.cacheSprite,this.ctx),this.container.addChild(this.cacheSprite),e.position.x=0,e.position.y=0,e.visible=!1)}))}destroy(){this.cacheSprite&&this.cacheSprite.destroy({texture:!0}),this.children.forEach(t=>t.destroy()),this.container.destroy()}}class hl extends s.a{constructor(t,e,n,i){super(),this.cond={},this.timeoutIds=[],this.condHandle=t=>{if(t)if(t.delay&&t.delay>0){const e=this.ctx.clock.setTimeout(()=>{t.event&&(this.cond[t.event]=!0,this.detectTrigger())},t.delay);this.timeoutIds.push(e)}else this.cond[t.event]=!0,this.detectTrigger();else this.detectTrigger()},this.id=t,this.ctx=i,this.eventHubs=n,e.forEach(t=>{this.addCond(t)})}setTriggerParams(t){this.triggerParams=t}addCond(t){const e=()=>this.condHandle(t);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(){if(Object.keys(this.cond).every(t=>!!this.cond[t])){Object.keys(this.cond).forEach(t=>{this.cond[t]=!1});const t=this.triggerParams;this.triggerParams=void 0,this.emit("active",t)}}reset(){Object.keys(this.cond).forEach(t=>{this.cond[t]=!1}),this.timeoutIds.forEach(t=>this.ctx.clock.clearTimeout(t))}}class cl extends s.a{constructor(t){super(),this.runtimeNodeEventHub=new s.a,this._currentSeqIndex=0,this._currentSeqState="idle",this.isForward=!0,this.autoPlay=!1,this.handlePrev=()=>{var t,e,n,i,r,o;this.hasPrev()||!this.isMainSeq?"idle"===this.currentSeqState?(this.decrSeqIndex(),null===(t=this.commonTimeNode.children[this.currentSeqIndex])||void 0===t||t.commonTimeNode.seekToStart(),null===(e=this.commonTimeNode.children[this.currentSeqIndex])||void 0===e||e.commonTimeNode.clearSubList(),this.currentSeqState="idle"):"running"===this.currentSeqState?(null===(n=this.commonTimeNode.children[this.currentSeqIndex])||void 0===n||n.commonTimeNode.seekToStart(),null===(i=this.commonTimeNode.children[this.currentSeqIndex])||void 0===i||i.commonTimeNode.clearSubList(),this.currentSeqState="idle"):"end"===this.currentSeqState&&(this.currentSeqIndex>=this.commonTimeNode.children.length&&(this.currentSeqIndex=this.commonTimeNode.children.length-1),null===(r=this.commonTimeNode.children[this.currentSeqIndex])||void 0===r||r.commonTimeNode.seekToStart(),null===(o=this.commonTimeNode.children[this.currentSeqIndex])||void 0===o||o.commonTimeNode.clearSubList(),this.currentSeqState="idle"):this.globalEventHub.emit("c:prev slide")},this.handleNext=()=>{var t,e,n,i;this.hasNext()||!this.isMainSeq?"idle"===this.currentSeqState?null===(t=this.commonTimeNode.children[this.currentSeqIndex])||void 0===t||t.commonTimeNode.startTimeNodeForce():"running"===this.currentSeqState?(null===(e=this.commonTimeNode.children[this.currentSeqIndex])||void 0===e||e.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===(i=this.commonTimeNode.children[this.currentSeqIndex])||void 0===i||i.commonTimeNode.startTimeNodeForce()):this.globalEventHub.emit("c:next slide")};const{json:e,iterateType:n,isIterate:i,isSub:r,parent:o,ctx:a,eventHub:u,iterateIndex:l,iterateId:h}=t;this.isMainSeq="mainSeq"===e.ctn.nodeType,this.isInteractiveSeq="interactiveSeq"===e.ctn.nodeType,this.id=e.ctn.id,this.isIterate=i,this.json=e,this.ctx=a,this.globalEventHub=u,this.commonTimeNode=new Hl({json:e.ctn,isSub:r,eventHubs:{global:u,runtime:this.runtimeNodeEventHub},ctx:a,parent:o,isIterate:!1,iterateType:n,iterateIndex:l,iterateId:h}),this.bindShapeEvent(),this.nextConds=new hl("mainSeq",e.nextCondLst,{global:u,runtime:this.runtimeNodeEventHub},this.ctx),this.prevConds=new hl("mainSeq",e.preCondLst,{global:u,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(Uh.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(Uh.mainSeqStepEnd,e)}),this.commonTimeNode.on("timeNodeEndSync",()=>{this.commonTimeNode.resetForRepeat(),this.ctx.clock.setTimeout(()=>{this.currentSeqState="idle",this.currentSeqIndex=0})}),this.nextConds.on("active",()=>{if(this.isInteractiveSeq){const{mode:t}=this.ctx;"interactive"!==t&&"sync"!==t||this.ctx.eventHub.emit(Uh.interactiveSeqNext,this.json.ctn.id),"sync"!==t&&"local"!==t||this.handleNext()}else this.handleNext()}),this.prevConds.on("active",this.handlePrev)}get currentSeqIndex(){return this._currentSeqIndex}set currentSeqIndex(t){this._currentSeqIndex=t,this.isMainSeq?this.ctx.eventHub.emit(Uh.mainSeqStepChange,t):this.isInteractiveSeq&&this.ctx.eventHub.emit(Uh.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(Uh.mainSeqStateChange,t):this.isInteractiveSeq&&this.ctx.eventHub.emit(Uh.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);t&&(t.interactiveContainer.interactive=!0,t.interactiveContainer.cursor="pointer",t.interactiveContainer.on("pointerdown",()=>{const t=`shape ${e} onClick`;this.globalEventHub.emit(t)}))}}})}setCurrentStep(t,e){let n=t;this.commonTimeNode.seekToStart();const{length:i}=this.commonTimeNode.children;if(-1===n&&(n=i-1),n>=0&&n<i)for(let t=0;t<=n;t++){const i=this.commonTimeNode.children[t];t!==n?i.commonTimeNode.seekToEnd(!1,!0):"start"===e?i.commonTimeNode.seekToStart():"end"===e&&i.commonTimeNode.seekToEnd(!1,!0)}this.currentSeqIndex=n,this.currentSeqState="start"===e?"idle":"end"}}function dl(t,e,n){const i=e.split(".");i.reduce((r,o,s)=>{if(r)return s!==i.length-1?r[o]:void(r[o]=n);console.warn(`${t} not support ${e}`)},t)}function fl(t,e){if(!e)return null;return e.split(".").reduce((n,i)=>{if(n)return n[i];console.warn(`${t} not support ${e}`)},t)}class pl{constructor(t){this.timingTarget=null,this.runtimeNodeEventHub=new s.a,this.onTimeLineStart=()=>{if(this.isConflict){const{target:t}=this.json.cBhvr;if("next"===this.activeWhenConflict){let e=t.id;"shape"===t.type&&t.txEl&&(e=`${e}-txEl-${t.txEl.range[0]}`),this.commonTimeNode.isIterate&&(e=`${e}-iterate-${this.commonTimeNode.iterateIndex}`),this.ctx.conflictTimeNodeManager.addRunningTimeNode(e,this.modifyAttrKey,this.commonTimeNode)}else"prev"===this.activeWhenConflict&&this.commonTimeNode.dispose()}};const{isIterate:e,isSub:n,json:i,ctx:r,parent:o,eventHub:a,iterateType:u,iterateIndex:l,iterateId:h}=t;this.json=i,this.id=i.cBhvr.ctn.id,this.ctx=r,this.globalEventHub=a,this.commonTimeNode=new Hl({json:i.cBhvr.ctn,isSub:n,eventHubs:{global:a,runtime:this.runtimeNodeEventHub},ctx:r,parent:o,isIterate:e,iterateType:u,iterateIndex:l,iterateId:h}),this.timingTarget=this.ctx.timingTargets.getTarget(i.cBhvr.target,e,{type:u,index:l,id:h}),this.commonTimeNode.on("seekToStart",()=>this.onSeekToStart()),this.commonTimeNode.on("seekToEnd",()=>this.onSeekToEnd()),this.commonTimeNode.on("timelineStart",this.onTimeLineStart)}}class ml extends pl{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.updateStartValue=()=>{this.timingTarget&&(this.startVal=fl(this.timingTarget,this.json.cBhvr.attrList[0]))},this.onSeekToStart=()=>{const t=this.json.cBhvr.attrList[0];null!==this.startVal&&this.timingTarget&&dl(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&&dl(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&&dl(this.timingTarget,t,e)}})}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}}class gl{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.replaceAll("#ppt_h",`(${this.timingTarget.design_ppt_h})`);return e=e.replaceAll("#ppt_w",`(${this.timingTarget.design_ppt_w})`),e=e.replaceAll("#ppt_x",`(${this.timingTarget.design_ppt_x})`),e=e.replaceAll("#ppt_y",`(${this.timingTarget.design_ppt_y})`),e=e.replaceAll("ppt_w","vars.ppt_w"),e=e.replaceAll("ppt_h","vars.ppt_h"),e=e.replaceAll("ppt_x","vars.ppt_x"),e=e.replaceAll("ppt_y","vars.ppt_y"),e=e.replaceAll("#","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 n=new RegExp(`([^a-z])${t}([^a-z])`,"g");e=e.replace(n,(e,n,i)=>`${n}math.${t}${i}`)}),new Function("vars","math","$","return "+e)}}class vl extends gl{constructor(t,e,n){super(t,e),this.value=t.val.value,n&&(this.fmla=this.parseFmla(n))}resolveValue(){return this.value}interpolationFrom(t,e,n){const i=t.resolveValue(n),r=i+(this.resolveValue()-i)*e;return t.fmla?t.fmla(n,this.math,r):r}}class _l extends gl{constructor(t,e){var n;super(t,e),this.value=null===(n=t.val)||void 0===n?void 0:n.value}interpolationFrom(t,e,n){let i=t.resolveValue(n);return e>this.time&&(i=this.resolveValue()),i}resolveValue(){return this.value||""}}class yl extends gl{constructor(t,e){super(t,e),this.fn=this.parseFmla(this.val)}resolveValue(t){return this.fn(t,this.math,1)}interpolationFrom(t,e,n){const i=t.resolveValue(n),r=i+(this.resolveValue(n)-i)*e;return t.fmla?t.fmla(n,this.math,r):r}}class xl extends gl{constructor(t,e){super(t,e),this.value=t.val.value}interpolationFrom(t,e){return yu(t.resolveValue(),this.value,e)}resolveValue(){return this.value}}class bl extends pl{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=fl(this.timingTarget,this.json.cBhvr.attrList[0]))},this.updateVars=()=>{var t,e,n,i;(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===(n=this.timingTarget)||void 0===n?void 0:n.ppt_x)&&(this.vars.ppt_x=this.timingTarget.ppt_x),(null===(i=this.timingTarget)||void 0===i?void 0:i.ppt_y)&&(this.vars.ppt_y=this.timingTarget.ppt_y),this.isColorAnim},this.onTimeUpdate=({duration:t,delta:e})=>{const n=e/t,i=this.keyFrames.findIndex(t=>n<=t[0]),{attrList:r}=this.json.cBhvr;if(i<0){const t=this.keyFrames[this.keyFrames.length-1];return void(this.timingTarget&&r&&r[0]&&dl(this.timingTarget,r[0],t[1].resolveValue(this.vars)))}const o=i-1,s=this.keyFrames[i],a=this.keyFrames[o]||s,u=s[0]-a[0]==0?1:(n-a[0])/(s[0]-a[0]),l=s[1].interpolationFrom(a[1],u,this.vars);this.timingTarget&&r&&r[0]&&dl(this.timingTarget,r[0],l)},this.onSeekToStart=()=>{null!==this.startVal&&this.timingTarget&&dl(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 yl(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 yl(t,this.timingTarget);this.keyFrames.push([t.time,e])}}else if(this.json.by){const n={time:0,val:{type:"string",value:this.json.cBhvr.attrList[0]},fmla:""};if("num"===e&&this.timingTarget){const t=new yl(n,this.timingTarget);this.keyFrames.push([n.time,t])}const i={time:1,val:{type:"string",value:((null===(t=n.val)||void 0===t?void 0:t.value)||"")+"+"+this.json.by},fmla:""};if("num"===e&&this.timingTarget){const t=new yl(i,this.timingTarget);this.keyFrames.push([i.time,t])}}if(this.json.tavLst.length>0)for(const t of this.json.tavLst)if(t.val&&this.timingTarget){let n=null;"string"===t.val.type?"num"===e?n=new yl(t,this.timingTarget):"str"===e&&(n=new _l(t,this.timingTarget)):"number"===t.val.type?n=new vl(t,this.timingTarget):"color"===t.val.type?(this.isColorAnim=!0,n=new xl(t,this.timingTarget)):"boolean"===t.val.type&&console.warn("not implements"),n&&this.keyFrames.push([t.time,n])}}}var wl=n(21),Sl=n.n(wl),Tl=n(22),El=n.n(Tl);class Ml extends Ei{constructor(){super(El.a,Sl.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 Al=n(23),Pl=n.n(Al);class Cl extends Ei{constructor(){super(void 0,Pl.a,{percent:0,transition:1})}set transition(t){this.uniforms.transition=Math.pow(t,t)}set percent(t){this.uniforms.percent=t}}class Rl extends pl{constructor(t){var e;super(t),this.filterType="",this.isConflict=!0,this.activeWhenConflict="prev",this.onTimeUpdate=({duration:t,delta:e})=>{const n=e/t;this.filter&&(this.filter.percent=n),n>=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 n=0;"out"===t.json.transition?n=-1:"in"===t.json.transition&&(n=1);const i=null===(e=t.json.filter)||void 0===e?void 0:e.match(/^([a-zA-Z]+)(\((.+)\))?/);if(i){const t=i[1],e=i[3];if("wipe"===t){const n=new Ml;"up"===e?n.direction=1:"down"===e?n.direction=2:"left"===e?n.direction=3:"right"===e&&(n.direction=4),this.filter=n,this.filterType=`${t}-${e}`}else if("fade"===t){const e=new Cl;this.filter=e,this.filterType=""+t}this.filter&&(this.filter.transition=n)}}get modifyAttrKey(){return this.filterType}}var Il=n(5);class Ll extends pl{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.onTimeUpdate=({duration:t,delta:e})=>{var n;const i=e/t,r=null===(n=this.path)||void 0===n?void 0:n.getPoint(i);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=()=>{var t,e,n;const i=null!==(e=null===(t=this.commonTimeNode.json)||void 0===t?void 0:t.spd)&&void 0!==e?e:1,r=null===(n=this.path)||void 0===n?void 0:n.getPoint(i>0?0:1);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.onSeekToEnd=()=>{var t,e,n;const i=null!==(e=null===(t=this.commonTimeNode.json)||void 0===t?void 0:t.spd)&&void 0!==e?e:1,r=null===(n=this.path)||void 0===n?void 0:n.getPoint(i>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.createPath()}get modifyAttrKey(){return"motion"}createPath(){var t;const e=new Il.Path,n=null===(t=this.json.path)||void 0===t?void 0:t.match(/[MLCmlc][^MLCmlc]+/g);if(n)for(const t of n){const[n,...i]=t.trim().replace(/\s+/g," ").split(" ");if("M"===n){const[t,n]=i.map(t=>Number(t));e.moveTo(t,n)}else if("L"===n){const[t,n]=i.map(t=>Number(t));e.lineTo(t,n)}else if("C"===n){const[t,n,r,o,s,a]=i.map(t=>Number(t));e.bezierCurveTo(t,n,r,o,s,a)}else if("Z"===n)e.closePath();else if("E"===n)console.warn("not implements");else if("c"===n){const[t,n,r,o,s,a]=i.map(t=>Number(t)),u=e.currentPoint;e.bezierCurveTo(t+u.x,n+u.y,r+u.x,o+u.y,s+u.x,a+u.y)}else if("l"===n){const t=e.currentPoint,[n,r]=i.map(t=>Number(t));e.lineTo(n+t.x,r+t.y)}else if("m"===n){const t=e.currentPoint,[n,r]=i.map(t=>Number(t));e.moveTo(n+t.x,r+t.y)}}this.path=e}}class Ol extends pl{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 n,i,r,o,s;const a=e/t,u={x:1,y:1};if(this.to){const t=null!==(n=this.from)&&void 0!==n?n:{x:null!==(r=null===(i=this.startVal)||void 0===i?void 0:i.x)&&void 0!==r?r:1,y:null!==(s=null===(o=this.startVal)||void 0===o?void 0:o.y)&&void 0!==s?s:1};u.x=t.x+(this.to.x-t.x)*a,u.y=t.y+(this.to.y-t.y)*a}else if(this.by){const t={x:this.by.x,y:this.by.y};u.x=1+(t.x-1)*a,u.y=1+(t.y-1)*a}this.timingTarget&&(this.timingTarget.scale=u)},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 Dl extends pl{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.startColorString=null,this.currentColorString="#FFFFFFFF",this.onTimelineStart=t=>{this.from.isInit()||this.from.fromHexString(this.currentColorString),this.to.isInit()||this.from.by(this.by,this.to),t.isReverse||this.updateCurrentValue();const[e]=this.json.cBhvr.attrList[0].split(".");dl(this.timingTarget,e+".on","true")},this.onTimeNodeEnd=()=>{if("remove"===this.json.cBhvr.ctn.fill){const[t]=this.json.cBhvr.attrList[0].split(".");dl(this.timingTarget,t+".on","false")}},this.onSeekToStart=()=>{if(this.timingTarget){const[t]=this.json.cBhvr.attrList[0].split(".");dl(this.timingTarget,t+".on","false")}},this.onTimeNodeStart=()=>{if(this.timingTarget){const t=fl(this.timingTarget,this.json.cBhvr.attrList[0]);t&&(this.startColorString=t)}},this.onTimeUpdate=({delta:t,duration:e})=>{const n=t/e;this.to.interpolationFrom(this.from,n,this.target),this.timingTarget&&dl(this.timingTarget,this.json.cBhvr.attrList[0],this.target.toHexString())},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1})},"rgb"===this.json.clrSpc?(this.from=new mu(this.json.from),this.to=new mu(this.json.to),this.by=new mu(this.json.by),this.target=new mu):(this.from=new pu(this.json.from),this.to=new pu(this.json.to),this.by=new pu(this.json.by),this.target=new pu),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=fl(this.timingTarget,this.json.cBhvr.attrList[0]);t&&(this.currentColorString=t)}}}class Nl extends pl{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 n=e/t;let i=0,r=0;if(void 0!==this.from&&void 0!==this.to){i=this.from,r=this.to;const t=i+(r-i)*n;this.timingTarget&&(this.timingTarget.r=t)}else if(void 0!==this.by){this.lastVal||(this.lastVal=0);const t=this.by*n-this.lastVal;this.lastVal=this.by*n,this.timingTarget&&(this.timingTarget.r+=t)}},this.onTimeNodeStart=()=>{var t;Object(a.isNumber)(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 Fl extends pl{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.isApplied=!1,this.onTimeUpdate=()=>{var t,e;const{cmd:n,cmdType:i}=this.json;!this.isApplied&&n&&i&&(this.isApplied=!0,null===(e=null===(t=this.timingTarget)||void 0===t?void 0:t.cmd)||void 0===e||e.applyCommand(n,i))},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)}get modifyAttrKey(){var t,e,n,i;return(null!==(e=null===(t=this.json)||void 0===t?void 0:t.cmd)&&void 0!==e?e:"")+(null!==(i=null===(n=this.json)||void 0===n?void 0:n.cmdType)&&void 0!==i?i:"")}}var Bl=n(24);class kl{constructor(t){kl.useRtc||(this.howl=new Bl.Howl({src:[t]}))}play(){var t;null===(t=this.howl)||void 0===t||t.play()}pause(){var t;null===(t=this.howl)||void 0===t||t.pause()}stop(){var t;null===(t=this.howl)||void 0===t||t.stop()}destroy(){var t;null===(t=this.howl)||void 0===t||t.unload()}}kl.useRtc=!1;class Ul{constructor(t){this.runtimeNodeEventHub=new s.a,this.stopAudio=()=>{this.audio.stop()},this.destroy=()=>{this.stopAudio(),this.audio.destroy()};const{json:e,isIterate:n,isSub:i,eventHub:r,ctx:o,parent:a,iterateType:u,iterateIndex:l,iterateId:h}=t;this.json=e,this.id=e.cMediaNode.ctn.id,this.commonTimeNode=new Hl({json:e.cMediaNode.ctn,isSub:i,eventHubs:{global:r,runtime:this.runtimeNodeEventHub},ctx:o,parent:a,isIterate:n,iterateType:u,iterateIndex:l,iterateId:h}),this.audio=new kl(e.cMediaNode.tgtEl),this.commonTimeNode.on("timelineStart",()=>{this.audio.play()}),this.commonTimeNode.on("seekToStart",this.stopAudio),this.commonTimeNode.on("seekToEnd",this.stopAudio),this.commonTimeNode.on("timeNodeDestroy",this.destroy)}}var Gl=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class Hl extends s.a{constructor(t){super(),this.uuid=Date.now().toString(32)+Math.random().toString(32).substring(2),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.isIterate=!1,this.iterateType="el",this.iterateIndex=0,this.children=[],this.subList=[],this.duration=0,this.timeDelta=0,this.isNegativeSpeed=!1,this.handleEndCond=()=>{this.isActive&&(this.isActive=!1,this.dispose())},this.handleActive=(t=!0)=>{if(this.isActive=!0,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/(gt.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:e,isIterate:n,ctx:i,eventHubs:r,parent:o,json:s,iterateType:a,iterateId:u,iterateIndex:l}=t;this.isSub=e,this.isIterate=n,this.parentTimeNode=o,this.json=s,this.ctx=i,this.iterateIndex=l,this.eventHubs=r,this.iterateType=a,this.iterateId=u;const h=Number(this.json.dur),c=this.json.spd||1;this.isNegativeSpeed=c<0,Number.isNaN(h)||(this.duration=h/Math.abs(c)),this.uuid+="--"+this.json.id,this.setPreStyle(),s.childTnLst&&this.createChildren(s.childTnLst),this.startConds=new hl(this.json.id||"",s.stCondLst,r,this.ctx),this.endConds=new hl(this.json.id||"",s.endCondLst,r,this.ctx),s.endSync&&(this.endSync=new hl(this.json.id||"",[s.endSync],r,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=Lu();let e=!0,n=0;const i=n=>{n===t&&(e=!1,this.ctx.eventHub.removeListener("IterateTimeNodeEnd",i))};for(this.ctx.eventHub.on("IterateTimeNodeEnd",i);e;){const e=JSON.parse(JSON.stringify(this.json)),i=new Hl({json:e,isSub:!1,eventHubs:this.eventHubs,ctx:this.ctx,parent:null,isIterate:!0,iterateType:e.iterate.type,iterateIndex:n,iterateId:t});this.iterateShadows[n]=i,n+=1}}isInfiniteRepeat(){return this.json.repeatCount>999999998}getReverse(){return this.isReverse}setReverse(t){this.isReverse=t}createTimeNode(t,e){let n=null;const i={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};return"seq"===t.type?n=new cl(i):"par"===t.type?n=new zl(i):"set"===t.type?n=new ml(i):"anim"===t.type?n=new bl(i):"animEffect"===t.type?n=new Rl(i):"animMotion"===t.type?n=new Ll(i):"animScale"===t.type?n=new Ol(i):"animClr"===t.type?n=new Dl(i):"animRot"===t.type?n=new Nl(i):"cmd"===t.type?n=new Fl(i):"audio"===t.type&&(n=new Ul(i)),n}createSubList(t){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.isTimeNodeEnd())&&(this.json.iterate||this.allChildrenEndHandle())})}createChildren(t){function e(t){return function(t){var e;return null===(e=null==t?void 0:t.cBhvr)||void 0===e?void 0:e.ctn}(t)?t.cBhvr.ctn.presetOrder:function(t){return null==t?void 0:t.ctn}(t)?t.ctn.presetOrder:void 0}if(e(t[0])){[...t].sort((t,n)=>{var i,r;return(null!==(i=e(t))&&void 0!==i?i:0)-(null!==(r=e(n))&&void 0!==r?r:0)}).forEach(n=>{const i=t.findIndex(t=>e(t)===e(n)),r=this.createTimeNode(n,!1);r&&(this.bindCommonTimeNodeEvent(r),this.children[i]=r)})}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.timeDelta=0,this.children.forEach(t=>t.commonTimeNode.resetForRepeat())}startSubList(){this.subList.forEach(t=>t.commonTimeNode.startTimeNode())}startReverseTimeLine(){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(Uh.animateEnd),this.ctx.ticker.remove(this.updateTimeLine)):this.duration>t&&(this.ctx.eventHub.emit(Uh.animateStart),this.ctx.ticker.add(this.updateTimeLine))}startTimeLine(t=!0){if(t&&(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(Uh.animateStart),this.updateTimeLine(0),this.ctx.ticker.add(this.updateTimeLine))}startIterate(){return Gl(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()}}))}isNatureTimeEnd(){return this.duration>=0&&this.timeDelta>=this.duration}setPreStyle(){if(!this.json.presetClass)return;const t=[],e=n=>{n.forEach(n=>{var i,r,o;n.cBhvr&&n.cBhvr.target&&t.findIndex(t=>t.id===n.cBhvr.target.id)<0&&t.push(n.cBhvr.target),(null===(r=null===(i=null==n?void 0:n.cBhvr)||void 0===i?void 0:i.ctn)||void 0===r?void 0:r.childTnLst)&&n.cBhvr.ctn.childTnLst.length>0&&e(n.cBhvr.ctn.childTnLst),(null===(o=null==n?void 0:n.ctn)||void 0===o?void 0:o.childTnLst)&&n.ctn.childTnLst.length>0&&e(n.ctn.childTnLst)})};e(this.json.childTnLst||[]),t.forEach(t=>{if(this.json.iterate){let e=0,n=!0;for(;n;){const i=this.ctx.timingTargets.getTarget(t,!0,{type:this.json.iterate.type,index:e,id:""});i&&(this.setPreStyleForTarget(i),e+=1),n=!!i}}else{const e=this.ctx.timingTargets.getTarget(t,!1);e&&this.setPreStyleForTarget(e)}})}setPreStyleForTarget(t){var e,n;if(t&&this.json.presetSubtype&&(t.presetSubType=this.json.presetSubtype),t&&!t.hasPreset)if("entr"===this.json.presetClass){const i=null===(n=null===(e=this.json)||void 0===e?void 0:e.childTnLst)||void 0===n?void 0:n.filter(t=>"set"===t.type&&"visible"===t.to);(null==i?void 0:i.length)&&(t.hasPreset=!0,t.style.visibility="hidden")}else("exit"===this.json.presetClass||"path"===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 n=this.json.endCondLst.filter(t=>/^self/.test(t.event||""))[0];n&&this.endConds.condHandle(n),this.startConds.condHandle()}onTimeLineEnd(){this.dispose(),(0===this.children.length||this.json.iterate)&&this.allChildrenEndHandle()}clearSubList(){this.subList.forEach(t=>t.commonTimeNode.destroy()),this.subList=[],this.children.forEach(t=>{t.commonTimeNode.clearSubList()})}seekToStart(t=!0){if(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()}for(let t=this.children.length-1;t>=0;t--){const e=this.children[t];null==e||e.commonTimeNode.seekToStart()}}dispose(t=!1){this.isConflictDispose=t,this.ctx.clock.clearTimeout(this.repeatTimeoutId),this.ctx.eventHub.emit(Uh.animateEnd),this.ctx.ticker.remove(this.updateTimeLine),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 n=this.json.autoRev||t;if(n?this.emit("seekToStart"):this.emit("seekToEnd"),this.json.iterate&&!this.isIterate)return this.isIterateEnd=!0,void this.iterateShadows.forEach(t=>t.seekToEnd(n,e));0===this.children.length&&(this.eventHubs.runtime.emit("runtime all end"),this.handleEnd()),this.children.forEach(t=>t.commonTimeNode.seekToEnd(n,e)),e&&this.json.subTnLst&&(this.subList.length<=0&&this.createSubList(this.json.subTnLst),this.subList.forEach(t=>t.commonTimeNode.seekToEnd(!1)),this.clearSubList())}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.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 zl extends s.a{constructor(t){super(),this.isRunning=!1,this.runtimeNodeEventHub=new s.a;const{json:e,iterateType:n,isIterate:i,isSub:r,parent:o,ctx:a,eventHub:u,iterateIndex:l,iterateId:h}=t;this.id=e.ctn.id,this.json=e,this.ctx=a,this.isIterate=i,this.globalEventHub=u,this.commonTimeNode=new Hl({json:e.ctn,isSub:r,eventHubs:{global:u,runtime:this.runtimeNodeEventHub},ctx:a,parent:o,isIterate:!1,iterateType:n,iterateIndex:l,iterateId:h}),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 jl=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class Vl{constructor(t,e,n){this.json=t,this.ctx=n;const i=t.timeNodeList.find(t=>"par"===t.type&&"tmRoot"===t.ctn.nodeType);i&&(this.tmRoot=new zl({json:i,isSub:!1,isIterate:!1,eventHub:e,ctx:n,parent:null,iterateType:"el",iterateIndex:0,iterateId:""}),this.mainSeq=this.tmRoot.commonTimeNode.children.find(t=>{var e,n,i;return"seq"===(null===(e=t.json)||void 0===e?void 0:e.type)&&"mainSeq"===(null===(i=null===(n=t.json)||void 0===n?void 0:n.ctn)||void 0===i?void 0:i.nodeType)}))}findSeq(t){var e;return null===(e=this.tmRoot)||void 0===e?void 0:e.commonTimeNode.children.find(e=>{var n,i,r;return"seq"===(null===(n=e.json)||void 0===n?void 0:n.type)&&(null===(r=null===(i=e.json)||void 0===i?void 0:i.ctn)||void 0===r?void 0:r.id)===t})}start(){var t,e;return jl(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 n;-1===t&&this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1),null===(n=this.mainSeq)||void 0===n||n.setCurrentStep(t,e)}destroy(){var t;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,n){const i=this.findSeq(t);i&&i.setCurrentStep(e,n)}applyInteractiveAction(t){const e=this.findSeq(t);e&&e.handleNext()}}var Wl=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class Xl extends ll{constructor(t,e,n){super({id:"stage",width:t.width,height:t.height,type:"Container",children:t.children},e,n),this.globalEventHub=new s.a,this.json=t,this.container.visible=!1,this.ctx=e,this.globalEventHub.on("c:prev slide",()=>{this.ctx.eventHub.emit(Uh.requestPrevSlide)}),this.globalEventHub.on("c:next slide",()=>{this.ctx.eventHub.emit(Uh.requestNextSlide)});const i=new hs;i.drawRect(0,0,t.width,t.height),this.container.addChild(i)}get interactiveContainer(){return this.container}render(){const t=Object.create(null,{render:{get:()=>super.render}});return Wl(this,void 0,void 0,(function*(){yield t.render.call(this),this.ctx.eventHub.emit("StageRenderEnd")}))}createTiming(){this.json.timing&&(this.timing=new Vl(this.json.timing,this.globalEventHub,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 n;null===(n=this.timing)||void 0===n||n.setMainSeqStep(t,e)}collectMainSeqStartValue(){var t;null===(t=this.timing)||void 0===t||t.collectMainSeqStartValue()}hasTiming(){return!!this.timing}destroy(){var t;super.destroy(),this.ctx.eventHub.removeAllListeners(),this.ctx.graphicsTexture.destroy(),this.ctx.fillTexture.destroy(),this.globalEventHub.removeAllListeners(),null===(t=this.timing)||void 0===t||t.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(){var t;this.hasTiming()&&(null===(t=this.timing)||void 0===t?void 0:t.hasMainSeq())?this.globalEventHub.emit("shape slide onNext"):this.ctx.eventHub.emit(Uh.requestNextSlide)}prevStep(){var t;this.hasTiming()&&(null===(t=this.timing)||void 0===t?void 0:t.hasMainSeq())?this.globalEventHub.emit("shape slide onPrev"):this.ctx.eventHub.emit(Uh.requestPrevSlide)}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,n){var i;null===(i=this.timing)||void 0===i||i.setInteractiveSeqState(t,e,n)}setMediaState(t,e){return Wl(this,void 0,void 0,(function*(){const n=this.ctx.medias[t];n&&(e?yield n.play():yield n.pause())}))}setMediaCurrentTime(t,e){const n=this.ctx.medias[t];n&&n.seek(e)}}const ql=134217729;function Yl(t,e,n,i,r){let o,s,a,u,l=e[0],h=i[0],c=0,d=0;h>l==h>-l?(o=l,l=e[++c]):(o=h,h=i[++d]);let f=0;if(c<t&&d<n)for(h>l==h>-l?(s=l+o,a=o-(s-l),l=e[++c]):(s=h+o,a=o-(s-h),h=i[++d]),o=s,0!==a&&(r[f++]=a);c<t&&d<n;)h>l==h>-l?(s=o+l,u=s-o,a=o-(s-u)+(l-u),l=e[++c]):(s=o+h,u=s-o,a=o-(s-u)+(h-u),h=i[++d]),o=s,0!==a&&(r[f++]=a);for(;c<t;)s=o+l,u=s-o,a=o-(s-u)+(l-u),l=e[++c],o=s,0!==a&&(r[f++]=a);for(;d<n;)s=o+h,u=s-o,a=o-(s-u)+(h-u),h=i[++d],o=s,0!==a&&(r[f++]=a);return 0===o&&0!==f||(r[f++]=o),f}function Zl(t,e){let n=e[0];for(let i=1;i<t;i++)n+=e[i];return n}function Jl(t){return new Float64Array(t)}const Kl=Jl(4),$l=Jl(8),Ql=Jl(12),th=Jl(16),eh=Jl(4);function nh(t,e,n,i,r,o){const s=(e-o)*(n-r),a=(t-r)*(i-o),u=s-a;if(0===s||0===a||s>0!=a>0)return u;const l=Math.abs(s+a);return Math.abs(u)>=33306690738754716e-32*l?u:-function(t,e,n,i,r,o,s){let a,u,l,h,c,d,f,p,m,g,v,_,y,x,b,w,S,T;const E=t-r,M=n-r,A=e-o,P=i-o;x=E*P,d=ql*E,f=d-(d-E),p=E-f,d=ql*P,m=d-(d-P),g=P-m,b=p*g-(x-f*m-p*m-f*g),w=A*M,d=ql*A,f=d-(d-A),p=A-f,d=ql*M,m=d-(d-M),g=M-m,S=p*g-(w-f*m-p*m-f*g),v=b-S,c=b-v,Kl[0]=b-(v+c)+(c-S),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-w,c=y-v,Kl[1]=y-(v+c)+(c-w),T=_+v,c=T-_,Kl[2]=_-(T-c)+(v-c),Kl[3]=T;let C=Zl(4,Kl),R=22204460492503146e-32*s;if(C>=R||-C>=R)return C;if(c=t-E,a=t-(E+c)+(c-r),c=n-M,l=n-(M+c)+(c-r),c=e-A,u=e-(A+c)+(c-o),c=i-P,h=i-(P+c)+(c-o),0===a&&0===u&&0===l&&0===h)return C;if(R=11093356479670487e-47*s+33306690738754706e-32*Math.abs(C),C+=E*h+P*a-(A*l+M*u),C>=R||-C>=R)return C;x=a*P,d=ql*a,f=d-(d-a),p=a-f,d=ql*P,m=d-(d-P),g=P-m,b=p*g-(x-f*m-p*m-f*g),w=u*M,d=ql*u,f=d-(d-u),p=u-f,d=ql*M,m=d-(d-M),g=M-m,S=p*g-(w-f*m-p*m-f*g),v=b-S,c=b-v,eh[0]=b-(v+c)+(c-S),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-w,c=y-v,eh[1]=y-(v+c)+(c-w),T=_+v,c=T-_,eh[2]=_-(T-c)+(v-c),eh[3]=T;const I=Yl(4,Kl,4,eh,$l);x=E*h,d=ql*E,f=d-(d-E),p=E-f,d=ql*h,m=d-(d-h),g=h-m,b=p*g-(x-f*m-p*m-f*g),w=A*l,d=ql*A,f=d-(d-A),p=A-f,d=ql*l,m=d-(d-l),g=l-m,S=p*g-(w-f*m-p*m-f*g),v=b-S,c=b-v,eh[0]=b-(v+c)+(c-S),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-w,c=y-v,eh[1]=y-(v+c)+(c-w),T=_+v,c=T-_,eh[2]=_-(T-c)+(v-c),eh[3]=T;const L=Yl(I,$l,4,eh,Ql);x=a*h,d=ql*a,f=d-(d-a),p=a-f,d=ql*h,m=d-(d-h),g=h-m,b=p*g-(x-f*m-p*m-f*g),w=u*l,d=ql*u,f=d-(d-u),p=u-f,d=ql*l,m=d-(d-l),g=l-m,S=p*g-(w-f*m-p*m-f*g),v=b-S,c=b-v,eh[0]=b-(v+c)+(c-S),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-w,c=y-v,eh[1]=y-(v+c)+(c-w),T=_+v,c=T-_,eh[2]=_-(T-c)+(v-c),eh[3]=T;const O=Yl(L,Ql,4,eh,th);return th[O-1]}(t,e,n,i,r,o,l)}Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(8),Jl(8),Jl(8),Jl(4),Jl(8),Jl(8),Jl(8),Jl(12);Jl(192),Jl(192);Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(8),Jl(8),Jl(8),Jl(8),Jl(8),Jl(8),Jl(8),Jl(8),Jl(8),Jl(4),Jl(4),Jl(4),Jl(8),Jl(16),Jl(16),Jl(16),Jl(32),Jl(32),Jl(48),Jl(64);Jl(1152),Jl(1152);Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(24),Jl(24),Jl(24),Jl(24),Jl(24),Jl(24),Jl(24),Jl(24),Jl(24),Jl(24),Jl(1152),Jl(1152),Jl(1152),Jl(1152),Jl(1152),Jl(2304),Jl(2304),Jl(3456),Jl(5760),Jl(8),Jl(8),Jl(8),Jl(16),Jl(24),Jl(48),Jl(48),Jl(96),Jl(192),Jl(384),Jl(384),Jl(384),Jl(768);Jl(96),Jl(96),Jl(96),Jl(1152);const ih=Math.pow(2,-52),rh=new Uint32Array(512);class oh{static from(t,e=ch,n=dh){const i=t.length,r=new Float64Array(2*i);for(let o=0;o<i;o++){const i=t[o];r[2*o]=e(i),r[2*o+1]=n(i)}return new oh(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 n=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),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:n,_hullTri:i,_hullHash:r}=this,o=t.length>>1;let s=1/0,a=1/0,u=-1/0,l=-1/0;for(let e=0;e<o;e++){const n=t[2*e],i=t[2*e+1];n<s&&(s=n),i<a&&(a=i),n>u&&(u=n),i>l&&(l=i),this._ids[e]=e}const h=(s+u)/2,c=(a+l)/2;let d,f,p,m=1/0;for(let e=0;e<o;e++){const n=sh(h,c,t[2*e],t[2*e+1]);n<m&&(d=e,m=n)}const g=t[2*d],v=t[2*d+1];m=1/0;for(let e=0;e<o;e++){if(e===d)continue;const n=sh(g,v,t[2*e],t[2*e+1]);n<m&&n>0&&(f=e,m=n)}let _=t[2*f],y=t[2*f+1],x=1/0;for(let e=0;e<o;e++){if(e===d||e===f)continue;const n=uh(g,v,_,y,t[2*e],t[2*e+1]);n<x&&(p=e,x=n)}let b=t[2*p],w=t[2*p+1];if(x===1/0){for(let e=0;e<o;e++)this._dists[e]=t[2*e]-t[0]||t[2*e+1]-t[1];lh(this._ids,this._dists,0,o-1);const e=new Uint32Array(o);let n=0;for(let t=0,i=-1/0;t<o;t++){const r=this._ids[t];this._dists[r]>i&&(e[n++]=r,i=this._dists[r])}return this.hull=e.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(nh(g,v,_,y,b,w)<0){const t=f,e=_,n=y;f=p,_=b,y=w,p=t,b=e,w=n}const S=function(t,e,n,i,r,o){const s=n-t,a=i-e,u=r-t,l=o-e,h=s*s+a*a,c=u*u+l*l,d=.5/(s*l-a*u);return{x:t+(l*h-a*c)*d,y:e+(s*c-u*h)*d}}(g,v,_,y,b,w);this._cx=S.x,this._cy=S.y;for(let e=0;e<o;e++)this._dists[e]=sh(t[2*e],t[2*e+1],S.x,S.y);lh(this._ids,this._dists,0,o-1),this._hullStart=d;let T=3;n[d]=e[p]=f,n[f]=e[d]=p,n[p]=e[f]=d,i[d]=0,i[f]=1,i[p]=2,r.fill(-1),r[this._hashKey(g,v)]=d,r[this._hashKey(_,y)]=f,r[this._hashKey(b,w)]=p,this.trianglesLen=0,this._addTriangle(d,f,p,-1,-1,-1);for(let o,s,a=0;a<this._ids.length;a++){const u=this._ids[a],l=t[2*u],h=t[2*u+1];if(a>0&&Math.abs(l-o)<=ih&&Math.abs(h-s)<=ih)continue;if(o=l,s=h,u===d||u===f||u===p)continue;let c=0;for(let t=0,e=this._hashKey(l,h);t<this._hashSize&&(c=r[(e+t)%this._hashSize],-1===c||c===n[c]);t++);c=e[c];let m,g=c;for(;m=n[g],nh(l,h,t[2*g],t[2*g+1],t[2*m],t[2*m+1])>=0;)if(g=m,g===c){g=-1;break}if(-1===g)continue;let v=this._addTriangle(g,u,n[g],-1,-1,i[g]);i[u]=this._legalize(v+2),i[g]=v,T++;let _=n[g];for(;m=n[_],nh(l,h,t[2*_],t[2*_+1],t[2*m],t[2*m+1])<0;)v=this._addTriangle(_,u,m,i[u],-1,i[_]),i[u]=this._legalize(v+2),n[_]=_,T--,_=m;if(g===c)for(;m=e[g],nh(l,h,t[2*m],t[2*m+1],t[2*g],t[2*g+1])<0;)v=this._addTriangle(m,u,g,-1,i[g],i[m]),this._legalize(v+2),i[m]=v,n[g]=g,T--,g=m;this._hullStart=e[u]=g,n[g]=e[_]=u,n[u]=_,r[this._hashKey(l,h)]=u,r[this._hashKey(t[2*g],t[2*g+1])]=g}this.hull=new Uint32Array(T);for(let t=0,e=this._hullStart;t<T;t++)this.hull[t]=e,e=n[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 n=t/(Math.abs(t)+Math.abs(e));return(e>0?3-n:1+n)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:n,coords:i}=this;let r=0,o=0;for(;;){const s=n[t],a=t-t%3;if(o=a+(t+2)%3,-1===s){if(0===r)break;t=rh[--r];continue}const u=s-s%3,l=a+(t+1)%3,h=u+(s+2)%3,c=e[o],d=e[t],f=e[l],p=e[h];if(ah(i[2*c],i[2*c+1],i[2*d],i[2*d+1],i[2*f],i[2*f+1],i[2*p],i[2*p+1])){e[t]=p,e[s]=c;const i=n[h];if(-1===i){let e=this._hullStart;do{if(this._hullTri[e]===h){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,i),this._link(s,n[o]),this._link(o,h);const a=u+(s+1)%3;r<rh.length&&(rh[r++]=a)}else{if(0===r)break;t=rh[--r]}}return o}_link(t,e){this._halfedges[t]=e,-1!==e&&(this._halfedges[e]=t)}_addTriangle(t,e,n,i,r,o){const s=this.trianglesLen;return this._triangles[s]=t,this._triangles[s+1]=e,this._triangles[s+2]=n,this._link(s,i),this._link(s+1,r),this._link(s+2,o),this.trianglesLen+=3,s}}function sh(t,e,n,i){const r=t-n,o=e-i;return r*r+o*o}function ah(t,e,n,i,r,o,s,a){const u=t-s,l=e-a,h=n-s,c=i-a,d=r-s,f=o-a,p=h*h+c*c,m=d*d+f*f;return u*(c*m-p*f)-l*(h*m-p*d)+(u*u+l*l)*(h*f-c*d)<0}function uh(t,e,n,i,r,o){const s=n-t,a=i-e,u=r-t,l=o-e,h=s*s+a*a,c=u*u+l*l,d=.5/(s*l-a*u),f=(l*h-a*c)*d,p=(s*c-u*h)*d;return f*f+p*p}function lh(t,e,n,i){if(i-n<=20)for(let r=n+1;r<=i;r++){const i=t[r],o=e[i];let s=r-1;for(;s>=n&&e[t[s]]>o;)t[s+1]=t[s--];t[s+1]=i}else{let r=n+1,o=i;hh(t,n+i>>1,r),e[t[n]]>e[t[i]]&&hh(t,n,i),e[t[r]]>e[t[i]]&&hh(t,r,i),e[t[n]]>e[t[r]]&&hh(t,n,r);const s=t[r],a=e[s];for(;;){do{r++}while(e[t[r]]<a);do{o--}while(e[t[o]]>a);if(o<r)break;hh(t,r,o)}t[n+1]=t[o],t[o]=s,i-r+1>=o-n?(lh(t,e,r,i),lh(t,e,n,o-1)):(lh(t,e,n,o-1),lh(t,e,r,i))}}function hh(t,e,n){const i=t[e];t[e]=t[n],t[n]=i}function ch(t){return t[0]}function dh(t){return t[1]}function fh(t,e,n){return"solidFill"===t.fillType?function(t,e,n){const i=new hs,[r,o]=gu(t.color);return i.beginFill(r,o),i.drawRect(0,0,e,n),i.endFill(),i}(t,e,n):"gradientFill"===t.fillType?function(t,e,n){let i=null;const r=new Fe;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 o=t=>{const e=[];for(let n=0,i=t.length;n<i-1;n++){const i=t[n],r=t[n+1],o=i.pos+.5*(r.pos-i.pos),s=yu(i.color,r.color,.5),a=2*n;e[a]=i,e[a+1]={color:s,pos:o},e[a+2]=r}return e};t.stopList=o(t.stopList),t.stopList=o(t.stopList),i=t.line?ph(t,e,n):t.path?function(t,e,n){var i,r,o;const s=[],a={x:0,y:0};if("circle"===(null===(i=t.path)||void 0===i?void 0:i.path)||"rect"===(null===(r=t.path)||void 0===r?void 0:r.path)||"shape"===(null===(o=t.path)||void 0===o?void 0:o.path)){const i=e/2,r=n/2,o=Math.sqrt(i*i+r*r);t.stopList.forEach(t=>{if(0===t.pos)s.push({point:{x:0,y:0},color:t.color});else{const e=o*t.pos,n=new Il.Path;n.absellipse(0,0,e,e,0,2*Math.PI,!1,0),n.getPoints(50).forEach(e=>{s.push({point:{x:e.x,y:e.y},color:t.color})})}a.x=i,a.y=r})}return{points:s,position:a}}(t,e,n):ph(t,e,n);if(i){const t=[],o=[],{position:s,points:a}=i,u=oh.from(a,t=>t.point.x,t=>t.point.y);for(let e=0;e<u.triangles.length;e+=3)t.push(a[u.triangles[e]].point.x,a[u.triangles[e]].point.y),t.push(a[u.triangles[e+1]].point.x,a[u.triangles[e+1]].point.y),t.push(a[u.triangles[e+2]].point.x,a[u.triangles[e+2]].point.y),o.push(...vu(a[u.triangles[e]].color)),o.push(...vu(a[u.triangles[e+1]].color)),o.push(...vu(a[u.triangles[e+2]].color));const l=new Dn;l.addAttribute("aVertexPosition",t,2),l.addAttribute("aColor",o,4);const h=Si.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 "),c=new hs;c.drawRect(0,0,e+1,n+1),r.mask=c,r.addChild(c);const d=new Qs(l,h);d.position.x=s.x,d.position.y=s.y,r.addChild(d)}return r}(t,e,n):null}function ph(t,e,n){const i=e/2,r=n/2,o=[{x:-i,y:r},{x:-i,y:-r},{x:i,y:r},{x:i,y:-r}],s=[du.fromPointSlope({x:-i,y:0},Math.PI/2),du.fromPointSlope({x:0,y:r},0),du.fromPointSlope({x:i,y:0},Math.PI/2),du.fromPointSlope({x:0,y:-r},0)],a=[],u=t.stopList.slice(1,t.stopList.length-1).map(o=>{var u,l,h;const c=2*Math.PI;let d=null!==(l=null===(u=t.line)||void 0===u?void 0:u.ang)&&void 0!==l?l:0;for(;d>c;)d-=c;for(;d<0;)d+=c;const f={x:0,y:0};hu(d,Math.PI/2)?(f.x=0,f.y=n/2-o.pos*n):hu(d,0)?(f.x=o.pos*e-e/2,f.y=0):(f.x=o.pos*e-e/2,f.y=n/2-o.pos*n),d>Math.PI/2&&d<=Math.PI&&(f.x*=-1),d>Math.PI&&d<=2*Math.PI&&(f.y*=-1);const p=du.fromPointSlope(f,Math.PI/2-((null===(h=t.line)||void 0===h?void 0:h.ang)||0)),m=s.map(t=>p.crossPoint(t)).filter(t=>t&&t.x<=i&&t.x>=-i&&t.y<=r&&t.y>=-r).map(t=>({point:t,color:o.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,n=f.x+e*g,s=p.resolveY(n);n<=i&&n>=-i&&s<=r&&s>=-r&&a.push({point:{x:n,y:s},color:o.color}),g+=g}return p});let l=[],h=[];t:for(let e=0;e<o.length;e++){const n=o[e];for(let e=0;e<u.length-1;e++){const i=u[e],r=u[e+1],o=i.distanceToLinearEquation(r),s=i.distanceToPoint(n),l=r.distanceToPoint(n);if(s<o&&l<o){const i=t.stopList.slice(1,t.stopList.length-1)[e],r=t.stopList.slice(1,t.stopList.length-1)[e+1],u=yu(i.color,r.color,s/o);a.splice(e+1,0,{point:n,color:u});continue t}}const i=u[0],r=u[u.length-1],s=i.distanceToPoint(n),c=r.distanceToPoint(n);s<=c?l.push({point:n,dis:s}):h.push({point:n,dis:c})}l=l.sort((t,e)=>e.dis-t.dis);const c=l.map((e,n)=>{if(0===n)return{point:e.point,color:t.stopList[0].color};{const n=t.stopList[0].color,i=t.stopList[1].color;return{point:e.point,color:yu(n,i,1-(0===l[0].dis?1:e.dis/l[0].dis))}}}).sort((t,e)=>e.point.y-t.point.y);h=h.sort((t,e)=>e.dis-t.dis);const d=h.map((e,n)=>{if(0===n)return{point:e.point,color:t.stopList[t.stopList.length-1].color};{const n=t.stopList[t.stopList.length-2].color,i=t.stopList[t.stopList.length-1].color;return{point:e.point,color:yu(n,i,0===h[0].dis?0:e.dis/h[0].dis)}}}).sort((t,e)=>e.point.y-t.point.y),f=c.concat(...a).concat(d);for(let t=0;t<f.length;t++)f[t].point.x+=i,f[t].point.y=-f[t].point.y+r;return{points:f,position:{x:0,y:0}}}const mh="\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",gh=[mh],vh={biLevel:"\nvec4 transform(vec4 texColor, float arg) {\n vec3 hsl = rgb2hsl(texColor.rgb);\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"};class _h extends Ei{constructor(t,e){var n;super(void 0,(n=vh[t],`\nvarying vec2 vTextureCoord;\n\nuniform float arg;\nuniform sampler2D uSampler;\n\n${gh.map(t=>t+"\n").join("\n")}\n\n${n}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg);\n}\n`),{arg:e})}}const yh=[mh],xh={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 float epsilon = 0.4;\n vec3 colorDiff = arg1.rgb - (texColor.rgb / max(texColor.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n if (colorDistance < epsilon) {\n arg2.rgb *= ceil(texColor.a);\n return arg2;\n } else {\n return texColor;\n }\n}\n"};class bh extends Ei{constructor(t,e,n){var i;super(void 0,(i=xh[t],`\nvarying vec2 vTextureCoord;\n\nuniform vec4 arg1;\nuniform vec4 arg2;\nuniform sampler2D uSampler;\n\n${yh.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, arg2);\n}\n`),{arg1:Float32Array.from(e),arg2:Float32Array.from(n)})}}const wh=[mh],Sh={lum:"\nvec4 transform(vec4 texColor, float arg1, float arg2) {\n if (arg1 > 0.0) {\n texColor.r += (1.0 - texColor.r) * arg1;\n texColor.g += (1.0 - texColor.g) * arg1;\n texColor.b += (1.0 - texColor.b) * arg1;\n } else if (arg1 < 0.0) {\n texColor.r -= texColor.r * arg1;\n texColor.g -= texColor.g * arg1;\n texColor.b -= texColor.b * arg1;\n }\n // todo 对比度\n texColor.rgb *= texColor.a;\n return texColor;\n}\n"};class Th extends Ei{constructor(t,e,n){var i;super(void 0,(i=Sh[t],`\nvarying vec2 vTextureCoord;\n\nuniform float arg1;\nuniform float arg2;\nuniform sampler2D uSampler;\n\n${wh.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, arg2);\n}\n`),{arg1:e,arg2:n})}}class Eh{constructor(t,e){this.renderContainers=[],this.renderTextures=[],this.textures=Object.create(null),this.fillStyles=[],this.renderer=t,this.spriteTextures=e}addTexture(t,e){this.textures[t]={texture:e,pivot:{x:0,y:0}}}render(t){const{items:e,width:n,height:i}=t,r=new Fe;e.forEach(t=>{if(t.item.blipFillObject){const{width:e,height:n}=t;t.item.blipFillObject.position.x+=t.x+e/2,t.item.blipFillObject.position.y+=t.y+n/2,t.item.blipFillObject.anchor.x=.5,t.item.blipFillObject.anchor.y=.5,t.item.blipFillObject.rotation=t.item.rotate/180*Math.PI,r.addChild(t.item.blipFillObject)}else{const e=fh(t.item.fill,t.width-4,t.height-4);if(e)e.position.x+=t.x+2,e.position.y+=t.y+2,r.addChild(e);else{const e=new hs;e.drawRect(0,0,t.width-4,t.height-4),r.addChild(e)}}if(t.item.name){const e=new Ms(t.item.name,{fontFamily:"Arial",fontSize:12,fill:16715792,align:"center"});e.position.x=t.x+2,e.position.y=t.y+2,r.addChild(e)}});const o=new hs;o.drawRect(0,0,Math.ceil(n),Math.ceil(i)),r.addChild(o);const s=Tn.create({width:n,height:i,resolution:Math.ceil(this.renderer.resolution)});this.renderTextures.push(s),this.renderContainers.push(r),this.renderer.render(r,{renderTexture:s}),e.forEach(t=>{const e=new wn(s.baseTexture,new fe(t.x+2,t.y+2,t.width-4,t.height-4));this.textures[t.item.id]={texture:e,pivot:t.item.pivot}})}getTexture(t){const e=this.textures[t],n=this.spriteTextures.getTexture(t);return e||(this.spriteTextures.getTexture(t)?{texture:n,pivot:{x:0,y:0}}:{texture:null,pivot:{x:0,y:0}})}getGifFrames(t){return this.spriteTextures.getGifFrames(t)}addFill(t,e,n,i,r=!1){var o;const s=JSON.stringify(t)+e+n,a=Au()(s);if(this.textures[a])return a;if(this.fillStyles.findIndex(t=>t.id===a)>=0)return a;if("blipFill"!==t.fillType){const r={x:0,y:0};"solidFill"===t.fillType&&(e+=2,n+=2,r.x=1,r.y=1),this.fillStyles.push({fill:t,width:e,height:n,id:a,name:i,pivot:r})}else{const e=this.spriteTextures.getTexture(t.src),n=this.spriteTextures.getFrameData(t.src);if(e){const i=new ms;i.texture=e,t.filters.length>0&&r&&(i.filters=function(t){const e=[];return t.forEach(t=>{if("biLevel"===t.type)e.push(new _h("biLevel",t.args[0]));else if("clrChange"===t.type||"changeBulletColor"===t.type){const n=vu(t.args[0]),i=vu(t.args[1]);e.push(new bh(t.type,n,i))}else"alphaModFix"===t.type?e.push(new _h(t.type,t.args[0])):"lum"===t.type&&e.push(new Th(t.type,t.args[0],t.args[1]))}),e}(t.filters)),this.fillStyles.push({fill:t,width:(null==n?void 0:n.rotate)?e.height:e.width,height:(null==n?void 0:n.rotate)?e.width:e.height,id:a,blipFillObject:i,pivot:{x:0,y:0},rotate:null!==(o=null==n?void 0:n.rotate)&&void 0!==o?o:0})}}return a}pack(){const t=this.fillStyles.filter(t=>!(!t.fill.fillType||"noFill"===t.fill.fillType||0===t.width||0===t.height)||(this.textures[t.id]={texture:null,pivot:{x:0,y:0}},!1));t.forEach(t=>{t.width+=4,t.height+=4});const e=Ou(t);for(let t=0,n=e.length;t<n;t++){const n=e[t];this.render(n)}}destroy(){this.textures=Object.create(null),this.fillStyles=[],this.renderTextures.forEach(t=>t.destroy(!0)),this.renderContainers.forEach(t=>t.destroy({children:!0})),this.spriteTextures.destroy()}}class Mh{constructor(t){this.renderContainers=[],this.renderTextures=[],this.idTidMap=Object.create(null),this.textures=Object.create(null),this.graphics=[],this.renderer=t}render(t){const{items:e,width:n,height:i}=t,r=Tn.create({width:n,height:i,resolution:Math.ceil(this.renderer.resolution)});this.renderTextures.push(r);const o=new Fe;e.forEach(t=>{const e=new ms;e.texture=t.item.texture,e.x=t.x+2,e.y=t.y+2,o.addChild(e)});const s=new hs;s.drawRect(0,0,n,i),o.addChild(s),this.renderer.render(o,{renderTexture:r}),this.renderContainers.push(o),e.forEach(t=>{const e=t.item.padding;this.textures[t.item.id]={texture:new wn(r.baseTexture,new fe(t.x+2+e,t.y+2+e,t.width-4-2*e,t.height-4-2*e)),pivot:t.item.pivot}})}getGraphicsData(t){const e=this.idTidMap[t]||"";return this.textures[e]||null}addGraphics(t,e,n,i,r,o,s,a){var u,l;const h=a||Lu(),c=Au()(e+(null!==(l=null===(u=null==o?void 0:o.width)||void 0===u?void 0:u.toString())&&void 0!==l?l:0)+s);if(this.idTidMap[h]=c,this.graphics.findIndex(t=>t.id===c)<0){const{texture:e,pivot:a,padding:u}=function(t,e,n,i,r,o=!0){var s;const a={x:Math.abs(r.x),y:Math.abs(r.y)},u=window.devicePixelRatio,l=document.createElement("canvas"),h=l.getContext("2d");if(!h)throw new Error("ctx");h.lineCap=(null==i?void 0:i.cap)||"butt",h.lineJoin=(null==i?void 0:i.join)||"miter";let c=0,d=0,f=0,p=0,m=0,g="none",v="none";const _=null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0;return o?(c=e,d=n,m=0,v="#ffffff"):(g="#ff0000",m=_,f=.5*_,p=.5*_,c=e+_,d=n+_,a.x+=.5*_,a.y+=.5*_),c+=Math.abs(r.x),d+=Math.abs(r.y),f+=Math.abs(r.x),p+=Math.abs(r.y),c+=4,d+=4,f+=2,p+=2,f*=u,p*=u,c=Math.ceil(c*u),d=Math.ceil(d*u),l.width=c,l.height=d,h.transform(u,0,0,u,f,p),t.forEach(t=>{h.lineWidth=m,h.strokeStyle=g,"none"!==t.fill&&(h.fillStyle=v),(null==i?void 0:i.dash)&&h.setLineDash(i.dash.split(",").map(t=>Number(t.trim()))),h.beginPath();const{scale:e}=t,n=t.path.trim().split(" ");let r={x:0,y:0};for(let t=0;t<n.length;t+=2){const i=n[t],o=n[t+1];if("M"===i){let[t,n]=o.split(",").map(t=>Number(t));r={x:t,y:n},t=t/9525*e.x,n=n/9525*e.y,h.moveTo(t,n)}else if("A"===i){const[t,n,i,s]=o.split(",").map(t=>Number(t));r=Nu(r,e,t,n,i,s,h)}else if("L"===i){let[t,n]=o.split(",").map(t=>Number(t));r={x:t,y:n},t=t/9525*e.x,n=n/9525*e.y,h.lineTo(t,n)}else if("QB"===i){let[t,n,i,s]=o.split(",").map(t=>Number(t));r={x:i,y:s},t=t/9525*e.x,n=n/9525*e.y,i=i/9525*e.x,s=s/9525*e.y,h.quadraticCurveTo(t,n,i,s)}else if("CB"===i){let[t,n,i,s,a,u]=o.split(",").map(t=>Number(t));r={x:a,y:u},t=t/9525*e.x,n=n/9525*e.y,i=i/9525*e.x,s=s/9525*e.y,a=a/9525*e.x,u=u/9525*e.y,h.bezierCurveTo(t,n,i,s,a,u)}else"C"===i&&h.closePath()}t.hasStroke&&m>0&&h.stroke(),"none"!==t.fill&&o&&h.fill("nonzero")}),{texture:new wn(new on(l,{width:l.width/2,height:l.height/2,resolution:u})),pivot:a,padding:2}}(t,i,r,o,n,s);this.graphics.push({id:c,texture:e,pivot:a,width:e.width,height:e.height,padding:u})}return h}pack(){this.graphics.forEach(t=>{t.width+=4,t.height+=4});Ou(this.graphics).forEach(t=>{this.render(t)}),this.graphics.forEach(t=>{t.texture.destroy(!0)}),this.graphics=[]}destroy(){Object.keys(this.textures).forEach(t=>{var e;null===(e=this.textures[t])||void 0===e||e.texture.destroy()}),this.textures=Object.create(null),this.graphics=[],this.renderContainers.forEach(t=>t.destroy({children:!0,baseTexture:!0,texture:!0})),this.renderTextures.forEach(t=>t.destroy(!0))}}var Ah=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class Ph{constructor(t){this.gifs=Object.create(null),this.textures=Object.create(null),this.frames=Object.create(null),this.spriteSheets=[],this.isLoaded=!1,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,n){return Ah(this,void 0,void 0,(function*(){const i=yield this.loader.fetchJson(`${t}/${e}/jsonOutput/${n}.json`),r=yield this.loader.fetchPng(`${t}/${e}/jsonOutput/${n}.png`),o=document.createElement("img");o.src=r,yield new Promise((t,e)=>{o.onload=()=>t(""),o.onerror=()=>e()});const s=new on(o),a=new Gs(s,i);yield new Promise(t=>{a.parse(()=>t(""))}),this.spriteSheets.push(a),Object.keys(a.textures).forEach(t=>{const e=t.match(/^(.+)_gif_(\d+)$/);if(e&&e[1]&&e[2]){const n=e[1];this.gifs[n]||(this.gifs[n]=[]);const i=parseInt(e[2],10);this.gifs[n][i]=a.textures[t]}else this.frames[t]=i.frames[t],this.textures[t]=a.textures[t]})}))}loadSpriteSheets(t,e,n){return this.isLoaded?Promise.resolve([]):(this.isLoaded=!0,Promise.all(t.map(t=>this.loadSpriteSheetItem(e,n,t))))}destroy(){this.isLoaded=!1,this.spriteSheets.forEach(t=>t.destroy(!0))}}class Ch extends s.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(800*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 Rh=n(10),Ih=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class Lh{constructor(t){this.useCache=!1,this.useCache=t}bindTask(t){this.taskId=t,this.useCache&&(this.cache=Rh.createInstance({name:"_slide_local_cache_",storeName:this.taskId,driver:Rh.INDEXEDDB,version:1}),this.cache.clear().catch(()=>{}))}fetchJson(t){var e,n;return Ih(this,void 0,void 0,(function*(){let i=yield null===(e=this.cache)||void 0===e?void 0:e.getItem(t);return i&&this.useCache||(i=yield(yield fetch(t)).json(),this.useCache&&(yield null===(n=this.cache)||void 0===n?void 0:n.setItem(t,i))),i}))}fetchPng(t){var e,n;return Ih(this,void 0,void 0,(function*(){let i=yield null===(e=this.cache)||void 0===e?void 0:e.getItem(t);if(i&&this.useCache)return i;if(i=yield fetch(t).then(t=>t.blob()).then(e=>new Promise((n,i)=>{const r=new FileReader;r.onload=()=>{n(r.result)},r.onerror=()=>{i(new Error(`fetch ${t} failed`))},r.readAsDataURL(e)})),this.useCache&&(yield null===(n=this.cache)||void 0===n?void 0:n.setItem(t,i)),!i)throw new Error(`fetch ${t} failed`);return i}))}destroy(){var t;null===(t=this.cache)||void 0===t||t.clear().catch(()=>{})}}class Oh{constructor(){this.runningTimeNodes={}}addRunningTimeNode(t,e,n){const i=`${e}_${t}`;if(this.runningTimeNodes[i])try{this.runningTimeNodes[i].dispose(!0)}catch(t){}this.runningTimeNodes[i]=n}}var Dh=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class Nh{constructor(t){this.isPaused=!1,this.timestamp=0,this.callbackList=[],this.onTimeUpdate=t=>{const e=t/(gt.TARGET_FPMS||.06);if(!this.isPaused){this.timestamp+=e,this.callbackList=this.callbackList.filter(t=>t&&!t.applied);for(let t=0,e=this.callbackList.length;t<e;t++){const e=this.callbackList[t];if(!e.applied){if(!(e.triggerTime<=this.timestamp))break;e.fn(),e.applied=!0}}}},this.ticker=t,this.ticker.add(this.onTimeUpdate)}setTimeout(t,e){const n=Lu(),i=this.timestamp+Math.max(e||16,16);return this.callbackList.push({fn:t,triggerTime:i,id:n,applied:!1}),this.callbackList.sort((t,e)=>t.triggerTime-e.triggerTime),n}clearTimeout(t){const e=this.callbackList.findIndex(e=>e.id===t);e>=0&&this.callbackList.splice(e,1)}delay(t){return new Promise(e=>{this.setTimeout(e,t)})}waitUntil(t,e){return Dh(this,void 0,void 0,(function*(){const n=this.timestamp;for(;!t()&&this.timestamp-n<e;)yield this.delay(50)}))}pause(){this.isPaused=!0}resume(){this.isPaused=!1}}var Fh=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};i.skipHello();const Bh={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"};class kh{constructor(t){this.eventHub=t,this.targets=Object.create(null)}addTarget(t,e){this.targets[t]=e}getTargetById(t){return this.targets[t]}getTarget(t,e,n={type:"el",index:0,id:""}){var i,r;let o=this.targets[t.id];return"shape"!==t.type?o:("shape"===t.type&&t.txEl&&(o=null!==(i=null==o?void 0:o.getTextElement(t.txEl.type,t.txEl.range))&&void 0!==i?i:null),"shape"===t.type&&t.bg&&0===n.index&&(e=!1,o=null!==(r=null==o?void 0:o.getBgElement())&&void 0!==r?r:null,this.eventHub.emit("IterateTimeNodeEnd",n.id)),e&&o?o.getIterateEntry(n.type,n.index,n.id):o)}clearTargets(){this.targets=Object.create(null)}}const Uh={mainSeqStepChange:"mainSeqStepChange",mainSeqStateChange:"mainSeqStateChange",interactiveSeqStateChange:"interactiveSeqStateChange",interactiveSeqNext:"interactiveSeqNext",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"};class Gh extends s.a{constructor(t,e={}){super(),this.loader=new Lh(!1),this.transactionPlayer=new u.TransactionPlayer,this.transactionSprite=new ms,this.isForward=!0,this.drawCall=0,this.scale=1,this.fps=new Ch,this.designWidth=0,this.designHeight=0,this.currentIndex=0,this.slideCount=0,this.runtime={drawCall:0,fps:0},this.mode=t,this.config={minFPS:Object(a.isUndefined)(e.minFPS)?30:e.minFPS,maxFPS:Object(a.isUndefined)(e.maxFPS)?40:e.maxFPS,resolution:Object(a.isUndefined)(e.resolution)?window.devicePixelRatio:e.resolution,autoFPS:!Object(a.isUndefined)(e.autoFPS)&&e.autoFPS,autoResolution:!Object(a.isUndefined)(e.autoResolution)&&e.autoResolution,transactionBgColor:Object(a.isUndefined)(e.transactionBgColor)?0:e.transactionBgColor},this.app=new lr({antialias:!0,autoDensity:!1,backgroundColor:16777215}),this.updateConfig(this.config),this.app.view.style.zIndex="1",this.app.stage.sortableChildren=!0;const n=this.app.renderer,{drawElements:i}=n.gl;n.gl.drawElements=(...t)=>{i.call(n.gl,...t),this.drawCall+=1},this.fps.on("update",t=>{if(t<this.config.minFPS){if(this.config.autoResolution){const t=this.scale*this.config.resolution*.7,e=this.app.renderer.resolution,n=Math.max(t,e-.1);n>=t&&this.updateResolution(n)}if(this.config.autoFPS){const t=14,{minFPS:e,maxFPS:n}=this.app.ticker,i=Math.max(t,e-2),r=Math.max(t,n-2);i>=t&&r>=t&&(this.app.ticker.minFPS=i,this.app.ticker.maxFPS=r)}}else if(t>this.config.maxFPS){if(this.config.autoResolution){const t=this.scale*this.config.resolution,e=this.app.renderer.resolution,n=Math.min(t,e+.1);n<=this.config.resolution&&this.updateResolution(n)}if(this.config.autoFPS){const t=this.config.minFPS,e=this.config.maxFPS,{minFPS:n,maxFPS:i}=this.app.ticker,r=Math.min(t,n+2),o=Math.min(e,i+2);r<=t&&o<=e&&(this.app.ticker.minFPS=r,this.app.ticker.maxFPS=o)}}}),this.app.ticker.add(()=>{this.runtime.drawCall=this.drawCall,this.runtime.fps=Math.floor(this.app.ticker.minFPS),this.drawCall=0},null,Be.LOW),this.clock=new Nh(this.app.ticker)}get view(){return this.app.renderer?this.app.view:null}updateConfig(t){Object(a.isUndefined)(t.minFPS)||(this.config.minFPS=t.minFPS,this.app.ticker.minFPS=t.minFPS),Object(a.isUndefined)(t.maxFPS)||(this.config.maxFPS=t.maxFPS,this.app.ticker.maxFPS=t.maxFPS),Object(a.isUndefined)(t.resolution)||(this.config.resolution=t.resolution,this.updateResolution(this.scale*this.config.resolution)),Object(a.isUndefined)(t.autoFPS)||(this.config.autoFPS=t.autoFPS),Object(a.isUndefined)(t.autoResolution)||(this.config.autoResolution=t.autoResolution),Object(a.isUndefined)(t.transactionBgColor)||(this.config.transactionBgColor=t.transactionBgColor)}preload(t){return Fh(this,void 0,void 0,(function*(){if(t<1||t>this.slideCount||!this.loader.cache)return;const e=yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/slide-${t}.json`),{sheets:n}=e;for(const t of n)yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/${t}.json`),yield this.loader.fetchPng(`${this.url}/${this.taskId}/jsonOutput/${t}.png`)}))}setResourceData(t,e){this.taskId=t,this.url=e,this.loader.bindTask(t)}setInteractive(t){this.app.stage.interactive=t,this.app.stage.interactiveChildren=t}loadSlide(t){return Fh(this,void 0,void 0,(function*(){const e=new Ph(this.loader),n=new s.a,i={mode:this.mode,renderer:this.app.renderer,graphicsTexture:new Mh(this.app.renderer),fillTexture:new Eh(this.app.renderer,e),stageWidth:0,stageHeight:0,ticker:this.app.ticker,timingTargets:new kh(n),eventHub:n,view:this.app.view,medias:Object.create(null),lastViewedIndex:this.currentIndex,conflictTimeNodeManager:new Oh,clock:this.clock},r=yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/slide-${t}.json`),{width:o,height:a,sheets:u}=r;yield e.loadSpriteSheets(u,this.url,this.taskId),i.stageWidth=o,i.stageHeight=a;const l=new Xl(r,i,{x:0,y:0});return this.translateEvent(i.eventHub,[Uh.mainSeqStepChange,Uh.mainSeqStateChange,Uh.hyperlinkTrigger,Uh.interactiveSeqNext,Uh.mainSeqStepStart,Uh.mainSeqStepEnd,Uh.animateStart,Uh.animateEnd,Uh.mediaPlay,Uh.mediaPause,Uh.mediaSeek,Uh.requestGotoSlide,Uh.requestNextSlide,Uh.requestPrevSlide,Uh.interactiveSeqStateChange]),l.preRender(),i.fillTexture.pack(),i.graphicsTexture.pack(),{stage:l,json:r}}))}translateEvent(t,e){e.forEach(e=>{t.on(e,(...t)=>{this.emit(e,...t)})})}renderSlide(t){return Fh(this,void 0,void 0,(function*(){this.emit(Uh.renderStart,t);const e=yield this.loadSlide(t);this.currentIndex=Number(t);const{width:n,height:i,slideCount:r}=e.json;let o;this.slideCount=r,this.designWidth=n,this.designHeight=i,this.currentStage&&(e.json.transition&&e.json.transition.type&&(o=this.getBase64(this.currentStage)),this.prevStage=this.currentStage),this.currentStage=e,yield e.stage.render(),e.stage.createTiming(),e.stage.container.visible=!0,e.stage.collectMainSeqStartValue(),this.isForward?e.stage.setMainSeqStep(0,"start"):e.stage.setMainSeqStep(-1,"end");const s=this.getBase64(this.currentStage);e.stage.container.visible=!1,this.app.stage.addChild(e.stage.container),o&&s&&e.json.transition&&e.json.transition.type&&(yield this.playTransaction(o,s,e.json.transition)),this.prevStage&&(this.app.stage.removeChild(this.prevStage.stage.container),this.prevStage.stage.destroy(),this.prevStage=void 0),this.isForward?yield e.stage.startTiming():e.stage.setMainSeqApplied(),this.updateResolution(this.config.resolution*this.scale),e.stage.container.visible=!0,this.emit(Uh.renderEnd,t),this.emit(Uh.slideChange,t),this.preload(t+1).catch(()=>{}),this.preload(t-1).catch(()=>{})}))}getBase64(t){const e=Tn.create({width:this.designWidth,height:this.designHeight,resolution:Math.ceil(this.app.renderer.resolution)});this.app.renderer.render(t.stage.container,{renderTexture:e});const n=this.app.renderer.plugins.extract.base64(e,"image/jpeg");return e.destroy(),n}getPreviewImage(t){return Fh(this,void 0,void 0,(function*(){if(t<1||t>this.slideCount)return null;const e=yield this.loadSlide(t);yield e.stage.render(),e.stage.container.visible=!0;const n=this.getBase64(e);return e.stage.destroy(),n}))}playTransaction(t,e,n){return Fh(this,void 0,void 0,(function*(){const i=this.app.view.parentElement;if(t&&e&&i&&Bh[n.type]&&this.transactionPlayer){this.transactionSprite.zIndex=999,this.app.stage.addChild(this.transactionSprite);const i=this.transactionPlayer.renderer.domElement,r=wn.from(i),o=()=>r.update();return setTimeout(()=>{this.app.ticker.add(o)}),this.transactionSprite.texture=r,new Promise(i=>{var r,s,a;null===(r=this.transactionPlayer)||void 0===r||r.play({reverse:!this.isForward,prevTextureUrl:t,nextTextureUrl:e,textureWidth:this.designWidth,textureHeight:this.designHeight,presetType:Bh[n.type],stageWidth:this.designWidth,stageHeight:this.designHeight,duration:null===(a=null===(s=this.currentStage)||void 0===s?void 0:s.json.transition)||void 0===a?void 0:a.dur,delay:0,clearColor:this.config.transactionBgColor,onTransactionEnd:()=>{i(),this.app.stage.removeChild(this.transactionSprite),this.app.ticker.remove(o)}})})}return Promise.resolve()}))}scaleView(t,e=!1){this.scale=t;const n=this.scale*this.config.resolution;this.view&&(this.view.style.width=Math.floor(this.designWidth*this.scale)+"px",this.view.style.height=Math.floor(this.designHeight*this.scale)+"px"),e&&this.updateResolution(n)}updateResolution(t){this.app.ticker.addOnce(()=>{this.app.renderer.resolution=t,this.app.renderer.plugins.interaction.resolution=this.app.renderer.resolution,this.app.renderer.resize(this.designWidth,this.designHeight)})}nextStep(){var t;null===(t=this.currentStage)||void 0===t||t.stage.nextStep()}prevStep(){var t;null===(t=this.currentStage)||void 0===t||t.stage.prevStep()}mainSeqLength(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.stage.mainSeqLength())&&void 0!==e?e:0}mainSeqStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.stage.mainSeqStep())&&void 0!==e?e:0}setMainSeqStep(t,e){var n;null===(n=this.currentStage)||void 0===n||n.stage.setMainSeqStep(t,e)}mainSeqState(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.stage.mainSeqState())&&void 0!==e?e:null}mainSeqHasNextStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.stage.mainSeqHasNextStep())&&void 0!==e&&e}mainSeqHasPrevStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.stage.mainSeqHasPrevStep())&&void 0!==e&&e}nextTick(t){this.app.ticker.addOnce(()=>{t()},Be.LOW)}applyInteractiveAction(t){var e;null===(e=this.currentStage)||void 0===e||e.stage.applyInteractiveAction(t)}seekInteractiveSeqToEnd(t){var e;null===(e=this.currentStage)||void 0===e||e.stage.seekInteractiveSeqToEnd(t)}setInteractiveSeqState(t,e,n){var i;null===(i=this.currentStage)||void 0===i||i.stage.setInteractiveSeqState(t,e,n)}setMediaState(t,e){var n;return Fh(this,void 0,void 0,(function*(){yield null===(n=this.currentStage)||void 0===n?void 0:n.stage.setMediaState(t,e)}))}setMediaCurrentTime(t,e){var n;null===(n=this.currentStage)||void 0===n||n.stage.setMediaCurrentTime(t,e)}pause(){this.app.ticker.stop()}resume(){this.app.ticker.start()}getSnapshot(){return this.currentStage?this.getBase64(this.currentStage):""}destroy(){var t;this.prevStage&&this.prevStage.stage.destroy(),this.currentStage&&this.currentStage.stage.destroy(),null===(t=this.transactionPlayer)||void 0===t||t.destroy(),this.loader.destroy(),this.fps.destroy();try{this.app.renderer.gl.getExtension("WEBGL_lose_context").loseContext()}catch(t){}this.app.destroy(!0,{children:!1,texture:!0,baseTexture:!0})}}var Hh,zh=[],jh="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"}(Hh||(Hh={}));var Vh,Wh=function(t){return Object.freeze(t)},Xh=function(t,e){this.inlineSize=t,this.blockSize=e,Wh(this)},qh=function(){function t(t,e,n,i){return this.x=t,this.y=e,this.width=n,this.height=i,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Wh(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}(),Yh=function(t){return t instanceof SVGElement&&"getBBox"in t},Zh=function(t){if(Yh(t)){var e=t.getBBox(),n=e.width,i=e.height;return!n&&!i}var r=t,o=r.offsetWidth,s=r.offsetHeight;return!(o||s||t.getClientRects().length)},Jh=function(t){var e,n;if(t instanceof Element)return!0;var i=null===(n=null===(e=t)||void 0===e?void 0:e.ownerDocument)||void 0===n?void 0:n.defaultView;return!!(i&&t instanceof i.Element)},Kh="undefined"!=typeof window?window:{},$h=new WeakMap,Qh=/auto|scroll/,tc=/^tb|vertical/,ec=/msie|trident/i.test(Kh.navigator&&Kh.navigator.userAgent),nc=function(t){return parseFloat(t||"0")},ic=function(t,e,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=!1),new Xh((n?e:t)||0,(n?t:e)||0)},rc=Wh({devicePixelContentBoxSize:ic(),borderBoxSize:ic(),contentBoxSize:ic(),contentRect:new qh(0,0,0,0)}),oc=function(t,e){if(void 0===e&&(e=!1),$h.has(t)&&!e)return $h.get(t);if(Zh(t))return $h.set(t,rc),rc;var n=getComputedStyle(t),i=Yh(t)&&t.ownerSVGElement&&t.getBBox(),r=!ec&&"border-box"===n.boxSizing,o=tc.test(n.writingMode||""),s=!i&&Qh.test(n.overflowY||""),a=!i&&Qh.test(n.overflowX||""),u=i?0:nc(n.paddingTop),l=i?0:nc(n.paddingRight),h=i?0:nc(n.paddingBottom),c=i?0:nc(n.paddingLeft),d=i?0:nc(n.borderTopWidth),f=i?0:nc(n.borderRightWidth),p=i?0:nc(n.borderBottomWidth),m=c+l,g=u+h,v=(i?0:nc(n.borderLeftWidth))+f,_=d+p,y=a?t.offsetHeight-_-t.clientHeight:0,x=s?t.offsetWidth-v-t.clientWidth:0,b=r?m+v:0,w=r?g+_:0,S=i?i.width:nc(n.width)-b-x,T=i?i.height:nc(n.height)-w-y,E=S+m+x+v,M=T+g+y+_,A=Wh({devicePixelContentBoxSize:ic(Math.round(S*devicePixelRatio),Math.round(T*devicePixelRatio),o),borderBoxSize:ic(E,M,o),contentBoxSize:ic(S,T,o),contentRect:new qh(c,u,S,T)});return $h.set(t,A),A},sc=function(t,e,n){var i=oc(t,n),r=i.borderBoxSize,o=i.contentBoxSize,s=i.devicePixelContentBoxSize;switch(e){case Hh.DEVICE_PIXEL_CONTENT_BOX:return s;case Hh.BORDER_BOX:return r;default:return o}},ac=function(t){var e=oc(t);this.target=t,this.contentRect=e.contentRect,this.borderBoxSize=Wh([e.borderBoxSize]),this.contentBoxSize=Wh([e.contentBoxSize]),this.devicePixelContentBoxSize=Wh([e.devicePixelContentBoxSize])},uc=function(t){if(Zh(t))return 1/0;for(var e=0,n=t.parentNode;n;)e+=1,n=n.parentNode;return e},lc=function(){var t=1/0,e=[];zh.forEach((function(n){if(0!==n.activeTargets.length){var i=[];n.activeTargets.forEach((function(e){var n=new ac(e.target),r=uc(e.target);i.push(n),e.lastReportedSize=sc(e.target,e.observedBox),r<t&&(t=r)})),e.push((function(){n.callback.call(n.observer,i,n.observer)})),n.activeTargets.splice(0,n.activeTargets.length)}}));for(var n=0,i=e;n<i.length;n++){(0,i[n])()}return t},hc=function(t){zh.forEach((function(e){e.activeTargets.splice(0,e.activeTargets.length),e.skippedTargets.splice(0,e.skippedTargets.length),e.observationTargets.forEach((function(n){n.isActive()&&(uc(n.target)>t?e.activeTargets.push(n):e.skippedTargets.push(n))}))}))},cc=function(){var t,e=0;for(hc(e);zh.some((function(t){return t.activeTargets.length>0}));)e=lc(),hc(e);return zh.some((function(t){return t.skippedTargets.length>0}))&&("function"==typeof ErrorEvent?t=new ErrorEvent("error",{message:jh}):((t=document.createEvent("Event")).initEvent("error",!1,!1),t.message=jh),window.dispatchEvent(t)),e>0},dc=[],fc=function(t){if(!Vh){var e=0,n=document.createTextNode("");new MutationObserver((function(){return dc.splice(0).forEach((function(t){return t()}))})).observe(n,{characterData:!0}),Vh=function(){n.textContent=""+(e?e--:e++)}}dc.push(t),Vh()},pc=0,mc={attributes:!0,characterData:!0,childList:!0,subtree:!0},gc=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],vc=function(t){return void 0===t&&(t=0),Date.now()+t},_c=!1,yc=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),!_c){_c=!0;var n,i=vc(t);n=function(){var n=!1;try{n=cc()}finally{if(_c=!1,t=i-vc(),!pc)return;n?e.run(1e3):t>0?e.run(t):e.start()}},fc((function(){requestAnimationFrame(n)}))}},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,mc)};document.body?e():Kh.addEventListener("DOMContentLoaded",e)},t.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),gc.forEach((function(e){return Kh.addEventListener(e,t.listener,!0)})))},t.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),gc.forEach((function(e){return Kh.removeEventListener(e,t.listener,!0)})),this.stopped=!0)},t}()),xc=function(t){!pc&&t>0&&yc.start(),!(pc+=t)&&yc.stop()},bc=function(){function t(t,e){this.target=t,this.observedBox=e||Hh.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return t.prototype.isActive=function(){var t,e=sc(this.target,this.observedBox,!0);return t=this.target,Yh(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}(),wc=function(t,e){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=e},Sc=new WeakMap,Tc=function(t,e){for(var n=0;n<t.length;n+=1)if(t[n].target===e)return n;return-1},Ec=function(){function t(){}return t.connect=function(t,e){var n=new wc(t,e);Sc.set(t,n)},t.observe=function(t,e,n){var i=Sc.get(t),r=0===i.observationTargets.length;Tc(i.observationTargets,e)<0&&(r&&zh.push(i),i.observationTargets.push(new bc(e,n&&n.box)),xc(1),yc.schedule())},t.unobserve=function(t,e){var n=Sc.get(t),i=Tc(n.observationTargets,e),r=1===n.observationTargets.length;i>=0&&(r&&zh.splice(zh.indexOf(n),1),n.observationTargets.splice(i,1),xc(-1))},t.disconnect=function(t){var e=this,n=Sc.get(t);n.observationTargets.slice().forEach((function(n){return e.unobserve(t,n.target)})),n.activeTargets.splice(0,n.activeTargets.length)},t}(),Mc=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.");Ec.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(!Jh(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Ec.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(!Jh(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Ec.unobserve(this,t)},t.prototype.disconnect=function(){Ec.disconnect(this)},t.toString=function(){return"function ResizeObserver () { [polyfill code] }"},t}(),Ac=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))},Pc=function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Cc=function(){function t(t,e,n,i,r){this.state="idle",this.index=-1,this.slideIndex=-1,this.fn=n,this.index=t,this.slideIndex=e,this.eventHub=i,this.id=r}return t.prototype.apply=function(){return Ac(this,void 0,void 0,(function(){var t;return Pc(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}(),Rc=function(){function t(){var t=this;this.eventHub=new s.a,this.tasks=[],this.index=0,this.eventHub.on("task-end",(function(e){var n,i=t.tasks.findIndex((function(t){return t.index===e.index})),r=i+1;r>=0&&(null===(n=t.tasks[r])||void 0===n||n.apply()),i>=0&&(t.tasks.splice(i,1),t.replaceIdleTask()),t.eventHub.emit("task-end-"+e.id)})),this.eventHub.on("task-error",(function(e){var n=e.task,i=t.tasks.findIndex((function(t){return t.index===n.index}));i>=0&&(t.tasks.splice(i,1),t.replaceIdleTask())}))}return t.prototype.replaceIdleTask=function(){for(var t,e=this,n=new Set,i=0,r=this.tasks.length;i<r;i++)"idle"===this.tasks[i].state&&"idle"===(null===(t=this.tasks[i+1])||void 0===t?void 0:t.state)&&n.add(i);Array.from(n).forEach((function(t){e.tasks.splice(t,1)}))},t.prototype.addTask=function(t,e,n){var i=new Cc(this.index++,e,t,this.eventHub,n);this.tasks.push(i),this.tasks.sort((function(t,e){return t.index-e.index})),this.replaceIdleTask(),1===this.tasks.length&&i.apply()},t.prototype.hasStartTask=function(){return this.tasks.some((function(t){return"start"===t.state}))},t}();function Ic(t,e){var n=t.__state.conversionName.toString(),i=Math.round(t.r),r=Math.round(t.g),o=Math.round(t.b),s=t.a,a=Math.round(t.h),u=t.s.toFixed(1),l=t.v.toFixed(1);if(e||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var h=t.hex.toString(16);h.length<6;)h="0"+h;return"#"+h}return"CSS_RGB"===n?"rgb("+i+","+r+","+o+")":"CSS_RGBA"===n?"rgba("+i+","+r+","+o+","+s+")":"HEX"===n?"0x"+t.hex.toString(16):"RGB_ARRAY"===n?"["+i+","+r+","+o+"]":"RGBA_ARRAY"===n?"["+i+","+r+","+o+","+s+"]":"RGB_OBJ"===n?"{r:"+i+",g:"+r+",b:"+o+"}":"RGBA_OBJ"===n?"{r:"+i+",g:"+r+",b:"+o+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+u+",v:"+l+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+u+",v:"+l+",a:"+s+"}":"unknown format"}var Lc=Array.prototype.forEach,Oc=Array.prototype.slice,Dc={BREAK:{},extend:function(t){return this.each(Oc.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(n){this.isUndefined(e[n])||(t[n]=e[n])}.bind(this))}),this),t},defaults:function(t){return this.each(Oc.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(n){this.isUndefined(t[n])&&(t[n]=e[n])}.bind(this))}),this),t},compose:function(){var t=Oc.call(arguments);return function(){for(var e=Oc.call(arguments),n=t.length-1;n>=0;n--)e=[t[n].apply(this,e)];return e[0]}},each:function(t,e,n){if(t)if(Lc&&t.forEach&&t.forEach===Lc)t.forEach(e,n);else if(t.length===t.length+0){var i,r=void 0;for(r=0,i=t.length;r<i;r++)if(r in t&&e.call(n,t[r],r)===this.BREAK)return}else for(var o in t)if(e.call(n,t[o],o)===this.BREAK)return},defer:function(t){setTimeout(t,0)},debounce:function(t,e,n){var i=void 0;return function(){var r=this,o=arguments;function s(){i=null,n||t.apply(r,o)}var a=n||!i;clearTimeout(i),i=setTimeout(s,e),a&&t.apply(r,o)}},toArray:function(t){return t.toArray?t.toArray():Oc.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}},Nc=[{litmus:Dc.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:Ic},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:Ic},CSS_RGB:{read:function(t){var e=t.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3])}},write:Ic},CSS_RGBA:{read:function(t){var e=t.match(/^rgba\(\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:Ic}}},{litmus:Dc.isNumber,conversions:{HEX:{read:function(t){return{space:"HEX",hex:t,conversionName:"HEX"}},write:function(t){return t.hex}}}},{litmus:Dc.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:Dc.isObject,conversions:{RGBA_OBJ:{read:function(t){return!!(Dc.isNumber(t.r)&&Dc.isNumber(t.g)&&Dc.isNumber(t.b)&&Dc.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!!(Dc.isNumber(t.r)&&Dc.isNumber(t.g)&&Dc.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!!(Dc.isNumber(t.h)&&Dc.isNumber(t.s)&&Dc.isNumber(t.v)&&Dc.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!!(Dc.isNumber(t.h)&&Dc.isNumber(t.s)&&Dc.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}}}}}],Fc=void 0,Bc=void 0,kc=function(){Bc=!1;var t=arguments.length>1?Dc.toArray(arguments):arguments[0];return Dc.each(Nc,(function(e){if(e.litmus(t))return Dc.each(e.conversions,(function(e,n){if(Fc=e.read(t),!1===Bc&&!1!==Fc)return Bc=Fc,Fc.conversionName=n,Fc.conversion=e,Dc.BREAK})),Dc.BREAK})),Bc},Uc=void 0,Gc={hsv_to_rgb:function(t,e,n){var i=Math.floor(t/60)%6,r=t/60-Math.floor(t/60),o=n*(1-e),s=n*(1-r*e),a=n*(1-(1-r)*e),u=[[n,a,o],[s,n,o],[o,n,a],[o,s,n],[a,o,n],[n,o,s]][i];return{r:255*u[0],g:255*u[1],b:255*u[2]}},rgb_to_hsv:function(t,e,n){var i=Math.min(t,e,n),r=Math.max(t,e,n),o=r-i,s=void 0;return 0===r?{h:NaN,s:0,v:0}:(s=t===r?(e-n)/o:e===r?2+(n-t)/o:4+(t-e)/o,(s/=6)<0&&(s+=1),{h:360*s,s:o/r,v:r/255})},rgb_to_hex:function(t,e,n){var i=this.hex_with_component(0,2,t);return i=this.hex_with_component(i,1,e),i=this.hex_with_component(i,0,n)},component_from_hex:function(t,e){return t>>8*e&255},hex_with_component:function(t,e,n){return n<<(Uc=8*e)|t&~(255<<Uc)}},Hc="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},zc=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},jc=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),Vc=function t(e,n,i){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,n);if(void 0===r){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,n,i)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(i):void 0},Wc=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)},Xc=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},qc=function(){function t(){if(zc(this,t),this.__state=kc.apply(this,arguments),!1===this.__state)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return jc(t,[{key:"toString",value:function(){return Ic(this)}},{key:"toHexString",value:function(){return Ic(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),t}();function Yc(t,e,n){Object.defineProperty(t,e,{get:function(){return"RGB"===this.__state.space||qc.recalculateRGB(this,e,n),this.__state[e]},set:function(t){"RGB"!==this.__state.space&&(qc.recalculateRGB(this,e,n),this.__state.space="RGB"),this.__state[e]=t}})}function Zc(t,e){Object.defineProperty(t,e,{get:function(){return"HSV"===this.__state.space||qc.recalculateHSV(this),this.__state[e]},set:function(t){"HSV"!==this.__state.space&&(qc.recalculateHSV(this),this.__state.space="HSV"),this.__state[e]=t}})}qc.recalculateRGB=function(t,e,n){if("HEX"===t.__state.space)t.__state[e]=Gc.component_from_hex(t.__state.hex,n);else{if("HSV"!==t.__state.space)throw new Error("Corrupted color state");Dc.extend(t.__state,Gc.hsv_to_rgb(t.__state.h,t.__state.s,t.__state.v))}},qc.recalculateHSV=function(t){var e=Gc.rgb_to_hsv(t.r,t.g,t.b);Dc.extend(t.__state,{s:e.s,v:e.v}),Dc.isNaN(e.h)?Dc.isUndefined(t.__state.h)&&(t.__state.h=0):t.__state.h=e.h},qc.COMPONENTS=["r","g","b","h","s","v","hex","a"],Yc(qc.prototype,"r",2),Yc(qc.prototype,"g",1),Yc(qc.prototype,"b",0),Zc(qc.prototype,"h"),Zc(qc.prototype,"s"),Zc(qc.prototype,"v"),Object.defineProperty(qc.prototype,"a",{get:function(){return this.__state.a},set:function(t){this.__state.a=t}}),Object.defineProperty(qc.prototype,"hex",{get:function(){return"HEX"!==this.__state.space&&(this.__state.hex=Gc.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 Jc=function(){function t(e,n){zc(this,t),this.initialValue=e[n],this.domElement=document.createElement("div"),this.object=e,this.property=n,this.__onChange=void 0,this.__onFinishChange=void 0}return jc(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}(),Kc={};Dc.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},(function(t,e){Dc.each(t,(function(t){Kc[t]=e}))}));var $c=/(\d+(\.\d+)?)px/;function Qc(t){if("0"===t||Dc.isUndefined(t))return 0;var e=t.match($c);return Dc.isNull(e)?0:parseFloat(e[1])}var td={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,n){var i=n,r=e;Dc.isUndefined(r)&&(r=!0),Dc.isUndefined(i)&&(i=!0),t.style.position="absolute",r&&(t.style.left=0,t.style.right=0),i&&(t.style.top=0,t.style.bottom=0)},fakeEvent:function(t,e,n,i){var r=n||{},o=Kc[e];if(!o)throw new Error("Event type "+e+" not supported.");var s=document.createEvent(o);switch(o){case"MouseEvents":var a=r.x||r.clientX||0,u=r.y||r.clientY||0;s.initMouseEvent(e,r.bubbles||!1,r.cancelable||!0,window,r.clickCount||1,0,0,a,u,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var l=s.initKeyboardEvent||s.initKeyEvent;Dc.defaults(r,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),l(e,r.bubbles||!1,r.cancelable,window,r.ctrlKey,r.altKey,r.shiftKey,r.metaKey,r.keyCode,r.charCode);break;default:s.initEvent(e,r.bubbles||!1,r.cancelable||!0)}Dc.defaults(s,i),t.dispatchEvent(s)},bind:function(t,e,n,i){var r=i||!1;return t.addEventListener?t.addEventListener(e,n,r):t.attachEvent&&t.attachEvent("on"+e,n),td},unbind:function(t,e,n,i){var r=i||!1;return t.removeEventListener?t.removeEventListener(e,n,r):t.detachEvent&&t.detachEvent("on"+e,n),td},addClass:function(t,e){if(void 0===t.className)t.className=e;else if(t.className!==e){var n=t.className.split(/ +/);-1===n.indexOf(e)&&(n.push(e),t.className=n.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return td},removeClass:function(t,e){if(e)if(t.className===e)t.removeAttribute("class");else{var n=t.className.split(/ +/),i=n.indexOf(e);-1!==i&&(n.splice(i,1),t.className=n.join(" "))}else t.className=void 0;return td},hasClass:function(t,e){return new RegExp("(?:^|\\s+)"+e+"(?:\\s+|$)").test(t.className)||!1},getWidth:function(t){var e=getComputedStyle(t);return Qc(e["border-left-width"])+Qc(e["border-right-width"])+Qc(e["padding-left"])+Qc(e["padding-right"])+Qc(e.width)},getHeight:function(t){var e=getComputedStyle(t);return Qc(e["border-top-width"])+Qc(e["border-bottom-width"])+Qc(e["padding-top"])+Qc(e["padding-bottom"])+Qc(e.height)},getOffset:function(t){var e=t,n={left:0,top:0};if(e.offsetParent)do{n.left+=e.offsetLeft,n.top+=e.offsetTop,e=e.offsetParent}while(e);return n},isActive:function(t){return t===document.activeElement&&(t.type||t.href)}},ed=function(t){function e(t,n){zc(this,e);var i=Xc(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),r=i;return i.__prev=i.getValue(),i.__checkbox=document.createElement("input"),i.__checkbox.setAttribute("type","checkbox"),td.bind(i.__checkbox,"change",(function(){r.setValue(!r.__prev)}),!1),i.domElement.appendChild(i.__checkbox),i.updateDisplay(),i}return Wc(e,t),jc(e,[{key:"setValue",value:function(t){var n=Vc(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(),n}},{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),Vc(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(Jc),nd=function(t){function e(t,n,i){zc(this,e);var r=Xc(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=i,s=r;if(r.__select=document.createElement("select"),Dc.isArray(o)){var a={};Dc.each(o,(function(t){a[t]=t})),o=a}return Dc.each(o,(function(t,e){var n=document.createElement("option");n.innerHTML=e,n.setAttribute("value",t),s.__select.appendChild(n)})),r.updateDisplay(),td.bind(r.__select,"change",(function(){var t=this.options[this.selectedIndex].value;s.setValue(t)})),r.domElement.appendChild(r.__select),r}return Wc(e,t),jc(e,[{key:"setValue",value:function(t){var n=Vc(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),n}},{key:"updateDisplay",value:function(){return td.isActive(this.__select)?this:(this.__select.value=this.getValue(),Vc(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this))}}]),e}(Jc),id=function(t){function e(t,n){zc(this,e);var i=Xc(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),r=i;function o(){r.setValue(r.__input.value)}return i.__input=document.createElement("input"),i.__input.setAttribute("type","text"),td.bind(i.__input,"keyup",o),td.bind(i.__input,"change",o),td.bind(i.__input,"blur",(function(){r.__onFinishChange&&r.__onFinishChange.call(r,r.getValue())})),td.bind(i.__input,"keydown",(function(t){13===t.keyCode&&this.blur()})),i.updateDisplay(),i.domElement.appendChild(i.__input),i}return Wc(e,t),jc(e,[{key:"updateDisplay",value:function(){return td.isActive(this.__input)||(this.__input.value=this.getValue()),Vc(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(Jc);function rd(t){var e=t.toString();return e.indexOf(".")>-1?e.length-e.indexOf(".")-1:0}var od=function(t){function e(t,n,i){zc(this,e);var r=Xc(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=i||{};return r.__min=o.min,r.__max=o.max,r.__step=o.step,Dc.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=rd(r.__impliedStep),r}return Wc(e,t),jc(e,[{key:"setValue",value:function(t){var n=t;return void 0!==this.__min&&n<this.__min?n=this.__min:void 0!==this.__max&&n>this.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),Vc(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,n)}},{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=rd(t),this}}]),e}(Jc);var sd=function(t){function e(t,n,i){zc(this,e);var r=Xc(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,i));r.__truncationSuspended=!1;var o=r,s=void 0;function a(){o.__onFinishChange&&o.__onFinishChange.call(o,o.getValue())}function u(t){var e=s-t.clientY;o.setValue(o.getValue()+e*o.__impliedStep),s=t.clientY}function l(){td.unbind(window,"mousemove",u),td.unbind(window,"mouseup",l),a()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),td.bind(r.__input,"change",(function(){var t=parseFloat(o.__input.value);Dc.isNaN(t)||o.setValue(t)})),td.bind(r.__input,"blur",(function(){a()})),td.bind(r.__input,"mousedown",(function(t){td.bind(window,"mousemove",u),td.bind(window,"mouseup",l),s=t.clientY})),td.bind(r.__input,"keydown",(function(t){13===t.keyCode&&(o.__truncationSuspended=!0,this.blur(),o.__truncationSuspended=!1,a())})),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return Wc(e,t),jc(e,[{key:"updateDisplay",value:function(){var t,n,i;return this.__input.value=this.__truncationSuspended?this.getValue():(t=this.getValue(),n=this.__precision,i=Math.pow(10,n),Math.round(t*i)/i),Vc(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(od);function ad(t,e,n,i,r){return i+(t-e)/(n-e)*(r-i)}var ud=function(t){function e(t,n,i,r,o){zc(this,e);var s=Xc(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,{min:i,max:r,step:o})),a=s;function u(t){t.preventDefault();var e=a.__background.getBoundingClientRect();return a.setValue(ad(t.clientX,e.left,e.right,a.__min,a.__max)),!1}function l(){td.unbind(window,"mousemove",u),td.unbind(window,"mouseup",l),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function h(t){var e=t.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(ad(e,n.left,n.right,a.__min,a.__max))}function c(){td.unbind(window,"touchmove",h),td.unbind(window,"touchend",c),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),td.bind(s.__background,"mousedown",(function(t){document.activeElement.blur(),td.bind(window,"mousemove",u),td.bind(window,"mouseup",l),u(t)})),td.bind(s.__background,"touchstart",(function(t){if(1!==t.touches.length)return;td.bind(window,"touchmove",h),td.bind(window,"touchend",c),h(t)})),td.addClass(s.__background,"slider"),td.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return Wc(e,t),jc(e,[{key:"updateDisplay",value:function(){var t=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*t+"%",Vc(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(od),ld=function(t){function e(t,n,i){zc(this,e);var r=Xc(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=r;return r.__button=document.createElement("div"),r.__button.innerHTML=void 0===i?"Fire":i,td.bind(r.__button,"click",(function(t){return t.preventDefault(),o.fire(),!1})),td.addClass(r.__button,"button"),r.domElement.appendChild(r.__button),r}return Wc(e,t),jc(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}(Jc),hd=function(t){function e(t,n){zc(this,e);var i=Xc(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));i.__color=new qc(i.getValue()),i.__temp=new qc(0);var r=i;i.domElement=document.createElement("div"),td.makeSelectable(i.domElement,!1),i.__selector=document.createElement("div"),i.__selector.className="selector",i.__saturation_field=document.createElement("div"),i.__saturation_field.className="saturation-field",i.__field_knob=document.createElement("div"),i.__field_knob.className="field-knob",i.__field_knob_border="2px solid ",i.__hue_knob=document.createElement("div"),i.__hue_knob.className="hue-knob",i.__hue_field=document.createElement("div"),i.__hue_field.className="hue-field",i.__input=document.createElement("input"),i.__input.type="text",i.__input_textShadow="0 1px 1px ",td.bind(i.__input,"keydown",(function(t){13===t.keyCode&&c.call(this)})),td.bind(i.__input,"blur",c),td.bind(i.__selector,"mousedown",(function(){td.addClass(this,"drag").bind(window,"mouseup",(function(){td.removeClass(r.__selector,"drag")}))})),td.bind(i.__selector,"touchstart",(function(){td.addClass(this,"drag").bind(window,"touchend",(function(){td.removeClass(r.__selector,"drag")}))}));var o,s=document.createElement("div");function a(t){f(t),td.bind(window,"mousemove",f),td.bind(window,"touchmove",f),td.bind(window,"mouseup",l),td.bind(window,"touchend",l)}function u(t){p(t),td.bind(window,"mousemove",p),td.bind(window,"touchmove",p),td.bind(window,"mouseup",h),td.bind(window,"touchend",h)}function l(){td.unbind(window,"mousemove",f),td.unbind(window,"touchmove",f),td.unbind(window,"mouseup",l),td.unbind(window,"touchend",l),d()}function h(){td.unbind(window,"mousemove",p),td.unbind(window,"touchmove",p),td.unbind(window,"mouseup",h),td.unbind(window,"touchend",h),d()}function c(){var t=kc(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 f(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=r.__saturation_field.getBoundingClientRect(),n=t.touches&&t.touches[0]||t,i=n.clientX,o=n.clientY,s=(i-e.left)/(e.right-e.left),a=1-(o-e.top)/(e.bottom-e.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function p(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=r.__hue_field.getBoundingClientRect(),n=1-((t.touches&&t.touches[0]||t).clientY-e.top)/(e.bottom-e.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return Dc.extend(i.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),Dc.extend(i.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:i.__field_knob_border+(i.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),Dc.extend(i.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),Dc.extend(i.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),Dc.extend(s.style,{width:"100%",height:"100%",background:"none"}),dd(s,"top","rgba(0,0,0,0)","#000"),Dc.extend(i.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(o=i.__hue_field).style.background="",o.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",o.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",Dc.extend(i.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:i.__input_textShadow+"rgba(0,0,0,0.7)"}),td.bind(i.__saturation_field,"mousedown",a),td.bind(i.__saturation_field,"touchstart",a),td.bind(i.__field_knob,"mousedown",a),td.bind(i.__field_knob,"touchstart",a),td.bind(i.__hue_field,"mousedown",u),td.bind(i.__hue_field,"touchstart",u),i.__saturation_field.appendChild(s),i.__selector.appendChild(i.__field_knob),i.__selector.appendChild(i.__saturation_field),i.__selector.appendChild(i.__hue_field),i.__hue_field.appendChild(i.__hue_knob),i.domElement.appendChild(i.__input),i.domElement.appendChild(i.__selector),i.updateDisplay(),i}return Wc(e,t),jc(e,[{key:"updateDisplay",value:function(){var t=kc(this.getValue());if(!1!==t){var e=!1;Dc.each(qc.COMPONENTS,(function(n){if(!Dc.isUndefined(t[n])&&!Dc.isUndefined(this.__color.__state[n])&&t[n]!==this.__color.__state[n])return e=!0,{}}),this),e&&Dc.extend(this.__color.__state,t)}Dc.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,i=255-n;Dc.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("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,dd(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),Dc.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+i+","+i+","+i+",.7)"})}}]),e}(Jc),cd=["-moz-","-o-","-webkit-","-ms-",""];function dd(t,e,n,i){t.style.background="",Dc.each(cd,(function(r){t.style.cssText+="background: "+r+"linear-gradient("+e+", "+n+" 0%, "+i+" 100%); "}))}var fd=function(t,e){var n=e||document,i=document.createElement("style");i.type="text/css",i.innerHTML=t;var r=n.getElementsByTagName("head")[0];try{r.appendChild(i)}catch(t){}},pd='<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>',md=function(t,e){var n=t[e];return Dc.isArray(arguments[2])||Dc.isObject(arguments[2])?new nd(t,e,arguments[2]):Dc.isNumber(n)?Dc.isNumber(arguments[2])&&Dc.isNumber(arguments[3])?Dc.isNumber(arguments[4])?new ud(t,e,arguments[2],arguments[3],arguments[4]):new ud(t,e,arguments[2],arguments[3]):Dc.isNumber(arguments[4])?new sd(t,e,{min:arguments[2],max:arguments[3],step:arguments[4]}):new sd(t,e,{min:arguments[2],max:arguments[3]}):Dc.isString(n)?new id(t,e):Dc.isFunction(n)?new ld(t,e,""):Dc.isBoolean(n)?new ed(t,e):null};var gd=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,1e3/60)},vd=function(){function t(){zc(this,t),this.backgroundElement=document.createElement("div"),Dc.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"}),td.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),Dc.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;td.bind(this.backgroundElement,"click",(function(){e.hide()}))}return jc(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(),Dc.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",td.unbind(t.domElement,"webkitTransitionEnd",e),td.unbind(t.domElement,"transitionend",e),td.unbind(t.domElement,"oTransitionEnd",e)};td.bind(this.domElement,"webkitTransitionEnd",e),td.bind(this.domElement,"transitionend",e),td.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-td.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-td.getHeight(this.domElement)/2+"px"}}]),t}();fd(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 .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 _d=function(){try{return!!window.localStorage}catch(t){return!1}}(),yd=void 0,xd=!0,bd=void 0,wd=!1,Sd=[],Td=function t(e){var n=this,i=e||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),td.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],i=Dc.defaults(i,{closeOnTop:!1,autoPlace:!0,width:t.DEFAULT_WIDTH}),i=Dc.defaults(i,{resizable:i.autoPlace,hideable:i.autoPlace}),Dc.isUndefined(i.load)?i.load={preset:"Default"}:i.preset&&(i.load.preset=i.preset),Dc.isUndefined(i.parent)&&i.hideable&&Sd.push(this),i.resizable=Dc.isUndefined(i.parent)&&i.resizable,i.autoPlace&&Dc.isUndefined(i.scrollable)&&(i.scrollable=!0);var r,o=_d&&"true"===localStorage.getItem(Rd(this,"isLocal")),s=void 0,a=void 0;if(Object.defineProperties(this,{parent:{get:function(){return i.parent}},scrollable:{get:function(){return i.scrollable}},autoPlace:{get:function(){return i.autoPlace}},closeOnTop:{get:function(){return i.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:i.load.preset},set:function(t){n.parent?n.getRoot().preset=t:i.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),n.revert()}},width:{get:function(){return i.width},set:function(t){i.width=t,Nd(n,t)}},name:{get:function(){return i.name},set:function(t){i.name=t,a&&(a.innerHTML=i.name)}},closed:{get:function(){return i.closed},set:function(e){i.closed=e,i.closed?td.addClass(n.__ul,t.CLASS_CLOSED):td.removeClass(n.__ul,t.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=e?t.TEXT_OPEN:t.TEXT_CLOSED)}},load:{get:function(){return i.load}},useLocalStorage:{get:function(){return o},set:function(t){_d&&(o=t,t?td.bind(window,"unload",s):td.unbind(window,"unload",s),localStorage.setItem(Rd(n,"isLocal"),t))}}}),Dc.isUndefined(i.parent)){if(this.closed=i.closed||!1,td.addClass(this.domElement,t.CLASS_MAIN),td.makeSelectable(this.domElement,!1),_d&&o){n.useLocalStorage=!0;var u=localStorage.getItem(Rd(this,"gui"));u&&(i.load=JSON.parse(u))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=t.TEXT_CLOSED,td.addClass(this.__closeButton,t.CLASS_CLOSE_BUTTON),i.closeOnTop?(td.addClass(this.__closeButton,t.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(td.addClass(this.__closeButton,t.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),td.bind(this.__closeButton,"click",(function(){n.closed=!n.closed}))}else{void 0===i.closed&&(i.closed=!0);var l=document.createTextNode(i.name);td.addClass(l,"controller-name"),a=Ed(n,l);td.addClass(this.__ul,t.CLASS_CLOSED),td.addClass(a,"title"),td.bind(a,"click",(function(t){return t.preventDefault(),n.closed=!n.closed,!1})),i.closed||(this.closed=!1)}i.autoPlace&&(Dc.isUndefined(i.parent)&&(xd&&(bd=document.createElement("div"),td.addClass(bd,"dg"),td.addClass(bd,t.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(bd),xd=!1),bd.appendChild(this.domElement),td.addClass(this.domElement,t.CLASS_AUTO_PLACE)),this.parent||Nd(n,i.width)),this.__resizeHandler=function(){n.onResizeDebounced()},td.bind(window,"resize",this.__resizeHandler),td.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),td.bind(this.__ul,"transitionend",this.__resizeHandler),td.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),i.resizable&&Dd(this),s=function(){_d&&"true"===localStorage.getItem(Rd(n,"isLocal"))&&localStorage.setItem(Rd(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=s,i.parent||((r=n.getRoot()).width+=1,Dc.defer((function(){r.width-=1})))};function Ed(t,e,n){var i=document.createElement("li");return e&&i.appendChild(e),n?t.__ul.insertBefore(i,n):t.__ul.appendChild(i),t.onResize(),i}function Md(t){td.unbind(window,"resize",t.__resizeHandler),t.saveToLocalStorageIfPossible&&td.unbind(window,"unload",t.saveToLocalStorageIfPossible)}function Ad(t,e){var n=t.__preset_select[t.__preset_select.selectedIndex];n.innerHTML=e?n.value+"*":n.value}function Pd(t,e){var n=t.getRoot(),i=n.__rememberedObjects.indexOf(e.object);if(-1!==i){var r=n.__rememberedObjectIndecesToControllers[i];if(void 0===r&&(r={},n.__rememberedObjectIndecesToControllers[i]=r),r[e.property]=e,n.load&&n.load.remembered){var o=n.load.remembered,s=void 0;if(o[t.preset])s=o[t.preset];else{if(!o.Default)return;s=o.Default}if(s[i]&&void 0!==s[i][e.property]){var a=s[i][e.property];e.initialValue=a,e.setValue(a)}}}}function Cd(t,e,n,i){if(void 0===e[n])throw new Error('Object "'+e+'" has no property "'+n+'"');var r=void 0;if(i.color)r=new hd(e,n);else{var o=[e,n].concat(i.factoryArgs);r=md.apply(t,o)}i.before instanceof Jc&&(i.before=i.before.__li),Pd(t,r),td.addClass(r.domElement,"c");var s=document.createElement("span");td.addClass(s,"property-name"),s.innerHTML=r.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(r.domElement);var u=Ed(t,a,i.before);return td.addClass(u,Td.CLASS_CONTROLLER_ROW),r instanceof hd?td.addClass(u,"color"):td.addClass(u,Hc(r.getValue())),function(t,e,n){if(n.__li=e,n.__gui=t,Dc.extend(n,{options:function(e){if(arguments.length>1){var i=n.__li.nextElementSibling;return n.remove(),Cd(t,n.object,n.property,{before:i,factoryArgs:[Dc.toArray(arguments)]})}if(Dc.isArray(e)||Dc.isObject(e)){var r=n.__li.nextElementSibling;return n.remove(),Cd(t,n.object,n.property,{before:r,factoryArgs:[e]})}},name:function(t){return n.__li.firstElementChild.firstElementChild.innerHTML=t,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof ud){var i=new sd(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});Dc.each(["updateDisplay","onChange","onFinishChange","step","min","max"],(function(t){var e=n[t],r=i[t];n[t]=i[t]=function(){var t=Array.prototype.slice.call(arguments);return r.apply(i,t),e.apply(n,t)}})),td.addClass(e,"has-slider"),n.domElement.insertBefore(i.domElement,n.domElement.firstElementChild)}else if(n instanceof sd){var r=function(e){if(Dc.isNumber(n.__min)&&Dc.isNumber(n.__max)){var i=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var o=Cd(t,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return o.name(i),r&&o.listen(),o}return e};n.min=Dc.compose(r,n.min),n.max=Dc.compose(r,n.max)}else n instanceof ed?(td.bind(e,"click",(function(){td.fakeEvent(n.__checkbox,"click")})),td.bind(n.__checkbox,"click",(function(t){t.stopPropagation()}))):n instanceof ld?(td.bind(e,"click",(function(){td.fakeEvent(n.__button,"click")})),td.bind(e,"mouseover",(function(){td.addClass(n.__button,"hover")})),td.bind(e,"mouseout",(function(){td.removeClass(n.__button,"hover")}))):n instanceof hd&&(td.addClass(e,"color"),n.updateDisplay=Dc.compose((function(t){return e.style.borderLeftColor=n.__color.toString(),t}),n.updateDisplay),n.updateDisplay());n.setValue=Dc.compose((function(e){return t.getRoot().__preset_select&&n.isModified()&&Ad(t.getRoot(),!0),e}),n.setValue)}(t,u,r),t.__controllers.push(r),r}function Rd(t,e){return document.location.href+"."+e}function Id(t,e,n){var i=document.createElement("option");i.innerHTML=e,i.value=e,t.__preset_select.appendChild(i),n&&(t.__preset_select.selectedIndex=t.__preset_select.length-1)}function Ld(t,e){e.style.display=t.useLocalStorage?"block":"none"}function Od(t){var e=t.__save_row=document.createElement("li");td.addClass(t.domElement,"has-save"),t.__ul.insertBefore(e,t.__ul.firstChild),td.addClass(e,"save-row");var n=document.createElement("span");n.innerHTML=" ",td.addClass(n,"button gears");var i=document.createElement("span");i.innerHTML="Save",td.addClass(i,"button"),td.addClass(i,"save");var r=document.createElement("span");r.innerHTML="New",td.addClass(r,"button"),td.addClass(r,"save-as");var o=document.createElement("span");o.innerHTML="Revert",td.addClass(o,"button"),td.addClass(o,"revert");var s=t.__preset_select=document.createElement("select");if(t.load&&t.load.remembered?Dc.each(t.load.remembered,(function(e,n){Id(t,n,n===t.preset)})):Id(t,"Default",!1),td.bind(s,"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(s),e.appendChild(n),e.appendChild(i),e.appendChild(r),e.appendChild(o),_d){var a=document.getElementById("dg-local-explain"),u=document.getElementById("dg-local-storage");document.getElementById("dg-save-locally").style.display="block","true"===localStorage.getItem(Rd(0,"isLocal"))&&u.setAttribute("checked","checked"),Ld(t,a),td.bind(u,"change",(function(){t.useLocalStorage=!t.useLocalStorage,Ld(t,a)}))}var l=document.getElementById("dg-new-constructor");td.bind(l,"keydown",(function(t){!t.metaKey||67!==t.which&&67!==t.keyCode||yd.hide()})),td.bind(n,"click",(function(){l.innerHTML=JSON.stringify(t.getSaveObject(),void 0,2),yd.show(),l.focus(),l.select()})),td.bind(i,"click",(function(){t.save()})),td.bind(r,"click",(function(){var e=prompt("Enter a new preset name.");e&&t.saveAs(e)})),td.bind(o,"click",(function(){t.revert()}))}function Dd(t){var e=void 0;function n(n){return n.preventDefault(),t.width+=e-n.clientX,t.onResize(),e=n.clientX,!1}function i(){td.removeClass(t.__closeButton,Td.CLASS_DRAG),td.unbind(window,"mousemove",n),td.unbind(window,"mouseup",i)}function r(r){return r.preventDefault(),e=r.clientX,td.addClass(t.__closeButton,Td.CLASS_DRAG),td.bind(window,"mousemove",n),td.bind(window,"mouseup",i),!1}t.__resize_handle=document.createElement("div"),Dc.extend(t.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),td.bind(t.__resize_handle,"mousedown",r),td.bind(t.__closeButton,"mousedown",r),t.domElement.insertBefore(t.__resize_handle,t.domElement.firstElementChild)}function Nd(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 Fd(t,e){var n={};return Dc.each(t.__rememberedObjects,(function(i,r){var o={},s=t.__rememberedObjectIndecesToControllers[r];Dc.each(s,(function(t,n){o[n]=e?t.initialValue:t.getValue()})),n[r]=o})),n}Td.toggleHide=function(){wd=!wd,Dc.each(Sd,(function(t){t.domElement.style.display=wd?"none":""}))},Td.CLASS_AUTO_PLACE="a",Td.CLASS_AUTO_PLACE_CONTAINER="ac",Td.CLASS_MAIN="main",Td.CLASS_CONTROLLER_ROW="cr",Td.CLASS_TOO_TALL="taller-than-window",Td.CLASS_CLOSED="closed",Td.CLASS_CLOSE_BUTTON="close-button",Td.CLASS_CLOSE_TOP="close-top",Td.CLASS_CLOSE_BOTTOM="close-bottom",Td.CLASS_DRAG="drag",Td.DEFAULT_WIDTH=245,Td.TEXT_CLOSED="Close Controls",Td.TEXT_OPEN="Open Controls",Td._keydownHandler=function(t){"text"===document.activeElement.type||72!==t.which&&72!==t.keyCode||Td.toggleHide()},td.bind(window,"keydown",Td._keydownHandler,!1),Dc.extend(Td.prototype,{add:function(t,e){return Cd(this,t,e,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(t,e){return Cd(this,t,e,{color:!0})},remove:function(t){this.__ul.removeChild(t.__li),this.__controllers.splice(this.__controllers.indexOf(t),1);var e=this;Dc.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&&bd.removeChild(this.domElement);var t=this;Dc.each(this.__folders,(function(e){t.removeFolder(e)})),td.unbind(window,"keydown",Td._keydownHandler,!1),Md(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 n=new Td(e);this.__folders[t]=n;var i=Ed(this,n.domElement);return td.addClass(i,"folder"),n},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],Md(t);var e=this;Dc.each(t.__folders,(function(e){t.removeFolder(e)})),Dc.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=td.getOffset(t.__ul).top,n=0;Dc.each(t.__ul.childNodes,(function(e){t.autoPlace&&e===t.__save_row||(n+=td.getHeight(e))})),window.innerHeight-e-20<n?(td.addClass(t.domElement,Td.CLASS_TOO_TALL),t.__ul.style.height=window.innerHeight-e-20+"px"):(td.removeClass(t.domElement,Td.CLASS_TOO_TALL),t.__ul.style.height="auto")}t.__resize_handle&&Dc.defer((function(){t.__resize_handle.style.height=t.__ul.offsetHeight+"px"})),t.__closeButton&&(t.__closeButton.style.width=t.width+"px")},onResizeDebounced:Dc.debounce((function(){this.onResize()}),50),remember:function(){if(Dc.isUndefined(yd)&&((yd=new vd).domElement.innerHTML=pd),this.parent)throw new Error("You can only call remember on a top level GUI.");var t=this;Dc.each(Array.prototype.slice.call(arguments),(function(e){0===t.__rememberedObjects.length&&Od(t),-1===t.__rememberedObjects.indexOf(e)&&t.__rememberedObjects.push(e)})),this.autoPlace&&Nd(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]=Fd(this)),t.folders={},Dc.each(this.__folders,(function(e,n){t.folders[n]=e.getSaveObject()})),t},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=Fd(this),Ad(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(t){this.load.remembered||(this.load.remembered={},this.load.remembered.Default=Fd(this,!0)),this.load.remembered[t]=Fd(this),this.preset=t,Id(this,t,!0),this.saveToLocalStorageIfPossible()},revert:function(t){Dc.each(this.__controllers,(function(e){this.getRoot().load.remembered?Pd(t||this.getRoot(),e):e.setValue(e.initialValue),e.__onFinishChange&&e.__onFinishChange.call(e,e.getValue())}),this),Dc.each(this.__folders,(function(t){t.revert(t)})),t||Ad(this.getRoot(),!1)},listen:function(t){var e=0===this.__listening.length;this.__listening.push(t),e&&function t(e){0!==e.length&&gd.call(window,(function(){t(e)}));Dc.each(e,(function(t){t.updateDisplay()}))}(this.__listening)},updateDisplay:function(){Dc.each(this.__controllers,(function(t){t.updateDisplay()})),Dc.each(this.__folders,(function(t){t.updateDisplay()}))}});var Bd=Td,kd=function(){function t(t){this.runTime={fps:0,resolution:""},this.target=t.target,this.data=t.params,this.player=t.player,this.gui=this.createControllerGUI(),this.createStats(),this.addEventListener()}return t.prototype.createStats=function(){var t=this;this.stateId=setInterval((function(){t.player.view&&(t.controller.runTimeFps.setValue(t.player.runtime.fps),t.controller.runTimeResolution.setValue(t.player.view.width+"*"+t.player.view.height))}),500)},t.prototype.createControllerGUI=function(){var t,e,n,i,r,o=new Bd({autoPlace:!0,closed:!0});return o.domElement.style.opacity=".6",o.domElement.style.transformOrigin="100% 0",o.domElement.style.transform="scale(1.4)",this.target.appendChild(o.domElement),o.domElement.style.position="absolute",o.domElement.style.right="0",o.domElement.style.top="0",o.domElement.style.zIndex="2",this.controller={runTimeFps:o.add({FPS:0},"FPS",0),runTimeResolution:o.add({"分辨率":""},"分辨率",""),autoResolution:o.add({"自动分辨率":null!==(t=this.data.autoResolution)&&void 0!==t&&t},"自动分辨率",!0),autoFps:o.add({"自动fps":null===(e=this.data.autoFPS)||void 0===e||e},"自动fps",!0),moreCalculation:o.add({"额外计算":0},"额外计算",0,100),minFPS:o.add({"最低fps":null!==(n=this.data.minFPS)&&void 0!==n?n:40},"最低fps",0,60),maxFPS:o.add({"最高fps":null!==(i=this.data.maxFPS)&&void 0!==i?i:50},"最高fps",0,60),resolution:o.add({"目标分辨倍率":null!==(r=this.data.resolution)&&void 0!==r?r:window.devicePixelRatio},"目标分辨倍率",.5,4)},this.controller.runTimeFps.disabled=!0,this.controller.runTimeResolution.disabled=!0,o},t.prototype.addEventListener=function(){var t,e=this;this.controller.autoFps.onChange((function(t){e.data.autoFPS=t,e.player.updateConfig(e.data)})),this.controller.maxFPS.onChange((function(t){e.data.maxFPS=t,e.player.updateConfig(e.data)})),this.controller.minFPS.onChange((function(t){e.data.minFPS=t,e.player.updateConfig(e.data)})),this.controller.autoResolution.onChange((function(t){e.data.autoResolution=t,e.player.updateConfig(e.data)})),this.controller.resolution.onChange((function(t){e.data.resolution=t,e.player.updateConfig(e.data)})),this.controller.moreCalculation.onChange((function(n){t&&e.player.app.ticker.remove(t),n>0&&(t=function(){for(var t="";t.length<8e3*n;)t+=Math.random().toString(32).substr(2);Au()(t)},e.player.app.ticker.add(t))}))},t.prototype.destroy=function(){try{window.clearInterval(this.stateId),this.target.removeChild(this.gui.domElement),this.gui.destroy()}catch(t){}},t}(),Ud=function(){function t(t){var e=this;this.tasks=[],this.schedule=function(){var t=e.tasks[0];t?e.fn(t).then((function(){e.tasks.splice(0,1),window.requestAnimationFrame(e.schedule)})):window.requestAnimationFrame(e.schedule)},this.fn=t,this.schedule()}return t.prototype.addTask=function(t){this.tasks.push(t)},t}(),Gd=function(){function t(){this.autoUnlock=Object.create(null),this.locks=Object.create(null)}return t.prototype.addLock=function(t,e){var n=this;this.locks[t]=e,this.autoUnlock[t]=window.setTimeout((function(){delete n.locks[t]}),3e3)},t.prototype.unlock=function(t,e){e&&this.locks[t]&&this.locks[t]===e&&(window.clearTimeout(this.autoUnlock[t]),delete this.locks[t])},t.prototype.isLocked=function(t){return!!this.locks[t]},t}(),Hd=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),zd=function(){return(zd=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},jd=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))},Vd=function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};window.__slide_local_logger__||(window.__slide_local_logger__=r.createInstance({name:"_slide_local_log_",driver:r.INDEXEDDB,version:1}));var Wd=window.__slide_local_logger__,Xd=window.ResizeObserver||Mc,qd=function(t){return new Promise((function(e){return setTimeout(e,t)}))};function Yd(t,e){return jd(this,void 0,void 0,(function(){var n;return Vd(this,(function(i){switch(i.label){case 0:n=Date.now(),i.label=1;case 1:return!t()&&Date.now()-n<e?[4,qd(50)]:[3,3];case 2:return i.sent(),[3,1];case 3:return[2]}}))}))}var Zd={syncDispatch:"syncDispatch",syncReceive:"syncReceive",renderStart:"renderStart",renderEnd:"renderEnd",renderError:"renderError",slideChange:"slideChange",mainSeqStepStart:"mainSeqStepStart",mainSeqStepEnd:"mainSeqStepEnd",animateStart:"animateStart",animateEnd:"animateEnd",stateChange:"stateChange"},Jd={taskId:"",url:"",currentSlideIndex:-1,mainSeqStep:-1,mainSeqState:null,mediaState:Object.create(null),interactiveSeqState:Object.create(null)},Kd=function(t){function e(e){var n=t.call(this)||this;return n.__slideState=Object(a.cloneDeep)(Jd),n.resize=!1,n.isAnimating=!1,n.renderingTaskManager=new Rc,n.isLoading=!1,n.interactive=!0,n.frameWidth=1,n.frameHeight=1,n.frame=document.createElement("div"),n.medianController=document.createElement("div"),n.frameResizeObserver=new Xd((function(){return n.frameResizeHandler()})),n.timestamp=function(){return Date.now()},n.mode="local",n.log="",n.logId="",n.lastEmitedState=null,n.playerController=null,n.lock=new Gd,n.isInitResized=!1,n.cacheImage=document.createElement("img"),n.isFrowning=!1,n.isReleasing=!1,n.designWidth=0,n.designHeight=0,n._slideCount=0,n.persistLog=function(){return jd(n,void 0,void 0,(function(){var t,e;return Vd(this,(function(n){switch(n.label){case 0:if(!Wd||!this.logId)return[3,5];n.label=1;case 1:return n.trys.push([1,4,,5]),t=this.log,[4,Wd.getItem(this.logId)];case 2:return e=n.sent()||"",[4,Wd.setItem(this.logId,e+t)];case 3:return n.sent(),this.log="",[3,5];case 4:return n.sent(),[3,5];case 5:return[2]}}))}))},n.handleSlideRef=function(){console.log(n)},n.handleSlideStateLog=function(){console.log(n.logId),console.log(JSON.stringify(n.slideState,null,2))},n.handleLogDownload=function(){return jd(n,void 0,void 0,(function(){var t,e,n;return Vd(this,(function(i){switch(i.label){case 0:return t="",Wd?(e=t,[4,Wd.getItem(this.logId)]):[3,2];case 1:t=e+(i.sent()||""),i.label=2;case 2:return t+=this.log,(n=document.createElement("a")).setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(t)),n.setAttribute("download",this.logId),n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n),[2]}}))}))},n.receiveSyncHandler=function(t){return jd(n,void 0,void 0,(function(){var e,n,i,r,o=this;return Vd(this,(function(s){switch(s.label){case 0:return this.log+="=== sync receive ["+(new Date).toISOString()+"] ===\n",this.log+=JSON.stringify(t,null,2),this.log+="\n\n","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(){o.doNextStep()}))):this.doNextStep(),[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():(this.setMainSeqStep(t.next+1,"start"),null===(e=this.player)||void 0===e||e.nextTick((function(){o.doPrevStep()}))),[3,6]);case 2:return"interactiveAnim"!==t.type?[3,3]:(this.player?this.player.applyInteractiveAction(t.seqId):this.__slideState.interactiveSeqState[t.seqId].step+=1,[3,6]);case 3:return"renderSlide"!==t.type?[3,5]:[4,this.doRenderSlide(t.index,t.isForward)];case 4:return s.sent(),[3,6];case 5:"mediaPlay"===t.type?(null===(n=this.player)||void 0===n||n.setMediaState(t.id,!0),this.__slideState.mediaState[t.id]=t.state):"mediaPause"===t.type?(null===(i=this.player)||void 0===i||i.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),s.label=6;case 6:return[2]}}))}))},n.handlePrevSlide=function(){return jd(n,void 0,void 0,(function(){var t;return Vd(this,(function(e){return this.player?((t=this.player.currentIndex-1)>=1&&this.renderSlide(t,!1),[2]):[2]}))}))},n.handleNextSlide=function(){return jd(n,void 0,void 0,(function(){var t;return Vd(this,(function(e){return this.player?((t=this.player.currentIndex+1)<=this.slideCount&&this.renderSlide(t,!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)},e.timestamp&&(n.timestamp=e.timestamp),n.config=e,n.syncQueue=new Ud(n.receiveSyncHandler),n.mode=e.mode,n.anchor=e.anchor,n.resize=e.resize||!1,n.interactive=e.interactive,n.frame.style.cssText="width:100%;height:100%;display:flex;justify-content:center;align-items:center;visibility:hidden;",n.setMedianControllerAttribute(),n.frame.appendChild(n.medianController),n.anchor.appendChild(n.frame),n.frameResizeObserver.observe(n.frame),n.on(Zd.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;n.emit(Zd.renderError,{error:e,index:i.slideIndex})})),window.addEventListener("__slide_log__",n.handleLogDownload),window.addEventListener("__slide_state__",n.handleSlideStateLog),window.addEventListener("__slide_ref__",n.handleSlideRef),n.persistLogId=window.setInterval(n.persistLog,5e3),n.resizeView=Object(a.debounce)(n.resizeView.bind(n),50),n.initPlayer(e),n}return Hd(e,t),e.prototype.initPlayer=function(t){var e=this;this.player=new Gh(this.mode),this.player.setInteractive(this.interactive),this.player.updateConfig(t.renderOptions||{}),this.player.view&&this.frame.appendChild(this.player.view),this.player.on(Uh.renderStart,(function(t){e.isLoading=!0,e.emit(Zd.renderStart,t)})),this.player.on(Uh.renderEnd,(function(t){e.isLoading=!1,e.player&&(e.designHeight=e.player.designHeight,e.designWidth=e.player.designWidth,e.cacheImage.style.width=e.player.designWidth+"px",e.cacheImage.style.height=e.player.designHeight+"px",e._slideCount=e.player.slideCount),e.emit(Zd.renderEnd,t)})),this.player.on(Uh.slideChange,(function(t){e.__slideState.currentSlideIndex=t,e.emit(Zd.slideChange,t)})),this.player.on(Uh.mainSeqStateChange,(function(t){e.__slideState.mainSeqState=t,e.emitStateChange()})),this.player.on(Uh.mainSeqStepChange,(function(t){e.__slideState.mainSeqStep=t,e.emitStateChange()})),this.player.on(Uh.interactiveSeqStateChange,(function(t){var n=t.id,i=t.state;e.__slideState.interactiveSeqState[n]=i,e.emitStateChange()})),this.player.on(Uh.animateStart,(function(){!0!==e.isAnimating&&(e.isAnimating=!0,e.emit(Zd.animateStart))})),this.player.on(Uh.animateEnd,(function(){!1!==e.isAnimating&&(e.isAnimating=!1,e.emit(Zd.animateEnd))})),this.player.on(Uh.interactiveSeqNext,(function(t){e.emitSyncDispatch({slideIndex:e.__slideState.currentSlideIndex,type:"interactiveAnim",seqId:t}),e.emitStateChange()})),this.player.on(Uh.mainSeqStepStart,(function(t){e.emit(Zd.mainSeqStepStart,t)})),this.player.on(Uh.mainSeqStepEnd,(function(t){e.emit(Zd.mainSeqStepEnd,t)})),this.player.on(Uh.mediaPlay,(function(t){var n={type:"play",time:e.timestamp()-1e3*t.time};e.__slideState.mediaState[t.id]=n,e.emitSyncDispatch({slideIndex:e.__slideState.currentSlideIndex,type:"mediaPlay",id:t.id,state:n}),e.emitStateChange()})),this.player.on(Uh.mediaPause,(function(t){var n={type:"pause",time:t.time};e.__slideState.mediaState[t.id]=n,e.emitSyncDispatch({slideIndex:e.__slideState.currentSlideIndex,type:"mediaPause",id:t.id,state:n}),e.emitStateChange()})),this.player.on(Uh.mediaSeek,(function(t){var n={type:"pause",time:0};t.isPlaying?(n.type="play",e.__slideState.mediaState[t.id]?n.time=e.__slideState.mediaState[t.id].time-1e3*t.time:n.time=e.timestamp()-1e3*t.time,e.__slideState.mediaState[t.id]=n):(n.type="pause",n.time=t.time,e.__slideState.mediaState[t.id]=n),e.emitSyncDispatch({slideIndex:e.__slideState.currentSlideIndex,type:"mediaSeek",id:t.id,time:t.time,state:n}),e.emitStateChange()})),this.player.on(Uh.requestPrevSlide,this.handlePrevSlide),this.player.on(Uh.requestNextSlide,this.handleNextSlide),this.player.on(Uh.requestGotoSlide,this.handleGotoSlide),(null==t?void 0:t.controller)&&this.createController()},e.prototype.createController=function(){this.player&&(this.playerController=new kd({player:this.player,params:this.player.config||{},target:this.frame}))},e.prototype.setMedianControllerAttribute=function(){this.medianController.id="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(){var t=this.frame.getBoundingClientRect(),e=t.width,n=t.height;this.frameWidth=e,this.frameHeight=n,this.resizeView()},e.prototype.resizeView=function(){var t,e,n=this,i=this.width,r=this.height;if(i>0&&r>0){var o=this.frameWidth/i,s=o*r;s>this.frameHeight&&(o*=this.frameHeight/s),null===(t=this.player)||void 0===t||t.scaleView(o,this.resize),this.cacheImage.style.transform="scale("+o+")",this.medianController.style.transform="scale("+o+")",this.medianController.style.top=(this.frameHeight-r*o)/2+"px",this.medianController.setAttribute("data-scale",o.toString()),this.isInitResized||(this.isInitResized=!0,null===(e=this.player)||void 0===e||e.clock.setTimeout((function(){n.frame.style.visibility="visible"}),32))}},e.prototype.setSlideState=function(t){var e,n,i;return jd(this,void 0,void 0,(function(){var r,o=this;return Vd(this,(function(s){switch(s.label){case 0:return this.log+="=== stateChange receive ["+(new Date).toISOString()+"] ===\n",this.log+=JSON.stringify(t,null,2),this.log+="\n\n",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===(n=this.player)||void 0===n||n.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:s.sent(),s.label=2;case 2:return[4,null===(i=this.player)||void 0===i?void 0:i.clock.waitUntil((function(){var e,n;return(null===(e=o.player)||void 0===e?void 0:e.currentIndex)===t.currentSlideIndex&&(null===(n=o.player)||void 0===n?void 0:n.currentStage)}),3e3)];case 3:return s.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),[2]}}))}))},e.prototype.initInteractiveSeq=function(t){var e;for(var n in t.interactiveSeqState){var i=t.interactiveSeqState[n];null===(e=this.player)||void 0===e||e.setInteractiveSeqState(n,i.step,"end"===i.state?"end":"start")}},e.prototype.initMedia=function(t){var e,n,i=this,r=function(r){var s=t.mediaState[r],a=o.__slideState.mediaState[r];if(a&&s.type===a.type&&s.time===a.time)return"continue";"play"===s.type?null===(e=o.player)||void 0===e||e.setMediaState(r,!0).then((function(){var t,e=i.timestamp();null===(t=i.player)||void 0===t||t.setMediaCurrentTime(r,(e-s.time)/1e3)})):null===(n=o.player)||void 0===n||n.setMediaState(r,!1).then((function(){var t;null===(t=i.player)||void 0===t||t.setMediaCurrentTime(r,s.time)}))},o=this;for(var s in t.mediaState)r(s)},Object.defineProperty(e.prototype,"slideCount",{get:function(){return this._slideCount},enumerable:!1,configurable:!0}),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 n;null===(n=this.player)||void 0===n||n.setResourceData(t,e),this.__slideState.taskId=t,this.__slideState.url=e,this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"setResource",taskId:t,url:e}),this.logId=t+"-"+Math.random().toString(32).substr(2)},e.prototype._renderSlide=function(t){var e;return jd(this,void 0,void 0,(function(){return Vd(this,(function(n){switch(n.label){case 0:return this.isLoading=!0,[4,null===(e=this.player)||void 0===e?void 0:e.renderSlide(t)];case 1:return n.sent(),this.__slideState.currentSlideIndex=t,this.isLoading=!1,this.resizeView(),this.emitStateChange(),[2]}}))}))},e.prototype.renderSlide=function(t,e){if(void 0===e&&(e=!0),this.player){this.isLoading=!0;var n=Number(t);(n!==this.player.currentIndex||this.renderingTaskManager.hasStartTask())&&(n>this.slideCount&&this.slideCount>0||("interactive"===this.mode?this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:n,isForward:e}):"sync"===this.mode?(this.doRenderSlide(n,e),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:n,isForward:e})):this.doRenderSlide(n,e)))}},e.prototype.doRenderSlide=function(t,e){var n=this;if(void 0===e&&(e=!0),!this.player)return Promise.resolve();var i=Math.random().toString(32).substr(2);return this.player.isForward=e,this.renderingTaskManager.addTask((function(){return n._renderSlide(t)}),t,i),new Promise((function(t){n.renderingTaskManager.eventHub.once("task-end-"+i,t)}))},e.prototype.nextStep=function(){!this.isLoading&&this.player&&(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())},e.prototype.doNextStep=function(){if(this.player){this.player.nextStep();var t=this.player.mainSeqStep();this.__slideState.mainSeqStep=t,this.emitStateChange()}},e.prototype.prevStep=function(){!this.isLoading&&this.player&&(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())},e.prototype.doPrevStep=function(){if(this.player){this.player.prevStep();var t=this.player.mainSeqStep();this.__slideState.mainSeqStep=t,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){var t=this.slideState;!Object(a.isEqual)(this.lastEmitedState,t)&&this.isSlideStateReady(t)&&(this.lastEmitedState=t,this.emit(Zd.stateChange,t),this.log+="=== stateChange dispatch ["+(new Date).toISOString()+"] ===\n",this.log+=JSON.stringify(this.slideState,null,2),this.log+="\n\n")}},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),this.emit(Zd.syncDispatch,zd(zd({},t),{uuid:e})),this.log+="=== sync dispatch ["+(new Date).toISOString()+"] ===\n",this.log+=JSON.stringify(t,null,2),this.log+="\n\n"}},e.prototype.setMainSeqStep=function(t,e){var n;null===(n=this.player)||void 0===n||n.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.getPreviewImage=function(t){var e;return jd(this,void 0,void 0,(function(){return Vd(this,(function(n){return[2,(null===(e=this.player)||void 0===e?void 0:e.getPreviewImage(t))||null]}))}))},e.prototype.frozen=function(){var t;return jd(this,void 0,void 0,(function(){var e,n,i,r=this;return Vd(this,(function(o){switch(o.label){case 0:return this.isFrowning?[2,Yd((function(){return!r.isFrowning}),6e4)]:this.view&&this.player?(this.isFrowning=!0,[4,this.player.clock.waitUntil((function(){return!r.isLoading}),6e4)]):[3,2];case 1:for(n in o.sent(),e=this.player.getSnapshot()||"",this.cacheImage.src=e,this.cacheImage.style.position="absolute",this.cacheImage.style.zIndex="999",this.frame.appendChild(this.cacheImage),this.player.destroy(),null===(t=this.playerController)||void 0===t||t.destroy(),this.player=void 0,this.__slideState.mediaState)i=this.__slideState.mediaState[n],this.__slideState.mediaState[n]=zd(zd({},i),{frozenTime:this.timestamp()});this.isFrowning=!1,o.label=2;case 2:return[2]}}))}))},e.prototype.release=function(){var t;return jd(this,void 0,void 0,(function(){var e,n,i,r,o=this;return Vd(this,(function(s){switch(s.label){case 0:if(this.isReleasing)return[2,Yd((function(){return!o.isReleasing}),6e4)];for(n in this.isReleasing=!0,this.initPlayer(this.config),this.player.view&&(this.player.view.style.visibility="hidden"),e=this.__slideState,this.__slideState=Object(a.cloneDeep)(Jd),e.mediaState)"play"===(i=e.mediaState[n]).type&&(r=Math.max(null!==(t=i.frozenTime)&&void 0!==t?t:0,i.time),i.time=this.timestamp()-(r-i.time),i.frozenTime=void 0);return[4,this.setSlideState(e)];case 1:return s.sent(),[4,this.player.clock.delay(333)];case 2:s.sent(),this.player.view&&(this.player.view.style.visibility="visible");try{this.frame.removeChild(this.cacheImage)}catch(t){}return this.isReleasing=!1,[2]}}))}))},e.prototype.destroy=function(){var t,e,n,i;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===(n=this.player)||void 0===n||n.removeAllListeners(),window.removeEventListener("__slide_log__",this.handleLogDownload),window.removeEventListener("__slide_state__",this.handleSlideStateLog),window.removeEventListener("__slide_ref__",this.handleSlideRef),window.clearInterval(this.persistLogId),Wd&&Wd.removeItem(this.logId).catch((function(){}));try{(null===(i=this.player)||void 0===i?void 0:i.view)&&this.anchor.removeChild(this.player.view)}catch(t){}},e}(s.a)}]);
|
|
274
|
+
*/qi.registerPlugin("accessibility",ke),qi.registerPlugin("extract",dr),qi.registerPlugin("interaction",Ze),qi.registerPlugin("particle",No),qi.registerPlugin("prepare",Us),qi.registerPlugin("batch",ir),qi.registerPlugin("tilingSprite",qs),Fr.registerPlugin(pa),Fr.registerPlugin(Yr),Fr.registerPlugin(fo),Fr.registerPlugin(Co),Fr.registerPlugin(Hs),lr.registerPlugin(He),lr.registerPlugin(Ur);var ru={AlphaFilter:ga,BlurFilter:Ga,BlurFilterPass:Ua,ColorMatrixFilter:za,DisplacementFilter:Va,FXAAFilter:Xa,NoiseFilter:Ya};class ou{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 su{constructor(t){this.target=t}applyCommand(t,e){this.target.applyCommand(t,e)}}class au{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}}class uu{constructor(t,e){this.hardHidden=!1,this.target=t,!0===e&&(this.hardHidden=!0)}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}get visibility(){return this.target.visible?"visible":"hidden"}set visibility(t){this.visibility===t||this.hardHidden||(this.target.visible="visible"===t)}}class lu{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 n,i;"click"===e?null===(n=this.proxy)||void 0===n||n.addListener("click",e=>this.handleProxyAction(e,t)):"hover"===e&&(null===(i=this.proxy)||void 0===i||i.addListener("mouseover",e=>this.handleProxyAction(e,t)))})}handleProxyAction(t,e){var n;const i=t.data.global,r=this.object.getGlobalPosition(),o=i.x-r.x+this.object.pivot.x,s=i.y-r.y+this.object.pivot.y;(null===(n=this.hitArea)||void 0===n?void 0:n.contains(o,s))&&this.object.visible&&this.handleAction(e,!0)}getOriginHitArea(){return this.object.hitArea?this.object.hitArea:new ve(0,0,this.object.width,this.object.height)}handleAction(t,e=!1){this.proxy&&!e||(this.ctx.eventHub.emit(Uh.hyperlinkTrigger,t),this.execAction(t))}execAction(t){var e;if("ppaction://hlinksldjump"===t.action){const n=(null!==(e=null==t?void 0:t.target)&&void 0!==e?e:"").match(/slide(\d+)\.xml/);n&&n[1]&&this.ctx.eventHub.emit(Uh.requestGotoSlide,Number(n[1]))}else if("ppaction://hlinkshowjump?jump=nextslide"===t.action)this.ctx.eventHub.emit(Uh.requestNextSlide);else if("ppaction://hlinkshowjump?jump=previousslide"===t.action)this.ctx.eventHub.emit(Uh.requestPrevSlide);else if("ppaction://hlinkshowjump?jump=firstslide"===t.action)this.ctx.eventHub.emit(Uh.requestGotoSlide,1);else if("ppaction://hlinkshowjump?jump=lastslide"===t.action)this.ctx.eventHub.emit(Uh.requestGotoSlide,-1);else if("ppaction://hlinkshowjump?jump=lastslideviewed"===t.action){const t=this.ctx.lastViewedIndex;this.ctx.eventHub.emit(Uh.requestGotoSlide,t)}else"ppaction://hlinkshowjump?jump=endshow"===t.action&&this.ctx.eventHub.emit(Uh.requestGotoSlide,-1)}}function hu(t,e,n=5){return Math.abs(t-e)<=Math.pow(10,-n)}function cu(t){return Math.floor(1e6*t)/1e6}class du{constructor(){this.point={x:0,y:0},this.slope=Math.PI/4}static fromPointSlope(t,e){const n=new du;return n.point=t,n.slope=e,n}resolveY(t){return Math.tan(this.slope)*(t-this.point.x)+this.point.y}distanceToLinearEquation(t){return hu(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 n=du.fromPointSlope(t,e),i=this.crossPoint(n);return i?Math.ceil(Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2))):0}crossPoint(t){if(hu(t.slope,this.slope))return null;let e=0,n=0;const i=Math.tan(t.slope),r=Math.tan(this.slope),{x:o,y:s}=this.point,{x:a,y:u}=t.point;return hu(this.slope,Math.PI/2)?(e=this.point.x,n=i*(e-a)+u):hu(t.slope,Math.PI/2)?(e=t.point.x,n=r*(e-o)+s):hu(this.slope,Math.PI)||hu(this.slope,0)?(n=this.point.y,e=(n-u)/i+a):hu(t.slope,Math.PI)||hu(t.slope,0)?(n=t.point.y,e=(n-s)/r+o):(e=(i*a-u+s-r*o)/(i-r),n=r*(e-o)+s),{x:e,y:n}}}class fu{constructor(t,e,n){var i,r,o,s,a,u;this.scaleExt={x:1,y:1},this.scaleOrigin={x:1,y:1},this.designScale={x:1,y:1},this.bound=new fe(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 Fe,this.ctx=e,this.style=new uu(this.container,t.hardHidden),this.designGlobalPosition={x:n.x+(null!==(r=null===(i=t.position)||void 0===i?void 0:i.x)&&void 0!==r?r:0),y:n.y+(null!==(s=null===(o=t.position)||void 0===o?void 0:o.y)&&void 0!==s?s:0)},(t.hlinkClick||t.hlinkHover)&&(this.hyperlink=new lu(this.container,this.ctx),t.hlinkHover&&(null===(a=this.hyperlink)||void 0===a||a.addAction(t.hlinkHover,"hover")),t.hlinkClick&&(null===(u=this.hyperlink)||void 0===u||u.addAction(t.hlinkClick,"click")))}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,n,i,r,o,s,a,u;this.designWidth=t.width,this.designHeight=t.height,this.designX=null!==(n=null===(e=t.position)||void 0===e?void 0:e.x)&&void 0!==n?n:0,this.designY=null!==(r=null===(i=t.position)||void 0===i?void 0:i.y)&&void 0!==r?r:0;const l=this.designWidth/2,h=this.designHeight/2;this.container.width=this.designWidth,this.container.height=this.designHeight,this.container.pivot.x=l,this.container.pivot.y=h;const c=null!==(s=null===(o=t.position)||void 0===o?void 0:o.x)&&void 0!==s?s:0,d=null!==(u=null===(a=t.position)||void 0===a?void 0:a.y)&&void 0!==u?u:0;this.container.x=c+l,this.container.y=d+h,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 f=new hs;f.drawRect(0,0,this.designWidth,this.designHeight),this.container.addChild(f),this.json.hardHidden&&(this.container.visible=!1),this.bound.x=c,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 cu(this.designWidth/this.ctx.stageWidth)}get design_ppt_h(){return cu((this.designHeight||this.container.height)/this.ctx.stageHeight)}get design_ppt_x(){return cu(this.designX/this.ctx.stageWidth)}get design_ppt_y(){return cu(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.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){const e=this.designHeight||this.container.height;this.scaleExt.y=t*this.ctx.stageHeight/e,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}}class pu{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,n,i,r]=vu(t);let o=0,s=0,a=0;const u=Math.max(e,n,i),l=Math.min(e,n,i),h=u-l;a=(u+l)/2,0===h?o=0:u===e?o=(n-i)/h%6*60:u===n?o=60*((i-e)/h+2):u===i&&(o=60*((e-n)/h+4)),s=0===h?0:h/(1-Math.abs(2*a-1)),this.h=o,this.s=s,this.l=a,this.a=r}interpolationFrom(t,e,n){const i=t.h+(this.h-t.h)*e,r=t.s+(this.s-t.s)*e,o=t.l+(this.l-t.l)*e,s=t.a+(this.a-t.a)*e;n.h=Math.max(Math.min(i,359),0),n.s=Math.max(Math.min(r,1),0),n.l=Math.max(Math.min(o,1),0),n.a=Math.max(Math.min(s,1),0)}toHexString(){let t=[0,0,0,0];const{h:e,s:n,l:i}=this;if(e<360&&e>=0&&n<=1&&n>=0&&i<=1&&i>=0){let r,o,s;const a=(1-Math.abs(2*i-1))*n,u=a*(1-Math.abs(e/60%2-1)),l=i-a/2;[r,o,s]=e>=0&&e<60?[a,u,0]:e>=60&&e<120?[u,a,0]:e>=120&&e<180?[0,a,u]:e>=180&&e<240?[0,u,a]:e>=240&&e<300?[u,0,a]:[a,0,u],t=[r+l,o+l,s+l,this.a]}return _u(t)}}class mu{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,n,i,r]=vu(t);this.r=e,this.g=n,this.b=i,this.a=r}isInit(){return this._isInit}interpolationFrom(t,e,n){n.r=t.r+(this.r-t.r)*e,n.g=t.g+(this.g-t.g)*e,n.b=t.b+(this.b-t.b)*e,n.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 _u([this.r,this.g,this.b,this.a])}}function gu(t){const e=t.substring(1);return[parseInt(e.substring(0,6),16),parseInt(e.substring(6,8),16)/255]}function vu(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 _u(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 yu(t,e,n){const i=vu(t),r=vu(e),o=Math.round(255*(i[0]+(r[0]-i[0])*n)),s=Math.round(255*(i[1]+(r[1]-i[1])*n)),a=Math.round(255*(i[2]+(r[2]-i[2])*n)),u=Math.round(255*(i[3]+(r[3]-i[3])*n));return"#"+o.toString(16).padStart(2,"0")+s.toString(16).padStart(2,"0")+a.toString(16).padStart(2,"0")+u.toString(16).padStart(2,"0")}class xu extends Ei{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"}set color(t){this.currentColor=t;const e=vu(t);this.uniforms.color=Float32Array.from(e)}get color(){return this.currentColor}}const bu=new ru.ColorMatrixFilter;bu.matrix=[1,0,0,0,-.2,0,1,0,0,-.2,0,0,1,0,-.2,0,0,0,1,0];const wu=new ru.ColorMatrixFilter;wu.matrix=[1,0,0,0,-.1,0,1,0,0,-.1,0,0,1,0,-.1,0,0,0,1,0];const Su=new ru.ColorMatrixFilter;Su.matrix=[1,0,0,0,.2,0,1,0,0,.2,0,0,1,0,.2,0,0,0,1,0];const Tu=new ru.ColorMatrixFilter;Tu.matrix=[1,0,0,0,.1,0,1,0,0,.1,0,0,1,0,.1,0,0,0,1,0];const Eu={darken:bu,darkenLess:wu,lightenLess:Tu,lighten:Su};var Mu=n(2),Au=n.n(Mu);class Pu{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"arrow":case"stealth":case"triangle":default:this.pivot={x:this.width,y:this.height/2}}}generatePaths(){this.hash="arrow-"+Au()(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 Cu extends fu{constructor(t,e,n){super({position:{x:t.x,y:t.y},width:t.width,height:t.height},e,n),this.fillColorFilter=new xu,this.fill=new au(this),this.json=t,this.ctx=e,this.parentGlobalPos=n,this.global={x:n.x+t.x,y:n.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,n;t?(null!==(n=null===(e=this.container.filters)||void 0===e?void 0:e.indexOf(this.fillColorFilter))&&void 0!==n?n:-1)<0&&(this.container.filters=[this.fillColorFilter]):this.container.filters=[]}get renderContainer(){return this.container}get interactiveContainer(){return this.container}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,n=544===this.presetSubType?this.scaleExt.x:1;this.container.position.x=this.designX+e+this.container.pivot.x*n}get ppt_y(){return this.global.y/this.ctx.stageHeight}set ppt_y(t){const e=t*this.ctx.stageHeight-this.global.y,n=544===this.presetSubType?this.scaleExt.y:1;this.container.position.y=this.designY+e+this.container.pivot.y*n}get design_ppt_x(){return cu(this.global.x/this.ctx.stageWidth)}get design_ppt_y(){return cu(this.global.y/this.ctx.stageHeight)}}var Ru=n(9),Iu=n.n(Ru);function Lu(){return Date.now().toString(32)+Math.random().toString(32).substring(2)}function Ou(t){const e=[],n=t.filter(t=>{const n=t.width<2048&&t.height<2048;return n||e.push(t),n}).sort((t,e)=>t.width*t.height-e.width*e.height);let i=n.length+1,r=2050,o=2050;const s=[];let a=null;for(;(r>2048||o>2048)&&n.length>0;)i-=1,a=Iu()(n.slice(0,i)),r=a.width,o=a.height;return a&&s.push(a),e.forEach(t=>{const e=Iu()([t]);s.push(e)}),i<n.length?s.concat(Ou(n.slice(i))):s}function Du(t,e,n){let i,r,o=e,s=n;0===o&&(o=s/1e4),0===s&&(s=o/1e4);const a=t%360;if(a%180==0)i=Math.cos(a*(Math.PI/180))*o,r=0;else if(a%90==0)i=0,r=-Math.sin(a*(Math.PI/180))*s;else{const t=Math.tan(a*Math.PI/180);i=o*s/Math.sqrt(Math.pow(s,2)+Math.pow(o*t,2)),(a>90&&a<270||a<-90&&a>-270)&&(i=-i),r=-t*i}return{x:i,y:r}}function Nu(t,e,n,i,r,o,s){const a={x:0,y:0},u=-o,l=Du((r=-r)/Math.PI*180,n,i),h=t.x-l.x,c=t.y-l.y;for(let t=0;t<51;t++){const o=Du((r+t/50*u)/Math.PI*180,n,i);o.x+=h,o.y+=c,t/50==1&&(a.x=o.x,a.y=o.y),o.x=o.x/9525*e.x,o.y=o.y/9525*e.y,s.lineTo(o.x,o.y)}return a}class Fu{constructor(t,e,n,i){this.renderContainer=new Fe,this.ctx=t,this.type=e,this.lineWidth=n,this.width=i}createPaths(){if("ww"===this.type)return null;{const t=`M 0,0 L ${9525*this.width},0`;return{paths:[{id:Lu(),path:t,fill:"norm",hasStroke:!0,scale:{x:1,y:1},hash:Au()(t)}],width:this.width,height:this.lineWidth}}}preRender(){const t=this.createPaths();if(t){const{paths:e,width:n,height:i}=t,r=e.reduce((t,e)=>t+e.hash,"");this.ghcTextureId=this.ctx.graphicsTexture.addGraphics(e,r,{x:0,y:0},n,i,{width:this.lineWidth},!1)}}render(){if(this.ghcTextureId){const t=this.ctx.graphicsTexture.getGraphicsData(this.ghcTextureId);t&&(this.sprite=new ms,this.sprite.pivot.x=t.pivot.x,this.sprite.texture=t.texture)}}destroy(){console.log("")}}var Bu=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class ku extends Cu{constructor(t,e,n){super(t,e,n),this.fillMaskSprite=new ms,this.fillSprite=new ms,this.strokeMaskSprite=new ms,this.strokeSprite=new ms,this.textureContainer=new Fe,this.underline=null;const{underLine:i,lineHeight:r,width:o}=this.json;i&&(this.underline=new Fu(e,i.type,r/16,o))}getIterateEntry(){return null}getBgElement(){return null}updateTransform(t){var e,n,i,r;const{isHorz:o}=this.json;t.position={x:o&&null!==(n=null===(e=t.position)||void 0===e?void 0:e.x)&&void 0!==n?n:0,y:o?0:null!==(r=null===(i=t.position)||void 0===i?void 0:i.y)&&void 0!==r?r:0},t.width=o?this.json.width:this.json.lineWidth,t.height=o?this.json.lineHeight:this.json.height,super.updateTransform(t)}preRender(){const{fill:t,stroke:e,lineWidth:n,lineHeight:i,content:r,fillLineHeight:o,isHorz:s}=this.json;t&&(this.fillTextureId=this.ctx.fillTexture.addFill({fillType:"blipFill",src:t.key,filters:[{type:"changeBulletColor",args:["#000000","#FFA500"]}]},t.width,t.height,void 0,"◾"===r),t.fill&&"noFill"!==t.fill.fillType&&(this.fillBgId=s?this.ctx.fillTexture.addFill(t.fill,n,o):this.ctx.fillTexture.addFill(t.fill,o,i))),e&&(this.strokeTextureId=this.ctx.fillTexture.addFill({fillType:"blipFill",src:e.key,filters:[]},e.width,e.height),e.fill&&"noFill"!==e.fill.fillType&&(this.strokeBgId=this.ctx.fillTexture.addFill(e.fill,n,i))),this.underline&&this.underline.preRender()}render(){var t;return Bu(this,void 0,void 0,(function*(){const{lineWidth:e,lineHeight:n,baseLine:i,underline:r,isHorz:o,height:s,width:a,highlightColor:u,x:l,y:h,content:c,fillLineHeight:d}=this.json;if(u){const t=new hs,[i,r]=gu(u);t.beginFill(i,r),t.drawRect(0,0,o?a:e,o?n:s),t.endFill(),this.textureContainer.addChild(t)}if(this.fillBgId&&this.fillTextureId){const t=this.ctx.fillTexture.getTexture(this.fillTextureId);(null==t?void 0:t.texture)&&(this.fillMaskSprite.texture=t.texture,this.fillMaskSprite.scale.x=.5,this.fillMaskSprite.scale.y=.5);const e=this.ctx.fillTexture.getTexture(this.fillBgId);e.texture&&(this.fillSprite.texture=e.texture,this.fillSprite.mask=this.fillMaskSprite,this.fillSprite.addChild(this.fillMaskSprite),o?this.fillSprite.position.y=h:this.fillSprite.position.x=l,this.textureContainer.addChild(this.fillSprite))}if(this.strokeBgId&&this.strokeTextureId){const t=this.ctx.fillTexture.getTexture(this.strokeTextureId);(null==t?void 0:t.texture)&&(this.strokeMaskSprite.texture=t.texture,this.strokeMaskSprite.scale.x=.5,this.strokeMaskSprite.scale.y=.5);const e=this.ctx.fillTexture.getTexture(this.strokeBgId);(null==e?void 0:e.texture)&&(this.strokeSprite.texture=e.texture,this.strokeSprite.mask=this.strokeMaskSprite,this.strokeSprite.addChild(this.strokeMaskSprite),o?this.strokeSprite.position.y=h:this.strokeSprite.position.x=l,this.textureContainer.addChild(this.strokeSprite))}if(this.underline&&(this.underline.render(),this.underline.sprite&&this.fillMaskSprite)){let e=null;this.fillBgId&&(e=this.ctx.fillTexture.getTexture(this.fillBgId)),this.underline.sprite.position.y=r?r-this.underline.lineWidth:i,this.underline.sprite.position.x=0;const n=new ms;n.texture=null!==(t=null==e?void 0:e.texture)&&void 0!==t?t:null,n.mask=this.underline.sprite,n.addChild(this.underline.sprite),this.textureContainer.addChild(n)}const f=Tn.create({width:o?a:e,height:o?d:s,resolution:2});this.ctx.renderer.render(this.textureContainer,{renderTexture:f});const p=new ms;p.texture=f,this.container.addChild(p),this.container.name=c}))}destroy(){this.textureContainer.destroy({texture:!0}),this.container.destroy({children:!0,texture:!0})}}var Uu=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class Gu extends Cu{constructor(){super(...arguments),this.units=[],this.isHorz=!0}getIterateElements(){return this.units}getIterateEntry(t,e,n){return this.units[e]?this.units[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null)}preRender(){for(let t=0,e=this.json.textUnits.length;t<e;t++){const e=this.json.textUnits[t];if(!e.content)continue;const{height:n,width:i,fillHeight:r,baseline:o,y:s,underline:a}=this.json,u=new ku(Object.assign(Object.assign({},e),{lineHeight:n,lineWidth:i,baseLine:o-s,underline:a,fillLineHeight:r||n,isHorz:this.isHorz}),this.ctx,this.global);u.preRender(),this.units.push(u)}}render(){return Uu(this,void 0,void 0,(function*(){for(const t of this.units.reverse())yield t.render(),this.container.addChild(t.container)}))}destroy(){this.units.forEach(t=>{t.destroy()}),this.container.destroy({children:!1})}}var Hu=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class zu extends Cu{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,n){const i=this.getIterateElements();return i[e]?i[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null)}preRender(){for(let t=0,e=this.json.lines.length;t<e;t++){const e=this.json.lines[t],n=new Gu(e,this.ctx,this.global);n.isHorz=this.isHorz,n.container.name="line-"+t,n.preRender(),this.lines.push(n)}}render(){return Hu(this,void 0,void 0,(function*(){for(const t of this.lines)yield t.render(),this.container.addChild(t.container)}))}destroy(){this.lines.forEach(t=>{t.destroy()}),this.container.destroy({children:!1})}}var ju=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class Vu{constructor(t,e,n,i){this.iterateElements=[],this.paragraphs=[],this.container=new Fe,this.json=t,this.ctx=e,this.parentGlobalPos=i,this.iterateType=n,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 hs;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()})}preRender(){var t;for(let e=0,n=this.json.paragraphs.length;e<n;e++){const n=this.json.paragraphs[e],i=new zu(n,this.ctx,this.global);i.isHorz=null===(t=this.json.isHorz)||void 0===t||t,i.preRender(),this.iterateElements=this.iterateElements.concat(i.getIterateElements()),i.container.name="段落-"+e,this.paragraphs.push(i)}}render(){return ju(this,void 0,void 0,(function*(){for(const t of this.paragraphs)yield t.render(),this.container.addChild(t.container);const{width:t}=this.container;this.container.scale.x<0&&(this.container.x+=-1*t)}))}}var Wu=n(19),Xu=n.n(Wu),qu=n(20),Yu=n.n(qu);const Zu={Reflection:class extends Ei{constructor(t){super(Xu.a,Yu.a,{uShapeFilterArea:new Float32Array([0,0,0,0]),uStartAlpha:t.startAlpha,uEndAlpha:t.endAlpha,uBlur:0}),this.json=t}}};var Ju=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};const Ku={pivot:{x:0,y:0},width:0,height:0};class $u extends fu{constructor(t,e,n){var i,r,o;super(t,e,n),this.renderContainer=new Fe,this.bgTextureId="",this.bgSprite=new ms,this.backgroundMaskTextureId="",this.filterAreaJustifies=[],this.backgroundMask=new ms,this.pathStrokeTextureId="",this.pathSprite=new ms,this.pathMask=new ms,this.pathMaskTextureId="",this.fillColorFilter=new xu,this.strokeColorFilter=new xu,this.id="",this.arrowList=[],this.fill=new au(this),this.stroke=new ou(this),this.updateFilterArea=()=>{const t=this.renderContainer.getBounds(!1),e=this.filterAreaJustifies.map(e=>e(t)),n=e.map(t=>t.width),i=e.map(t=>t.height),r=new fe(t.x,t.y,Math.max(...n),Math.max(...i));this.renderContainer.filterArea=r,this.renderContainer.filters.forEach(t=>{t.uniforms.uShapeFilterArea=new Float32Array(4),t.uniforms.uShapeFilterArea[0]=r.x,t.uniforms.uShapeFilterArea[1]=r.y,t.uniforms.uShapeFilterArea[2]=r.width,t.uniforms.uShapeFilterArea[3]=r.height})},this.json=t,this.id=t.id,this.container.name=t.id,this.renderContainer.name=t.id+"-render-container",this.fillStyle=t.fillStyle,this.lineStyle=t.lineStyle,this.geometry=t.geometry,this.ctx.timingTargets.addTarget(this.id,this),"solidFill"===(null===(i=this.fillStyle)||void 0===i?void 0:i.fillType)&&(this.fillColorFilter.currentColor=this.fillStyle.color),"solidFill"===(null===(o=null===(r=this.lineStyle)||void 0===r?void 0:r.fill)||void 0===o?void 0:o.fillType)&&(this.strokeColorFilter.currentColor=this.lineStyle.fill.color),this.pathSprite.name="path-fill",this.pathMask.name="path-mask",this.bgSprite.name="bg-fill",this.backgroundMask.name="bg-mask",this.updateTransform(this.json),t.textBody&&(this.text=new Vu(t.textBody,this.ctx,t.textBody.iterateType,{x:this.designGlobalPosition.x,y:this.designGlobalPosition.y})),this.container.hitArea=new ve(1,1,this.json.width,this.json.height)}get interactiveContainer(){return this.renderContainer}get strokeActive(){var t,e;return(null!==(e=null===(t=this.pathSprite.filters)||void 0===t?void 0:t.length)&&void 0!==e?e:-1)>0}set strokeActive(t){var e,n;t?(null!==(n=null===(e=this.pathSprite.filters)||void 0===e?void 0:e.indexOf(this.strokeColorFilter))&&void 0!==n?n:-1)<0&&(this.pathSprite.filters=[this.strokeColorFilter]):this.pathSprite.filters=[]}get fillActive(){var t,e;return(null!==(e=null===(t=this.bgSprite.filters)||void 0===t?void 0:t.length)&&void 0!==e?e:-1)>0}set fillActive(t){var e,n;t?(null!==(n=null===(e=this.bgSprite.filters)||void 0===e?void 0:e.indexOf(this.fillColorFilter))&&void 0!==n?n:-1)<0&&(this.bgSprite.filters=[this.fillColorFilter]):this.bgSprite.filters=[]}getTextElement(t,e){var n,i;return null!==(i=null===(n=this.text)||void 0===n?void 0:n.getTextElement(t,e))&&void 0!==i?i:null}getBgElement(){return this}getIterateEntry(t,e,n){return"el"===t||0===e?this:this.text?this.text.getIterateEntry(e-1,n)||null:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null)}createBackgroundMask(){return Ju(this,void 0,void 0,(function*(){const t=this.ctx.graphicsTexture.getGraphicsData(this.backgroundMaskTextureId);t&&(this.backgroundMask.texture=t.texture,this.backgroundMask.pivot.x=t.pivot.x,this.backgroundMask.pivot.y=t.pivot.y)}))}createBackground(){var t,e,n,i,r,o,s,a,u;const{pivot:l,width:h,height:c}=(null===(t=this.geometry)||void 0===t?void 0:t.fillTransform)||Ku;if(this.json.useBgFill&&this.ctx.bgTexture)return this.bgSprite.texture=this.ctx.bgTexture,this.bgSprite.mask=this.backgroundMask,this.container.addChild(this.backgroundMask),this.container.addChild(this.bgSprite),this.bgSprite.x=l.x,this.bgSprite.y=l.y,this.bgSprite.pivot.x=(null===(e=this.json.position)||void 0===e?void 0:e.x)||0,void(this.bgSprite.pivot.y=(null===(n=this.json.position)||void 0===n?void 0:n.y)||0);if("gifFill"===(null===(i=this.fillStyle)||void 0===i?void 0:i.fillType)){const t=this.ctx.fillTexture.getGifFrames(this.fillStyle.src),e=t.map((t,e)=>({texture:t,time:this.fillStyle.delays[e]||20}));this.bgSprite=new iu(e,!0),this.bgSprite.play();let n=1;const i=this.fillStyle.loop;this.bgSprite.onLoop=()=>{n+=1,i>0&&n>i&&this.bgSprite.gotoAndStop(t.length-1)},this.bgSprite.height=c||this.designHeight,this.bgSprite.width=h||this.designWidth,this.bgSprite.mask=this.backgroundMask,this.bgSprite.x=l.x,this.bgSprite.y=l.y,this.container.addChild(this.backgroundMask),this.container.addChild(this.bgSprite)}else if("groupFill"===(null===(r=this.fillStyle)||void 0===r?void 0:r.fillType)){if(this.groupFillTextureId){const t=this.ctx.fillTexture.getTexture(this.groupFillTextureId);t.texture&&(this.bgSprite.texture=t.texture,this.bgSprite.mask=this.backgroundMask,this.bgSprite.x=-1*(null!==(s=null===(o=this.json.position)||void 0===o?void 0:o.x)&&void 0!==s?s:0),this.bgSprite.y=-1*(null!==(u=null===(a=this.json.position)||void 0===a?void 0:a.y)&&void 0!==u?u:0),this.container.addChild(this.bgSprite),this.container.addChild(this.backgroundMask))}}else{const t=this.ctx.fillTexture.getTexture(this.bgTextureId);t.texture&&(this.bgSprite.texture=t.texture,this.bgSprite.mask=this.backgroundMask,this.container.addChild(this.backgroundMask),this.container.addChild(this.bgSprite),this.bgSprite.x=l.x,this.bgSprite.y=l.y,this.bgSprite.pivot.x=t.pivot.x,this.bgSprite.pivot.y=t.pivot.y)}}createPathFill(){const t=this.ctx.fillTexture.getTexture(this.pathStrokeTextureId);t.texture&&(this.pathSprite.texture=t.texture,this.pathSprite.pivot.x=this.pathMask.pivot.x,this.pathSprite.pivot.y=this.pathMask.pivot.y,this.pathMask.pivot.x=0,this.pathMask.pivot.y=0,this.pathSprite.mask=this.pathMask,this.pathSprite.addChild(this.pathMask),this.container.addChild(this.pathSprite))}createPathMask(){return Ju(this,void 0,void 0,(function*(){const t=this.ctx.graphicsTexture.getGraphicsData(this.pathMaskTextureId);if(t){const{texture:e,pivot:n}=t;this.pathMask.texture=e,this.pathMask.pivot.x=n.x,this.pathMask.pivot.y=n.y,this.pathMask.texture=e}}))}createFilledPathMask(){var t,e;return Ju(this,void 0,void 0,(function*(){const n=(null===(e=null===(t=this.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 ms(e.texture);n.pivot.x=e.pivot.x,n.pivot.y=e.pivot.y;const i=new ms(this.bgSprite.texture);i.pivot.x=this.bgSprite.pivot.x,i.pivot.y=this.bgSprite.pivot.y,i.mask=n,i.filters=[Eu[t.fill]],this.container.addChild(i),this.container.addChild(n)}}}))}createBackgroundTexture(){var t,e,n,i,r;if(this.fillStyle&&"gifFill"!==this.fillStyle.fillType&&"groupFill"!==this.fillStyle.fillType){const o=(null===(t=this.geometry)||void 0===t?void 0:t.fillTransform)||Ku,s=(null==o?void 0:o.width)||this.designWidth,a=(null==o?void 0:o.height)||this.designHeight;this.bgTextureId=this.ctx.fillTexture.addFill(this.fillStyle,s+(null!==(n=null===(e=this.lineStyle)||void 0===e?void 0:e.width)&&void 0!==n?n:0),a+(null!==(r=null===(i=this.lineStyle)||void 0===i?void 0:i.width)&&void 0!==r?r:0))}}createPathFillTexture(){var t,e;if((null===(t=this.lineStyle)||void 0===t?void 0:t.fill)&&"gifFill"!==this.lineStyle.fill.fillType&&"groupFill"!==this.lineStyle.fill.fillType){const{width:t,height:n}=(null===(e=this.geometry)||void 0===e?void 0:e.lineTransform)||Ku,i=Object(a.isNumber)(this.lineStyle.width)?this.lineStyle.width:1;this.pathStrokeTextureId=this.ctx.fillTexture.addFill(this.lineStyle.fill,(t||this.designWidth)+i,(n||this.designHeight)+i)}}createArrowFillTexture(){var t;null===(t=this.json.lineArrowList)||void 0===t||t.forEach(t=>{var e,n,i,r;const o=new Pu(Object.assign(Object.assign({},t),{fillStyle:null===(e=this.lineStyle)||void 0===e?void 0:e.fill,lineWidth:null!==(i=null===(n=this.lineStyle)||void 0===n?void 0:n.width)&&void 0!==i?i:0}));o.graphicsId=this.ctx.graphicsTexture.addGraphics(null!==(r=o.paths)&&void 0!==r?r:[],o.hash,o.pivot||{x:0,y:0},o.width,o.height,void 0,!0),o.textureId=this.ctx.fillTexture.addFill(o.fillStyle,o.width,o.height),this.arrowList.push(o)})}createArrow(){this.arrowList.forEach(t=>{const e=this.ctx.graphicsTexture.getGraphicsData(t.graphicsId),n=this.ctx.fillTexture.getTexture(t.textureId);if(e&&n.texture){const{texture:i,pivot:r}=e,o=new ms(i);o.pivot.x=r.x,o.pivot.y=r.y;const s=new ms(n.texture);s.addChild(o),s.mask=o,s.position.x=t.position.x,s.position.y=t.position.y,s.pivot.x=t.pivot.x+n.pivot.x,s.pivot.y=t.pivot.y+n.pivot.y,s.rotation=t.rotate/180*Math.PI,t.sprite=s,this.container.addChild(s)}})}preRender(){var t,e,n,i,r,o,s,a,u,l;this.createBackgroundTexture(),this.createPathFillTexture(),this.createArrowFillTexture();const{width:h,height:c,pivot:d}=(null===(t=this.geometry)||void 0===t?void 0:t.lineTransform)||Ku,f=h||this.designWidth,p=c||this.designHeight;(null===(e=this.geometry)||void 0===e?void 0:e.paths)&&this.geometry.paths.length>0&&(this.pathMaskTextureId=this.ctx.graphicsTexture.addGraphics(null!==(i=null===(n=this.geometry)||void 0===n?void 0:n.paths)&&void 0!==i?i:[],this.geometry.hash,d||{x:0,y:0},f,p,this.lineStyle,!1),this.backgroundMaskTextureId=this.ctx.graphicsTexture.addGraphics(null!==(o=null===(r=this.geometry)||void 0===r?void 0:r.paths)&&void 0!==o?o:[],this.geometry.hash,d||{x:0,y:0},f,p,this.lineStyle,!0));const m=(null===(a=null===(s=this.geometry)||void 0===s?void 0:s.paths)||void 0===a?void 0:a.filter(t=>"none"!==t.fill&&"norm"!==t.fill))||[];for(const t of m)this.ctx.graphicsTexture.addGraphics([t],t.hash,((null===(u=this.geometry)||void 0===u?void 0:u.lineTransform)||Ku).pivot,f,p,this.lineStyle,!0,t.id);null===(l=this.text)||void 0===l||l.preRender()}subClassRender(){return Ju(this,void 0,void 0,(function*(){}))}setupEffect(){const{effectList:t}=this.json;if(t&&t.length>0){const e=[];return t.forEach(t=>{"reflection"===t.type&&(this.filterAreaJustifies.push(t=>(t.height*=2,t)),e.push(new Zu.Reflection(t)))}),this.ctx.ticker.add(this.updateFilterArea,void 0,-20),this.renderContainer.filters=e,!0}return!1}render(){var t,e,n,i,r,o;return Ju(this,void 0,void 0,(function*(){if(yield this.createBackgroundMask(),yield this.createBackground(),yield this.subClassRender(),yield this.createFilledPathMask(),yield this.createPathMask(),yield this.createPathFill(),yield this.createArrow(),this.text&&(yield this.text.render()),"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.position.x=(null!==(i=null===(n=this.json.position)||void 0===n?void 0:n.x)&&void 0!==i?i:0)+this.text.x,this.text.container.position.y=(null!==(o=null===(r=this.json.position)||void 0===r?void 0:r.y)&&void 0!==o?o:0)+this.text.y,this.renderContainer.addChild(this.text.container));else{if(this.text){if(Object(a.isBoolean)(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.container.addChild(this.text.container)}this.renderContainer.addChild(this.container)}if(this.renderContainer.cacheAsBitmap=!!this.json.cacheAsBitMap,"background"===this.json.id){const t=Tn.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}}))}destroy(){this.bgSprite.destroy(),this.backgroundMask.destroy(),this.pathSprite.destroy(),this.pathMask.destroy(),this.fillColorFilter.destroy(),this.strokeColorFilter.destroy(),this.arrowList.forEach(t=>{var e;null===(e=t.sprite)||void 0===e||e.destroy()})}}var Qu=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};function tl(t,e){for(const n in e)t.style[n]=e[n]}class el{constructor(t){var e,n;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.playCallBackList=[],this.duration=0,this.start=0,this.end=0,this.changeMediaProgress=t=>{t.stopPropagation();const e=t.offsetX/this.progress.clientWidth*this.duration;this.jumpToTime(e),this.medianIsEnd=!1,this.ctx.eventHub.emit(Uh.mediaSeek,{id:this.targetId,time:this.media.currentTime-this.start,isPlaying:this.media.isPlaying})},this.jumpToTime=(t=0)=>{const e=Math.floor(t)+this.start;this.media.currentTime!==e&&(this.media.currentTime=e,(this.media.paused||this.media.ended)&&this.ctx.clock.setTimeout(()=>{this.media.play().then(()=>this.media.pause())},16))},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=el.formatTime(this.duration)},this.playMedia=()=>Qu(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=()=>Qu(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=()=>Qu(this,void 0,void 0,(function*(){const t=this.media.currentTime-this.start;this.duration>0&&(t>this.duration||this.media.ended)&&(yield this.pauseMedia(),this.medianIsEnd=!0),this.currentTime.innerText=el.formatTime(t),this.currentProgress.style.flex=(t/this.duration).toString()})),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.eventHub.emit(Uh.mediaPlay,{id:this.targetId,time:this.media.currentTime}),this.playMedia()},this.pauseMediaFromCtrl=()=>{this.ctx.eventHub.emit(Uh.mediaPause,{id:this.targetId,time:this.media.currentTime}),this.pauseMedia()},this.targetId=t.targetId,this.ctx=t.ctx,this.height=t.height,this.width=t.width,this.sprite=t.sprite,this.media=t.media,this.info=t.info,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!==(n=this.info.cut.end)&&void 0!==n?n:0)}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 n=Math.floor(t/60),i=String(n<0?0:n).padStart(2,"0"),r=Math.floor(t%60);e=`${i}:${String(r<0?0:r).padStart(2,"0")}`}return e}createButton(){const t={marginLeft:"15px",marginRight:"10px",fontSize:"0",height:"20px"};tl(this.playButton,Object.assign(Object.assign({},t),{display:"block"}));const e=document.createElement("img");tl(e,{height:"20px"}),e.src="https://convertcdn.netless.link/publicFiles/icon/play.png",this.playButton.appendChild(e),tl(this.pauseButton,Object.assign(Object.assign({},t),{display:"none"}));const n=document.createElement("img");tl(n,{height:"20px"}),n.src="https://convertcdn.netless.link/publicFiles/icon/pause.png",this.pauseButton.appendChild(n)}createTimer(){const t=document.createElement("div");tl(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(){tl(this.progress,{flex:"1",position:"relative",marginRight:"10px"});const t=document.createElement("div");tl(t,{background:"#D9D9D9",position:"relative",height:"10px",display:"flex"}),this.progress.appendChild(t),tl(this.currentProgress,{background:"#4F4F4F",top:"0px",left:"0",height:"10px",flex:"0"}),t.appendChild(this.currentProgress)}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{sprite:e}=this,{stageWidth:n,stageHeight:i}=this.ctx,r=e.getGlobalPosition(),o=1/Number(null===(t=this.container)||void 0===t?void 0:t.getAttribute("data-scale"));r.y=r.y+this.height-50,r.x=Math.max(r.x,0),r.x=Math.min(r.x,n-300*o),r.y=Math.max(r.y,0),r.y=Math.min(r.y,i-50),tl(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(${o})`,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.progress.removeEventListener("mousedown",this.changeMediaProgress,!1),this.playButton.removeEventListener("click",()=>this.playMedia(),!1),this.pauseButton.removeEventListener("click",()=>this.pauseMedia(),!1),this.media.removeListener("durationchange",this.getMediaDuration,!1),this.media.removeListener("timeupdate",this.mediaTimeUpdate,!1),this.media.removeListener("pause",this.onPauseMedia,!1),this.media.removeListener("play",this.onPlayMedia,!1)}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 nl=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class il extends s.a{constructor(t){var e,n;super(),this.type="video",this.sprite=new ms,this.isPlaying=!1,this.id=t.id,this.video=t.video,this.start=null===(e=t.video.cut)||void 0===e?void 0:e.start,this.end=null===(n=t.video.cut)||void 0===n?void 0:n.end,this.container=t.container,this.ctx=t.ctx,this.ctx.medias[this.id]=this,this.videoResource=new fn(this.video.src,{autoLoad:!0,autoPlay:!1,updateFPS:30,crossorigin:!0});const{video:i,width:r,height:o,sprite:s}=t;this.controller=new el({targetId:t.id,ctx:t.ctx,width:r,height:o,sprite:s,media:this,info:i,canvasElement:t.canvasElement}),this.controller.addPlayCallBack(()=>{this.sprite.width=r,this.sprite.height=o,this.ctx.clock.setTimeout(()=>{this.sprite.visible=!0},50)});const a=new on(null,{height:o,width:r});a.resource=this.videoResource,this.videoResource.bind(a),this.sprite=new ms,this.sprite.visible=!1,this.sprite.texture=new wn(a),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)})})}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){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 nl(this,void 0,void 0,(function*(){this.isPlaying=!0,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||(yield null===(t=this.videoResource.source)||void 0===t?void 0:t.play())}))}load(){return this.videoResource.load()}pause(){var t;this.isPlaying=!1,null===(t=this.videoResource.source)||void 0===t||t.pause()}togglePause(){this.isPlaying?this.pause():this.play()}seek(t){this.controller.jumpToTime(t)}destroy(){var t;this.sprite.interactive=!1,this.sprite.destroy({texture:!0,baseTexture:!0}),null===(t=this.videoResource)||void 0===t||t.destroy(),this.controller.destroy()}}var rl=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class ol extends s.a{constructor(t){super(),this.type="audio",this.isPlaying=!1,this.id=t.id,this.audio=t.audio,this.container=t.container,this.container=t.container,this.audioEl=document.createElement("audio"),this.audioEl.src=this.audio.src,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:e,height:n,sprite:i}=t;this.controller=new el({targetId:t.id,ctx:t.ctx,height:n,width:e,sprite:i,media:this,info:this.audio,canvasElement:t.canvasElement}),["durationchange","timeupdate","pause","play"].forEach(t=>{this.audioEl.addEventListener(t,()=>{this.emit(t)})})}get currentTime(){return this.audioEl.currentTime}set currentTime(t){this.audioEl.currentTime=t}get paused(){return this.audioEl.paused}get ended(){return this.audioEl.ended}get duration(){return this.audioEl.duration}load(){return Promise.resolve()}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){return rl(this,void 0,void 0,(function*(){this.isPlaying=!0;try{yield this.audioEl.play()}catch(t){console.debug("[PPT Player]: refuse to play()")}}))}pause(){this.isPlaying=!1,this.audioEl.pause()}togglePause(){this.isPlaying?this.pause():this.play()}seek(t){this.controller.jumpToTime(t)}destroy(){this.audioEl.pause(),this.controller.destroy()}}var sl=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class al extends $u{constructor(t,e,n){super(Object.assign(Object.assign({},t),{type:"Shape",useBgFill:!1,textRotateWithShape:!0}),e,n),this.picTextureId="",this.picSprite=new ms,this.picMask=new ms,this.cmd=new su(this),this.picFill=t.picFill,this.media=null==t?void 0:t.media}applyCommand(t,e){var n,i,r,o,s;if("call"===e)if(/playFrom\(([0-9.]+)\)/.test(t)){const e=t.match(/playFrom\(([0-9.]+)\)/),i=Number(e[1]||"0");null===(n=this.mediaPlayer)||void 0===n||n.play().then(()=>{var t;null===(t=this.mediaPlayer)||void 0===t||t.seek(i)})}else"custom-pause"===t?null===(i=this.mediaPlayer)||void 0===i||i.pause():"togglePause"===t?null===(r=this.mediaPlayer)||void 0===r||r.togglePause():"stop"===t&&(null===(o=this.mediaPlayer)||void 0===o||o.pause(),null===(s=this.mediaPlayer)||void 0===s||s.seek(0))}renderPic(){var t,e,n;return sl(this,void 0,void 0,(function*(){const i=this.ctx.fillTexture.getTexture(this.picTextureId);i.texture&&(this.picSprite.texture=i.texture),this.picMask.texture=this.backgroundMask.texture,this.picSprite.mask=this.picMask,this.picSprite.width=this.designWidth,this.picSprite.height=this.designHeight,this.container.addChild(this.picSprite),this.container.addChild(this.picMask),"video"===(null===(t=this.media)||void 0===t?void 0:t.type)&&this.media.src?(this.mediaPlayer=new il({id:this.json.id+"-video",ctx:this.ctx,video:this.media,height:this.designHeight,width:this.designWidth,sprite:this.picSprite,container:this.container,canvasElement:this.ctx.view}),(null===(e=this.mediaPlayer)||void 0===e?void 0:e.sprite)&&(this.mediaPlayer.sprite.mask=this.picMask)):"audio"===(null===(n=this.media)||void 0===n?void 0:n.type)&&this.media.src&&(this.mediaPlayer=new ol({id:this.json.id+"-audio",ctx:this.ctx,audio:this.media,height:this.designHeight,width:this.designWidth,sprite:this.picSprite,container:this.container,canvasElement:this.ctx.view})),this.mediaPlayer&&(this.picSprite.interactive=!0,this.picSprite.on("mouseover",()=>{this.mediaPlayer.showController()}),this.picSprite.on("mouseout",()=>{this.mediaPlayer.hideController()},!1))}))}preRender(){if(super.preRender(),"gifFill"!==this.picFill.fillType)this.picTextureId=this.ctx.fillTexture.addFill(this.picFill,this.designWidth,this.designHeight);else{let t=1;const e=this.ctx.fillTexture.getGifFrames(this.picFill.src),n=e.map((t,e)=>({texture:t,time:this.picFill.delays[e]||20}));this.picSprite=new iu(n,!0),this.picSprite.play();const i=this.picFill.loop;this.picSprite.onLoop=()=>{t+=1,i>0&&t>i&&this.picSprite.gotoAndStop(e.length-1)}}}subClassRender(){return sl(this,void 0,void 0,(function*(){yield this.renderPic()}))}destroy(){this.mediaPlayer&&(this.picSprite.interactive=!1,this.mediaPlayer.destroy(),this.mediaPlayer=void 0),this.picSprite.destroy(),this.picMask.destroy()}}var ul=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class ll extends fu{constructor(t,e,n){var i,r,o,s;super(t,e,n),this.children=[],this.cacheSprite=new ms,this.json=t,this.container.name=t.id,this.ctx.timingTargets.addTarget(t.id,this);const a={x:null!==(r=null===(i=t.position)||void 0===i?void 0:i.x)&&void 0!==r?r:0,y:null!==(s=null===(o=t.position)||void 0===o?void 0:o.y)&&void 0!==s?s:0};t.children.forEach(t=>{let e=null;"Shape"===(null==t?void 0:t.type)?e=new $u(t,this.ctx,a):"Picture"===(null==t?void 0:t.type)?e=new al(t,this.ctx,a):"Container"===(null==t?void 0:t.type)&&(e=new ll(t,this.ctx,a)),e&&this.children.push(e)}),this.updateTransform(this.json)}get interactiveContainer(){return this.container}get renderContainer(){return this.container}preRender(){if(this.json.fillStyle)if("groupFill"===this.json.fillStyle.fillType)this.fillTextureId=this.groupFillTextureId;else{const{fillStyle:t,width:e,height:n}=this.json;this.fillTextureId=this.ctx.fillTexture.addFill(t,e,n)}for(const t of this.children)t.groupFillTextureId=this.fillTextureId,t.preRender()}getBgElement(){return null}getIterateEntry(t,e,n){return 0===e?this:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null)}getTextElement(){return null}render(){var t;return ul(this,void 0,void 0,(function*(){const e=new Fe;for(const n of this.children)yield n.render(),n.renderContainer&&e.addChild(n.renderContainer),(n.json.hlinkHover||n.json.hlinkClick)&&(null===(t=n.hyperlink)||void 0===t||t.addProxy(this.container));this.container.addChild(e),this.json.cacheAsTexture&&(!function(t,e,n,i){const r=t.getBounds(),o=Math.min(r.x,e.x,r.x+r.width,e.x+e.width),s=Math.max(r.x,e.x,r.x+r.width,e.x+e.width),a=Math.min(r.y,e.y,r.y+r.height,e.y+e.height),u=s-o,l=Math.max(r.y,e.y,r.y+r.height,e.y+e.height)-a,h=e.x-r.x>0?e.x-r.x:0,c=e.y-r.y>0?e.y-r.y:0,d=Tn.create({width:u,height:l,resolution:Math.ceil(i.renderer.resolution)});t.position.x=h,t.position.y=c,i.renderer.render(t,{renderTexture:d}),n.texture=d,n.position.x=-h,n.position.y=-c}(e,new fe(this.designX,this.designY,this.designWidth,this.designHeight),this.cacheSprite,this.ctx),this.container.addChild(this.cacheSprite),e.position.x=0,e.position.y=0,e.visible=!1)}))}destroy(){this.cacheSprite&&this.cacheSprite.destroy({texture:!0}),this.children.forEach(t=>t.destroy()),this.container.destroy()}}class hl extends s.a{constructor(t,e,n,i){super(),this.cond={},this.timeoutIds=[],this.condHandle=t=>{if(t)if(t.delay&&t.delay>0){const e=this.ctx.clock.setTimeout(()=>{t.event&&(this.cond[t.event]=!0,this.detectTrigger())},t.delay);this.timeoutIds.push(e)}else this.cond[t.event]=!0,this.detectTrigger();else this.detectTrigger()},this.id=t,this.ctx=i,this.eventHubs=n,e.forEach(t=>{this.addCond(t)})}setTriggerParams(t){this.triggerParams=t}addCond(t){const e=()=>this.condHandle(t);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(){if(Object.keys(this.cond).every(t=>!!this.cond[t])){Object.keys(this.cond).forEach(t=>{this.cond[t]=!1});const t=this.triggerParams;this.triggerParams=void 0,this.emit("active",t)}}reset(){Object.keys(this.cond).forEach(t=>{this.cond[t]=!1}),this.timeoutIds.forEach(t=>this.ctx.clock.clearTimeout(t))}}class cl extends s.a{constructor(t){super(),this.runtimeNodeEventHub=new s.a,this._currentSeqIndex=0,this._currentSeqState="idle",this.isForward=!0,this.autoPlay=!1,this.handlePrev=()=>{var t,e,n,i,r,o;this.hasPrev()||!this.isMainSeq?"idle"===this.currentSeqState?(this.decrSeqIndex(),null===(t=this.commonTimeNode.children[this.currentSeqIndex])||void 0===t||t.commonTimeNode.seekToStart(),null===(e=this.commonTimeNode.children[this.currentSeqIndex])||void 0===e||e.commonTimeNode.clearSubList(),this.currentSeqState="idle"):"running"===this.currentSeqState?(null===(n=this.commonTimeNode.children[this.currentSeqIndex])||void 0===n||n.commonTimeNode.seekToStart(),null===(i=this.commonTimeNode.children[this.currentSeqIndex])||void 0===i||i.commonTimeNode.clearSubList(),this.currentSeqState="idle"):"end"===this.currentSeqState&&(this.currentSeqIndex>=this.commonTimeNode.children.length&&(this.currentSeqIndex=this.commonTimeNode.children.length-1),null===(r=this.commonTimeNode.children[this.currentSeqIndex])||void 0===r||r.commonTimeNode.seekToStart(),null===(o=this.commonTimeNode.children[this.currentSeqIndex])||void 0===o||o.commonTimeNode.clearSubList(),this.currentSeqState="idle"):this.globalEventHub.emit("c:prev slide")},this.handleNext=()=>{var t,e,n,i;this.hasNext()||!this.isMainSeq?"idle"===this.currentSeqState?null===(t=this.commonTimeNode.children[this.currentSeqIndex])||void 0===t||t.commonTimeNode.startTimeNodeForce():"running"===this.currentSeqState?(null===(e=this.commonTimeNode.children[this.currentSeqIndex])||void 0===e||e.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===(i=this.commonTimeNode.children[this.currentSeqIndex])||void 0===i||i.commonTimeNode.startTimeNodeForce()):this.globalEventHub.emit("c:next slide")};const{json:e,iterateType:n,isIterate:i,isSub:r,parent:o,ctx:a,eventHub:u,iterateIndex:l,iterateId:h}=t;this.isMainSeq="mainSeq"===e.ctn.nodeType,this.isInteractiveSeq="interactiveSeq"===e.ctn.nodeType,this.id=e.ctn.id,this.isIterate=i,this.json=e,this.ctx=a,this.globalEventHub=u,this.commonTimeNode=new Hl({json:e.ctn,isSub:r,eventHubs:{global:u,runtime:this.runtimeNodeEventHub},ctx:a,parent:o,isIterate:!1,iterateType:n,iterateIndex:l,iterateId:h}),this.bindShapeEvent(),this.nextConds=new hl("mainSeq",e.nextCondLst,{global:u,runtime:this.runtimeNodeEventHub},this.ctx),this.prevConds=new hl("mainSeq",e.preCondLst,{global:u,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(Uh.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(Uh.mainSeqStepEnd,e)}),this.commonTimeNode.on("timeNodeEndSync",()=>{this.commonTimeNode.resetForRepeat(),this.ctx.clock.setTimeout(()=>{this.currentSeqState="idle",this.currentSeqIndex=0})}),this.nextConds.on("active",()=>{if(this.isInteractiveSeq){const{mode:t}=this.ctx;"interactive"!==t&&"sync"!==t||this.ctx.eventHub.emit(Uh.interactiveSeqNext,this.json.ctn.id),"sync"!==t&&"local"!==t||this.handleNext()}else this.handleNext()}),this.prevConds.on("active",this.handlePrev)}get currentSeqIndex(){return this._currentSeqIndex}set currentSeqIndex(t){this._currentSeqIndex=t,this.isMainSeq?this.ctx.eventHub.emit(Uh.mainSeqStepChange,t):this.isInteractiveSeq&&this.ctx.eventHub.emit(Uh.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(Uh.mainSeqStateChange,t):this.isInteractiveSeq&&this.ctx.eventHub.emit(Uh.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);t&&(t.interactiveContainer.interactive=!0,t.interactiveContainer.cursor="pointer",t.interactiveContainer.on("pointerdown",()=>{const t=`shape ${e} onClick`;this.globalEventHub.emit(t)}))}}})}setCurrentStep(t,e){let n=t;this.commonTimeNode.seekToStart();const{length:i}=this.commonTimeNode.children;if(-1===n&&(n=i-1),n>=0&&n<i)for(let t=0;t<=n;t++){const i=this.commonTimeNode.children[t];t!==n?i.commonTimeNode.seekToEnd(!1,!0):"start"===e?i.commonTimeNode.seekToStart():"end"===e&&i.commonTimeNode.seekToEnd(!1,!0)}this.currentSeqIndex=n,this.currentSeqState="start"===e?"idle":"end"}}function dl(t,e,n){const i=e.split(".");i.reduce((r,o,s)=>{if(r)return s!==i.length-1?r[o]:void(r[o]=n);console.warn(`${t} not support ${e}`)},t)}function fl(t,e){if(!e)return null;return e.split(".").reduce((n,i)=>{if(n)return n[i];console.warn(`${t} not support ${e}`)},t)}class pl{constructor(t){this.timingTarget=null,this.runtimeNodeEventHub=new s.a,this.onTimeLineStart=()=>{if(this.isConflict){const{target:t}=this.json.cBhvr;if("next"===this.activeWhenConflict){let e=t.id;"shape"===t.type&&t.txEl&&(e=`${e}-txEl-${t.txEl.range[0]}`),this.commonTimeNode.isIterate&&(e=`${e}-iterate-${this.commonTimeNode.iterateIndex}`),this.ctx.conflictTimeNodeManager.addRunningTimeNode(e,this.modifyAttrKey,this.commonTimeNode)}else"prev"===this.activeWhenConflict&&this.commonTimeNode.dispose()}};const{isIterate:e,isSub:n,json:i,ctx:r,parent:o,eventHub:a,iterateType:u,iterateIndex:l,iterateId:h}=t;this.json=i,this.id=i.cBhvr.ctn.id,this.ctx=r,this.globalEventHub=a,this.commonTimeNode=new Hl({json:i.cBhvr.ctn,isSub:n,eventHubs:{global:a,runtime:this.runtimeNodeEventHub},ctx:r,parent:o,isIterate:e,iterateType:u,iterateIndex:l,iterateId:h}),this.timingTarget=this.ctx.timingTargets.getTarget(i.cBhvr.target,e,{type:u,index:l,id:h}),this.commonTimeNode.on("seekToStart",()=>this.onSeekToStart()),this.commonTimeNode.on("seekToEnd",()=>this.onSeekToEnd()),this.commonTimeNode.on("timelineStart",this.onTimeLineStart)}}class ml extends pl{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.updateStartValue=()=>{this.timingTarget&&(this.startVal=fl(this.timingTarget,this.json.cBhvr.attrList[0]))},this.onSeekToStart=()=>{const t=this.json.cBhvr.attrList[0];null!==this.startVal&&this.timingTarget&&dl(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&&dl(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&&dl(this.timingTarget,t,e)}})}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}}class gl{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.replaceAll("#ppt_h",`(${this.timingTarget.design_ppt_h})`);return e=e.replaceAll("#ppt_w",`(${this.timingTarget.design_ppt_w})`),e=e.replaceAll("#ppt_x",`(${this.timingTarget.design_ppt_x})`),e=e.replaceAll("#ppt_y",`(${this.timingTarget.design_ppt_y})`),e=e.replaceAll("ppt_w","vars.ppt_w"),e=e.replaceAll("ppt_h","vars.ppt_h"),e=e.replaceAll("ppt_x","vars.ppt_x"),e=e.replaceAll("ppt_y","vars.ppt_y"),e=e.replaceAll("#","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 n=new RegExp(`([^a-z])${t}([^a-z])`,"g");e=e.replace(n,(e,n,i)=>`${n}math.${t}${i}`)}),new Function("vars","math","$","return "+e)}}class vl extends gl{constructor(t,e,n){super(t,e),this.value=t.val.value,n&&(this.fmla=this.parseFmla(n))}resolveValue(){return this.value}interpolationFrom(t,e,n){const i=t.resolveValue(n),r=i+(this.resolveValue()-i)*e;return t.fmla?t.fmla(n,this.math,r):r}}class _l extends gl{constructor(t,e){var n;super(t,e),this.value=null===(n=t.val)||void 0===n?void 0:n.value}interpolationFrom(t,e,n){let i=t.resolveValue(n);return e>this.time&&(i=this.resolveValue()),i}resolveValue(){return this.value||""}}class yl extends gl{constructor(t,e){super(t,e),this.fn=this.parseFmla(this.val)}resolveValue(t){return this.fn(t,this.math,1)}interpolationFrom(t,e,n){const i=t.resolveValue(n),r=i+(this.resolveValue(n)-i)*e;return t.fmla?t.fmla(n,this.math,r):r}}class xl extends gl{constructor(t,e){super(t,e),this.value=t.val.value}interpolationFrom(t,e){return yu(t.resolveValue(),this.value,e)}resolveValue(){return this.value}}class bl extends pl{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=fl(this.timingTarget,this.json.cBhvr.attrList[0]))},this.updateVars=()=>{var t,e,n,i;(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===(n=this.timingTarget)||void 0===n?void 0:n.ppt_x)&&(this.vars.ppt_x=this.timingTarget.ppt_x),(null===(i=this.timingTarget)||void 0===i?void 0:i.ppt_y)&&(this.vars.ppt_y=this.timingTarget.ppt_y),this.isColorAnim},this.onTimeUpdate=({duration:t,delta:e})=>{const n=e/t,i=this.keyFrames.findIndex(t=>n<=t[0]),{attrList:r}=this.json.cBhvr;if(i<0){const t=this.keyFrames[this.keyFrames.length-1];return void(this.timingTarget&&r&&r[0]&&dl(this.timingTarget,r[0],t[1].resolveValue(this.vars)))}const o=i-1,s=this.keyFrames[i],a=this.keyFrames[o]||s,u=s[0]-a[0]==0?1:(n-a[0])/(s[0]-a[0]),l=s[1].interpolationFrom(a[1],u,this.vars);this.timingTarget&&r&&r[0]&&dl(this.timingTarget,r[0],l)},this.onSeekToStart=()=>{null!==this.startVal&&this.timingTarget&&dl(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 yl(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 yl(t,this.timingTarget);this.keyFrames.push([t.time,e])}}else if(this.json.by){const n={time:0,val:{type:"string",value:this.json.cBhvr.attrList[0]},fmla:""};if("num"===e&&this.timingTarget){const t=new yl(n,this.timingTarget);this.keyFrames.push([n.time,t])}const i={time:1,val:{type:"string",value:((null===(t=n.val)||void 0===t?void 0:t.value)||"")+"+"+this.json.by},fmla:""};if("num"===e&&this.timingTarget){const t=new yl(i,this.timingTarget);this.keyFrames.push([i.time,t])}}if(this.json.tavLst.length>0)for(const t of this.json.tavLst)if(t.val&&this.timingTarget){let n=null;"string"===t.val.type?"num"===e?n=new yl(t,this.timingTarget):"str"===e&&(n=new _l(t,this.timingTarget)):"number"===t.val.type?n=new vl(t,this.timingTarget):"color"===t.val.type?(this.isColorAnim=!0,n=new xl(t,this.timingTarget)):"boolean"===t.val.type&&console.warn("not implements"),n&&this.keyFrames.push([t.time,n])}}}var wl=n(21),Sl=n.n(wl),Tl=n(22),El=n.n(Tl);class Ml extends Ei{constructor(){super(El.a,Sl.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 Al=n(23),Pl=n.n(Al);class Cl extends Ei{constructor(){super(void 0,Pl.a,{percent:0,transition:1})}set transition(t){this.uniforms.transition=Math.pow(t,t)}set percent(t){this.uniforms.percent=t}}class Rl extends pl{constructor(t){var e;super(t),this.filterType="",this.isConflict=!0,this.activeWhenConflict="prev",this.onTimeUpdate=({duration:t,delta:e})=>{const n=e/t;this.filter&&(this.filter.percent=n),n>=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 n=0;"out"===t.json.transition?n=-1:"in"===t.json.transition&&(n=1);const i=null===(e=t.json.filter)||void 0===e?void 0:e.match(/^([a-zA-Z]+)(\((.+)\))?/);if(i){const t=i[1],e=i[3];if("wipe"===t){const n=new Ml;"up"===e?n.direction=1:"down"===e?n.direction=2:"left"===e?n.direction=3:"right"===e&&(n.direction=4),this.filter=n,this.filterType=`${t}-${e}`}else if("fade"===t){const e=new Cl;this.filter=e,this.filterType=""+t}this.filter&&(this.filter.transition=n)}}get modifyAttrKey(){return this.filterType}}var Il=n(5);class Ll extends pl{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.onTimeUpdate=({duration:t,delta:e})=>{var n;const i=e/t,r=null===(n=this.path)||void 0===n?void 0:n.getPoint(i);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=()=>{var t,e,n;const i=null!==(e=null===(t=this.commonTimeNode.json)||void 0===t?void 0:t.spd)&&void 0!==e?e:1,r=null===(n=this.path)||void 0===n?void 0:n.getPoint(i>0?0:1);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.onSeekToEnd=()=>{var t,e,n;const i=null!==(e=null===(t=this.commonTimeNode.json)||void 0===t?void 0:t.spd)&&void 0!==e?e:1,r=null===(n=this.path)||void 0===n?void 0:n.getPoint(i>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.createPath()}get modifyAttrKey(){return"motion"}createPath(){var t;const e=new Il.Path,n=null===(t=this.json.path)||void 0===t?void 0:t.match(/[MLCmlc][^MLCmlc]+/g);if(n)for(const t of n){const[n,...i]=t.trim().replace(/\s+/g," ").split(" ");if("M"===n){const[t,n]=i.map(t=>Number(t));e.moveTo(t,n)}else if("L"===n){const[t,n]=i.map(t=>Number(t));e.lineTo(t,n)}else if("C"===n){const[t,n,r,o,s,a]=i.map(t=>Number(t));e.bezierCurveTo(t,n,r,o,s,a)}else if("Z"===n)e.closePath();else if("E"===n)console.warn("not implements");else if("c"===n){const[t,n,r,o,s,a]=i.map(t=>Number(t)),u=e.currentPoint;e.bezierCurveTo(t+u.x,n+u.y,r+u.x,o+u.y,s+u.x,a+u.y)}else if("l"===n){const t=e.currentPoint,[n,r]=i.map(t=>Number(t));e.lineTo(n+t.x,r+t.y)}else if("m"===n){const t=e.currentPoint,[n,r]=i.map(t=>Number(t));e.moveTo(n+t.x,r+t.y)}}this.path=e}}class Ol extends pl{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 n,i,r,o,s;const a=e/t,u={x:1,y:1};if(this.to){const t=null!==(n=this.from)&&void 0!==n?n:{x:null!==(r=null===(i=this.startVal)||void 0===i?void 0:i.x)&&void 0!==r?r:1,y:null!==(s=null===(o=this.startVal)||void 0===o?void 0:o.y)&&void 0!==s?s:1};u.x=t.x+(this.to.x-t.x)*a,u.y=t.y+(this.to.y-t.y)*a}else if(this.by){const t={x:this.by.x,y:this.by.y};u.x=1+(t.x-1)*a,u.y=1+(t.y-1)*a}this.timingTarget&&(this.timingTarget.scale=u)},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 Dl extends pl{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.startColorString=null,this.currentColorString="#FFFFFFFF",this.onTimelineStart=t=>{this.from.isInit()||this.from.fromHexString(this.currentColorString),this.to.isInit()||this.from.by(this.by,this.to),t.isReverse||this.updateCurrentValue();const[e]=this.json.cBhvr.attrList[0].split(".");dl(this.timingTarget,e+".on","true")},this.onTimeNodeEnd=()=>{if("remove"===this.json.cBhvr.ctn.fill){const[t]=this.json.cBhvr.attrList[0].split(".");dl(this.timingTarget,t+".on","false")}},this.onSeekToStart=()=>{if(this.timingTarget){const[t]=this.json.cBhvr.attrList[0].split(".");dl(this.timingTarget,t+".on","false")}},this.onTimeNodeStart=()=>{if(this.timingTarget){const t=fl(this.timingTarget,this.json.cBhvr.attrList[0]);t&&(this.startColorString=t)}},this.onTimeUpdate=({delta:t,duration:e})=>{const n=t/e;this.to.interpolationFrom(this.from,n,this.target),this.timingTarget&&dl(this.timingTarget,this.json.cBhvr.attrList[0],this.target.toHexString())},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1})},"rgb"===this.json.clrSpc?(this.from=new mu(this.json.from),this.to=new mu(this.json.to),this.by=new mu(this.json.by),this.target=new mu):(this.from=new pu(this.json.from),this.to=new pu(this.json.to),this.by=new pu(this.json.by),this.target=new pu),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=fl(this.timingTarget,this.json.cBhvr.attrList[0]);t&&(this.currentColorString=t)}}}class Nl extends pl{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 n=e/t;let i=0,r=0;if(void 0!==this.from&&void 0!==this.to){i=this.from,r=this.to;const t=i+(r-i)*n;this.timingTarget&&(this.timingTarget.r=t)}else if(void 0!==this.by){this.lastVal||(this.lastVal=0);const t=this.by*n-this.lastVal;this.lastVal=this.by*n,this.timingTarget&&(this.timingTarget.r+=t)}},this.onTimeNodeStart=()=>{var t;Object(a.isNumber)(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 Fl extends pl{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.isApplied=!1,this.onTimeUpdate=()=>{var t,e;const{cmd:n,cmdType:i}=this.json;!this.isApplied&&n&&i&&(this.isApplied=!0,null===(e=null===(t=this.timingTarget)||void 0===t?void 0:t.cmd)||void 0===e||e.applyCommand(n,i))},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)}get modifyAttrKey(){var t,e,n,i;return(null!==(e=null===(t=this.json)||void 0===t?void 0:t.cmd)&&void 0!==e?e:"")+(null!==(i=null===(n=this.json)||void 0===n?void 0:n.cmdType)&&void 0!==i?i:"")}}var Bl=n(24);class kl{constructor(t){kl.useRtc||(this.howl=new Bl.Howl({src:[t]}))}play(){var t;null===(t=this.howl)||void 0===t||t.play()}pause(){var t;null===(t=this.howl)||void 0===t||t.pause()}stop(){var t;null===(t=this.howl)||void 0===t||t.stop()}destroy(){var t;null===(t=this.howl)||void 0===t||t.unload()}}kl.useRtc=!1;class Ul{constructor(t){this.runtimeNodeEventHub=new s.a,this.stopAudio=()=>{this.audio.stop()},this.destroy=()=>{this.stopAudio(),this.audio.destroy()};const{json:e,isIterate:n,isSub:i,eventHub:r,ctx:o,parent:a,iterateType:u,iterateIndex:l,iterateId:h}=t;this.json=e,this.id=e.cMediaNode.ctn.id,this.commonTimeNode=new Hl({json:e.cMediaNode.ctn,isSub:i,eventHubs:{global:r,runtime:this.runtimeNodeEventHub},ctx:o,parent:a,isIterate:n,iterateType:u,iterateIndex:l,iterateId:h}),this.audio=new kl(e.cMediaNode.tgtEl),this.commonTimeNode.on("timelineStart",()=>{this.audio.play()}),this.commonTimeNode.on("seekToStart",this.stopAudio),this.commonTimeNode.on("seekToEnd",this.stopAudio),this.commonTimeNode.on("timeNodeDestroy",this.destroy)}}var Gl=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class Hl extends s.a{constructor(t){super(),this.uuid=Date.now().toString(32)+Math.random().toString(32).substring(2),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.isIterate=!1,this.iterateType="el",this.iterateIndex=0,this.children=[],this.subList=[],this.duration=0,this.timeDelta=0,this.isNegativeSpeed=!1,this.handleEndCond=()=>{this.isActive&&(this.isActive=!1,this.dispose())},this.handleActive=(t=!0)=>{if(this.isActive=!0,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/(gt.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:e,isIterate:n,ctx:i,eventHubs:r,parent:o,json:s,iterateType:a,iterateId:u,iterateIndex:l}=t;this.isSub=e,this.isIterate=n,this.parentTimeNode=o,this.json=s,this.ctx=i,this.iterateIndex=l,this.eventHubs=r,this.iterateType=a,this.iterateId=u;const h=Number(this.json.dur),c=this.json.spd||1;this.isNegativeSpeed=c<0,Number.isNaN(h)||(this.duration=h/Math.abs(c)),this.uuid+="--"+this.json.id,this.setPreStyle(),s.childTnLst&&this.createChildren(s.childTnLst),this.startConds=new hl(this.json.id||"",s.stCondLst,r,this.ctx),this.endConds=new hl(this.json.id||"",s.endCondLst,r,this.ctx),s.endSync&&(this.endSync=new hl(this.json.id||"",[s.endSync],r,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=Lu();let e=!0,n=0;const i=n=>{n===t&&(e=!1,this.ctx.eventHub.removeListener("IterateTimeNodeEnd",i))};for(this.ctx.eventHub.on("IterateTimeNodeEnd",i);e;){const e=JSON.parse(JSON.stringify(this.json)),i=new Hl({json:e,isSub:!1,eventHubs:this.eventHubs,ctx:this.ctx,parent:null,isIterate:!0,iterateType:e.iterate.type,iterateIndex:n,iterateId:t});this.iterateShadows[n]=i,n+=1}}isInfiniteRepeat(){return this.json.repeatCount>999999998}getReverse(){return this.isReverse}setReverse(t){this.isReverse=t}createTimeNode(t,e){let n=null;const i={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};return"seq"===t.type?n=new cl(i):"par"===t.type?n=new zl(i):"set"===t.type?n=new ml(i):"anim"===t.type?n=new bl(i):"animEffect"===t.type?n=new Rl(i):"animMotion"===t.type?n=new Ll(i):"animScale"===t.type?n=new Ol(i):"animClr"===t.type?n=new Dl(i):"animRot"===t.type?n=new Nl(i):"cmd"===t.type?n=new Fl(i):"audio"===t.type&&(n=new Ul(i)),n}createSubList(t){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.isTimeNodeEnd())&&(this.json.iterate||this.allChildrenEndHandle())})}createChildren(t){function e(t){return function(t){var e;return null===(e=null==t?void 0:t.cBhvr)||void 0===e?void 0:e.ctn}(t)?t.cBhvr.ctn.presetOrder:function(t){return null==t?void 0:t.ctn}(t)?t.ctn.presetOrder:function(t){return null==t?void 0:t.cMediaNode}(t)?t.cMediaNode.ctn.presetOrder:void 0}if(e(t[0])){[...t].sort((t,n)=>{var i,r;return(null!==(i=e(t))&&void 0!==i?i:0)-(null!==(r=e(n))&&void 0!==r?r:0)}).forEach(n=>{const i=t.findIndex(t=>e(t)===e(n)),r=this.createTimeNode(n,!1);r&&(this.bindCommonTimeNodeEvent(r),this.children[i]=r)})}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.timeDelta=0,this.children.forEach(t=>t.commonTimeNode.resetForRepeat())}startSubList(){this.subList.forEach(t=>t.commonTimeNode.startTimeNode())}startReverseTimeLine(){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(Uh.animateEnd),this.ctx.ticker.remove(this.updateTimeLine)):this.duration>t&&(this.ctx.eventHub.emit(Uh.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(Uh.animateStart),this.updateTimeLine(0),this.ctx.ticker.add(this.updateTimeLine))}startIterate(){return Gl(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()}}))}isNatureTimeEnd(){return this.duration>=0&&this.timeDelta>=this.duration}setPreStyle(){if(!this.json.presetClass)return;const t=[],e=n=>{n.forEach(n=>{var i,r,o;n.cBhvr&&n.cBhvr.target&&t.findIndex(t=>t.id===n.cBhvr.target.id)<0&&t.push(n.cBhvr.target),(null===(r=null===(i=null==n?void 0:n.cBhvr)||void 0===i?void 0:i.ctn)||void 0===r?void 0:r.childTnLst)&&n.cBhvr.ctn.childTnLst.length>0&&e(n.cBhvr.ctn.childTnLst),(null===(o=null==n?void 0:n.ctn)||void 0===o?void 0:o.childTnLst)&&n.ctn.childTnLst.length>0&&e(n.ctn.childTnLst)})};e(this.json.childTnLst||[]),t.forEach(t=>{if(this.json.iterate){let e=0,n=!0;for(;n;){const i=this.ctx.timingTargets.getTarget(t,!0,{type:this.json.iterate.type,index:e,id:""});i&&(this.setPreStyleForTarget(i),e+=1),n=!!i}}else{const e=this.ctx.timingTargets.getTarget(t,!1);e&&this.setPreStyleForTarget(e)}})}setPreStyleForTarget(t){var e,n;if(t&&this.json.presetSubtype&&(t.presetSubType=this.json.presetSubtype),t&&!t.hasPreset)if("entr"===this.json.presetClass){const i=null===(n=null===(e=this.json)||void 0===e?void 0:e.childTnLst)||void 0===n?void 0:n.filter(t=>"set"===t.type&&"visible"===t.to);(null==i?void 0:i.length)&&(t.hasPreset=!0,t.style.visibility="hidden")}else("exit"===this.json.presetClass||"path"===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 n=this.json.endCondLst.filter(t=>/^self/.test(t.event||""))[0];n&&this.endConds.condHandle(n),this.startConds.condHandle()}onTimeLineEnd(){this.dispose(),(0===this.children.length||this.json.iterate)&&this.allChildrenEndHandle()}clearSubList(){this.subList.forEach(t=>t.commonTimeNode.destroy()),this.subList=[],this.children.forEach(t=>{t.commonTimeNode.clearSubList()})}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()}for(let t=this.children.length-1;t>=0;t--){const e=this.children[t];null==e||e.commonTimeNode.seekToStart()}}dispose(t=!1){this.isConflictDispose=t,this.ctx.clock.clearTimeout(this.repeatTimeoutId),this.ctx.eventHub.emit(Uh.animateEnd),this.ctx.ticker.remove(this.updateTimeLine),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 n=this.json.autoRev||t;if(n?this.emit("seekToStart"):this.emit("seekToEnd"),this.json.iterate&&!this.isIterate)return this.isIterateEnd=!0,void this.iterateShadows.forEach(t=>t.seekToEnd(n,e));0===this.children.length&&(this.eventHubs.runtime.emit("runtime all end"),this.handleEnd()),this.children.forEach(t=>t.commonTimeNode.seekToEnd(n,e)),e&&this.json.subTnLst&&(this.subList.length<=0&&this.createSubList(this.json.subTnLst),this.subList.forEach(t=>t.commonTimeNode.seekToEnd(!1)),this.clearSubList())}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 zl extends s.a{constructor(t){super(),this.isRunning=!1,this.runtimeNodeEventHub=new s.a;const{json:e,iterateType:n,isIterate:i,isSub:r,parent:o,ctx:a,eventHub:u,iterateIndex:l,iterateId:h}=t;this.id=e.ctn.id,this.json=e,this.ctx=a,this.isIterate=i,this.globalEventHub=u,this.commonTimeNode=new Hl({json:e.ctn,isSub:r,eventHubs:{global:u,runtime:this.runtimeNodeEventHub},ctx:a,parent:o,isIterate:!1,iterateType:n,iterateIndex:l,iterateId:h}),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 jl=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class Vl{constructor(t,e,n){this.json=t,this.ctx=n;const i=t.timeNodeList.find(t=>"par"===t.type&&"tmRoot"===t.ctn.nodeType);i&&(this.tmRoot=new zl({json:i,isSub:!1,isIterate:!1,eventHub:e,ctx:n,parent:null,iterateType:"el",iterateIndex:0,iterateId:""}),this.mainSeq=this.tmRoot.commonTimeNode.children.find(t=>{var e,n,i;return"seq"===(null===(e=t.json)||void 0===e?void 0:e.type)&&"mainSeq"===(null===(i=null===(n=t.json)||void 0===n?void 0:n.ctn)||void 0===i?void 0:i.nodeType)}))}findSeq(t){var e;return null===(e=this.tmRoot)||void 0===e?void 0:e.commonTimeNode.children.find(e=>{var n,i,r;return"seq"===(null===(n=e.json)||void 0===n?void 0:n.type)&&(null===(r=null===(i=e.json)||void 0===i?void 0:i.ctn)||void 0===r?void 0:r.id)===t})}start(){var t,e;return jl(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 n;-1===t&&this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1),null===(n=this.mainSeq)||void 0===n||n.setCurrentStep(t,e)}destroy(){var t;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,n){const i=this.findSeq(t);i&&i.setCurrentStep(e,n)}applyInteractiveAction(t){const e=this.findSeq(t);e&&e.handleNext()}}var Wl=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class Xl extends ll{constructor(t,e,n){super({id:"stage",width:t.width,height:t.height,type:"Container",children:t.children},e,n),this.globalEventHub=new s.a,this.json=t,this.container.visible=!1,this.ctx=e,this.globalEventHub.on("c:prev slide",()=>{this.ctx.eventHub.emit(Uh.requestPrevSlide)}),this.globalEventHub.on("c:next slide",()=>{this.ctx.eventHub.emit(Uh.requestNextSlide)});const i=new hs;i.drawRect(0,0,t.width,t.height),this.container.addChild(i)}get interactiveContainer(){return this.container}render(){const t=Object.create(null,{render:{get:()=>super.render}});return Wl(this,void 0,void 0,(function*(){yield t.render.call(this),this.ctx.eventHub.emit("StageRenderEnd")}))}createTiming(){this.json.timing&&(this.timing=new Vl(this.json.timing,this.globalEventHub,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 n;null===(n=this.timing)||void 0===n||n.setMainSeqStep(t,e)}collectMainSeqStartValue(){var t;null===(t=this.timing)||void 0===t||t.collectMainSeqStartValue()}hasTiming(){return!!this.timing}destroy(){var t;this.ctx.eventHub.removeAllListeners(),this.ctx.graphicsTexture.destroy(),this.ctx.fillTexture.destroy(),this.globalEventHub.removeAllListeners(),null===(t=this.timing)||void 0===t||t.destroy(),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(){var t;this.hasTiming()&&(null===(t=this.timing)||void 0===t?void 0:t.hasMainSeq())?this.globalEventHub.emit("shape slide onNext"):this.ctx.eventHub.emit(Uh.requestNextSlide)}prevStep(){var t;this.hasTiming()&&(null===(t=this.timing)||void 0===t?void 0:t.hasMainSeq())?this.globalEventHub.emit("shape slide onPrev"):this.ctx.eventHub.emit(Uh.requestPrevSlide)}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,n){var i;null===(i=this.timing)||void 0===i||i.setInteractiveSeqState(t,e,n)}setMediaState(t,e){return Wl(this,void 0,void 0,(function*(){const n=this.ctx.medias[t];n&&(e?yield n.play():yield n.pause())}))}setMediaCurrentTime(t,e){const n=this.ctx.medias[t];n&&n.seek(e)}}const ql=134217729;function Yl(t,e,n,i,r){let o,s,a,u,l=e[0],h=i[0],c=0,d=0;h>l==h>-l?(o=l,l=e[++c]):(o=h,h=i[++d]);let f=0;if(c<t&&d<n)for(h>l==h>-l?(s=l+o,a=o-(s-l),l=e[++c]):(s=h+o,a=o-(s-h),h=i[++d]),o=s,0!==a&&(r[f++]=a);c<t&&d<n;)h>l==h>-l?(s=o+l,u=s-o,a=o-(s-u)+(l-u),l=e[++c]):(s=o+h,u=s-o,a=o-(s-u)+(h-u),h=i[++d]),o=s,0!==a&&(r[f++]=a);for(;c<t;)s=o+l,u=s-o,a=o-(s-u)+(l-u),l=e[++c],o=s,0!==a&&(r[f++]=a);for(;d<n;)s=o+h,u=s-o,a=o-(s-u)+(h-u),h=i[++d],o=s,0!==a&&(r[f++]=a);return 0===o&&0!==f||(r[f++]=o),f}function Zl(t,e){let n=e[0];for(let i=1;i<t;i++)n+=e[i];return n}function Jl(t){return new Float64Array(t)}const Kl=Jl(4),$l=Jl(8),Ql=Jl(12),th=Jl(16),eh=Jl(4);function nh(t,e,n,i,r,o){const s=(e-o)*(n-r),a=(t-r)*(i-o),u=s-a;if(0===s||0===a||s>0!=a>0)return u;const l=Math.abs(s+a);return Math.abs(u)>=33306690738754716e-32*l?u:-function(t,e,n,i,r,o,s){let a,u,l,h,c,d,f,p,m,g,v,_,y,x,b,w,S,T;const E=t-r,M=n-r,A=e-o,P=i-o;x=E*P,d=ql*E,f=d-(d-E),p=E-f,d=ql*P,m=d-(d-P),g=P-m,b=p*g-(x-f*m-p*m-f*g),w=A*M,d=ql*A,f=d-(d-A),p=A-f,d=ql*M,m=d-(d-M),g=M-m,S=p*g-(w-f*m-p*m-f*g),v=b-S,c=b-v,Kl[0]=b-(v+c)+(c-S),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-w,c=y-v,Kl[1]=y-(v+c)+(c-w),T=_+v,c=T-_,Kl[2]=_-(T-c)+(v-c),Kl[3]=T;let C=Zl(4,Kl),R=22204460492503146e-32*s;if(C>=R||-C>=R)return C;if(c=t-E,a=t-(E+c)+(c-r),c=n-M,l=n-(M+c)+(c-r),c=e-A,u=e-(A+c)+(c-o),c=i-P,h=i-(P+c)+(c-o),0===a&&0===u&&0===l&&0===h)return C;if(R=11093356479670487e-47*s+33306690738754706e-32*Math.abs(C),C+=E*h+P*a-(A*l+M*u),C>=R||-C>=R)return C;x=a*P,d=ql*a,f=d-(d-a),p=a-f,d=ql*P,m=d-(d-P),g=P-m,b=p*g-(x-f*m-p*m-f*g),w=u*M,d=ql*u,f=d-(d-u),p=u-f,d=ql*M,m=d-(d-M),g=M-m,S=p*g-(w-f*m-p*m-f*g),v=b-S,c=b-v,eh[0]=b-(v+c)+(c-S),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-w,c=y-v,eh[1]=y-(v+c)+(c-w),T=_+v,c=T-_,eh[2]=_-(T-c)+(v-c),eh[3]=T;const I=Yl(4,Kl,4,eh,$l);x=E*h,d=ql*E,f=d-(d-E),p=E-f,d=ql*h,m=d-(d-h),g=h-m,b=p*g-(x-f*m-p*m-f*g),w=A*l,d=ql*A,f=d-(d-A),p=A-f,d=ql*l,m=d-(d-l),g=l-m,S=p*g-(w-f*m-p*m-f*g),v=b-S,c=b-v,eh[0]=b-(v+c)+(c-S),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-w,c=y-v,eh[1]=y-(v+c)+(c-w),T=_+v,c=T-_,eh[2]=_-(T-c)+(v-c),eh[3]=T;const L=Yl(I,$l,4,eh,Ql);x=a*h,d=ql*a,f=d-(d-a),p=a-f,d=ql*h,m=d-(d-h),g=h-m,b=p*g-(x-f*m-p*m-f*g),w=u*l,d=ql*u,f=d-(d-u),p=u-f,d=ql*l,m=d-(d-l),g=l-m,S=p*g-(w-f*m-p*m-f*g),v=b-S,c=b-v,eh[0]=b-(v+c)+(c-S),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-w,c=y-v,eh[1]=y-(v+c)+(c-w),T=_+v,c=T-_,eh[2]=_-(T-c)+(v-c),eh[3]=T;const O=Yl(L,Ql,4,eh,th);return th[O-1]}(t,e,n,i,r,o,l)}Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(8),Jl(8),Jl(8),Jl(4),Jl(8),Jl(8),Jl(8),Jl(12);Jl(192),Jl(192);Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(8),Jl(8),Jl(8),Jl(8),Jl(8),Jl(8),Jl(8),Jl(8),Jl(8),Jl(4),Jl(4),Jl(4),Jl(8),Jl(16),Jl(16),Jl(16),Jl(32),Jl(32),Jl(48),Jl(64);Jl(1152),Jl(1152);Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(4),Jl(24),Jl(24),Jl(24),Jl(24),Jl(24),Jl(24),Jl(24),Jl(24),Jl(24),Jl(24),Jl(1152),Jl(1152),Jl(1152),Jl(1152),Jl(1152),Jl(2304),Jl(2304),Jl(3456),Jl(5760),Jl(8),Jl(8),Jl(8),Jl(16),Jl(24),Jl(48),Jl(48),Jl(96),Jl(192),Jl(384),Jl(384),Jl(384),Jl(768);Jl(96),Jl(96),Jl(96),Jl(1152);const ih=Math.pow(2,-52),rh=new Uint32Array(512);class oh{static from(t,e=ch,n=dh){const i=t.length,r=new Float64Array(2*i);for(let o=0;o<i;o++){const i=t[o];r[2*o]=e(i),r[2*o+1]=n(i)}return new oh(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 n=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),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:n,_hullTri:i,_hullHash:r}=this,o=t.length>>1;let s=1/0,a=1/0,u=-1/0,l=-1/0;for(let e=0;e<o;e++){const n=t[2*e],i=t[2*e+1];n<s&&(s=n),i<a&&(a=i),n>u&&(u=n),i>l&&(l=i),this._ids[e]=e}const h=(s+u)/2,c=(a+l)/2;let d,f,p,m=1/0;for(let e=0;e<o;e++){const n=sh(h,c,t[2*e],t[2*e+1]);n<m&&(d=e,m=n)}const g=t[2*d],v=t[2*d+1];m=1/0;for(let e=0;e<o;e++){if(e===d)continue;const n=sh(g,v,t[2*e],t[2*e+1]);n<m&&n>0&&(f=e,m=n)}let _=t[2*f],y=t[2*f+1],x=1/0;for(let e=0;e<o;e++){if(e===d||e===f)continue;const n=uh(g,v,_,y,t[2*e],t[2*e+1]);n<x&&(p=e,x=n)}let b=t[2*p],w=t[2*p+1];if(x===1/0){for(let e=0;e<o;e++)this._dists[e]=t[2*e]-t[0]||t[2*e+1]-t[1];lh(this._ids,this._dists,0,o-1);const e=new Uint32Array(o);let n=0;for(let t=0,i=-1/0;t<o;t++){const r=this._ids[t];this._dists[r]>i&&(e[n++]=r,i=this._dists[r])}return this.hull=e.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(nh(g,v,_,y,b,w)<0){const t=f,e=_,n=y;f=p,_=b,y=w,p=t,b=e,w=n}const S=function(t,e,n,i,r,o){const s=n-t,a=i-e,u=r-t,l=o-e,h=s*s+a*a,c=u*u+l*l,d=.5/(s*l-a*u);return{x:t+(l*h-a*c)*d,y:e+(s*c-u*h)*d}}(g,v,_,y,b,w);this._cx=S.x,this._cy=S.y;for(let e=0;e<o;e++)this._dists[e]=sh(t[2*e],t[2*e+1],S.x,S.y);lh(this._ids,this._dists,0,o-1),this._hullStart=d;let T=3;n[d]=e[p]=f,n[f]=e[d]=p,n[p]=e[f]=d,i[d]=0,i[f]=1,i[p]=2,r.fill(-1),r[this._hashKey(g,v)]=d,r[this._hashKey(_,y)]=f,r[this._hashKey(b,w)]=p,this.trianglesLen=0,this._addTriangle(d,f,p,-1,-1,-1);for(let o,s,a=0;a<this._ids.length;a++){const u=this._ids[a],l=t[2*u],h=t[2*u+1];if(a>0&&Math.abs(l-o)<=ih&&Math.abs(h-s)<=ih)continue;if(o=l,s=h,u===d||u===f||u===p)continue;let c=0;for(let t=0,e=this._hashKey(l,h);t<this._hashSize&&(c=r[(e+t)%this._hashSize],-1===c||c===n[c]);t++);c=e[c];let m,g=c;for(;m=n[g],nh(l,h,t[2*g],t[2*g+1],t[2*m],t[2*m+1])>=0;)if(g=m,g===c){g=-1;break}if(-1===g)continue;let v=this._addTriangle(g,u,n[g],-1,-1,i[g]);i[u]=this._legalize(v+2),i[g]=v,T++;let _=n[g];for(;m=n[_],nh(l,h,t[2*_],t[2*_+1],t[2*m],t[2*m+1])<0;)v=this._addTriangle(_,u,m,i[u],-1,i[_]),i[u]=this._legalize(v+2),n[_]=_,T--,_=m;if(g===c)for(;m=e[g],nh(l,h,t[2*m],t[2*m+1],t[2*g],t[2*g+1])<0;)v=this._addTriangle(m,u,g,-1,i[g],i[m]),this._legalize(v+2),i[m]=v,n[g]=g,T--,g=m;this._hullStart=e[u]=g,n[g]=e[_]=u,n[u]=_,r[this._hashKey(l,h)]=u,r[this._hashKey(t[2*g],t[2*g+1])]=g}this.hull=new Uint32Array(T);for(let t=0,e=this._hullStart;t<T;t++)this.hull[t]=e,e=n[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 n=t/(Math.abs(t)+Math.abs(e));return(e>0?3-n:1+n)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:n,coords:i}=this;let r=0,o=0;for(;;){const s=n[t],a=t-t%3;if(o=a+(t+2)%3,-1===s){if(0===r)break;t=rh[--r];continue}const u=s-s%3,l=a+(t+1)%3,h=u+(s+2)%3,c=e[o],d=e[t],f=e[l],p=e[h];if(ah(i[2*c],i[2*c+1],i[2*d],i[2*d+1],i[2*f],i[2*f+1],i[2*p],i[2*p+1])){e[t]=p,e[s]=c;const i=n[h];if(-1===i){let e=this._hullStart;do{if(this._hullTri[e]===h){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,i),this._link(s,n[o]),this._link(o,h);const a=u+(s+1)%3;r<rh.length&&(rh[r++]=a)}else{if(0===r)break;t=rh[--r]}}return o}_link(t,e){this._halfedges[t]=e,-1!==e&&(this._halfedges[e]=t)}_addTriangle(t,e,n,i,r,o){const s=this.trianglesLen;return this._triangles[s]=t,this._triangles[s+1]=e,this._triangles[s+2]=n,this._link(s,i),this._link(s+1,r),this._link(s+2,o),this.trianglesLen+=3,s}}function sh(t,e,n,i){const r=t-n,o=e-i;return r*r+o*o}function ah(t,e,n,i,r,o,s,a){const u=t-s,l=e-a,h=n-s,c=i-a,d=r-s,f=o-a,p=h*h+c*c,m=d*d+f*f;return u*(c*m-p*f)-l*(h*m-p*d)+(u*u+l*l)*(h*f-c*d)<0}function uh(t,e,n,i,r,o){const s=n-t,a=i-e,u=r-t,l=o-e,h=s*s+a*a,c=u*u+l*l,d=.5/(s*l-a*u),f=(l*h-a*c)*d,p=(s*c-u*h)*d;return f*f+p*p}function lh(t,e,n,i){if(i-n<=20)for(let r=n+1;r<=i;r++){const i=t[r],o=e[i];let s=r-1;for(;s>=n&&e[t[s]]>o;)t[s+1]=t[s--];t[s+1]=i}else{let r=n+1,o=i;hh(t,n+i>>1,r),e[t[n]]>e[t[i]]&&hh(t,n,i),e[t[r]]>e[t[i]]&&hh(t,r,i),e[t[n]]>e[t[r]]&&hh(t,n,r);const s=t[r],a=e[s];for(;;){do{r++}while(e[t[r]]<a);do{o--}while(e[t[o]]>a);if(o<r)break;hh(t,r,o)}t[n+1]=t[o],t[o]=s,i-r+1>=o-n?(lh(t,e,r,i),lh(t,e,n,o-1)):(lh(t,e,n,o-1),lh(t,e,r,i))}}function hh(t,e,n){const i=t[e];t[e]=t[n],t[n]=i}function ch(t){return t[0]}function dh(t){return t[1]}function fh(t,e,n){return"solidFill"===t.fillType?function(t,e,n){const i=new hs,[r,o]=gu(t.color);return i.beginFill(r,o),i.drawRect(0,0,e,n),i.endFill(),i}(t,e,n):"gradientFill"===t.fillType?function(t,e,n){let i=null;const r=new Fe;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 o=t=>{const e=[];for(let n=0,i=t.length;n<i-1;n++){const i=t[n],r=t[n+1],o=i.pos+.5*(r.pos-i.pos),s=yu(i.color,r.color,.5),a=2*n;e[a]=i,e[a+1]={color:s,pos:o},e[a+2]=r}return e};t.stopList=o(t.stopList),t.stopList=o(t.stopList),i=t.line?ph(t,e,n):t.path?function(t,e,n){var i,r,o;const s=[],a={x:0,y:0};if("circle"===(null===(i=t.path)||void 0===i?void 0:i.path)||"rect"===(null===(r=t.path)||void 0===r?void 0:r.path)||"shape"===(null===(o=t.path)||void 0===o?void 0:o.path)){const i=e/2,r=n/2,o=Math.sqrt(i*i+r*r);t.stopList.forEach(t=>{if(0===t.pos)s.push({point:{x:0,y:0},color:t.color});else{const e=o*t.pos,n=new Il.Path;n.absellipse(0,0,e,e,0,2*Math.PI,!1,0),n.getPoints(50).forEach(e=>{s.push({point:{x:e.x,y:e.y},color:t.color})})}a.x=i,a.y=r})}return{points:s,position:a}}(t,e,n):ph(t,e,n);if(i){const t=[],o=[],{position:s,points:a}=i,u=oh.from(a,t=>t.point.x,t=>t.point.y);for(let e=0;e<u.triangles.length;e+=3)t.push(a[u.triangles[e]].point.x,a[u.triangles[e]].point.y),t.push(a[u.triangles[e+1]].point.x,a[u.triangles[e+1]].point.y),t.push(a[u.triangles[e+2]].point.x,a[u.triangles[e+2]].point.y),o.push(...vu(a[u.triangles[e]].color)),o.push(...vu(a[u.triangles[e+1]].color)),o.push(...vu(a[u.triangles[e+2]].color));const l=new Dn;l.addAttribute("aVertexPosition",t,2),l.addAttribute("aColor",o,4);const h=Si.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 "),c=new hs;c.drawRect(0,0,e+1,n+1),r.mask=c,r.addChild(c);const d=new Qs(l,h);d.position.x=s.x,d.position.y=s.y,r.addChild(d)}return r}(t,e,n):null}function ph(t,e,n){const i=e/2,r=n/2,o=[{x:-i,y:r},{x:-i,y:-r},{x:i,y:r},{x:i,y:-r}],s=[du.fromPointSlope({x:-i,y:0},Math.PI/2),du.fromPointSlope({x:0,y:r},0),du.fromPointSlope({x:i,y:0},Math.PI/2),du.fromPointSlope({x:0,y:-r},0)],a=[],u=t.stopList.slice(1,t.stopList.length-1).map(o=>{var u,l,h;const c=2*Math.PI;let d=null!==(l=null===(u=t.line)||void 0===u?void 0:u.ang)&&void 0!==l?l:0;for(;d>c;)d-=c;for(;d<0;)d+=c;const f={x:0,y:0};hu(d,Math.PI/2)?(f.x=0,f.y=n/2-o.pos*n):hu(d,0)?(f.x=o.pos*e-e/2,f.y=0):(f.x=o.pos*e-e/2,f.y=n/2-o.pos*n),d>Math.PI/2&&d<=Math.PI&&(f.x*=-1),d>Math.PI&&d<=2*Math.PI&&(f.y*=-1);const p=du.fromPointSlope(f,Math.PI/2-((null===(h=t.line)||void 0===h?void 0:h.ang)||0)),m=s.map(t=>p.crossPoint(t)).filter(t=>t&&t.x<=i&&t.x>=-i&&t.y<=r&&t.y>=-r).map(t=>({point:t,color:o.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,n=f.x+e*g,s=p.resolveY(n);n<=i&&n>=-i&&s<=r&&s>=-r&&a.push({point:{x:n,y:s},color:o.color}),g+=g}return p});let l=[],h=[];t:for(let e=0;e<o.length;e++){const n=o[e];for(let e=0;e<u.length-1;e++){const i=u[e],r=u[e+1],o=i.distanceToLinearEquation(r),s=i.distanceToPoint(n),l=r.distanceToPoint(n);if(s<o&&l<o){const i=t.stopList.slice(1,t.stopList.length-1)[e],r=t.stopList.slice(1,t.stopList.length-1)[e+1],u=yu(i.color,r.color,s/o);a.splice(e+1,0,{point:n,color:u});continue t}}const i=u[0],r=u[u.length-1],s=i.distanceToPoint(n),c=r.distanceToPoint(n);s<=c?l.push({point:n,dis:s}):h.push({point:n,dis:c})}l=l.sort((t,e)=>e.dis-t.dis);const c=l.map((e,n)=>{if(0===n)return{point:e.point,color:t.stopList[0].color};{const n=t.stopList[0].color,i=t.stopList[1].color;return{point:e.point,color:yu(n,i,1-(0===l[0].dis?1:e.dis/l[0].dis))}}}).sort((t,e)=>e.point.y-t.point.y);h=h.sort((t,e)=>e.dis-t.dis);const d=h.map((e,n)=>{if(0===n)return{point:e.point,color:t.stopList[t.stopList.length-1].color};{const n=t.stopList[t.stopList.length-2].color,i=t.stopList[t.stopList.length-1].color;return{point:e.point,color:yu(n,i,0===h[0].dis?0:e.dis/h[0].dis)}}}).sort((t,e)=>e.point.y-t.point.y),f=c.concat(...a).concat(d);for(let t=0;t<f.length;t++)f[t].point.x+=i,f[t].point.y=-f[t].point.y+r;return{points:f,position:{x:0,y:0}}}const mh="\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",gh=[mh],vh={biLevel:"\nvec4 transform(vec4 texColor, float arg) {\n vec3 hsl = rgb2hsl(texColor.rgb);\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"};class _h extends Ei{constructor(t,e){var n;super(void 0,(n=vh[t],`\nvarying vec2 vTextureCoord;\n\nuniform float arg;\nuniform sampler2D uSampler;\n\n${gh.map(t=>t+"\n").join("\n")}\n\n${n}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg);\n}\n`),{arg:e})}}const yh=[mh],xh={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 float epsilon = 0.4;\n vec3 colorDiff = arg1.rgb - (texColor.rgb / max(texColor.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n if (colorDistance < epsilon) {\n arg2.rgb *= ceil(texColor.a);\n return arg2;\n } else {\n return texColor;\n }\n}\n"};class bh extends Ei{constructor(t,e,n){var i;super(void 0,(i=xh[t],`\nvarying vec2 vTextureCoord;\n\nuniform vec4 arg1;\nuniform vec4 arg2;\nuniform sampler2D uSampler;\n\n${yh.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, arg2);\n}\n`),{arg1:Float32Array.from(e),arg2:Float32Array.from(n)})}}const wh=[mh],Sh={lum:"\nvec4 transform(vec4 texColor, float arg1, float arg2) {\n if (arg1 > 0.0) {\n texColor.r += (1.0 - texColor.r) * arg1;\n texColor.g += (1.0 - texColor.g) * arg1;\n texColor.b += (1.0 - texColor.b) * arg1;\n } else if (arg1 < 0.0) {\n texColor.r -= texColor.r * arg1;\n texColor.g -= texColor.g * arg1;\n texColor.b -= texColor.b * arg1;\n }\n // todo 对比度\n texColor.rgb *= texColor.a;\n return texColor;\n}\n"};class Th extends Ei{constructor(t,e,n){var i;super(void 0,(i=Sh[t],`\nvarying vec2 vTextureCoord;\n\nuniform float arg1;\nuniform float arg2;\nuniform sampler2D uSampler;\n\n${wh.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, arg2);\n}\n`),{arg1:e,arg2:n})}}class Eh{constructor(t,e){this.renderContainers=[],this.renderTextures=[],this.textures=Object.create(null),this.fillStyles=[],this.renderer=t,this.spriteTextures=e}addTexture(t,e){this.textures[t]={texture:e,pivot:{x:0,y:0}}}render(t){const{items:e,width:n,height:i}=t,r=new Fe;e.forEach(t=>{if(t.item.blipFillObject){const{width:e,height:n}=t;t.item.blipFillObject.position.x+=t.x+e/2,t.item.blipFillObject.position.y+=t.y+n/2,t.item.blipFillObject.anchor.x=.5,t.item.blipFillObject.anchor.y=.5,t.item.blipFillObject.rotation=t.item.rotate/180*Math.PI,r.addChild(t.item.blipFillObject)}else{const e=fh(t.item.fill,t.width-4,t.height-4);if(e)e.position.x+=t.x+2,e.position.y+=t.y+2,r.addChild(e);else{const e=new hs;e.drawRect(0,0,t.width-4,t.height-4),r.addChild(e)}}if(t.item.name){const e=new Ms(t.item.name,{fontFamily:"Arial",fontSize:12,fill:16715792,align:"center"});e.position.x=t.x+2,e.position.y=t.y+2,r.addChild(e)}});const o=new hs;o.drawRect(0,0,Math.ceil(n),Math.ceil(i)),r.addChild(o);const s=Tn.create({width:n,height:i,resolution:Math.ceil(this.renderer.resolution)});this.renderTextures.push(s),this.renderContainers.push(r),this.renderer.render(r,{renderTexture:s}),e.forEach(t=>{const e=new wn(s.baseTexture,new fe(t.x+2,t.y+2,t.width-4,t.height-4));this.textures[t.item.id]={texture:e,pivot:t.item.pivot}})}getTexture(t){const e=this.textures[t],n=this.spriteTextures.getTexture(t);return e||(this.spriteTextures.getTexture(t)?{texture:n,pivot:{x:0,y:0}}:{texture:null,pivot:{x:0,y:0}})}getGifFrames(t){return this.spriteTextures.getGifFrames(t)}addFill(t,e,n,i,r=!1){var o;const s=JSON.stringify(t)+e+n,a=Au()(s);if(this.textures[a])return a;if(this.fillStyles.findIndex(t=>t.id===a)>=0)return a;if("blipFill"!==t.fillType){const r={x:0,y:0};"solidFill"===t.fillType&&(e+=2,n+=2,r.x=1,r.y=1),this.fillStyles.push({fill:t,width:e,height:n,id:a,name:i,pivot:r})}else{const e=this.spriteTextures.getTexture(t.src),n=this.spriteTextures.getFrameData(t.src);if(e){const i=new ms;i.texture=e,t.filters.length>0&&r&&(i.filters=function(t){const e=[];return t.forEach(t=>{if("biLevel"===t.type)e.push(new _h("biLevel",t.args[0]));else if("clrChange"===t.type||"changeBulletColor"===t.type){const n=vu(t.args[0]),i=vu(t.args[1]);e.push(new bh(t.type,n,i))}else"alphaModFix"===t.type?e.push(new _h(t.type,t.args[0])):"lum"===t.type&&e.push(new Th(t.type,t.args[0],t.args[1]))}),e}(t.filters)),this.fillStyles.push({fill:t,width:(null==n?void 0:n.rotate)?e.height:e.width,height:(null==n?void 0:n.rotate)?e.width:e.height,id:a,blipFillObject:i,pivot:{x:0,y:0},rotate:null!==(o=null==n?void 0:n.rotate)&&void 0!==o?o:0})}}return a}pack(){const t=this.fillStyles.filter(t=>!(!t.fill.fillType||"noFill"===t.fill.fillType||0===t.width||0===t.height)||(this.textures[t.id]={texture:null,pivot:{x:0,y:0}},!1));t.forEach(t=>{t.width+=4,t.height+=4});const e=Ou(t);for(let t=0,n=e.length;t<n;t++){const n=e[t];this.render(n)}}destroy(){this.textures=Object.create(null),this.fillStyles=[],this.renderTextures.forEach(t=>t.destroy(!0)),this.renderContainers.forEach(t=>t.destroy({children:!0})),this.spriteTextures.destroy()}}class Mh{constructor(t){this.renderContainers=[],this.renderTextures=[],this.idTidMap=Object.create(null),this.textures=Object.create(null),this.graphics=[],this.renderer=t}render(t){const{items:e,width:n,height:i}=t,r=Tn.create({width:n,height:i,resolution:Math.ceil(this.renderer.resolution)});this.renderTextures.push(r);const o=new Fe;e.forEach(t=>{const e=new ms;e.texture=t.item.texture,e.x=t.x+2,e.y=t.y+2,o.addChild(e)});const s=new hs;s.drawRect(0,0,n,i),o.addChild(s),this.renderer.render(o,{renderTexture:r}),this.renderContainers.push(o),e.forEach(t=>{const e=t.item.padding;this.textures[t.item.id]={texture:new wn(r.baseTexture,new fe(t.x+2+e,t.y+2+e,t.width-4-2*e,t.height-4-2*e)),pivot:t.item.pivot}})}getGraphicsData(t){const e=this.idTidMap[t]||"";return this.textures[e]||null}addGraphics(t,e,n,i,r,o,s,a){var u,l;const h=a||Lu(),c=Au()(e+(null!==(l=null===(u=null==o?void 0:o.width)||void 0===u?void 0:u.toString())&&void 0!==l?l:0)+s);if(this.idTidMap[h]=c,this.graphics.findIndex(t=>t.id===c)<0){const{texture:e,pivot:a,padding:u}=function(t,e,n,i,r,o=!0){var s;const a={x:Math.abs(r.x),y:Math.abs(r.y)},u=window.devicePixelRatio,l=document.createElement("canvas"),h=l.getContext("2d");if(!h)throw new Error("ctx");h.lineCap=(null==i?void 0:i.cap)||"butt",h.lineJoin=(null==i?void 0:i.join)||"miter";let c=0,d=0,f=0,p=0,m=0,g="none",v="none";const _=null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0;return o?(c=e,d=n,m=0,v="#ffffff"):(g="#ff0000",m=_,f=.5*_,p=.5*_,c=e+_,d=n+_,a.x+=.5*_,a.y+=.5*_),c+=Math.abs(r.x),d+=Math.abs(r.y),f+=Math.abs(r.x),p+=Math.abs(r.y),c+=4,d+=4,f+=2,p+=2,f*=u,p*=u,c=Math.ceil(c*u),d=Math.ceil(d*u),l.width=c,l.height=d,h.transform(u,0,0,u,f,p),t.forEach(t=>{h.lineWidth=m,h.strokeStyle=g,"none"!==t.fill&&(h.fillStyle=v),(null==i?void 0:i.dash)&&h.setLineDash(i.dash.split(",").map(t=>Number(t.trim()))),h.beginPath();const{scale:e}=t,n=t.path.trim().split(" ");let r={x:0,y:0};for(let t=0;t<n.length;t+=2){const i=n[t],o=n[t+1];if("M"===i){let[t,n]=o.split(",").map(t=>Number(t));r={x:t,y:n},t=t/9525*e.x,n=n/9525*e.y,h.moveTo(t,n)}else if("A"===i){const[t,n,i,s]=o.split(",").map(t=>Number(t));r=Nu(r,e,t,n,i,s,h)}else if("L"===i){let[t,n]=o.split(",").map(t=>Number(t));r={x:t,y:n},t=t/9525*e.x,n=n/9525*e.y,h.lineTo(t,n)}else if("QB"===i){let[t,n,i,s]=o.split(",").map(t=>Number(t));r={x:i,y:s},t=t/9525*e.x,n=n/9525*e.y,i=i/9525*e.x,s=s/9525*e.y,h.quadraticCurveTo(t,n,i,s)}else if("CB"===i){let[t,n,i,s,a,u]=o.split(",").map(t=>Number(t));r={x:a,y:u},t=t/9525*e.x,n=n/9525*e.y,i=i/9525*e.x,s=s/9525*e.y,a=a/9525*e.x,u=u/9525*e.y,h.bezierCurveTo(t,n,i,s,a,u)}else"C"===i&&h.closePath()}t.hasStroke&&m>0&&h.stroke(),"none"!==t.fill&&o&&h.fill("nonzero")}),{texture:new wn(new on(l,{width:l.width/2,height:l.height/2,resolution:u})),pivot:a,padding:2}}(t,i,r,o,n,s);this.graphics.push({id:c,texture:e,pivot:a,width:e.width,height:e.height,padding:u})}return h}pack(){this.graphics.forEach(t=>{t.width+=4,t.height+=4});Ou(this.graphics).forEach(t=>{this.render(t)}),this.graphics.forEach(t=>{t.texture.destroy(!0)}),this.graphics=[]}destroy(){Object.keys(this.textures).forEach(t=>{var e;null===(e=this.textures[t])||void 0===e||e.texture.destroy()}),this.textures=Object.create(null),this.graphics=[],this.renderContainers.forEach(t=>t.destroy({children:!0,baseTexture:!0,texture:!0})),this.renderTextures.forEach(t=>t.destroy(!0))}}var Ah=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class Ph{constructor(t){this.gifs=Object.create(null),this.textures=Object.create(null),this.frames=Object.create(null),this.spriteSheets=[],this.isLoaded=!1,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,n){return Ah(this,void 0,void 0,(function*(){const i=yield this.loader.fetchJson(`${t}/${e}/jsonOutput/${n}.json`),r=yield this.loader.fetchPng(`${t}/${e}/jsonOutput/${n}.png`),o=document.createElement("img");o.src=r,yield new Promise((t,e)=>{o.onload=()=>t(""),o.onerror=()=>e()});const s=new on(o),a=new Gs(s,i);yield new Promise(t=>{a.parse(()=>t(""))}),this.spriteSheets.push(a),Object.keys(a.textures).forEach(t=>{const e=t.match(/^(.+)_gif_(\d+)$/);if(e&&e[1]&&e[2]){const n=e[1];this.gifs[n]||(this.gifs[n]=[]);const i=parseInt(e[2],10);this.gifs[n][i]=a.textures[t]}else this.frames[t]=i.frames[t],this.textures[t]=a.textures[t]})}))}loadSpriteSheets(t,e,n){return this.isLoaded?Promise.resolve([]):(this.isLoaded=!0,Promise.all(t.map(t=>this.loadSpriteSheetItem(e,n,t))))}destroy(){this.isLoaded=!1,this.spriteSheets.forEach(t=>t.destroy(!0))}}class Ch extends s.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(800*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 Rh=n(10),Ih=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class Lh{constructor(t){this.useCache=!1,this.useCache=t}bindTask(t){this.taskId=t,this.useCache&&(this.cache=Rh.createInstance({name:"_slide_local_cache_",storeName:this.taskId,driver:Rh.INDEXEDDB,version:1}),this.cache.clear().catch(()=>{}))}fetchJson(t){var e,n;return Ih(this,void 0,void 0,(function*(){let i=yield null===(e=this.cache)||void 0===e?void 0:e.getItem(t);return i&&this.useCache||(i=yield(yield fetch(t)).json(),this.useCache&&(yield null===(n=this.cache)||void 0===n?void 0:n.setItem(t,i))),i}))}fetchPng(t){var e,n;return Ih(this,void 0,void 0,(function*(){let i=yield null===(e=this.cache)||void 0===e?void 0:e.getItem(t);if(i&&this.useCache)return i;if(i=yield fetch(t).then(t=>t.blob()).then(e=>new Promise((n,i)=>{const r=new FileReader;r.onload=()=>{n(r.result)},r.onerror=()=>{i(new Error(`fetch ${t} failed`))},r.readAsDataURL(e)})),this.useCache&&(yield null===(n=this.cache)||void 0===n?void 0:n.setItem(t,i)),!i)throw new Error(`fetch ${t} failed`);return i}))}destroy(){var t;null===(t=this.cache)||void 0===t||t.clear().catch(()=>{})}}class Oh{constructor(){this.runningTimeNodes={}}addRunningTimeNode(t,e,n){const i=`${e}_${t}`;if(this.runningTimeNodes[i])try{this.runningTimeNodes[i].dispose(!0)}catch(t){}this.runningTimeNodes[i]=n}}var Dh=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};class Nh{constructor(t){this.isPaused=!1,this.timestamp=0,this.callbackList=[],this.onTimeUpdate=t=>{const e=t/(gt.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 n=this.callbackList[e];if(n&&!n.applied){if(!(n.triggerTime<=this.timestamp))break;n.fn(),n.applied=!0,t=this.callbackList.length}}}},this.ticker=t,this.ticker.add(this.onTimeUpdate)}setTimeout(t,e){const n=Lu(),i=this.timestamp+Math.max(e||16,16);return this.callbackList.push({fn:t,triggerTime:i,id:n,applied:!1}),this.callbackList.sort((t,e)=>t.triggerTime-e.triggerTime),n}clearTimeout(t){const e=this.callbackList.findIndex(e=>e.id===t);e>=0&&this.callbackList.splice(e,1)}delay(t){return new Promise(e=>{this.setTimeout(e,t)})}waitUntil(t,e){return Dh(this,void 0,void 0,(function*(){const n=this.timestamp;for(;!t()&&this.timestamp-n<e;)yield this.delay(50)}))}pause(){this.isPaused=!0}resume(){this.isPaused=!1}}var Fh=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))};i.skipHello();const Bh={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"};class kh{constructor(t){this.eventHub=t,this.targets=Object.create(null)}addTarget(t,e){this.targets[t]=e}getTargetById(t){return this.targets[t]}getTarget(t,e,n={type:"el",index:0,id:""}){var i,r;let o=this.targets[t.id];return"shape"!==t.type?o:("shape"===t.type&&t.txEl&&(o=null!==(i=null==o?void 0:o.getTextElement(t.txEl.type,t.txEl.range))&&void 0!==i?i:null),"shape"===t.type&&t.bg&&0===n.index&&(e=!1,o=null!==(r=null==o?void 0:o.getBgElement())&&void 0!==r?r:null,this.eventHub.emit("IterateTimeNodeEnd",n.id)),e&&o?o.getIterateEntry(n.type,n.index,n.id):o)}clearTargets(){this.targets=Object.create(null)}}const Uh={mainSeqStepChange:"mainSeqStepChange",mainSeqStateChange:"mainSeqStateChange",interactiveSeqStateChange:"interactiveSeqStateChange",interactiveSeqNext:"interactiveSeqNext",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"};class Gh extends s.a{constructor(t,e={}){super(),this.loader=new Lh(!0),this.transactionPlayer=new u.TransactionPlayer,this.transactionSprite=new ms,this.isForward=!0,this.drawCall=0,this.scale=1,this.fps=new Ch,this.designWidth=0,this.designHeight=0,this.currentIndex=0,this.slideCount=0,this.runtime={drawCall:0,fps:0},this.mode=t,this.config={minFPS:Object(a.isUndefined)(e.minFPS)?30:e.minFPS,maxFPS:Object(a.isUndefined)(e.maxFPS)?40:e.maxFPS,resolution:Object(a.isUndefined)(e.resolution)?window.devicePixelRatio:e.resolution,autoFPS:!Object(a.isUndefined)(e.autoFPS)&&e.autoFPS,autoResolution:!Object(a.isUndefined)(e.autoResolution)&&e.autoResolution,transactionBgColor:Object(a.isUndefined)(e.transactionBgColor)?0:e.transactionBgColor},this.app=new lr({antialias:!0,autoDensity:!1,backgroundColor:16777215}),this.updateConfig(this.config),this.app.view.style.zIndex="1",this.app.stage.sortableChildren=!0;const n=this.app.renderer,{drawElements:i}=n.gl;n.gl.drawElements=(...t)=>{i.call(n.gl,...t),this.drawCall+=1},this.fps.on("update",t=>{if(t<this.config.minFPS){if(this.config.autoResolution){const t=this.scale*this.config.resolution*.7,e=this.app.renderer.resolution,n=Math.max(t,e-.1);n>=t&&this.updateResolution(n)}if(this.config.autoFPS){const t=14,{minFPS:e,maxFPS:n}=this.app.ticker,i=Math.max(t,e-2),r=Math.max(t,n-2);i>=t&&r>=t&&(this.app.ticker.minFPS=i,this.app.ticker.maxFPS=r)}}else if(t>this.config.maxFPS){if(this.config.autoResolution){const t=this.scale*this.config.resolution,e=this.app.renderer.resolution,n=Math.min(t,e+.1);n<=this.config.resolution&&this.updateResolution(n)}if(this.config.autoFPS){const t=this.config.minFPS,e=this.config.maxFPS,{minFPS:n,maxFPS:i}=this.app.ticker,r=Math.min(t,n+2),o=Math.min(e,i+2);r<=t&&o<=e&&(this.app.ticker.minFPS=r,this.app.ticker.maxFPS=o)}}}),this.app.ticker.add(()=>{this.runtime.drawCall=this.drawCall,this.runtime.fps=Math.floor(this.app.ticker.minFPS),this.drawCall=0},null,Be.LOW),this.clock=new Nh(this.app.ticker)}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}updateConfig(t){Object(a.isUndefined)(t.minFPS)||(this.config.minFPS=t.minFPS,this.app.ticker.minFPS=t.minFPS),Object(a.isUndefined)(t.maxFPS)||(this.config.maxFPS=t.maxFPS,this.app.ticker.maxFPS=t.maxFPS),Object(a.isUndefined)(t.resolution)||(this.config.resolution=t.resolution,this.updateResolution(this.scale*this.config.resolution)),Object(a.isUndefined)(t.autoFPS)||(this.config.autoFPS=t.autoFPS),Object(a.isUndefined)(t.autoResolution)||(this.config.autoResolution=t.autoResolution),Object(a.isUndefined)(t.transactionBgColor)||(this.config.transactionBgColor=t.transactionBgColor)}preload(t){return Fh(this,void 0,void 0,(function*(){if(t<1||t>this.slideCount||!this.loader.cache)return;const e=yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/slide-${t}.json`),{sheets:n}=e;for(const t of n)yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/${t}.json`),yield this.loader.fetchPng(`${this.url}/${this.taskId}/jsonOutput/${t}.png`)}))}setResourceData(t,e){this.taskId=t,this.url=e,this.loader.bindTask(t)}setInteractive(t){this.app.stage.interactive=t,this.app.stage.interactiveChildren=t}loadSlide(t){return Fh(this,void 0,void 0,(function*(){const e=new Ph(this.loader),n=new s.a,i={mode:this.mode,renderer:this.app.renderer,graphicsTexture:new Mh(this.app.renderer),fillTexture:new Eh(this.app.renderer,e),stageWidth:0,stageHeight:0,ticker:this.app.ticker,timingTargets:new kh(n),eventHub:n,view:this.app.view,medias:Object.create(null),lastViewedIndex:this.currentIndex,conflictTimeNodeManager:new Oh,clock:this.clock},r=yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/slide-${t}.json`),{width:o,height:a,sheets:u}=r;yield e.loadSpriteSheets(u,this.url,this.taskId),i.stageWidth=o,i.stageHeight=a;const l=new Xl(r,i,{x:0,y:0});return this.translateEvent(i.eventHub,[Uh.mainSeqStepChange,Uh.mainSeqStateChange,Uh.hyperlinkTrigger,Uh.interactiveSeqNext,Uh.mainSeqStepStart,Uh.mainSeqStepEnd,Uh.animateStart,Uh.animateEnd,Uh.mediaPlay,Uh.mediaPause,Uh.mediaSeek,Uh.requestGotoSlide,Uh.requestNextSlide,Uh.requestPrevSlide,Uh.interactiveSeqStateChange]),l.preRender(),i.fillTexture.pack(),i.graphicsTexture.pack(),{stage:l,json:r}}))}translateEvent(t,e){e.forEach(e=>{t.on(e,(...t)=>{this.emit(e,...t)})})}renderSlide(t){return Fh(this,void 0,void 0,(function*(){this.emit(Uh.renderStart,t);const e=yield this.loadSlide(t);this.currentIndex=Number(t);const{width:n,height:i,slideCount:r}=e.json;let o;this.slideCount=r,this.designWidth=n,this.designHeight=i,this.currentStage&&(e.json.transition&&e.json.transition.type&&(o=this.getBase64(this.currentStage)),this.prevStage=this.currentStage),this.currentStage=e,yield e.stage.render(),e.stage.createTiming(),e.stage.container.visible=!0,e.stage.collectMainSeqStartValue(),this.isForward?e.stage.setMainSeqStep(0,"start"):e.stage.setMainSeqStep(-1,"end");const s=this.getBase64(this.currentStage);e.stage.container.visible=!1,this.app.stage.addChild(e.stage.container),o&&s&&e.json.transition&&e.json.transition.type&&(yield this.playTransaction(o,s,e.json.transition)),this.prevStage&&(this.app.stage.removeChild(this.prevStage.stage.container),this.prevStage.stage.destroy(),this.prevStage=void 0),this.isForward?yield e.stage.startTiming():e.stage.setMainSeqApplied(),this.updateResolution(this.config.resolution*this.scale),e.stage.container.visible=!0,this.emit(Uh.renderEnd,t),this.emit(Uh.slideChange,t),this.preload(t+1).catch(()=>{}),this.preload(t-1).catch(()=>{})}))}getBase64(t){const e=Tn.create({width:this.designWidth,height:this.designHeight,resolution:Math.ceil(this.app.renderer.resolution)});this.app.renderer.render(t.stage.container,{renderTexture:e});const n=this.app.renderer.plugins.extract.base64(e,"image/jpeg");return e.destroy(),n}getPreviewImage(t){return Fh(this,void 0,void 0,(function*(){if(t<1||t>this.slideCount)return null;const e=yield this.loadSlide(t);yield e.stage.render(),e.stage.container.visible=!0;const n=this.getBase64(e);return e.stage.destroy(),n}))}playTransaction(t,e,n){return Fh(this,void 0,void 0,(function*(){const i=this.app.view.parentElement;if(t&&e&&i&&Bh[n.type]&&this.transactionPlayer){this.transactionSprite.zIndex=999,this.transactionSprite.visible=!1,this.app.stage.addChild(this.transactionSprite);const i=this.transactionPlayer.renderer.domElement,r=wn.from(i),o=()=>r.update();return this.app.ticker.add(o),setTimeout(()=>{this.transactionSprite.visible=!0},100),this.transactionSprite.texture=r,new Promise(i=>{var r,s,a;null===(r=this.transactionPlayer)||void 0===r||r.play({reverse:!this.isForward,prevTextureUrl:t,nextTextureUrl:e,textureWidth:this.designWidth,textureHeight:this.designHeight,presetType:Bh[n.type],stageWidth:this.designWidth,stageHeight:this.designHeight,duration:null===(a=null===(s=this.currentStage)||void 0===s?void 0:s.json.transition)||void 0===a?void 0:a.dur,delay:0,clearColor:this.config.transactionBgColor,onTransactionEnd:()=>{i(),this.app.stage.removeChild(this.transactionSprite),this.app.ticker.remove(o)}})})}return Promise.resolve()}))}scaleView(t,e=!1){this.scale=t;const n=this.scale*this.config.resolution;this.view&&(this.view.style.width=Math.floor(this.designWidth*this.scale)+"px",this.view.style.height=Math.floor(this.designHeight*this.scale)+"px"),e&&this.updateResolution(n)}updateResolution(t){this.app.ticker.addOnce(()=>{this.app.renderer.resolution=t,this.app.renderer.plugins.interaction.resolution=this.app.renderer.resolution,this.app.renderer.resize(this.designWidth,this.designHeight)})}nextStep(){var t;null===(t=this.currentStage)||void 0===t||t.stage.nextStep()}prevStep(){var t;null===(t=this.currentStage)||void 0===t||t.stage.prevStep()}mainSeqLength(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.stage.mainSeqLength())&&void 0!==e?e:0}mainSeqStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.stage.mainSeqStep())&&void 0!==e?e:0}setMainSeqStep(t,e){var n;null===(n=this.currentStage)||void 0===n||n.stage.setMainSeqStep(t,e)}mainSeqState(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.stage.mainSeqState())&&void 0!==e?e:null}mainSeqHasNextStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.stage.mainSeqHasNextStep())&&void 0!==e&&e}mainSeqHasPrevStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.stage.mainSeqHasPrevStep())&&void 0!==e&&e}nextTick(t){this.app.ticker.addOnce(()=>{t()},Be.LOW)}applyInteractiveAction(t){var e;null===(e=this.currentStage)||void 0===e||e.stage.applyInteractiveAction(t)}seekInteractiveSeqToEnd(t){var e;null===(e=this.currentStage)||void 0===e||e.stage.seekInteractiveSeqToEnd(t)}setInteractiveSeqState(t,e,n){var i;null===(i=this.currentStage)||void 0===i||i.stage.setInteractiveSeqState(t,e,n)}setMediaState(t,e){var n;return Fh(this,void 0,void 0,(function*(){yield null===(n=this.currentStage)||void 0===n?void 0:n.stage.setMediaState(t,e)}))}setMediaCurrentTime(t,e){var n;null===(n=this.currentStage)||void 0===n||n.stage.setMediaCurrentTime(t,e)}pause(){this.app.ticker.stop()}resume(){this.app.ticker.start()}getSnapshot(){return this.currentStage?this.getBase64(this.currentStage):""}destroy(){var t;this.prevStage&&this.prevStage.stage.destroy(),this.currentStage&&this.currentStage.stage.destroy(),null===(t=this.transactionPlayer)||void 0===t||t.destroy(),this.loader.destroy(),this.fps.destroy();try{this.app.renderer.gl.getExtension("WEBGL_lose_context").loseContext()}catch(t){}this.app.destroy(!0,{children:!1,texture:!0,baseTexture:!0})}}var Hh,zh=[],jh="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"}(Hh||(Hh={}));var Vh,Wh=function(t){return Object.freeze(t)},Xh=function(t,e){this.inlineSize=t,this.blockSize=e,Wh(this)},qh=function(){function t(t,e,n,i){return this.x=t,this.y=e,this.width=n,this.height=i,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Wh(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}(),Yh=function(t){return t instanceof SVGElement&&"getBBox"in t},Zh=function(t){if(Yh(t)){var e=t.getBBox(),n=e.width,i=e.height;return!n&&!i}var r=t,o=r.offsetWidth,s=r.offsetHeight;return!(o||s||t.getClientRects().length)},Jh=function(t){var e,n;if(t instanceof Element)return!0;var i=null===(n=null===(e=t)||void 0===e?void 0:e.ownerDocument)||void 0===n?void 0:n.defaultView;return!!(i&&t instanceof i.Element)},Kh="undefined"!=typeof window?window:{},$h=new WeakMap,Qh=/auto|scroll/,tc=/^tb|vertical/,ec=/msie|trident/i.test(Kh.navigator&&Kh.navigator.userAgent),nc=function(t){return parseFloat(t||"0")},ic=function(t,e,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=!1),new Xh((n?e:t)||0,(n?t:e)||0)},rc=Wh({devicePixelContentBoxSize:ic(),borderBoxSize:ic(),contentBoxSize:ic(),contentRect:new qh(0,0,0,0)}),oc=function(t,e){if(void 0===e&&(e=!1),$h.has(t)&&!e)return $h.get(t);if(Zh(t))return $h.set(t,rc),rc;var n=getComputedStyle(t),i=Yh(t)&&t.ownerSVGElement&&t.getBBox(),r=!ec&&"border-box"===n.boxSizing,o=tc.test(n.writingMode||""),s=!i&&Qh.test(n.overflowY||""),a=!i&&Qh.test(n.overflowX||""),u=i?0:nc(n.paddingTop),l=i?0:nc(n.paddingRight),h=i?0:nc(n.paddingBottom),c=i?0:nc(n.paddingLeft),d=i?0:nc(n.borderTopWidth),f=i?0:nc(n.borderRightWidth),p=i?0:nc(n.borderBottomWidth),m=c+l,g=u+h,v=(i?0:nc(n.borderLeftWidth))+f,_=d+p,y=a?t.offsetHeight-_-t.clientHeight:0,x=s?t.offsetWidth-v-t.clientWidth:0,b=r?m+v:0,w=r?g+_:0,S=i?i.width:nc(n.width)-b-x,T=i?i.height:nc(n.height)-w-y,E=S+m+x+v,M=T+g+y+_,A=Wh({devicePixelContentBoxSize:ic(Math.round(S*devicePixelRatio),Math.round(T*devicePixelRatio),o),borderBoxSize:ic(E,M,o),contentBoxSize:ic(S,T,o),contentRect:new qh(c,u,S,T)});return $h.set(t,A),A},sc=function(t,e,n){var i=oc(t,n),r=i.borderBoxSize,o=i.contentBoxSize,s=i.devicePixelContentBoxSize;switch(e){case Hh.DEVICE_PIXEL_CONTENT_BOX:return s;case Hh.BORDER_BOX:return r;default:return o}},ac=function(t){var e=oc(t);this.target=t,this.contentRect=e.contentRect,this.borderBoxSize=Wh([e.borderBoxSize]),this.contentBoxSize=Wh([e.contentBoxSize]),this.devicePixelContentBoxSize=Wh([e.devicePixelContentBoxSize])},uc=function(t){if(Zh(t))return 1/0;for(var e=0,n=t.parentNode;n;)e+=1,n=n.parentNode;return e},lc=function(){var t=1/0,e=[];zh.forEach((function(n){if(0!==n.activeTargets.length){var i=[];n.activeTargets.forEach((function(e){var n=new ac(e.target),r=uc(e.target);i.push(n),e.lastReportedSize=sc(e.target,e.observedBox),r<t&&(t=r)})),e.push((function(){n.callback.call(n.observer,i,n.observer)})),n.activeTargets.splice(0,n.activeTargets.length)}}));for(var n=0,i=e;n<i.length;n++){(0,i[n])()}return t},hc=function(t){zh.forEach((function(e){e.activeTargets.splice(0,e.activeTargets.length),e.skippedTargets.splice(0,e.skippedTargets.length),e.observationTargets.forEach((function(n){n.isActive()&&(uc(n.target)>t?e.activeTargets.push(n):e.skippedTargets.push(n))}))}))},cc=function(){var t,e=0;for(hc(e);zh.some((function(t){return t.activeTargets.length>0}));)e=lc(),hc(e);return zh.some((function(t){return t.skippedTargets.length>0}))&&("function"==typeof ErrorEvent?t=new ErrorEvent("error",{message:jh}):((t=document.createEvent("Event")).initEvent("error",!1,!1),t.message=jh),window.dispatchEvent(t)),e>0},dc=[],fc=function(t){if(!Vh){var e=0,n=document.createTextNode("");new MutationObserver((function(){return dc.splice(0).forEach((function(t){return t()}))})).observe(n,{characterData:!0}),Vh=function(){n.textContent=""+(e?e--:e++)}}dc.push(t),Vh()},pc=0,mc={attributes:!0,characterData:!0,childList:!0,subtree:!0},gc=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],vc=function(t){return void 0===t&&(t=0),Date.now()+t},_c=!1,yc=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),!_c){_c=!0;var n,i=vc(t);n=function(){var n=!1;try{n=cc()}finally{if(_c=!1,t=i-vc(),!pc)return;n?e.run(1e3):t>0?e.run(t):e.start()}},fc((function(){requestAnimationFrame(n)}))}},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,mc)};document.body?e():Kh.addEventListener("DOMContentLoaded",e)},t.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),gc.forEach((function(e){return Kh.addEventListener(e,t.listener,!0)})))},t.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),gc.forEach((function(e){return Kh.removeEventListener(e,t.listener,!0)})),this.stopped=!0)},t}()),xc=function(t){!pc&&t>0&&yc.start(),!(pc+=t)&&yc.stop()},bc=function(){function t(t,e){this.target=t,this.observedBox=e||Hh.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return t.prototype.isActive=function(){var t,e=sc(this.target,this.observedBox,!0);return t=this.target,Yh(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}(),wc=function(t,e){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=e},Sc=new WeakMap,Tc=function(t,e){for(var n=0;n<t.length;n+=1)if(t[n].target===e)return n;return-1},Ec=function(){function t(){}return t.connect=function(t,e){var n=new wc(t,e);Sc.set(t,n)},t.observe=function(t,e,n){var i=Sc.get(t),r=0===i.observationTargets.length;Tc(i.observationTargets,e)<0&&(r&&zh.push(i),i.observationTargets.push(new bc(e,n&&n.box)),xc(1),yc.schedule())},t.unobserve=function(t,e){var n=Sc.get(t),i=Tc(n.observationTargets,e),r=1===n.observationTargets.length;i>=0&&(r&&zh.splice(zh.indexOf(n),1),n.observationTargets.splice(i,1),xc(-1))},t.disconnect=function(t){var e=this,n=Sc.get(t);n.observationTargets.slice().forEach((function(n){return e.unobserve(t,n.target)})),n.activeTargets.splice(0,n.activeTargets.length)},t}(),Mc=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.");Ec.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(!Jh(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Ec.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(!Jh(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Ec.unobserve(this,t)},t.prototype.disconnect=function(){Ec.disconnect(this)},t.toString=function(){return"function ResizeObserver () { [polyfill code] }"},t}(),Ac=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))},Pc=function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Cc=function(){function t(t,e,n,i,r){this.state="idle",this.index=-1,this.slideIndex=-1,this.fn=n,this.index=t,this.slideIndex=e,this.eventHub=i,this.id=r}return t.prototype.apply=function(){return Ac(this,void 0,void 0,(function(){var t;return Pc(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}(),Rc=function(){function t(){var t=this;this.eventHub=new s.a,this.tasks=[],this.index=0,this.eventHub.on("task-end",(function(e){var n,i=t.tasks.findIndex((function(t){return t.index===e.index})),r=i+1;r>=0&&(null===(n=t.tasks[r])||void 0===n||n.apply()),i>=0&&(t.tasks.splice(i,1),t.replaceIdleTask()),t.eventHub.emit("task-end-"+e.id)})),this.eventHub.on("task-error",(function(e){var n=e.task,i=t.tasks.findIndex((function(t){return t.index===n.index}));i>=0&&(t.tasks.splice(i,1),t.replaceIdleTask())}))}return t.prototype.replaceIdleTask=function(){for(var t,e=this,n=new Set,i=0,r=this.tasks.length;i<r;i++)"idle"===this.tasks[i].state&&"idle"===(null===(t=this.tasks[i+1])||void 0===t?void 0:t.state)&&n.add(i);Array.from(n).forEach((function(t){e.tasks.splice(t,1)}))},t.prototype.addTask=function(t,e,n){var i=new Cc(this.index++,e,t,this.eventHub,n);this.tasks.push(i),this.tasks.sort((function(t,e){return t.index-e.index})),this.replaceIdleTask(),1===this.tasks.length&&i.apply()},t.prototype.hasStartTask=function(){return this.tasks.some((function(t){return"start"===t.state}))},t}();function Ic(t,e){var n=t.__state.conversionName.toString(),i=Math.round(t.r),r=Math.round(t.g),o=Math.round(t.b),s=t.a,a=Math.round(t.h),u=t.s.toFixed(1),l=t.v.toFixed(1);if(e||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var h=t.hex.toString(16);h.length<6;)h="0"+h;return"#"+h}return"CSS_RGB"===n?"rgb("+i+","+r+","+o+")":"CSS_RGBA"===n?"rgba("+i+","+r+","+o+","+s+")":"HEX"===n?"0x"+t.hex.toString(16):"RGB_ARRAY"===n?"["+i+","+r+","+o+"]":"RGBA_ARRAY"===n?"["+i+","+r+","+o+","+s+"]":"RGB_OBJ"===n?"{r:"+i+",g:"+r+",b:"+o+"}":"RGBA_OBJ"===n?"{r:"+i+",g:"+r+",b:"+o+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+u+",v:"+l+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+u+",v:"+l+",a:"+s+"}":"unknown format"}var Lc=Array.prototype.forEach,Oc=Array.prototype.slice,Dc={BREAK:{},extend:function(t){return this.each(Oc.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(n){this.isUndefined(e[n])||(t[n]=e[n])}.bind(this))}),this),t},defaults:function(t){return this.each(Oc.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(n){this.isUndefined(t[n])&&(t[n]=e[n])}.bind(this))}),this),t},compose:function(){var t=Oc.call(arguments);return function(){for(var e=Oc.call(arguments),n=t.length-1;n>=0;n--)e=[t[n].apply(this,e)];return e[0]}},each:function(t,e,n){if(t)if(Lc&&t.forEach&&t.forEach===Lc)t.forEach(e,n);else if(t.length===t.length+0){var i,r=void 0;for(r=0,i=t.length;r<i;r++)if(r in t&&e.call(n,t[r],r)===this.BREAK)return}else for(var o in t)if(e.call(n,t[o],o)===this.BREAK)return},defer:function(t){setTimeout(t,0)},debounce:function(t,e,n){var i=void 0;return function(){var r=this,o=arguments;function s(){i=null,n||t.apply(r,o)}var a=n||!i;clearTimeout(i),i=setTimeout(s,e),a&&t.apply(r,o)}},toArray:function(t){return t.toArray?t.toArray():Oc.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}},Nc=[{litmus:Dc.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:Ic},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:Ic},CSS_RGB:{read:function(t){var e=t.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3])}},write:Ic},CSS_RGBA:{read:function(t){var e=t.match(/^rgba\(\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:Ic}}},{litmus:Dc.isNumber,conversions:{HEX:{read:function(t){return{space:"HEX",hex:t,conversionName:"HEX"}},write:function(t){return t.hex}}}},{litmus:Dc.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:Dc.isObject,conversions:{RGBA_OBJ:{read:function(t){return!!(Dc.isNumber(t.r)&&Dc.isNumber(t.g)&&Dc.isNumber(t.b)&&Dc.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!!(Dc.isNumber(t.r)&&Dc.isNumber(t.g)&&Dc.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!!(Dc.isNumber(t.h)&&Dc.isNumber(t.s)&&Dc.isNumber(t.v)&&Dc.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!!(Dc.isNumber(t.h)&&Dc.isNumber(t.s)&&Dc.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}}}}}],Fc=void 0,Bc=void 0,kc=function(){Bc=!1;var t=arguments.length>1?Dc.toArray(arguments):arguments[0];return Dc.each(Nc,(function(e){if(e.litmus(t))return Dc.each(e.conversions,(function(e,n){if(Fc=e.read(t),!1===Bc&&!1!==Fc)return Bc=Fc,Fc.conversionName=n,Fc.conversion=e,Dc.BREAK})),Dc.BREAK})),Bc},Uc=void 0,Gc={hsv_to_rgb:function(t,e,n){var i=Math.floor(t/60)%6,r=t/60-Math.floor(t/60),o=n*(1-e),s=n*(1-r*e),a=n*(1-(1-r)*e),u=[[n,a,o],[s,n,o],[o,n,a],[o,s,n],[a,o,n],[n,o,s]][i];return{r:255*u[0],g:255*u[1],b:255*u[2]}},rgb_to_hsv:function(t,e,n){var i=Math.min(t,e,n),r=Math.max(t,e,n),o=r-i,s=void 0;return 0===r?{h:NaN,s:0,v:0}:(s=t===r?(e-n)/o:e===r?2+(n-t)/o:4+(t-e)/o,(s/=6)<0&&(s+=1),{h:360*s,s:o/r,v:r/255})},rgb_to_hex:function(t,e,n){var i=this.hex_with_component(0,2,t);return i=this.hex_with_component(i,1,e),i=this.hex_with_component(i,0,n)},component_from_hex:function(t,e){return t>>8*e&255},hex_with_component:function(t,e,n){return n<<(Uc=8*e)|t&~(255<<Uc)}},Hc="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},zc=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},jc=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),Vc=function t(e,n,i){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,n);if(void 0===r){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,n,i)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(i):void 0},Wc=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)},Xc=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},qc=function(){function t(){if(zc(this,t),this.__state=kc.apply(this,arguments),!1===this.__state)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return jc(t,[{key:"toString",value:function(){return Ic(this)}},{key:"toHexString",value:function(){return Ic(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),t}();function Yc(t,e,n){Object.defineProperty(t,e,{get:function(){return"RGB"===this.__state.space||qc.recalculateRGB(this,e,n),this.__state[e]},set:function(t){"RGB"!==this.__state.space&&(qc.recalculateRGB(this,e,n),this.__state.space="RGB"),this.__state[e]=t}})}function Zc(t,e){Object.defineProperty(t,e,{get:function(){return"HSV"===this.__state.space||qc.recalculateHSV(this),this.__state[e]},set:function(t){"HSV"!==this.__state.space&&(qc.recalculateHSV(this),this.__state.space="HSV"),this.__state[e]=t}})}qc.recalculateRGB=function(t,e,n){if("HEX"===t.__state.space)t.__state[e]=Gc.component_from_hex(t.__state.hex,n);else{if("HSV"!==t.__state.space)throw new Error("Corrupted color state");Dc.extend(t.__state,Gc.hsv_to_rgb(t.__state.h,t.__state.s,t.__state.v))}},qc.recalculateHSV=function(t){var e=Gc.rgb_to_hsv(t.r,t.g,t.b);Dc.extend(t.__state,{s:e.s,v:e.v}),Dc.isNaN(e.h)?Dc.isUndefined(t.__state.h)&&(t.__state.h=0):t.__state.h=e.h},qc.COMPONENTS=["r","g","b","h","s","v","hex","a"],Yc(qc.prototype,"r",2),Yc(qc.prototype,"g",1),Yc(qc.prototype,"b",0),Zc(qc.prototype,"h"),Zc(qc.prototype,"s"),Zc(qc.prototype,"v"),Object.defineProperty(qc.prototype,"a",{get:function(){return this.__state.a},set:function(t){this.__state.a=t}}),Object.defineProperty(qc.prototype,"hex",{get:function(){return"HEX"!==this.__state.space&&(this.__state.hex=Gc.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 Jc=function(){function t(e,n){zc(this,t),this.initialValue=e[n],this.domElement=document.createElement("div"),this.object=e,this.property=n,this.__onChange=void 0,this.__onFinishChange=void 0}return jc(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}(),Kc={};Dc.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},(function(t,e){Dc.each(t,(function(t){Kc[t]=e}))}));var $c=/(\d+(\.\d+)?)px/;function Qc(t){if("0"===t||Dc.isUndefined(t))return 0;var e=t.match($c);return Dc.isNull(e)?0:parseFloat(e[1])}var td={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,n){var i=n,r=e;Dc.isUndefined(r)&&(r=!0),Dc.isUndefined(i)&&(i=!0),t.style.position="absolute",r&&(t.style.left=0,t.style.right=0),i&&(t.style.top=0,t.style.bottom=0)},fakeEvent:function(t,e,n,i){var r=n||{},o=Kc[e];if(!o)throw new Error("Event type "+e+" not supported.");var s=document.createEvent(o);switch(o){case"MouseEvents":var a=r.x||r.clientX||0,u=r.y||r.clientY||0;s.initMouseEvent(e,r.bubbles||!1,r.cancelable||!0,window,r.clickCount||1,0,0,a,u,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var l=s.initKeyboardEvent||s.initKeyEvent;Dc.defaults(r,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),l(e,r.bubbles||!1,r.cancelable,window,r.ctrlKey,r.altKey,r.shiftKey,r.metaKey,r.keyCode,r.charCode);break;default:s.initEvent(e,r.bubbles||!1,r.cancelable||!0)}Dc.defaults(s,i),t.dispatchEvent(s)},bind:function(t,e,n,i){var r=i||!1;return t.addEventListener?t.addEventListener(e,n,r):t.attachEvent&&t.attachEvent("on"+e,n),td},unbind:function(t,e,n,i){var r=i||!1;return t.removeEventListener?t.removeEventListener(e,n,r):t.detachEvent&&t.detachEvent("on"+e,n),td},addClass:function(t,e){if(void 0===t.className)t.className=e;else if(t.className!==e){var n=t.className.split(/ +/);-1===n.indexOf(e)&&(n.push(e),t.className=n.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return td},removeClass:function(t,e){if(e)if(t.className===e)t.removeAttribute("class");else{var n=t.className.split(/ +/),i=n.indexOf(e);-1!==i&&(n.splice(i,1),t.className=n.join(" "))}else t.className=void 0;return td},hasClass:function(t,e){return new RegExp("(?:^|\\s+)"+e+"(?:\\s+|$)").test(t.className)||!1},getWidth:function(t){var e=getComputedStyle(t);return Qc(e["border-left-width"])+Qc(e["border-right-width"])+Qc(e["padding-left"])+Qc(e["padding-right"])+Qc(e.width)},getHeight:function(t){var e=getComputedStyle(t);return Qc(e["border-top-width"])+Qc(e["border-bottom-width"])+Qc(e["padding-top"])+Qc(e["padding-bottom"])+Qc(e.height)},getOffset:function(t){var e=t,n={left:0,top:0};if(e.offsetParent)do{n.left+=e.offsetLeft,n.top+=e.offsetTop,e=e.offsetParent}while(e);return n},isActive:function(t){return t===document.activeElement&&(t.type||t.href)}},ed=function(t){function e(t,n){zc(this,e);var i=Xc(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),r=i;return i.__prev=i.getValue(),i.__checkbox=document.createElement("input"),i.__checkbox.setAttribute("type","checkbox"),td.bind(i.__checkbox,"change",(function(){r.setValue(!r.__prev)}),!1),i.domElement.appendChild(i.__checkbox),i.updateDisplay(),i}return Wc(e,t),jc(e,[{key:"setValue",value:function(t){var n=Vc(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(),n}},{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),Vc(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(Jc),nd=function(t){function e(t,n,i){zc(this,e);var r=Xc(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=i,s=r;if(r.__select=document.createElement("select"),Dc.isArray(o)){var a={};Dc.each(o,(function(t){a[t]=t})),o=a}return Dc.each(o,(function(t,e){var n=document.createElement("option");n.innerHTML=e,n.setAttribute("value",t),s.__select.appendChild(n)})),r.updateDisplay(),td.bind(r.__select,"change",(function(){var t=this.options[this.selectedIndex].value;s.setValue(t)})),r.domElement.appendChild(r.__select),r}return Wc(e,t),jc(e,[{key:"setValue",value:function(t){var n=Vc(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),n}},{key:"updateDisplay",value:function(){return td.isActive(this.__select)?this:(this.__select.value=this.getValue(),Vc(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this))}}]),e}(Jc),id=function(t){function e(t,n){zc(this,e);var i=Xc(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),r=i;function o(){r.setValue(r.__input.value)}return i.__input=document.createElement("input"),i.__input.setAttribute("type","text"),td.bind(i.__input,"keyup",o),td.bind(i.__input,"change",o),td.bind(i.__input,"blur",(function(){r.__onFinishChange&&r.__onFinishChange.call(r,r.getValue())})),td.bind(i.__input,"keydown",(function(t){13===t.keyCode&&this.blur()})),i.updateDisplay(),i.domElement.appendChild(i.__input),i}return Wc(e,t),jc(e,[{key:"updateDisplay",value:function(){return td.isActive(this.__input)||(this.__input.value=this.getValue()),Vc(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(Jc);function rd(t){var e=t.toString();return e.indexOf(".")>-1?e.length-e.indexOf(".")-1:0}var od=function(t){function e(t,n,i){zc(this,e);var r=Xc(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=i||{};return r.__min=o.min,r.__max=o.max,r.__step=o.step,Dc.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=rd(r.__impliedStep),r}return Wc(e,t),jc(e,[{key:"setValue",value:function(t){var n=t;return void 0!==this.__min&&n<this.__min?n=this.__min:void 0!==this.__max&&n>this.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),Vc(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,n)}},{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=rd(t),this}}]),e}(Jc);var sd=function(t){function e(t,n,i){zc(this,e);var r=Xc(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,i));r.__truncationSuspended=!1;var o=r,s=void 0;function a(){o.__onFinishChange&&o.__onFinishChange.call(o,o.getValue())}function u(t){var e=s-t.clientY;o.setValue(o.getValue()+e*o.__impliedStep),s=t.clientY}function l(){td.unbind(window,"mousemove",u),td.unbind(window,"mouseup",l),a()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),td.bind(r.__input,"change",(function(){var t=parseFloat(o.__input.value);Dc.isNaN(t)||o.setValue(t)})),td.bind(r.__input,"blur",(function(){a()})),td.bind(r.__input,"mousedown",(function(t){td.bind(window,"mousemove",u),td.bind(window,"mouseup",l),s=t.clientY})),td.bind(r.__input,"keydown",(function(t){13===t.keyCode&&(o.__truncationSuspended=!0,this.blur(),o.__truncationSuspended=!1,a())})),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return Wc(e,t),jc(e,[{key:"updateDisplay",value:function(){var t,n,i;return this.__input.value=this.__truncationSuspended?this.getValue():(t=this.getValue(),n=this.__precision,i=Math.pow(10,n),Math.round(t*i)/i),Vc(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(od);function ad(t,e,n,i,r){return i+(t-e)/(n-e)*(r-i)}var ud=function(t){function e(t,n,i,r,o){zc(this,e);var s=Xc(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,{min:i,max:r,step:o})),a=s;function u(t){t.preventDefault();var e=a.__background.getBoundingClientRect();return a.setValue(ad(t.clientX,e.left,e.right,a.__min,a.__max)),!1}function l(){td.unbind(window,"mousemove",u),td.unbind(window,"mouseup",l),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function h(t){var e=t.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(ad(e,n.left,n.right,a.__min,a.__max))}function c(){td.unbind(window,"touchmove",h),td.unbind(window,"touchend",c),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),td.bind(s.__background,"mousedown",(function(t){document.activeElement.blur(),td.bind(window,"mousemove",u),td.bind(window,"mouseup",l),u(t)})),td.bind(s.__background,"touchstart",(function(t){if(1!==t.touches.length)return;td.bind(window,"touchmove",h),td.bind(window,"touchend",c),h(t)})),td.addClass(s.__background,"slider"),td.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return Wc(e,t),jc(e,[{key:"updateDisplay",value:function(){var t=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*t+"%",Vc(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(od),ld=function(t){function e(t,n,i){zc(this,e);var r=Xc(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=r;return r.__button=document.createElement("div"),r.__button.innerHTML=void 0===i?"Fire":i,td.bind(r.__button,"click",(function(t){return t.preventDefault(),o.fire(),!1})),td.addClass(r.__button,"button"),r.domElement.appendChild(r.__button),r}return Wc(e,t),jc(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}(Jc),hd=function(t){function e(t,n){zc(this,e);var i=Xc(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));i.__color=new qc(i.getValue()),i.__temp=new qc(0);var r=i;i.domElement=document.createElement("div"),td.makeSelectable(i.domElement,!1),i.__selector=document.createElement("div"),i.__selector.className="selector",i.__saturation_field=document.createElement("div"),i.__saturation_field.className="saturation-field",i.__field_knob=document.createElement("div"),i.__field_knob.className="field-knob",i.__field_knob_border="2px solid ",i.__hue_knob=document.createElement("div"),i.__hue_knob.className="hue-knob",i.__hue_field=document.createElement("div"),i.__hue_field.className="hue-field",i.__input=document.createElement("input"),i.__input.type="text",i.__input_textShadow="0 1px 1px ",td.bind(i.__input,"keydown",(function(t){13===t.keyCode&&c.call(this)})),td.bind(i.__input,"blur",c),td.bind(i.__selector,"mousedown",(function(){td.addClass(this,"drag").bind(window,"mouseup",(function(){td.removeClass(r.__selector,"drag")}))})),td.bind(i.__selector,"touchstart",(function(){td.addClass(this,"drag").bind(window,"touchend",(function(){td.removeClass(r.__selector,"drag")}))}));var o,s=document.createElement("div");function a(t){f(t),td.bind(window,"mousemove",f),td.bind(window,"touchmove",f),td.bind(window,"mouseup",l),td.bind(window,"touchend",l)}function u(t){p(t),td.bind(window,"mousemove",p),td.bind(window,"touchmove",p),td.bind(window,"mouseup",h),td.bind(window,"touchend",h)}function l(){td.unbind(window,"mousemove",f),td.unbind(window,"touchmove",f),td.unbind(window,"mouseup",l),td.unbind(window,"touchend",l),d()}function h(){td.unbind(window,"mousemove",p),td.unbind(window,"touchmove",p),td.unbind(window,"mouseup",h),td.unbind(window,"touchend",h),d()}function c(){var t=kc(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 f(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=r.__saturation_field.getBoundingClientRect(),n=t.touches&&t.touches[0]||t,i=n.clientX,o=n.clientY,s=(i-e.left)/(e.right-e.left),a=1-(o-e.top)/(e.bottom-e.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function p(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=r.__hue_field.getBoundingClientRect(),n=1-((t.touches&&t.touches[0]||t).clientY-e.top)/(e.bottom-e.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return Dc.extend(i.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),Dc.extend(i.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:i.__field_knob_border+(i.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),Dc.extend(i.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),Dc.extend(i.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),Dc.extend(s.style,{width:"100%",height:"100%",background:"none"}),dd(s,"top","rgba(0,0,0,0)","#000"),Dc.extend(i.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(o=i.__hue_field).style.background="",o.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",o.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",Dc.extend(i.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:i.__input_textShadow+"rgba(0,0,0,0.7)"}),td.bind(i.__saturation_field,"mousedown",a),td.bind(i.__saturation_field,"touchstart",a),td.bind(i.__field_knob,"mousedown",a),td.bind(i.__field_knob,"touchstart",a),td.bind(i.__hue_field,"mousedown",u),td.bind(i.__hue_field,"touchstart",u),i.__saturation_field.appendChild(s),i.__selector.appendChild(i.__field_knob),i.__selector.appendChild(i.__saturation_field),i.__selector.appendChild(i.__hue_field),i.__hue_field.appendChild(i.__hue_knob),i.domElement.appendChild(i.__input),i.domElement.appendChild(i.__selector),i.updateDisplay(),i}return Wc(e,t),jc(e,[{key:"updateDisplay",value:function(){var t=kc(this.getValue());if(!1!==t){var e=!1;Dc.each(qc.COMPONENTS,(function(n){if(!Dc.isUndefined(t[n])&&!Dc.isUndefined(this.__color.__state[n])&&t[n]!==this.__color.__state[n])return e=!0,{}}),this),e&&Dc.extend(this.__color.__state,t)}Dc.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,i=255-n;Dc.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("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,dd(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),Dc.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+i+","+i+","+i+",.7)"})}}]),e}(Jc),cd=["-moz-","-o-","-webkit-","-ms-",""];function dd(t,e,n,i){t.style.background="",Dc.each(cd,(function(r){t.style.cssText+="background: "+r+"linear-gradient("+e+", "+n+" 0%, "+i+" 100%); "}))}var fd=function(t,e){var n=e||document,i=document.createElement("style");i.type="text/css",i.innerHTML=t;var r=n.getElementsByTagName("head")[0];try{r.appendChild(i)}catch(t){}},pd='<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>',md=function(t,e){var n=t[e];return Dc.isArray(arguments[2])||Dc.isObject(arguments[2])?new nd(t,e,arguments[2]):Dc.isNumber(n)?Dc.isNumber(arguments[2])&&Dc.isNumber(arguments[3])?Dc.isNumber(arguments[4])?new ud(t,e,arguments[2],arguments[3],arguments[4]):new ud(t,e,arguments[2],arguments[3]):Dc.isNumber(arguments[4])?new sd(t,e,{min:arguments[2],max:arguments[3],step:arguments[4]}):new sd(t,e,{min:arguments[2],max:arguments[3]}):Dc.isString(n)?new id(t,e):Dc.isFunction(n)?new ld(t,e,""):Dc.isBoolean(n)?new ed(t,e):null};var gd=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,1e3/60)},vd=function(){function t(){zc(this,t),this.backgroundElement=document.createElement("div"),Dc.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"}),td.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),Dc.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;td.bind(this.backgroundElement,"click",(function(){e.hide()}))}return jc(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(),Dc.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",td.unbind(t.domElement,"webkitTransitionEnd",e),td.unbind(t.domElement,"transitionend",e),td.unbind(t.domElement,"oTransitionEnd",e)};td.bind(this.domElement,"webkitTransitionEnd",e),td.bind(this.domElement,"transitionend",e),td.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-td.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-td.getHeight(this.domElement)/2+"px"}}]),t}();fd(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 .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 _d=function(){try{return!!window.localStorage}catch(t){return!1}}(),yd=void 0,xd=!0,bd=void 0,wd=!1,Sd=[],Td=function t(e){var n=this,i=e||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),td.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],i=Dc.defaults(i,{closeOnTop:!1,autoPlace:!0,width:t.DEFAULT_WIDTH}),i=Dc.defaults(i,{resizable:i.autoPlace,hideable:i.autoPlace}),Dc.isUndefined(i.load)?i.load={preset:"Default"}:i.preset&&(i.load.preset=i.preset),Dc.isUndefined(i.parent)&&i.hideable&&Sd.push(this),i.resizable=Dc.isUndefined(i.parent)&&i.resizable,i.autoPlace&&Dc.isUndefined(i.scrollable)&&(i.scrollable=!0);var r,o=_d&&"true"===localStorage.getItem(Rd(this,"isLocal")),s=void 0,a=void 0;if(Object.defineProperties(this,{parent:{get:function(){return i.parent}},scrollable:{get:function(){return i.scrollable}},autoPlace:{get:function(){return i.autoPlace}},closeOnTop:{get:function(){return i.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:i.load.preset},set:function(t){n.parent?n.getRoot().preset=t:i.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),n.revert()}},width:{get:function(){return i.width},set:function(t){i.width=t,Nd(n,t)}},name:{get:function(){return i.name},set:function(t){i.name=t,a&&(a.innerHTML=i.name)}},closed:{get:function(){return i.closed},set:function(e){i.closed=e,i.closed?td.addClass(n.__ul,t.CLASS_CLOSED):td.removeClass(n.__ul,t.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=e?t.TEXT_OPEN:t.TEXT_CLOSED)}},load:{get:function(){return i.load}},useLocalStorage:{get:function(){return o},set:function(t){_d&&(o=t,t?td.bind(window,"unload",s):td.unbind(window,"unload",s),localStorage.setItem(Rd(n,"isLocal"),t))}}}),Dc.isUndefined(i.parent)){if(this.closed=i.closed||!1,td.addClass(this.domElement,t.CLASS_MAIN),td.makeSelectable(this.domElement,!1),_d&&o){n.useLocalStorage=!0;var u=localStorage.getItem(Rd(this,"gui"));u&&(i.load=JSON.parse(u))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=t.TEXT_CLOSED,td.addClass(this.__closeButton,t.CLASS_CLOSE_BUTTON),i.closeOnTop?(td.addClass(this.__closeButton,t.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(td.addClass(this.__closeButton,t.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),td.bind(this.__closeButton,"click",(function(){n.closed=!n.closed}))}else{void 0===i.closed&&(i.closed=!0);var l=document.createTextNode(i.name);td.addClass(l,"controller-name"),a=Ed(n,l);td.addClass(this.__ul,t.CLASS_CLOSED),td.addClass(a,"title"),td.bind(a,"click",(function(t){return t.preventDefault(),n.closed=!n.closed,!1})),i.closed||(this.closed=!1)}i.autoPlace&&(Dc.isUndefined(i.parent)&&(xd&&(bd=document.createElement("div"),td.addClass(bd,"dg"),td.addClass(bd,t.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(bd),xd=!1),bd.appendChild(this.domElement),td.addClass(this.domElement,t.CLASS_AUTO_PLACE)),this.parent||Nd(n,i.width)),this.__resizeHandler=function(){n.onResizeDebounced()},td.bind(window,"resize",this.__resizeHandler),td.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),td.bind(this.__ul,"transitionend",this.__resizeHandler),td.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),i.resizable&&Dd(this),s=function(){_d&&"true"===localStorage.getItem(Rd(n,"isLocal"))&&localStorage.setItem(Rd(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=s,i.parent||((r=n.getRoot()).width+=1,Dc.defer((function(){r.width-=1})))};function Ed(t,e,n){var i=document.createElement("li");return e&&i.appendChild(e),n?t.__ul.insertBefore(i,n):t.__ul.appendChild(i),t.onResize(),i}function Md(t){td.unbind(window,"resize",t.__resizeHandler),t.saveToLocalStorageIfPossible&&td.unbind(window,"unload",t.saveToLocalStorageIfPossible)}function Ad(t,e){var n=t.__preset_select[t.__preset_select.selectedIndex];n.innerHTML=e?n.value+"*":n.value}function Pd(t,e){var n=t.getRoot(),i=n.__rememberedObjects.indexOf(e.object);if(-1!==i){var r=n.__rememberedObjectIndecesToControllers[i];if(void 0===r&&(r={},n.__rememberedObjectIndecesToControllers[i]=r),r[e.property]=e,n.load&&n.load.remembered){var o=n.load.remembered,s=void 0;if(o[t.preset])s=o[t.preset];else{if(!o.Default)return;s=o.Default}if(s[i]&&void 0!==s[i][e.property]){var a=s[i][e.property];e.initialValue=a,e.setValue(a)}}}}function Cd(t,e,n,i){if(void 0===e[n])throw new Error('Object "'+e+'" has no property "'+n+'"');var r=void 0;if(i.color)r=new hd(e,n);else{var o=[e,n].concat(i.factoryArgs);r=md.apply(t,o)}i.before instanceof Jc&&(i.before=i.before.__li),Pd(t,r),td.addClass(r.domElement,"c");var s=document.createElement("span");td.addClass(s,"property-name"),s.innerHTML=r.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(r.domElement);var u=Ed(t,a,i.before);return td.addClass(u,Td.CLASS_CONTROLLER_ROW),r instanceof hd?td.addClass(u,"color"):td.addClass(u,Hc(r.getValue())),function(t,e,n){if(n.__li=e,n.__gui=t,Dc.extend(n,{options:function(e){if(arguments.length>1){var i=n.__li.nextElementSibling;return n.remove(),Cd(t,n.object,n.property,{before:i,factoryArgs:[Dc.toArray(arguments)]})}if(Dc.isArray(e)||Dc.isObject(e)){var r=n.__li.nextElementSibling;return n.remove(),Cd(t,n.object,n.property,{before:r,factoryArgs:[e]})}},name:function(t){return n.__li.firstElementChild.firstElementChild.innerHTML=t,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof ud){var i=new sd(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});Dc.each(["updateDisplay","onChange","onFinishChange","step","min","max"],(function(t){var e=n[t],r=i[t];n[t]=i[t]=function(){var t=Array.prototype.slice.call(arguments);return r.apply(i,t),e.apply(n,t)}})),td.addClass(e,"has-slider"),n.domElement.insertBefore(i.domElement,n.domElement.firstElementChild)}else if(n instanceof sd){var r=function(e){if(Dc.isNumber(n.__min)&&Dc.isNumber(n.__max)){var i=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var o=Cd(t,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return o.name(i),r&&o.listen(),o}return e};n.min=Dc.compose(r,n.min),n.max=Dc.compose(r,n.max)}else n instanceof ed?(td.bind(e,"click",(function(){td.fakeEvent(n.__checkbox,"click")})),td.bind(n.__checkbox,"click",(function(t){t.stopPropagation()}))):n instanceof ld?(td.bind(e,"click",(function(){td.fakeEvent(n.__button,"click")})),td.bind(e,"mouseover",(function(){td.addClass(n.__button,"hover")})),td.bind(e,"mouseout",(function(){td.removeClass(n.__button,"hover")}))):n instanceof hd&&(td.addClass(e,"color"),n.updateDisplay=Dc.compose((function(t){return e.style.borderLeftColor=n.__color.toString(),t}),n.updateDisplay),n.updateDisplay());n.setValue=Dc.compose((function(e){return t.getRoot().__preset_select&&n.isModified()&&Ad(t.getRoot(),!0),e}),n.setValue)}(t,u,r),t.__controllers.push(r),r}function Rd(t,e){return document.location.href+"."+e}function Id(t,e,n){var i=document.createElement("option");i.innerHTML=e,i.value=e,t.__preset_select.appendChild(i),n&&(t.__preset_select.selectedIndex=t.__preset_select.length-1)}function Ld(t,e){e.style.display=t.useLocalStorage?"block":"none"}function Od(t){var e=t.__save_row=document.createElement("li");td.addClass(t.domElement,"has-save"),t.__ul.insertBefore(e,t.__ul.firstChild),td.addClass(e,"save-row");var n=document.createElement("span");n.innerHTML=" ",td.addClass(n,"button gears");var i=document.createElement("span");i.innerHTML="Save",td.addClass(i,"button"),td.addClass(i,"save");var r=document.createElement("span");r.innerHTML="New",td.addClass(r,"button"),td.addClass(r,"save-as");var o=document.createElement("span");o.innerHTML="Revert",td.addClass(o,"button"),td.addClass(o,"revert");var s=t.__preset_select=document.createElement("select");if(t.load&&t.load.remembered?Dc.each(t.load.remembered,(function(e,n){Id(t,n,n===t.preset)})):Id(t,"Default",!1),td.bind(s,"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(s),e.appendChild(n),e.appendChild(i),e.appendChild(r),e.appendChild(o),_d){var a=document.getElementById("dg-local-explain"),u=document.getElementById("dg-local-storage");document.getElementById("dg-save-locally").style.display="block","true"===localStorage.getItem(Rd(0,"isLocal"))&&u.setAttribute("checked","checked"),Ld(t,a),td.bind(u,"change",(function(){t.useLocalStorage=!t.useLocalStorage,Ld(t,a)}))}var l=document.getElementById("dg-new-constructor");td.bind(l,"keydown",(function(t){!t.metaKey||67!==t.which&&67!==t.keyCode||yd.hide()})),td.bind(n,"click",(function(){l.innerHTML=JSON.stringify(t.getSaveObject(),void 0,2),yd.show(),l.focus(),l.select()})),td.bind(i,"click",(function(){t.save()})),td.bind(r,"click",(function(){var e=prompt("Enter a new preset name.");e&&t.saveAs(e)})),td.bind(o,"click",(function(){t.revert()}))}function Dd(t){var e=void 0;function n(n){return n.preventDefault(),t.width+=e-n.clientX,t.onResize(),e=n.clientX,!1}function i(){td.removeClass(t.__closeButton,Td.CLASS_DRAG),td.unbind(window,"mousemove",n),td.unbind(window,"mouseup",i)}function r(r){return r.preventDefault(),e=r.clientX,td.addClass(t.__closeButton,Td.CLASS_DRAG),td.bind(window,"mousemove",n),td.bind(window,"mouseup",i),!1}t.__resize_handle=document.createElement("div"),Dc.extend(t.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),td.bind(t.__resize_handle,"mousedown",r),td.bind(t.__closeButton,"mousedown",r),t.domElement.insertBefore(t.__resize_handle,t.domElement.firstElementChild)}function Nd(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 Fd(t,e){var n={};return Dc.each(t.__rememberedObjects,(function(i,r){var o={},s=t.__rememberedObjectIndecesToControllers[r];Dc.each(s,(function(t,n){o[n]=e?t.initialValue:t.getValue()})),n[r]=o})),n}Td.toggleHide=function(){wd=!wd,Dc.each(Sd,(function(t){t.domElement.style.display=wd?"none":""}))},Td.CLASS_AUTO_PLACE="a",Td.CLASS_AUTO_PLACE_CONTAINER="ac",Td.CLASS_MAIN="main",Td.CLASS_CONTROLLER_ROW="cr",Td.CLASS_TOO_TALL="taller-than-window",Td.CLASS_CLOSED="closed",Td.CLASS_CLOSE_BUTTON="close-button",Td.CLASS_CLOSE_TOP="close-top",Td.CLASS_CLOSE_BOTTOM="close-bottom",Td.CLASS_DRAG="drag",Td.DEFAULT_WIDTH=245,Td.TEXT_CLOSED="Close Controls",Td.TEXT_OPEN="Open Controls",Td._keydownHandler=function(t){"text"===document.activeElement.type||72!==t.which&&72!==t.keyCode||Td.toggleHide()},td.bind(window,"keydown",Td._keydownHandler,!1),Dc.extend(Td.prototype,{add:function(t,e){return Cd(this,t,e,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(t,e){return Cd(this,t,e,{color:!0})},remove:function(t){this.__ul.removeChild(t.__li),this.__controllers.splice(this.__controllers.indexOf(t),1);var e=this;Dc.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&&bd.removeChild(this.domElement);var t=this;Dc.each(this.__folders,(function(e){t.removeFolder(e)})),td.unbind(window,"keydown",Td._keydownHandler,!1),Md(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 n=new Td(e);this.__folders[t]=n;var i=Ed(this,n.domElement);return td.addClass(i,"folder"),n},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],Md(t);var e=this;Dc.each(t.__folders,(function(e){t.removeFolder(e)})),Dc.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=td.getOffset(t.__ul).top,n=0;Dc.each(t.__ul.childNodes,(function(e){t.autoPlace&&e===t.__save_row||(n+=td.getHeight(e))})),window.innerHeight-e-20<n?(td.addClass(t.domElement,Td.CLASS_TOO_TALL),t.__ul.style.height=window.innerHeight-e-20+"px"):(td.removeClass(t.domElement,Td.CLASS_TOO_TALL),t.__ul.style.height="auto")}t.__resize_handle&&Dc.defer((function(){t.__resize_handle.style.height=t.__ul.offsetHeight+"px"})),t.__closeButton&&(t.__closeButton.style.width=t.width+"px")},onResizeDebounced:Dc.debounce((function(){this.onResize()}),50),remember:function(){if(Dc.isUndefined(yd)&&((yd=new vd).domElement.innerHTML=pd),this.parent)throw new Error("You can only call remember on a top level GUI.");var t=this;Dc.each(Array.prototype.slice.call(arguments),(function(e){0===t.__rememberedObjects.length&&Od(t),-1===t.__rememberedObjects.indexOf(e)&&t.__rememberedObjects.push(e)})),this.autoPlace&&Nd(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]=Fd(this)),t.folders={},Dc.each(this.__folders,(function(e,n){t.folders[n]=e.getSaveObject()})),t},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=Fd(this),Ad(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(t){this.load.remembered||(this.load.remembered={},this.load.remembered.Default=Fd(this,!0)),this.load.remembered[t]=Fd(this),this.preset=t,Id(this,t,!0),this.saveToLocalStorageIfPossible()},revert:function(t){Dc.each(this.__controllers,(function(e){this.getRoot().load.remembered?Pd(t||this.getRoot(),e):e.setValue(e.initialValue),e.__onFinishChange&&e.__onFinishChange.call(e,e.getValue())}),this),Dc.each(this.__folders,(function(t){t.revert(t)})),t||Ad(this.getRoot(),!1)},listen:function(t){var e=0===this.__listening.length;this.__listening.push(t),e&&function t(e){0!==e.length&&gd.call(window,(function(){t(e)}));Dc.each(e,(function(t){t.updateDisplay()}))}(this.__listening)},updateDisplay:function(){Dc.each(this.__controllers,(function(t){t.updateDisplay()})),Dc.each(this.__folders,(function(t){t.updateDisplay()}))}});var Bd=Td,kd=function(){function t(t){this.runTime={fps:0,resolution:""},this.target=t.target,this.data=t.params,this.player=t.player,this.gui=this.createControllerGUI(),this.createStats(),this.addEventListener()}return t.prototype.createStats=function(){var t=this;this.stateId=setInterval((function(){t.player.view&&(t.controller.runTimeFps.setValue(t.player.runtime.fps),t.controller.runTimeResolution.setValue(t.player.view.width+"*"+t.player.view.height))}),500)},t.prototype.createControllerGUI=function(){var t,e,n,i,r,o=new Bd({autoPlace:!0,closed:!0});return o.domElement.style.opacity=".6",o.domElement.style.transformOrigin="100% 0",o.domElement.style.transform="scale(1.4)",this.target.appendChild(o.domElement),o.domElement.style.position="absolute",o.domElement.style.right="0",o.domElement.style.top="0",o.domElement.style.zIndex="2",this.controller={runTimeFps:o.add({FPS:0},"FPS",0),runTimeResolution:o.add({"分辨率":""},"分辨率",""),autoResolution:o.add({"自动分辨率":null!==(t=this.data.autoResolution)&&void 0!==t&&t},"自动分辨率",!0),autoFps:o.add({"自动fps":null===(e=this.data.autoFPS)||void 0===e||e},"自动fps",!0),moreCalculation:o.add({"额外计算":0},"额外计算",0,100),minFPS:o.add({"最低fps":null!==(n=this.data.minFPS)&&void 0!==n?n:40},"最低fps",0,60),maxFPS:o.add({"最高fps":null!==(i=this.data.maxFPS)&&void 0!==i?i:50},"最高fps",0,60),resolution:o.add({"目标分辨倍率":null!==(r=this.data.resolution)&&void 0!==r?r:window.devicePixelRatio},"目标分辨倍率",.5,4)},this.controller.runTimeFps.disabled=!0,this.controller.runTimeResolution.disabled=!0,o},t.prototype.addEventListener=function(){var t,e=this;this.controller.autoFps.onChange((function(t){e.data.autoFPS=t,e.player.updateConfig(e.data)})),this.controller.maxFPS.onChange((function(t){e.data.maxFPS=t,e.player.updateConfig(e.data)})),this.controller.minFPS.onChange((function(t){e.data.minFPS=t,e.player.updateConfig(e.data)})),this.controller.autoResolution.onChange((function(t){e.data.autoResolution=t,e.player.updateConfig(e.data)})),this.controller.resolution.onChange((function(t){e.data.resolution=t,e.player.updateConfig(e.data)})),this.controller.moreCalculation.onChange((function(n){t&&e.player.app.ticker.remove(t),n>0&&(t=function(){for(var t="";t.length<8e3*n;)t+=Math.random().toString(32).substr(2);Au()(t)},e.player.app.ticker.add(t))}))},t.prototype.destroy=function(){try{window.clearInterval(this.stateId),this.target.removeChild(this.gui.domElement),this.gui.destroy()}catch(t){}},t}(),Ud=function(){function t(t){var e=this;this.tasks=[],this.schedule=function(){var t=e.tasks[0];t?e.fn(t).then((function(){e.tasks.splice(0,1),window.requestAnimationFrame(e.schedule)})):window.requestAnimationFrame(e.schedule)},this.fn=t,this.schedule()}return t.prototype.addTask=function(t){this.tasks.push(t)},t}(),Gd=function(){function t(){this.autoUnlock=Object.create(null),this.locks=Object.create(null)}return t.prototype.addLock=function(t,e){var n=this;this.locks[t]=e,this.autoUnlock[t]=window.setTimeout((function(){delete n.locks[t]}),3e3)},t.prototype.unlock=function(t,e){e&&this.locks[t]&&this.locks[t]===e&&(window.clearTimeout(this.autoUnlock[t]),delete this.locks[t])},t.prototype.isLocked=function(t){return!!this.locks[t]},t}(),Hd=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),zd=function(){return(zd=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},jd=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))},Vd=function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};window.__slide_local_logger__||(window.__slide_local_logger__=r.createInstance({name:"_slide_local_log_",driver:r.INDEXEDDB,version:1}));var Wd=window.__slide_local_logger__,Xd=window.ResizeObserver||Mc,qd=function(t){return new Promise((function(e){return setTimeout(e,t)}))};function Yd(t,e){return jd(this,void 0,void 0,(function(){var n;return Vd(this,(function(i){switch(i.label){case 0:n=Date.now(),i.label=1;case 1:return!t()&&Date.now()-n<e?[4,qd(50)]:[3,3];case 2:return i.sent(),[3,1];case 3:return[2]}}))}))}var Zd={syncDispatch:"syncDispatch",syncReceive:"syncReceive",renderStart:"renderStart",renderEnd:"renderEnd",renderError:"renderError",slideChange:"slideChange",mainSeqStepStart:"mainSeqStepStart",mainSeqStepEnd:"mainSeqStepEnd",animateStart:"animateStart",animateEnd:"animateEnd",stateChange:"stateChange"},Jd={taskId:"",url:"",currentSlideIndex:-1,mainSeqStep:-1,mainSeqState:null,mediaState:Object.create(null),interactiveSeqState:Object.create(null)},Kd=function(t){function e(e){var n=t.call(this)||this;return n.__slideState=Object(a.cloneDeep)(Jd),n.resize=!1,n.isAnimating=!1,n.renderingTaskManager=new Rc,n.isLoading=!1,n.interactive=!0,n.frameWidth=1,n.frameHeight=1,n.frame=document.createElement("div"),n.medianController=document.createElement("div"),n.frameResizeObserver=new Xd((function(){return n.frameResizeHandler()})),n.timestamp=function(){return Date.now()},n.mode="local",n.log="",n.logId="",n.lastEmitedState=null,n.playerController=null,n.lock=new Gd,n.isInitResized=!1,n.cacheImage=document.createElement("img"),n.isFrowning=!1,n.isReleasing=!1,n.designWidth=0,n.designHeight=0,n._slideCount=0,n.persistLog=function(){return jd(n,void 0,void 0,(function(){var t,e;return Vd(this,(function(n){switch(n.label){case 0:if(!Wd||!this.logId)return[3,5];n.label=1;case 1:return n.trys.push([1,4,,5]),t=this.log,[4,Wd.getItem(this.logId)];case 2:return e=n.sent()||"",[4,Wd.setItem(this.logId,e+t)];case 3:return n.sent(),this.log="",[3,5];case 4:return n.sent(),[3,5];case 5:return[2]}}))}))},n.handleSlideRef=function(){console.log(n)},n.handleSlideStateLog=function(){console.log(n.logId),console.log(JSON.stringify(n.slideState,null,2))},n.handleLogDownload=function(){return jd(n,void 0,void 0,(function(){var t,e,n;return Vd(this,(function(i){switch(i.label){case 0:return t="",Wd?(e=t,[4,Wd.getItem(this.logId)]):[3,2];case 1:t=e+(i.sent()||""),i.label=2;case 2:return t+=this.log,(n=document.createElement("a")).setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(t)),n.setAttribute("download",this.logId),n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n),[2]}}))}))},n.receiveSyncHandler=function(t){return jd(n,void 0,void 0,(function(){var e,n,i,r,o=this;return Vd(this,(function(s){switch(s.label){case 0:return this.log+="=== sync receive ["+(new Date).toISOString()+"] ===\n",this.log+=JSON.stringify(t,null,2),this.log+="\n\n","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(){o.doNextStep()}))):this.doNextStep(),[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():(this.setMainSeqStep(t.next+1,"start"),null===(e=this.player)||void 0===e||e.nextTick((function(){o.doPrevStep()}))),[3,6]);case 2:return"interactiveAnim"!==t.type?[3,3]:(this.player?this.player.applyInteractiveAction(t.seqId):this.__slideState.interactiveSeqState[t.seqId].step+=1,[3,6]);case 3:return"renderSlide"!==t.type?[3,5]:[4,this.doRenderSlide(t.index,t.isForward)];case 4:return s.sent(),[3,6];case 5:"mediaPlay"===t.type?(null===(n=this.player)||void 0===n||n.setMediaState(t.id,!0),this.__slideState.mediaState[t.id]=t.state):"mediaPause"===t.type?(null===(i=this.player)||void 0===i||i.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),s.label=6;case 6:return[2]}}))}))},n.handlePrevSlide=function(){return jd(n,void 0,void 0,(function(){var t;return Vd(this,(function(e){return this.player?((t=this.player.prevSlideIndex)>=1&&this.renderSlide(t,!1),[2]):[2]}))}))},n.handleNextSlide=function(){return jd(n,void 0,void 0,(function(){var t;return Vd(this,(function(e){return this.player?((t=this.player.nextSlideIndex)<=this.slideCount&&this.renderSlide(t,!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)},e.timestamp&&(n.timestamp=e.timestamp),n.config=e,n.syncQueue=new Ud(n.receiveSyncHandler),n.mode=e.mode,n.anchor=e.anchor,n.resize=e.resize||!1,n.interactive=e.interactive,n.frame.style.cssText="width:100%;height:100%;display:flex;justify-content:center;align-items:center;visibility:hidden;position:relative;z-index:1;",n.setMedianControllerAttribute(),n.frame.appendChild(n.medianController),n.anchor.appendChild(n.frame),n.frameResizeObserver.observe(n.frame),n.on(Zd.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;n.emit(Zd.renderError,{error:e,index:i.slideIndex})})),window.addEventListener("__slide_log__",n.handleLogDownload),window.addEventListener("__slide_state__",n.handleSlideStateLog),window.addEventListener("__slide_ref__",n.handleSlideRef),n.persistLogId=window.setInterval(n.persistLog,5e3),n.resizeView=Object(a.debounce)(n.resizeView.bind(n),50),n.initPlayer(e),n}return Hd(e,t),e.prototype.initPlayer=function(t){var e=this;this.player=new Gh(this.mode),this.player.setInteractive(this.interactive),this.player.updateConfig(t.renderOptions||{}),this.player.view&&this.frame.appendChild(this.player.view),this.player.on(Uh.renderStart,(function(t){e.isLoading=!0,e.emit(Zd.renderStart,t)})),this.player.on(Uh.renderEnd,(function(t){e.isLoading=!1,e.player&&(e.designHeight=e.player.designHeight,e.designWidth=e.player.designWidth,e.cacheImage.style.width=e.player.designWidth+"px",e.cacheImage.style.height=e.player.designHeight+"px",e._slideCount=e.player.slideCount),e.emit(Zd.renderEnd,t)})),this.player.on(Uh.slideChange,(function(t){e.__slideState.currentSlideIndex=t,e.emit(Zd.slideChange,t)})),this.player.on(Uh.mainSeqStateChange,(function(t){e.__slideState.mainSeqState=t,e.emitStateChange()})),this.player.on(Uh.mainSeqStepChange,(function(t){e.__slideState.mainSeqStep=t,e.emitStateChange()})),this.player.on(Uh.interactiveSeqStateChange,(function(t){var n=t.id,i=t.state;e.__slideState.interactiveSeqState[n]=i,e.emitStateChange()})),this.player.on(Uh.animateStart,(function(){!0!==e.isAnimating&&(e.isAnimating=!0,e.emit(Zd.animateStart))})),this.player.on(Uh.animateEnd,(function(){!1!==e.isAnimating&&(e.isAnimating=!1,e.emit(Zd.animateEnd))})),this.player.on(Uh.interactiveSeqNext,(function(t){e.emitSyncDispatch({slideIndex:e.__slideState.currentSlideIndex,type:"interactiveAnim",seqId:t}),e.emitStateChange()})),this.player.on(Uh.mainSeqStepStart,(function(t){e.emit(Zd.mainSeqStepStart,t)})),this.player.on(Uh.mainSeqStepEnd,(function(t){e.emit(Zd.mainSeqStepEnd,t)})),this.player.on(Uh.mediaPlay,(function(t){var n={type:"play",time:e.timestamp()-1e3*t.time};e.__slideState.mediaState[t.id]=n,e.emitSyncDispatch({slideIndex:e.__slideState.currentSlideIndex,type:"mediaPlay",id:t.id,state:n}),e.emitStateChange()})),this.player.on(Uh.mediaPause,(function(t){var n={type:"pause",time:t.time};e.__slideState.mediaState[t.id]=n,e.emitSyncDispatch({slideIndex:e.__slideState.currentSlideIndex,type:"mediaPause",id:t.id,state:n}),e.emitStateChange()})),this.player.on(Uh.mediaSeek,(function(t){var n={type:"pause",time:0};t.isPlaying?(n.type="play",e.__slideState.mediaState[t.id]?n.time=e.__slideState.mediaState[t.id].time-1e3*t.time:n.time=e.timestamp()-1e3*t.time,e.__slideState.mediaState[t.id]=n):(n.type="pause",n.time=t.time,e.__slideState.mediaState[t.id]=n),e.emitSyncDispatch({slideIndex:e.__slideState.currentSlideIndex,type:"mediaSeek",id:t.id,time:t.time,state:n}),e.emitStateChange()})),this.player.on(Uh.requestPrevSlide,this.handlePrevSlide),this.player.on(Uh.requestNextSlide,this.handleNextSlide),this.player.on(Uh.requestGotoSlide,this.handleGotoSlide),(null==t?void 0:t.controller)&&this.createController()},e.prototype.createController=function(){this.player&&(this.playerController=new kd({player:this.player,params:this.player.config||{},target: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(){var t=this.frame.getBoundingClientRect(),e=t.width,n=t.height;this.frameWidth=e,this.frameHeight=n,this.resizeView()},e.prototype.resizeView=function(){var t,e,n=this,i=this.width,r=this.height;if(i>0&&r>0){var o=this.frameWidth/i,s=o*r;s>this.frameHeight&&(o*=this.frameHeight/s),null===(t=this.player)||void 0===t||t.scaleView(o,this.resize),this.cacheImage.style.transform="scale("+o+")",this.medianController.style.transform="scale("+o+")",this.medianController.style.top=(this.frameHeight-r*o)/2+"px",this.medianController.setAttribute("data-scale",o.toString()),this.isInitResized||(this.isInitResized=!0,null===(e=this.player)||void 0===e||e.clock.setTimeout((function(){n.frame.style.visibility="visible"}),32))}},e.prototype.setSlideState=function(t){var e,n,i;return jd(this,void 0,void 0,(function(){var r,o=this;return Vd(this,(function(s){switch(s.label){case 0:return this.log+="=== stateChange receive ["+(new Date).toISOString()+"] ===\n",this.log+=JSON.stringify(t,null,2),this.log+="\n\n",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===(n=this.player)||void 0===n||n.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:s.sent(),s.label=2;case 2:return[4,null===(i=this.player)||void 0===i?void 0:i.clock.waitUntil((function(){var e,n;return(null===(e=o.player)||void 0===e?void 0:e.currentIndex)===t.currentSlideIndex&&(null===(n=o.player)||void 0===n?void 0:n.currentStage)}),3e3)];case 3:return s.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),[2]}}))}))},e.prototype.initInteractiveSeq=function(t){var e;for(var n in t.interactiveSeqState){var i=t.interactiveSeqState[n];null===(e=this.player)||void 0===e||e.setInteractiveSeqState(n,i.step,"end"===i.state?"end":"start")}},e.prototype.initMedia=function(t){var e,n,i=this,r=function(r){var s=t.mediaState[r],a=o.__slideState.mediaState[r];if(a&&s.type===a.type&&s.time===a.time)return"continue";"play"===s.type?null===(e=o.player)||void 0===e||e.setMediaState(r,!0).then((function(){var t,e=i.timestamp();null===(t=i.player)||void 0===t||t.setMediaCurrentTime(r,(e-s.time)/1e3)})):null===(n=o.player)||void 0===n||n.setMediaState(r,!1).then((function(){var t;null===(t=i.player)||void 0===t||t.setMediaCurrentTime(r,s.time)}))},o=this;for(var s in t.mediaState)r(s)},Object.defineProperty(e.prototype,"slideCount",{get:function(){return this._slideCount},enumerable:!1,configurable:!0}),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 n;null===(n=this.player)||void 0===n||n.setResourceData(t,e),this.__slideState.taskId=t,this.__slideState.url=e,this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"setResource",taskId:t,url:e}),this.logId=t+"-"+Math.random().toString(32).substr(2)},e.prototype._renderSlide=function(t){var e;return jd(this,void 0,void 0,(function(){return Vd(this,(function(n){switch(n.label){case 0:return this.isLoading=!0,[4,null===(e=this.player)||void 0===e?void 0:e.renderSlide(t)];case 1:return n.sent(),this.__slideState.currentSlideIndex=t,this.isLoading=!1,this.resizeView(),this.emitStateChange(),[2]}}))}))},e.prototype.renderSlide=function(t,e){if(void 0===e&&(e=!0),this.player){this.isLoading=!0;var n=Number(t);(n!==this.player.currentIndex||this.renderingTaskManager.hasStartTask())&&(n>this.slideCount&&this.slideCount>0||("interactive"===this.mode?this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:n,isForward:e}):"sync"===this.mode?(this.doRenderSlide(n,e),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:n,isForward:e})):this.doRenderSlide(n,e)))}},e.prototype.doRenderSlide=function(t,e){var n=this;if(void 0===e&&(e=!0),!this.player)return Promise.resolve();var i=Math.random().toString(32).substr(2);return this.player.isForward=e,this.renderingTaskManager.addTask((function(){return n._renderSlide(t)}),t,i),new Promise((function(t){n.renderingTaskManager.eventHub.once("task-end-"+i,t)}))},e.prototype.nextStep=function(){!this.isLoading&&this.player&&(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())},e.prototype.doNextStep=function(){if(this.player){this.player.nextStep();var t=this.player.mainSeqStep();this.__slideState.mainSeqStep=t,this.emitStateChange()}},e.prototype.prevStep=function(){!this.isLoading&&this.player&&(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())},e.prototype.doPrevStep=function(){if(this.player){this.player.prevStep();var t=this.player.mainSeqStep();this.__slideState.mainSeqStep=t,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){var t=this.slideState;!Object(a.isEqual)(this.lastEmitedState,t)&&this.isSlideStateReady(t)&&(this.lastEmitedState=t,this.emit(Zd.stateChange,t),this.log+="=== stateChange dispatch ["+(new Date).toISOString()+"] ===\n",this.log+=JSON.stringify(this.slideState,null,2),this.log+="\n\n")}},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),this.emit(Zd.syncDispatch,zd(zd({},t),{uuid:e})),this.log+="=== sync dispatch ["+(new Date).toISOString()+"] ===\n",this.log+=JSON.stringify(t,null,2),this.log+="\n\n"}},e.prototype.setMainSeqStep=function(t,e){var n;null===(n=this.player)||void 0===n||n.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.getPreviewImage=function(t){var e;return jd(this,void 0,void 0,(function(){return Vd(this,(function(n){return[2,(null===(e=this.player)||void 0===e?void 0:e.getPreviewImage(t))||null]}))}))},e.prototype.frozen=function(){var t;return jd(this,void 0,void 0,(function(){var e,n,i,r=this;return Vd(this,(function(o){switch(o.label){case 0:return this.isFrowning?[2,Yd((function(){return!r.isFrowning}),6e4)]:this.view&&this.player?(this.isFrowning=!0,[4,this.player.clock.waitUntil((function(){return!r.isLoading}),6e4)]):[3,2];case 1:for(n in o.sent(),e=this.player.getSnapshot()||"",this.cacheImage.src=e,this.cacheImage.style.position="absolute",this.cacheImage.style.zIndex="100",this.frame.appendChild(this.cacheImage),this.player.destroy(),null===(t=this.playerController)||void 0===t||t.destroy(),this.player=void 0,this.__slideState.mediaState)i=this.__slideState.mediaState[n],this.__slideState.mediaState[n]=zd(zd({},i),{frozenTime:this.timestamp()});this.isFrowning=!1,o.label=2;case 2:return[2]}}))}))},e.prototype.release=function(){var t;return jd(this,void 0,void 0,(function(){var e,n,i,r,o=this;return Vd(this,(function(s){switch(s.label){case 0:if(this.isReleasing)return[2,Yd((function(){return!o.isReleasing}),6e4)];for(n in this.isReleasing=!0,this.initPlayer(this.config),this.player.view&&(this.player.view.style.visibility="hidden"),e=this.__slideState,this.__slideState=Object(a.cloneDeep)(Jd),e.mediaState)"play"===(i=e.mediaState[n]).type&&(r=Math.max(null!==(t=i.frozenTime)&&void 0!==t?t:0,i.time),i.time=this.timestamp()-(r-i.time),i.frozenTime=void 0);return[4,this.setSlideState(e)];case 1:return s.sent(),[4,this.player.clock.delay(333)];case 2:s.sent(),this.player.view&&(this.player.view.style.visibility="visible");try{this.frame.removeChild(this.cacheImage)}catch(t){}return this.isReleasing=!1,[2]}}))}))},e.prototype.destroy=function(){var t,e,n,i;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===(n=this.player)||void 0===n||n.removeAllListeners(),window.removeEventListener("__slide_log__",this.handleLogDownload),window.removeEventListener("__slide_state__",this.handleSlideStateLog),window.removeEventListener("__slide_ref__",this.handleSlideRef),window.clearInterval(this.persistLogId),Wd&&Wd.removeItem(this.logId).catch((function(){}));try{(null===(i=this.player)||void 0===i?void 0:i.view)&&this.anchor.removeChild(this.player.view)}catch(t){}},e}(s.a)}]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netless/slide",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.38",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "huaguzheng <huaguzheng2007@126.com>",
|
|
6
6
|
"homepage": "https://github.com/huaguzheng/netless-ppt-plugin/tree/main/packages/slide#readme",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "8adfae0943d1739f268e9822bd42094d91057e19"
|
|
43
43
|
}
|