@awayjs/scene 0.13.250 → 0.13.251

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.
@@ -1 +1 @@
1
- (function(t,e){typeof exports==="object"&&typeof module!=="undefined"?e(exports,require("@awayjs/core"),require("@awayjs/stage"),require("@awayjs/view"),require("@awayjs/graphics"),require("@awayjs/renderer"),require("@awayjs/materials"),require("node-html-parser")):typeof define==="function"&&define.amd?define(["exports","@awayjs/core","@awayjs/stage","@awayjs/view","@awayjs/graphics","@awayjs/renderer","@awayjs/materials","node-html-parser"],e):e(t.AwayjsScene=t.AwayjsScene||{},t.AwayjsCore,t.AwayjsStage,t.AwayjsView,t.AwayjsGraphics,t.AwayjsRenderer,t.AwayjsMaterials,t.nodeHtmlParser)})(this,function(d,G,q,o,Y,X,h,y){"use strict";var r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)if(e.hasOwnProperty(i))t[i]=e[i]};function g(t,e){r(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}function t(t,e){var i=typeof Symbol==="function"&&t[Symbol.iterator];if(!i)return t;var r=i.call(t),s,n=[],o;try{while((e===void 0||e-- >0)&&!(s=r.next()).done)n.push(s.value)}catch(t){o={error:t}}finally{try{if(s&&!s.done&&(i=r["return"]))i.call(r)}finally{if(o)throw o.error}}return n}function e(t){return this instanceof e?(this.v=t,this):new e(t)}var i=function(e){g(t,e);function t(){var t=e.call(this)||this;t._pObjects=new Array;return t}t.prototype.getNewObject=function(){var t=this._pCreateObject();this._pObjects.push(t);return t};t.prototype._pCreateObject=function(){throw new G.AbstractMethodError};t.prototype._iValidate=function(){};return t}(G.AssetBase);var s=function(s){g(t,s);function t(t,e){if(t===void 0){t=null}if(e===void 0){e="triangle"}var i=s.call(this)||this;i._primitiveDirty=true;i._uvDirty=true;i._scaleU=1;i._scaleV=1;i._material=t;i._elementsType=e;if(i._elementsType==X.ElementsType.TRIANGLE){var r=new X.TriangleElements(new q.AttributesBuffer);r.autoDeriveNormals=false;r.autoDeriveTangents=false;i._elements=r}else if(i._elementsType==X.ElementsType.LINE){i._elements=new X.LineElements(new q.AttributesBuffer)}return i}Object.defineProperty(t.prototype,"assetType",{get:function(){return t.assetType},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"elementsType",{get:function(){return this._elementsType},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"material",{get:function(){return this._material},set:function(t){if(t==this._material)return;this._material=t;var e=this._pObjects.length;for(var i=0;i<e;i++)this._pObjects[i].material=this._material},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"scaleU",{get:function(){return this._scaleU},set:function(t){if(this._scaleU==t)return;this._scaleU=t;this._pInvalidateUVs()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"scaleV",{get:function(){return this._scaleV},set:function(t){if(this._scaleV==t)return;this._scaleV=t;this._pInvalidateUVs()},enumerable:true,configurable:true});t.prototype._pBuildGraphics=function(t,e){throw new G.AbstractMethodError};t.prototype._pBuildUVs=function(t,e){throw new G.AbstractMethodError};t.prototype._pInvalidatePrimitive=function(){this._primitiveDirty=true};t.prototype._pInvalidateUVs=function(){this._uvDirty=true};t.prototype.updateGraphics=function(){this._pBuildGraphics(this._elements,this._elementsType);this._primitiveDirty=false};t.prototype.updateUVs=function(){this._pBuildUVs(this._elements,this._elementsType);this._uvDirty=false};t.prototype._iValidate=function(){if(this._primitiveDirty)this.updateGraphics();if(this._uvDirty)this.updateUVs()};t.prototype._pCreateObject=function(){var t=new f(null,this._material);t.graphics.addShape(Y.Shape.getShape(this._elements));t._iSourcePrefab=this;return t};t.assetType="[asset PrimitivePrefab]";return t}(i);var n=function(u){g(t,u);function t(t,e,i,r,s,n,o,a,h){if(t===void 0){t=null}if(e===void 0){e="triangle"}if(i===void 0){i=100}if(r===void 0){r=100}if(s===void 0){s=100}if(n===void 0){n=1}if(o===void 0){o=1}if(a===void 0){a=1}if(h===void 0){h=true}var l=u.call(this,t,e)||this;l._width=i;l._height=r;l._depth=s;l._segmentsW=n;l._segmentsH=o;l._segmentsD=a;l._tile6=h;return l}Object.defineProperty(t.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"depth",{get:function(){return this._depth},set:function(t){this._depth=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"tile6",{get:function(){return this._tile6},set:function(t){this._tile6=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"segmentsW",{get:function(){return this._segmentsW},set:function(t){this._segmentsW=t;this._pInvalidatePrimitive();this._pInvalidateUVs()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"segmentsH",{get:function(){return this._segmentsH},set:function(t){this._segmentsH=t;this._pInvalidatePrimitive();this._pInvalidateUVs()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"segmentsD",{get:function(){return this._segmentsD},set:function(t){this._segmentsD=t;this._pInvalidatePrimitive();this._pInvalidateUVs()},enumerable:true,configurable:true});t.prototype._pBuildGraphics=function(t,e){var i;var r;var s;var n;var o;var a,h,l,u;var c,_,f=0;var p,d;var g,m,v;var y;var b=this._width/2;var x=this._height/2;var w=this._depth/2;if(e==X.ElementsType.TRIANGLE){var E=t;var S=((this._segmentsW+1)*(this._segmentsH+1)+(this._segmentsW+1)*(this._segmentsD+1)+(this._segmentsH+1)*(this._segmentsD+1))*2;var A=(this._segmentsW*this._segmentsH+this._segmentsW*this._segmentsD+this._segmentsH*this._segmentsD)*12;if(S==E.numVertices&&E.indices!=null){E.invalidateIndices();E.invalidateVertices(E.positions);E.invalidateVertices(E.normals);E.invalidateVertices(E.tangents)}else{E.setIndices(new Uint16Array(A));E.setPositions(new Float32Array(S*3));E.setNormals(new Float32Array(S*3));E.setTangents(new Float32Array(S*3));this._pInvalidateUVs()}i=E.indices.get(E.numElements);r=E.positions.get(S);s=E.normals.get(S);n=E.tangents.get(S);o=E.concatenatedBuffer.stride/4;p=0;d=0;g=this._width/this._segmentsW;m=this._height/this._segmentsH;v=this._depth/this._segmentsD;for(c=0;c<=this._segmentsW;c++){y=-b+c*g;for(_=0;_<=this._segmentsH;_++){r[p]=y;r[p+1]=-x+_*m;r[p+2]=-w;s[p]=0;s[p+1]=0;s[p+2]=-1;n[p]=1;n[p+1]=0;n[p+2]=0;p+=o;r[p]=y;r[p+1]=-x+_*m;r[p+2]=w;s[p]=0;s[p+1]=0;s[p+2]=1;n[p]=-1;n[p+1]=0;n[p+2]=0;p+=o;if(c&&_){a=2*((c-1)*(this._segmentsH+1)+(_-1));h=2*(c*(this._segmentsH+1)+(_-1));l=a+2;u=h+2;i[d++]=a;i[d++]=l;i[d++]=u;i[d++]=a;i[d++]=u;i[d++]=h;i[d++]=h+1;i[d++]=u+1;i[d++]=l+1;i[d++]=h+1;i[d++]=l+1;i[d++]=a+1}}}f+=2*(this._segmentsW+1)*(this._segmentsH+1);for(c=0;c<=this._segmentsW;c++){y=-b+c*g;for(_=0;_<=this._segmentsD;_++){r[p]=y;r[p+1]=x;r[p+2]=-w+_*v;s[p]=0;s[p+1]=1;s[p+2]=0;n[p]=1;n[p+1]=0;n[p+2]=0;p+=o;r[p]=y;r[p+1]=-x;r[p+2]=-w+_*v;s[p]=0;s[p+1]=-1;s[p+2]=0;n[p]=1;n[p+1]=0;n[p+2]=0;p+=o;if(c&&_){a=f+2*((c-1)*(this._segmentsD+1)+(_-1));h=f+2*(c*(this._segmentsD+1)+(_-1));l=a+2;u=h+2;i[d++]=a;i[d++]=l;i[d++]=u;i[d++]=a;i[d++]=u;i[d++]=h;i[d++]=h+1;i[d++]=u+1;i[d++]=l+1;i[d++]=h+1;i[d++]=l+1;i[d++]=a+1}}}f+=2*(this._segmentsW+1)*(this._segmentsD+1);for(c=0;c<=this._segmentsD;c++){y=w-c*v;for(_=0;_<=this._segmentsH;_++){r[p]=-b;r[p+1]=-x+_*m;r[p+2]=y;s[p]=-1;s[p+1]=0;s[p+2]=0;n[p]=0;n[p+1]=0;n[p+2]=-1;p+=o;r[p]=b;r[p+1]=-x+_*m;r[p+2]=y;s[p]=1;s[p+1]=0;s[p+2]=0;n[p]=0;n[p+1]=0;n[p+2]=1;p+=o;if(c&&_){a=f+2*((c-1)*(this._segmentsH+1)+(_-1));h=f+2*(c*(this._segmentsH+1)+(_-1));l=a+2;u=h+2;i[d++]=a;i[d++]=l;i[d++]=u;i[d++]=a;i[d++]=u;i[d++]=h;i[d++]=h+1;i[d++]=u+1;i[d++]=l+1;i[d++]=h+1;i[d++]=l+1;i[d++]=a+1}}}}else if(e==X.ElementsType.LINE){var T=t;var P=this._segmentsH*4+this._segmentsW*4+this._segmentsD*4;r=new Float32Array(P*6);var D=new Float32Array(P);p=0;d=0;for(c=0;c<this._segmentsH;++c){r[p++]=-b;r[p++]=c*this._height/this._segmentsH-x;r[p++]=-w;r[p++]=b;r[p++]=c*this._height/this._segmentsH-x;r[p++]=-w;D[d++]=1;r[p++]=-b;r[p++]=x-c*this._height/this._segmentsH;r[p++]=w;r[p++]=b;r[p++]=x-c*this._height/this._segmentsH;r[p++]=w;D[d++]=1}for(c=0;c<this._segmentsW;++c){r[p++]=c*this._width/this._segmentsW-b;r[p++]=-x;r[p++]=-w;r[p++]=c*this._width/this._segmentsW-b;r[p++]=x;r[p++]=-w;D[d++]=1;r[p++]=b-c*this._width/this._segmentsW;r[p++]=-x;r[p++]=w;r[p++]=b-c*this._width/this._segmentsW;r[p++]=x;r[p++]=w;D[d++]=1}for(c=0;c<this._segmentsH;++c){r[p++]=-b;r[p++]=c*this._height/this._segmentsH-x;r[p++]=-w;r[p++]=-b;r[p++]=c*this._height/this._segmentsH-x;r[p++]=w;D[d++]=1;r[p++]=b;r[p++]=x-c*this._height/this._segmentsH;r[p++]=-w;r[p++]=b;r[p++]=x-c*this._height/this._segmentsH;r[p++]=w;D[d++]=1}for(c=0;c<this._segmentsD;++c){r[p++]=b;r[p++]=-x;r[p++]=c*this._depth/this._segmentsD-w;r[p++]=b;r[p++]=x;r[p++]=c*this._depth/this._segmentsD-w;D[d++]=1;r[p++]=-b;r[p++]=-x;r[p++]=w-c*this._depth/this._segmentsD;r[p++]=-b;r[p++]=x;r[p++]=w-c*this._depth/this._segmentsD;D[d++]=1}for(c=0;c<this._segmentsD;++c){r[p++]=-b;r[p++]=-x;r[p++]=w-c*this._depth/this._segmentsD;r[p++]=b;r[p++]=-x;r[p++]=w-c*this._depth/this._segmentsD;D[d++]=1;r[p++]=-b;r[p++]=x;r[p++]=c*this._depth/this._segmentsD-w;r[p++]=b;r[p++]=x;r[p++]=c*this._depth/this._segmentsD-w;D[d++]=1}for(c=0;c<this._segmentsW;++c){r[p++]=b-c*this._width/this._segmentsW;r[p++]=-x;r[p++]=-w;r[p++]=b-c*this._width/this._segmentsW;r[p++]=-x;r[p++]=w;D[d++]=1;r[p++]=c*this._width/this._segmentsW-b;r[p++]=x;r[p++]=-w;r[p++]=c*this._width/this._segmentsW-b;r[p++]=x;r[p++]=w;D[d++]=1}T.setPositions(r);T.setThickness(D)}};t.prototype._pBuildUVs=function(t,e){var i,r,s;var n;var o;var a,h;var l,u;var c,_;var f,p;var d,g;var m;if(e==X.ElementsType.TRIANGLE){m=((this._segmentsW+1)*(this._segmentsH+1)+(this._segmentsW+1)*(this._segmentsD+1)+(this._segmentsH+1)*(this._segmentsD+1))*2;var v=t;if(v.uvs&&m==v.numVertices){v.invalidateVertices(v.uvs)}else{v.setUVs(new Float32Array(m*2))}n=v.uvs.get(m);o=v.uvs.stride;if(this._tile6){a=l=1/3;h=u=1/2}else{a=h=1;l=u=0}s=0;c=1*l;_=1*u;f=2*l;p=0*u;d=a/this._segmentsW;g=h/this._segmentsH;for(i=0;i<=this._segmentsW;i++){for(r=0;r<=this._segmentsH;r++){n[s]=(c+i*d)*this._scaleU;n[s+1]=(_+(h-r*g))*this._scaleV;s+=o;n[s]=(f+(a-i*d))*this._scaleU;n[s+1]=(p+(h-r*g))*this._scaleV;s+=o}}c=1*l;_=0*u;f=0*l;p=0*u;d=a/this._segmentsW;g=h/this._segmentsD;for(i=0;i<=this._segmentsW;i++){for(r=0;r<=this._segmentsD;r++){n[s]=(c+i*d)*this._scaleU;n[s+1]=(_+(h-r*g))*this._scaleV;s+=o;n[s]=(f+i*d)*this._scaleU;n[s+1]=(p+r*g)*this._scaleV;s+=o}}c=0*l;_=1*u;f=2*l;p=1*u;d=a/this._segmentsD;g=h/this._segmentsH;for(i=0;i<=this._segmentsD;i++){for(r=0;r<=this._segmentsH;r++){n[s]=(c+i*d)*this._scaleU;n[s+1]=(_+(h-r*g))*this._scaleV;s+=o;n[s]=(f+(a-i*d))*this._scaleU;n[s+1]=(p+(h-r*g))*this._scaleV;s+=o}}}else if(e==X.ElementsType.LINE){}};return t}(s);var a=function(a){g(t,a);function t(t,e,i,r,s,n){if(t===void 0){t=null}if(e===void 0){e="triangle"}if(i===void 0){i=50}if(r===void 0){r=16}if(s===void 0){s=12}if(n===void 0){n=true}var o=a.call(this,t,e)||this;o._radius=i;o._segmentsW=r;o._segmentsH=s;o._yUp=n;return o}Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(t){this._radius=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"segmentsW",{get:function(){return this._segmentsW},set:function(t){this._segmentsW=t;this._pInvalidatePrimitive();this._pInvalidateUVs()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"segmentsH",{get:function(){return this._segmentsH},set:function(t){this._segmentsH=t;this._pInvalidatePrimitive();this._pInvalidateUVs()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"yUp",{get:function(){return this._yUp},set:function(t){this._yUp=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});t.prototype._pBuildGraphics=function(t,e){var i;var r;var s;var n;var o;var a;var h;var l,u;var c;var _;var f;if(e==X.ElementsType.TRIANGLE){var p=t;f=(this._segmentsH+1)*(this._segmentsW+1);if(f==p.numVertices&&p.indices!=null){p.invalidateIndices();p.invalidateVertices(p.positions);p.invalidateVertices(p.normals);p.invalidateVertices(p.tangents)}else{p.setIndices(new Uint16Array((this._segmentsH-1)*this._segmentsW*6));p.setPositions(new Float32Array(f*3));p.setNormals(new Float32Array(f*3));p.setTangents(new Float32Array(f*3));this._pInvalidateUVs()}i=p.indices.get(p.numElements);r=p.positions.get(f);s=p.normals.get(f);n=p.tangents.get(f);o=p.concatenatedBuffer.stride/4;l=0;u=0;var d=void 0;var g=void 0;var m=void 0;for(h=0;h<=this._segmentsH;++h){d=l;var v=Math.PI*h/this._segmentsH;var y=-this._radius*Math.cos(v);var b=this._radius*Math.sin(v);for(a=0;a<=this._segmentsW;++a){var x=2*Math.PI*a/this._segmentsW;var w=b*Math.cos(x);var E=b*Math.sin(x);var S=1/Math.sqrt(w*w+E*E+y*y);var A=Math.sqrt(E*E+w*w);if(this._yUp){g=0;m=A>.007?w/A:0;c=-y;_=E}else{g=A>.007?w/A:0;m=0;c=E;_=y}if(a==this._segmentsW){r[l]=r[d];r[l+1]=r[d+1];r[l+2]=r[d+2];s[l]=s[d]+w*S*.5;s[l+1]=s[d+1]+c*S*.5;s[l+2]=s[d+2]+_*S*.5;n[l]=A>.007?-E/A:1;n[l+1]=g;n[l+2]=m}else{r[l]=w;r[l+1]=c;r[l+2]=_;s[l]=w*S;s[l+1]=c*S;s[l+2]=_*S;n[l]=A>.007?-E/A:1;n[l+1]=g;n[l+2]=m}if(a>0&&h>0){var T=(this._segmentsW+1)*h+a;var P=(this._segmentsW+1)*h+a-1;var D=(this._segmentsW+1)*(h-1)+a-1;var I=(this._segmentsW+1)*(h-1)+a;if(h==this._segmentsH){r[l]=r[d];r[l+1]=r[d+1];r[l+2]=r[d+2];i[u++]=T;i[u++]=D;i[u++]=I}else if(h==1){i[u++]=T;i[u++]=P;i[u++]=D}else{i[u++]=T;i[u++]=P;i[u++]=D;i[u++]=T;i[u++]=D;i[u++]=I}}l+=o}}}else if(e==X.ElementsType.LINE){var C=t;var M=this._segmentsH*this._segmentsW*2+this._segmentsW;var O=new Float32Array(M*6);var F=new Float32Array(M);l=0;u=0;for(h=0;h<=this._segmentsH;++h){var v=Math.PI*h/this._segmentsH;var y=-this._radius*Math.cos(v);var b=this._radius*Math.sin(v);for(a=0;a<=this._segmentsW;++a){var x=2*Math.PI*a/this._segmentsW;var w=b*Math.cos(x);var E=b*Math.sin(x);if(this._yUp){c=-y;_=E}else{c=E;_=y}if(a>0){O[l++]=w;O[l++]=c;O[l++]=_;F[u++]=1;if(h>0){var R=h==1?3-(6*(this._segmentsW-a)+12*a):3-this._segmentsW*12;O[l]=O[l+++R];O[l]=O[l+++R];O[l]=O[l+++R];O[l++]=w;O[l++]=c;O[l++]=_;F[u++]=1}}if(a<this._segmentsW){O[l++]=w;O[l++]=c;O[l++]=_}}}C.setPositions(O);C.setThickness(F)}};t.prototype._pBuildUVs=function(t,e){var i,r;var s=(this._segmentsH+1)*(this._segmentsW+1);var n;var o;if(e==X.ElementsType.TRIANGLE){s=(this._segmentsH+1)*(this._segmentsW+1);var a=t;if(a.uvs&&s==a.numVertices){a.invalidateVertices(a.uvs)}else{a.setUVs(new Float32Array(s*2))}n=a.uvs.get(s);o=a.uvs.stride;var h=0;for(r=0;r<=this._segmentsH;++r){for(i=0;i<=this._segmentsW;++i){n[h]=i/this._segmentsW*this._scaleU;n[h+1]=r/this._segmentsH*this._scaleV;h+=o}}}else if(e==X.ElementsType.LINE){}};return t}(s);var l;var b=G.ConfigManager.instance.addStore("scene",{ALLOW_FORCE_MSAA:8,MSAA_MINIMAL_IMAGE_SIZE:300,ALLOW_APPROXIMATION:0,USE_UNSAFE_CACHE_AS_BITMAP:false,USE_UNSAFE_SCALE_9_SLICE:false,USE_UNSAFE_FILTERS:false,USE_UNSAFE_BLENDS:false,REMAP_BLEND_MODE:true,BLEND_MODE_REMAP_TABLE:(l={},l[q.BlendMode.DARKEN]=q.BlendMode.MULTIPLY,l),CPU_COPY_PIXELS_COUNT:64*64,FONT_TESSELATION_QUALITY:1/10,USE_UNSAFE_FNT:false,TEXT_SHAPE_ROUND_PRECISION:.1});var u=function(t){g(e,t);function e(){var e=t.call(this)||this;e._mouseChildren=true;e._sessionID=-1;e._avmDepthID=-1;e._alignmentMode=o.AlignmentMode.REGISTRATION_POINT;e._visible=true;e._maskId=-1;e._mouseEnabled=true;e._maskMode=false;e.isSlice9ScaledMC=false;e.isSlice9ScaledSprite=false;e.isAVMScene=false;e.placeObjectTag=null;e._blendMode="";e.castsShadows=true;e._filters=null;e.orientationMode=o.OrientationMode.DEFAULT;e.zOffset=0;e.hasDispatchedAddedToStage=false;e.cursorType="";e._isInFocus=false;e._tabEnabled=false;e._tabIndex=-1;e._avmDepthID=-1;e._onInvalidatePropertiesDelegate=function(t){return e._onInvalidateProperties(t)};e._onInvalidateImagesDelegate=function(t){return e._onInvalidateImages(t)};e._transform=new G.Transform(null);e._transform.addEventListener(G.TransformEvent.INVALIDATE_MATRIX3D,function(t){return e._invalidateHierarchicalProperty(o.HierarchicalProperty.SCENE_TRANSFORM)});e._transform.addEventListener(G.TransformEvent.INVALIDATE_COLOR_TRANSFORM,function(t){return e._invalidateHierarchicalProperty(o.HierarchicalProperty.COLOR_TRANSFORM)});e._defaultBoundingVolume=e._getDefaultBoundingVolume();return e}e.prototype.getScriptPrecedence=function(){if(!this._parent){return[]}var t=this._parent.getScriptPrecedence();if(this.placeObjectTag){t.push(this.placeObjectTag.actionBlocksPrecedence)}return t};e.prototype.getMouseCursor=function(){return"initial"};Object.defineProperty(e.prototype,"tabEnabled",{get:function(){return this._tabEnabled},set:function(t){this._tabEnabled=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"tabIndex",{get:function(){return this._tabIndex},set:function(t){this._tabIndex=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"isInFocus",{get:function(){return this._isInFocus},set:function(t){this._isInFocus=t},enumerable:true,configurable:true});e.prototype.setFocus=function(t,e,i){if(e===void 0){e=false}if(i===void 0){i=true}if(this._isInFocus==t)return;this._isInFocus=t};Object.defineProperty(e.prototype,"alignmentMode",{get:function(){return this._alignmentMode},set:function(t){if(this._alignmentMode==t)return;this._alignmentMode=t;this._invalidateHierarchicalProperty(o.HierarchicalProperty.SCENE_TRANSFORM)},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"alpha",{get:function(){return this._transform.colorTransform.alphaMultiplier},set:function(t){this._transform.colorTransform.alphaMultiplier=t;this._transform.invalidateColorTransform()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"blendMode",{get:function(){if(!b.USE_UNSAFE_BLENDS){return""}if(b.REMAP_BLEND_MODE){return b.BLEND_MODE_REMAP_TABLE[this._blendMode]||this._blendMode}return this._blendMode},set:function(t){if(this._blendMode===t){return}this._blendMode=t;if(t===q.BlendMode.OVERLAY){this._transform.invalidateColorTransform()}},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"defaultBoundingVolume",{get:function(){return this._defaultBoundingVolume},set:function(t){if(this._defaultBoundingVolume==t)return;this._defaultBoundingVolume=t;if(this._boundsPrimitive){this._boundsPrimitive.dispose();this._boundsPrimitive=null}this.invalidate()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"cacheAsBitmap",{get:function(){return this._bitmapCache},set:function(t){if(t===this._bitmapCache){return}if(!b.USE_UNSAFE_CACHE_AS_BITMAP){return}t&&console.warn("[@scene/DisplayObject] Unsafe cacheAsBitmap is enabled!"+"You can disable it by `Settings.USE_UNSAFE_CACHE_AS_BITMAP = false`",this.id);this._bitmapCache=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"eulers",{get:function(){if(!this._eulers)this._eulers=new G.Vector3D;this._eulers.x=this.rotationX;this._eulers.y=this.rotationY;this._eulers.z=this.rotationZ;return this._eulers},set:function(t){this._transform.rotation.x=t.x;this._transform.rotation.y=t.y;this._transform.rotation.z=t.z;this._transform.invalidateMatrix3D()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"filters",{get:function(){return this._filters},set:function(t){if(!b.USE_UNSAFE_FILTERS){return}this._filters=t;this._invalidateStyle()},enumerable:true,configurable:true});e.prototype.updateFilters=function(t){console.warn("[scene/DisplayObject] - updateFilters is just a stub")};Object.defineProperty(e.prototype,"index",{get:function(){if(this._parent)return this._parent.getChildIndex(this);return 0},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"loader",{get:function(){return this._loader},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"mask",{set:function(t){this.scriptMask=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"maskMode",{get:function(){return this._maskMode},set:function(t){if(this._maskMode==t)return;this._maskMode=t;this._maskId=t?this.id:-1;this._updateMaskMode()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"pickObject",{get:function(){return this._pickObject},set:function(t){if(this._pickObject==t)return;this._pickObject=t.pickObjectFromTimeline?t.clone():t;if(this._pickObject){this._pickObject.mouseChildren=false;this._pickObject.mouseEnabled=false}},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"mouseEnabled",{get:function(){return this._mouseEnabled},set:function(t){if(this._mouseEnabled==t)return;this._mouseEnabled=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"mouseX",{get:function(){return this._mouseX},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"mouseY",{get:function(){return this._mouseY},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"name",{get:function(){return this._pName?this._pName:""},set:function(t){this._pName=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"registrationPoint",{get:function(){if(this._registrationMatrix3D)return new G.Vector3D(-this._registrationMatrix3D._rawData[12]*this.scaleX,-this._registrationMatrix3D._rawData[13]*this.scaleY,-this._registrationMatrix3D._rawData[14]*this.scaleZ);return null},set:function(t){if(!t){if(!this._registrationMatrix3D)return;this._registrationMatrix3D._rawData[12]=0;this._registrationMatrix3D._rawData[13]=0;this._registrationMatrix3D._rawData[14]=0;if(this._registrationMatrix3D.isIdentity())this._registrationMatrix3D=null}else{if(!this._registrationMatrix3D)this._registrationMatrix3D=new G.Matrix3D;this._registrationMatrix3D._rawData[12]=-t.x/this._transform.scale.x;this._registrationMatrix3D._rawData[13]=-t.y/this._transform.scale.y;this._registrationMatrix3D._rawData[14]=-t.z/this._transform.scale.z}this._registrationMatrix3D.invalidatePosition();this._invalidateHierarchicalProperty(o.HierarchicalProperty.SCENE_TRANSFORM)},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"registrationScale",{get:function(){if(this._registrationMatrix3D)return new G.Vector3D(this._registrationMatrix3D._rawData[0],this._registrationMatrix3D._rawData[5],this._registrationMatrix3D._rawData[10]);return null},set:function(t){if(!t){if(!this._registrationMatrix3D)return;this._registrationMatrix3D._rawData[0]=1;this._registrationMatrix3D._rawData[5]=1;this._registrationMatrix3D._rawData[10]=1;if(this._registrationMatrix3D.isIdentity())this._registrationMatrix3D=null}else{if(!this._registrationMatrix3D)this._registrationMatrix3D=new G.Matrix3D;this._registrationMatrix3D._rawData[0]=t.x;this._registrationMatrix3D._rawData[5]=t.y;this._registrationMatrix3D._rawData[10]=t.z}this._invalidateHierarchicalProperty(o.HierarchicalProperty.SCENE_TRANSFORM)},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"rotationX",{get:function(){return this._transform.rotation.x*G.MathConsts.RADIANS_TO_DEGREES},set:function(t){if(this.rotationX==t)return;this._transform.rotation.x=t*G.MathConsts.DEGREES_TO_RADIANS;this._transform.invalidateMatrix3D()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"rotationY",{get:function(){return this._transform.rotation.y*G.MathConsts.RADIANS_TO_DEGREES},set:function(t){if(this.rotationY==t)return;this._transform.rotation.y=t*G.MathConsts.DEGREES_TO_RADIANS;this._transform.invalidateMatrix3D()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"rotationZ",{get:function(){return this._transform.rotation.z*G.MathConsts.RADIANS_TO_DEGREES},set:function(t){if(this.rotationZ==t)return;this._transform.rotation.z=t*G.MathConsts.DEGREES_TO_RADIANS;this._transform.invalidateMatrix3D()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"scale9Grid",{get:function(){return this._scale9Grid},set:function(t){this._scale9Grid=t;this._invalidateHierarchicalProperty(o.HierarchicalProperty.SCALE9)},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"scaleX",{get:function(){return this._transform.scale.x},set:function(t){this._setScaleX(t)},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"scaleY",{get:function(){return this._transform.scale.y},set:function(t){this._setScaleY(t)},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"scaleZ",{get:function(){return this._transform.scale.z},set:function(t){this._setScaleZ(t)},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"skewX",{get:function(){return this._transform.skew.x},set:function(t){if(this.skewX==t)return;this._transform.skew.x=t;this._transform.invalidateMatrix3D()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"skewY",{get:function(){return this._transform.skew.y},set:function(t){if(this.skewY==t)return;this._transform.skew.y=t;this._transform.invalidateMatrix3D()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"skewZ",{get:function(){return this._transform.skew.z},set:function(t){if(this.skewZ==t)return;this._transform.skew.z=t;this._transform.invalidateMatrix3D()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"scrollRect",{get:function(){return this._scrollRect},set:function(t){this._scrollRect=t;if(!t&&this._scrollRectPrimitive){var e=this.masks.indexOf(this._scrollRectPrimitive);this.masks.splice(e,1);this._scrollRectPrimitive=null}this._transform.invalidatePosition();this._scrollRectPrimitiveDirty=true},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"material",{get:function(){return this._material},set:function(t){if(this._material==t)return;this._material=t;this._invalidateMaterial()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"style",{get:function(){return this._style},set:function(t){if(this._style==t)return;if(this._style){this._style.removeEventListener(X.StyleEvent.INVALIDATE_PROPERTIES,this._onInvalidatePropertiesDelegate);this._style.removeEventListener(X.StyleEvent.INVALIDATE_IMAGES,this._onInvalidateImagesDelegate)}this._style=t;if(this._style){this._style.addEventListener(X.StyleEvent.INVALIDATE_PROPERTIES,this._onInvalidatePropertiesDelegate);this._style.addEventListener(X.StyleEvent.INVALIDATE_IMAGES,this._onInvalidateImagesDelegate)}this._invalidateStyle()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"boundsVisible",{get:function(){return this._boundsVisible},set:function(t){if(t==this._boundsVisible)return;this._boundsVisible=t;this.invalidate()},enumerable:true,configurable:true});e.prototype.getScrollRectPrimitive=function(){if(this._scrollRectPrimitiveDirty){this._scrollRectPrimitiveDirty=false;if(!this._scrollRectPrimitive){this._scrollRectPrimitive=new f;this._scrollRectPrimitive.maskMode=true;if(!this.masks)this.masks=[];this.masks.push(this._scrollRectPrimitive)}this._scrollRectPrimitive.graphics.clear();this._scrollRectPrimitive.graphics.beginFill(255,1);this._scrollRectPrimitive.graphics.drawRect(0,0,this._scrollRect.width,this._scrollRect.height);this._scrollRectPrimitive.graphics.endFill()}return this._scrollRectPrimitive};e.prototype.getBoundsPrimitive=function(t){if(this._boundsPrimitive==null){switch(this._defaultBoundingVolume){case o.BoundingVolumeType.BOX:case o.BoundingVolumeType.BOX_BOUNDS:case o.BoundingVolumeType.BOX_BOUNDS_FAST:case o.BoundingVolumeType.BOX_FAST:this._boundsPrefab=new n(null,X.ElementsType.LINE);this._boundsPrimitive=this._boundsPrefab.getNewObject();break;case o.BoundingVolumeType.SPHERE:case o.BoundingVolumeType.SPHERE_BOUNDS:case o.BoundingVolumeType.SPHERE_BOUNDS_FAST:case o.BoundingVolumeType.SPHERE_FAST:this._boundsPrefab=new a(null,X.ElementsType.LINE);this._boundsPrimitive=this._boundsPrefab.getNewObject();break;default:}this._boundsPrefabDirty=true}if(this._boundsPrefabDirty)this._updateBoundsPrefab(t);return this._boundsPrimitive};Object.defineProperty(e.prototype,"transform",{get:function(){return this._transform},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},set:function(t){if(this._visible==t)return;this._visible=t;this._invalidateHierarchicalProperty(o.HierarchicalProperty.VISIBLE)},enumerable:true,configurable:true});e.prototype._mergeMasks=function(t,e){if(!t&&!e){return null}if(!t&&e){e.maskMode=true;return[e]}if(e&&!t.includes(e)){t.push(e)}for(var i=t.length-1;i>=0;i--){var r=t[i];if(!r){console.warn("[DisplayObject] Timeline mask has null value, skipping it");t.splice(i,1)}else{r.maskMode=true}}return t};Object.defineProperty(e.prototype,"scriptMask",{get:function(){return this._scriptMask},set:function(t){if(t===this._scriptMask)return;if(this._scriptMask){var e=this._masks.indexOf(this._scriptMask);if(e!==-1){this._masks.splice(e,1);this._scriptMask.maskMode=false}}this._scriptMask=t;this._masks=this._mergeMasks(this._masks,t);this._invalidateHierarchicalProperty(o.HierarchicalProperty.MASKS)},enumerable:true,configurable:true});e.prototype.updateTimelineMask=function(t){this._masks=this._mergeMasks(t,this._scriptMask);this._invalidateHierarchicalProperty(o.HierarchicalProperty.MASKS)};Object.defineProperty(e.prototype,"masks",{get:function(){return this._masks},set:function(t){if(this._masks==t)return;this._masks=t;if(!t||!t.length){this._scriptMask=null}else{var e=t.length;var i=false;for(var r=0;r<e;r++){t[r].maskMode=true;i=i||t[r]===this._scriptMask}if(this._scriptMask&&!i){this._scriptMask=null}}this._invalidateHierarchicalProperty(o.HierarchicalProperty.MASKS)},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"mouseChildren",{get:function(){return this._mouseChildren},set:function(t){if(this._mouseChildren==t)return;this._mouseChildren=t;this._invalidateHierarchicalProperty(o.HierarchicalProperty.MOUSE_ENABLED)},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"x",{get:function(){return this._transform.position.x},set:function(t){if(this._transform.position.x==t)return;this._transform.matrix3D._rawData[12]=t;this._transform.invalidatePosition()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"y",{get:function(){return this._transform.position.y},set:function(t){if(this._transform.position.y==t)return;this._transform.matrix3D._rawData[13]=t;this._transform.invalidatePosition()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"z",{get:function(){return this._transform.position.z},set:function(t){if(this._transform.position.z==t)return;this._transform.matrix3D._rawData[14]=t;this._transform.invalidatePosition()},enumerable:true,configurable:true});e.prototype.advanceFrame=function(){};e.prototype.getEntity=function(){return};e.prototype._initNode=function(t){};e.prototype.clone=function(){var t=new e;this.copyTo(t);return t};e.prototype.copyTo=function(t){var e;t.defaultBoundingVolume=this._defaultBoundingVolume;if(this._registrationMatrix3D)t._registrationMatrix3D=this._registrationMatrix3D.clone();t.mouseChildren=this._mouseChildren;t.material=this._material;t.style=this._style;t.pickObject=this._pickObject;t.pickObjectFromTimeline=this.pickObjectFromTimeline;t.boundsVisible=this._boundsVisible;t.name=this._pName;t.mouseEnabled=this._mouseEnabled;t.extra=this.extra;t.maskMode=this._maskMode;t.castsShadows=this.castsShadows;t.assetNamespace=this.assetNamespace;t._symbol=this._symbol;t.avm1Symbol=this.avm1Symbol;t.isAVMScene=this.isAVMScene;t.isSlice9ScaledMC=this.isSlice9ScaledMC;t.scale9Grid=(e=this.scale9Grid)===null||e===void 0?void 0:e.clone();if(this._masks){t._masks=this._masks.slice();t._scriptMask=this._scriptMask;t._invalidateHierarchicalProperty(o.HierarchicalProperty.MASKS)}this._transform.copyRawDataTo(t._transform)};e.prototype.dispose=function(){this.disposeValues()};e.prototype.disposeValues=function(){if(this._parent)this._parent.removeChild(this);this.material=null;if(this._adapter){this._adapter.dispose();this._adapter=null}this._pickObject=null;this._masks=null;this._scriptMask=null};e.prototype.lookAt=function(t,e){if(e===void 0){e=null}this.transform.lookAt(t,e)};e.prototype.movePivot=function(t,e,i){if(t==0&&e==0&&i==0)return;if(!this._registrationMatrix3D)this._registrationMatrix3D=new G.Matrix3D;this._registrationMatrix3D._rawData[12]-=t/this._transform.scale.x;this._registrationMatrix3D._rawData[13]-=e/this._transform.scale.y;this._registrationMatrix3D._rawData[14]-=i/this._transform.scale.z;this._invalidateHierarchicalProperty(o.HierarchicalProperty.SCENE_TRANSFORM)};e.prototype.reset=function(){this.visible=true;if(!this.noTimelineUpdate)this._transform.clearMatrix3D();this._transform.clearColorTransform();this.masks=null;this.maskMode=false};e.prototype.isOnDisplayList=function(){var t=this;while(t){if(t.isAVMScene)return true;t=t.parent}return false};e.prototype._setParent=function(t){this._parent=t};e.prototype._invalidateHierarchicalProperty=function(t){this.dispatchEvent(new o.HeirarchicalEvent(o.HeirarchicalEvent.INVALIDATE_PROPERTY,t))};e.prototype._iInternalUpdate=function(){if(this._iController)this._iController.update()};Object.defineProperty(e.prototype,"maskId",{get:function(){return this._maskId},enumerable:true,configurable:true});e.prototype._setScaleX=function(t){if(this.scaleX==t)return;this._transform.scale.x=t;this._transform.invalidateMatrix3D()};e.prototype._setScaleY=function(t){if(this.scaleY==t)return;this._transform.scale.y=t;this._transform.invalidateMatrix3D()};e.prototype._setScaleZ=function(t){if(this.scaleZ==t)return;this._transform.scale.z=t;this._transform.invalidateMatrix3D()};e.prototype._updateBoundsPrefab=function(t){if(this._boundsPrefab instanceof n){var e=t.getBoundingVolume(null,this._defaultBoundingVolume).getBox();if(e==null)return;this._boundsPrefab.width=e.width;this._boundsPrefab.height=e.height;this._boundsPrefab.depth=e.depth;this._boundsPrimitive.registrationPoint=new G.Vector3D(-(e.x+e.width/2)*this._boundsPrimitive.transform.scale.x,-(e.y+e.height/2)*this._boundsPrimitive.transform.scale.y,-(e.z+e.depth/2)*this._boundsPrimitive.transform.scale.z)}else if(this._boundsPrefab instanceof a){var i=t.getBoundingVolume(null,this._defaultBoundingVolume).getSphere();if(i==null)return;this._boundsPrefab.radius=i.radius;this._boundsPrimitive.registrationPoint=new G.Vector3D(-i.x*this._boundsPrimitive.transform.scale.x,-i.y*this._boundsPrimitive.transform.scale.y,-i.z*this._boundsPrimitive.transform.scale.z)}};e.prototype._updateMaskMode=function(){if(this._maskMode){this._mouseEnabled=false;this.partitionClass=o.BasicPartition}this._invalidateHierarchicalProperty(o.HierarchicalProperty.MASK_ID)};e.prototype._invalidateMaterial=function(){this.dispatchEvent(new X.RenderableEvent(X.RenderableEvent.INVALIDATE_MATERIAL,this))};e.prototype._invalidateStyle=function(){this.dispatchEvent(new X.RenderableEvent(X.RenderableEvent.INVALIDATE_STYLE,this))};e.prototype.invalidateElements=function(){this.dispatchEvent(new X.RenderableEvent(X.RenderableEvent.INVALIDATE_ELEMENTS,this))};e.prototype._onInvalidateProperties=function(t){if(t===void 0){t=null}this._invalidateStyle()};e.prototype._onInvalidateImages=function(t){if(t===void 0){t=null}this.invalidate()};e.prototype._getDefaultBoundingVolume=function(){return o.BoundingVolumeType.BOX_BOUNDS_FAST};return e}(G.AssetBase);var c=function(s){g(i,s);function i(){var t=s.call(this)||this;t._children=new Array;t.doingSwap=false;t.tabChildren=false;return t}Object.defineProperty(i.prototype,"assetType",{get:function(){return i.assetType},enumerable:true,configurable:true});Object.defineProperty(i.prototype,"animator",{get:function(){return this._animator},set:function(t){if(this._animator)this._animator.removeOwner(this);this._animator=t;if(this._animator)this._animator.addOwner(this)},enumerable:true,configurable:true});Object.defineProperty(i.prototype,"numChildren",{get:function(){return this._children.length},enumerable:true,configurable:true});i.prototype.advanceFrame=function(){for(var t=0;t<this._children.length;t++)this._children[t].advanceFrame()};i.prototype.addChild=function(t){return this.addChildAt(t,this._children.length)};i.prototype.addChildAt=function(t,e){if(t.parent)t.parent.removeChild(t);this._children.splice(e,0,t);t._setParent(this);this.dispatchEvent(new o.ContainerEvent(o.ContainerEvent.ADD_CHILD_AT,t,e));return t};i.prototype.addChildren=function(){var t=[];for(var e=0;e<arguments.length;e++){t[e]=arguments[e]}var i=t.length;for(var r=0;r<i;r++)this.addChild(t[r])};i.prototype.clone=function(){var t=new i;this.copyTo(t);return t};i.prototype.copyTo=function(t){s.prototype.copyTo.call(this,t);if(this._animator)t.animator=this._animator.clone();var e=this._children.length;for(var i=0;i<e;++i){var r=this._children[i].adapter.clone().adaptee;t.addChild(r)}};i.prototype.contains=function(t){return this._children.indexOf(t)>=0};i.prototype.disposeValues=function(){if(this._animator)this._animator.dispose();for(var t=this._children.length-1;t>=0;t--)this.removeChild(this._children[t]);s.prototype.disposeValues.call(this)};i.prototype.getChildAt=function(t){var e=this._children[t];if(e==null)throw new G.RangeError("Index does not exist in the child list of the caller");return e};i.prototype.getChildByName=function(t){var e=this._children.length;for(var i=0;i<e;++i)if(this._children[i].name==t)return this._children[i];return null};i.prototype.getChildIndex=function(t){var e=this._children.indexOf(t);if(e==-1){throw i.NO_CHILD_ERROR}return e};i.prototype.getObjectsUnderPoint=function(t){return new Array};i.prototype.removeChild=function(t){if(t==null)throw new G.ArgumentError("Parameter child cannot be null");this.removeChildAt(this.getChildIndex(t));return t};i.prototype.removeChildAt=function(t){return this.removeChildAtInternal(t)};i.prototype.removeChildren=function(t,e){if(t===void 0){t=0}if(e===void 0){e=2147483647}if(t<0)throw new G.RangeError("beginIndex is out of range of the child list");if(e>this._children.length)throw new G.RangeError("endIndex is out of range of the child list");for(var i=e-1;i>=t;i--)this.removeChildAtInternal(i)};i.prototype.setChildIndex=function(t,e){var i=this.getChildIndex(t);if(i<0)throw new G.ArgumentError("Parameter child must be child of this object");if(e>this._children.length-1)throw new G.RangeError("Parameter index is out of range of the child list");if(i==e)return;this.removeChildAt(i);this.addChildAt(t,e);if(t._sessionID>=0&&this._sessionID_childs){delete this._sessionID_childs[t._sessionID];t._sessionID=-1}};i.prototype.swapChildren=function(t,e){if(t.parent!=this||e.parent!=this)return;this.swapChildrenAt(this.getChildIndex(t),this.getChildIndex(e))};i.prototype.swapChildrenAt=function(t,e){if(t==e)return;if(t>=this._children.length||e>=this._children.length)throw"[scene/DisplayobjectContainer] - swapChildrenAt - Range Error";var i;var r;if(t<e){r=this.removeChildAt(e);i=this.removeChildAt(t);this.addChildAt(r,t);this.addChildAt(i,e)}else{i=this.removeChildAt(t);r=this.removeChildAt(e);this.addChildAt(i,e);this.addChildAt(r,t)}if(this._sessionID_childs){if(this._children[t]._sessionID>=0){delete this._sessionID_childs[this._children[t]._sessionID];this._children[t]._sessionID==-1;this._children[t]._avmDepthID==-1}if(this._children[e]._sessionID>=0){delete this._sessionID_childs[this._children[e]._sessionID];this._children[e]._sessionID==-1;this._children[t]._avmDepthID==-1}}};i.prototype._initNode=function(t){for(var e=0;e<this._children.length;++e)t.addChildAt(this._children[e],e)};i.prototype.removeChildAtInternal=function(t){var e=this._children.splice(t,1)[0];e._setParent(null);this.dispatchEvent(new o.ContainerEvent(o.ContainerEvent.REMOVE_CHILD_AT,e,t));return e};i.prototype._updateMaskMode=function(){if(this.maskMode)this.mouseChildren=false;s.prototype._updateMaskMode.call(this)};i.assetType="[asset DisplayObjectContainer]";i.NO_CHILD_ERROR=new G.ArgumentError("Child parameter is not a child of the caller");return i}(u);o.PartitionBase.registerAbstraction(o.EntityNode,c);var f=function(r){g(s,r);function s(t,e){if(t===void 0){t=null}if(e===void 0){e=null}var i=r.call(this)||this;i.graphics=t;i.material=e;return i}s.getNewSprite=function(t,e){if(t===void 0){t=null}if(e===void 0){e=null}if(s._sprites.length){var i=s._sprites.pop();i.graphics=t;i.material=e;return i}return new s(t,e)};s.clearPool=function(){s._sprites=[]};Object.defineProperty(s.prototype,"assetType",{get:function(){return s.assetType},enumerable:true,configurable:true});Object.defineProperty(s.prototype,"graphics",{get:function(){if(!this._graphics){this.graphics=Y.Graphics.getGraphics();this.invalidate()}return this._graphics},set:function(t){if(this._graphics==t)return;if(this._graphics){this._graphics.usages--}this._graphics=t;if(this._graphics)this._graphics.usages++;this.invalidate()},enumerable:true,configurable:true});s.prototype.getEntity=function(){return this._graphics};s.prototype.dispose=function(){this.disposeValues();s._sprites.push(this)};s.prototype.disposeValues=function(){r.prototype.disposeValues.call(this)};s.prototype.clone=function(){var t=s.getNewSprite();this.copyTo(t);return t};s.prototype.copyTo=function(t,e){if(e===void 0){e=false}r.prototype.copyTo.call(this,t);t._iSourcePrefab=this._iSourcePrefab;if(this._graphics)this._graphics.copyTo(t.graphics,e)};s.prototype._iInternalUpdate=function(){r.prototype._iInternalUpdate.call(this);if(this._iSourcePrefab)this._iSourcePrefab._iValidate()};s.prototype.bakeTransformations=function(){this._graphics.applyTransformation(this.transform.matrix3D);this.transform.clearMatrix3D()};s._sprites=new Array;s.assetType="[asset Sprite]";return s}(c);var _=Object.create(null);function w(t,e){if(e===void 0){e=""}var i=_[t._id+e];_[t._id+e]=true;if(!i){console.warn("[MorphSprite] - id",t.id,e,t)}return!i}var p=function(e){g(r,e);function r(){var t=e!==null&&e.apply(this,arguments)||this;t._frameCaches={};return t}r.getNewMorphSprite=function(t,e){if(t===void 0){t=null}if(e===void 0){e=null}if(r._morphSprites.length){var i=r._morphSprites.pop();i.graphics=t||Y.Graphics.getGraphics();i.material=e;return i}return new r(t,e)};Object.defineProperty(r.prototype,"assetType",{get:function(){return r.assetType},enumerable:true,configurable:true});r.prototype.reset=function(){e.prototype.reset.call(this);this.setRatio(0)};r.prototype._blendStyle=function(t,e,i,r){var s=1-r;var n=r;var o;var a;var h=t.style.fillStyle;var l=e.style.fillStyle;var u;if(t.style.data_type!=e.style.data_type){throw"Error in morph data - different styles of pathes"}switch(h.data_type){case Y.SolidFillStyle.data_type:{var c=h;var _=l;a=s*c.alpha+n*_.alpha;o=G.ColorUtils.interpolateFloat32Color(c.color,_.color,r);u=new Y.SolidFillStyle(o,a);break}case Y.GradientFillStyle.data_type:{var f=[];var p=[];var d=[];var c=h;var _=l;var g=c.colors.length;for(var m=0;m<g;m++){f[f.length]=G.ColorUtils.interpolateFloat32Color(c.colors[m],_.colors[m],r);d[d.length]=s*c.alphas[m]+n*_.alphas[m];p[p.length]=s*c.ratios[m]+n*_.ratios[m]}var v=c.matrix;var y=_.matrix;var b=new G.Matrix;b.a=v.a*s+y.a*n;b.b=v.b*s+y.b*n;b.c=v.c*s+y.c*n;b.d=v.d*s+y.d*n;b.tx=v.tx*s+y.tx*n;b.ty=v.ty*s+y.ty*n;u=new Y.GradientFillStyle(c.type,f,d,p,b,c.spreadMethod,c.interpolationMethod,c.focalPointRatio);break}case Y.BitmapFillStyle.data_type:{var c=h;var _=l;var v=c.matrix;var y=_.matrix;var b=new G.Matrix;b.a=v.a*s+y.a*n;b.b=v.b*s+y.b*n;b.c=v.c*s+y.c*n;b.d=v.d*s+y.d*n;b.tx=v.tx*s+y.tx*n;b.ty=v.ty*s+y.ty*n;u=new Y.BitmapFillStyle(c.material,b,c.repeat,c.smooth);break}}if(t.style.data_type===Y.GraphicsStrokeStyle.data_type){var c=t.style;var _=e.style;var x=s*c.thickness+n*_.thickness;i.style=new Y.GraphicsStrokeStyle(u,x,c.jointstyle,c.capstyle,c.miterLimit,c.scaleMode)}else{i.style=new Y.GraphicsFillStyle(u)}};r.prototype._blendContours=function(t,e,i,r){var s=1-r;var n=r;var o=t._commands.length;if(e._commands.length!==o){throw"Error in morph data - different number of contour"}for(var a=0;a<o;a++){var h=t._commands[a];var l=t._data[a];var u=e._commands[a];var c=e._data[a];var _=0;var f=0;var p=0;var d=0;var g=0;var m=0;var v=h.length;if(u.length!=v){v=Math.min(u.length,v);w(this,"different number of commands in contour");return}for(var y=0;y<v;y++){switch(h[y]){case Y.GraphicsPathCommand.MOVE_TO:if(u[y]!=Y.GraphicsPathCommand.MOVE_TO){throw"Error in morph data - both shapes must start with Move too command"}p=l[_++];d=l[_++];g=c[f++];m=c[f++];i.moveTo(s*p+n*g,s*d+n*m);break;case Y.GraphicsPathCommand.LINE_TO:if(u[y]==Y.GraphicsPathCommand.LINE_TO){p=l[_++];d=l[_++];g=c[f++];m=c[f++];i.lineTo(s*p+n*g,s*d+n*m)}else if(u[y]==Y.GraphicsPathCommand.CURVE_TO){var b=p+(l[_++]-p)/2;var x=d+(l[_++]-d)/2;i.curveTo(s*b+n*c[f++],s*x+n*c[f++],s*l[_-2]+n*c[f++],s*l[_-1]+n*c[f++]);p=l[_-2];d=l[_-1];g=c[f-2];m=c[f-1]}break;case Y.GraphicsPathCommand.CURVE_TO:if(u[y]==Y.GraphicsPathCommand.LINE_TO){var b=g+(c[f++]-g)/2;var x=m+(c[f++]-m)/2;i.curveTo(s*l[_++]+n*b,s*l[_++]+n*x,s*l[_++]+n*c[f-2],s*l[_++]+n*c[f-1]);p=l[_-2];d=l[_-1];g=c[f-2];m=c[f-1]}else if(u[y]==Y.GraphicsPathCommand.CURVE_TO){i.curveTo(s*l[_++]+n*c[f++],s*l[_++]+n*c[f++],s*l[_++]+n*c[f++],s*l[_++]+n*c[f++]);p=l[_-2];d=l[_-1];g=c[f-2];m=c[f-1]}break}}}};r.prototype.setRatio=function(t){var e=t*65535|0;var i=this._graphics;if(this._ratio===e){return}this._ratio=e;if(i.buildQueueTags){i.buildQueueTags(true)}else{i.endFill();i.clear()}if(i.start.length!==i.end.length){throw"Error in morph data - different number of pathes"}var r=i.start.length;for(var s=0;s<r;s++){var n=new Y.GraphicsPath;var o=i.start[s];var a=i.end[s];this._blendStyle(o,a,n,t);this._blendContours(o,a,n,t);i.add_queued_path(n)}i._endFillInternal(true)};r.prototype.dispose=function(){this.disposeValues();this._frameCaches={};r._morphSprites.push(this)};r.prototype.clone=function(){var t=r.getNewMorphSprite();this.copyTo(t);return t};r.assetType="[asset MorphSprite]";r._morphSprites=new Array;return r}(f);var m;var v=["",q.BlendMode.NORMAL,q.BlendMode.LAYER,q.BlendMode.MULTIPLY,q.BlendMode.SCREEN,q.BlendMode.LIGHTEN,q.BlendMode.DARKEN,q.BlendMode.DIFFERENCE,q.BlendMode.ADD,q.BlendMode.SUBTRACT,q.BlendMode.INVERT,q.BlendMode.ALPHA,q.BlendMode.ERASE,q.BlendMode.OVERLAY,q.BlendMode.HARDLIGHT];function x(t){if(t===void 0){t=1}return v[t]||v[1]}var E=function(){function u(t){this.factory=t;this._update_indices=[];this._update_frames=[];this.isButton=false;this._initalMcID=-1;this.numKeyFrames=0;this.keyframe_indices=[];this.avm1Exports={};this.avm1InitActions={};this.avm1ButtonActions=[];this.graphicsPool={};this.audioPool={};this.placeObjectTagsForSessionIDs={};this._labels={};this._framescripts={};this._framescripts_translated={};this.keyframe_to_frameidx={}}u.prototype.resetScripts=function(){this._framescripts={};this._framescripts_translated={}};u.prototype.init=function(){if(this.frame_command_indices==null||this.frame_recipe==null||this.keyframe_durations==null){return}var t=0;var e=0;var i=0;var r=0;var s=0;var n=0;this.keyframe_firstframes=[];this.keyframe_constructframes=[];this.keyframe_indices=[];this.keyframe_to_frameidx={};this.keyframe_to_frameidx[0]=0;var o=0;for(e=0;e<this.numKeyFrames;e++){this.keyframe_to_frameidx[e]=o;r=this.keyframe_durations[e];o+=r;if(this.frame_recipe[e]&1)n=s;this.keyframe_firstframes[s]=t;this.keyframe_constructframes[s++]=n;for(i=0;i<r;i++)this.keyframe_indices[t++]=e}};u.prototype.get_framescript=function(t){if(this._framescripts[t]==null)return"";if(typeof this._framescripts[t]=="string")return this._framescripts[t];else{throw new Error("Framescript is already translated to Function!!!")}};u.prototype.add_framescript=function(t,e,i,r){if(r===void 0){r=false}if(this._initalMcID>=0&&i.id!=this._initalMcID)return;this._initalMcID=i.id;if(!this._framescripts[e]){this._framescripts[e]=[]}if(Array.isArray(t)){for(var s=0;s<t.length;s++){this._framescripts[e][this._framescripts[e].length]=t[s]}}else{this._framescripts[e].push(t)}this._framescripts_translated[e]=!r};u.prototype.get_script_for_frame=function(t,e,i){if(i===void 0){i=false}if(e>=0&&this._framescripts[e]){if(i&&!this._framescripts_translated[e]){var r=t.className?t.className:t.name;this._framescripts[e]=this.factory.createFrameScripts(this._framescripts[e],e,r,t.id);this._framescripts_translated[e]=true}return this._framescripts[e]}return null};Object.defineProperty(u.prototype,"numFrames",{get:function(){return this.keyframe_indices.length},enumerable:true,configurable:true});u.prototype.getKeyframeIndexForFrameIndex=function(t){return this.keyframe_indices[t]};u.prototype.getChildInstance=function(t,e){return this.factory.createChildInstanceForTimeline(this,t,e)};u.prototype.extractHitArea=function(t){t.reset(false);this.gotoFrame(t,this.numFrames-1,false);var e=t.numChildren;var i=new c;var r;var s;while(e>0){e--;s=t.getChildAt(e);r=s.clone();r.x=s.x;r.scaleX=s.scaleX;r.y=s.y;r.scaleY=s.scaleY;r.rotationZ=s.rotationZ;i.addChild(r)}i.pickObjectFromTimeline=true;t.pickObject=i;t.reset(false);return i};u.prototype.getCurrentFrameLabel=function(t){var e=this.keyframe_to_frameidx[t.constructedKeyFrameIndex];for(var i in this._labels){if(this._labels[i].keyFrameIndex==t.constructedKeyFrameIndex&&e==t.currentFrameIndex){return this._labels[i].name}}return null};u.prototype.getCurrentLabel=function(t){var e=null;var i=-1;for(var r in this._labels){var s=this._labels[r].keyFrameIndex;if(s>i&&s<=t.constructedKeyFrameIndex){i=s;e=this._labels[r].name}}return e};u.prototype.jumpToLabel=function(t,e,i){if(i===void 0){i=0}if(!this._labels[e]){console.warn("[TIMELINE] - jumpToLabel with invalid label",t,e,i);return}var r=this._labels[e].keyFrameIndex;if(r>=0)t.currentFrameIndex=this.keyframe_firstframes[r]+i};u.prototype.getScriptForLabel=function(t,e,i){if(i===void 0){i=false}var r=this._labels[e.toLowerCase()].keyFrameIndex;if(r<0)return null;var s=this.keyframe_firstframes[r];if(s>=0&&this._framescripts[s]){return this.get_script_for_frame(t,s,i)}return null};u.prototype.gotoFrame=function(t,e,i,r,s){if(i===void 0){i=true}if(r===void 0){r=false}if(s===void 0){s=false}var n=t.constructedKeyFrameIndex;var o=this.keyframe_indices[e];if(n==o&&!s){t.adapter.queueFrameScripts(this,e,i);return}else if(n+1==o){this.constructNextFrame(t,i,true);return}var a=this.keyframe_constructframes[o];var h=a;var l=o>n;if(l&&n>a)h=n+1;t.adapter.constructFrame(this,h,o,l,e,r,i);this.applyCollectedUpdateCommands(t);t.constructedKeyFrameIndex=o};u.prototype.applyCollectedUpdateCommands=function(t){var e;var i=this._update_indices.length;for(e=0;e<i;e++)this.update_childs(t,this._update_indices[e],this._update_frames[e])};u.prototype.constructNextFrame=function(t,e,i){if(e===void 0){e=true}if(i===void 0){i=false}var r=t.currentFrameIndex;var s=this.keyframe_indices[r];if(e)t.adapter.queueFrameScripts(this,r,i);if(t.constructedKeyFrameIndex!=s){t.constructedKeyFrameIndex=s;var n=this.frame_command_indices[s];var o=this.frame_recipe[s];if(o&1){t.adapter.removeAllTimelineChilds()}else if(o&2){this.remove_childs_continous(t,n++)}if(o&4)this.add_childs_continous(t,n++);if(o&8)this.update_childs(t,n++);if(o&16)this.start_sounds(t,n++)}};u.prototype.remove_childs_continous=function(t,e){var i=this.command_index_stream[e];var r=i+this.command_length_stream[e];for(var s=i;s<r;s++){t.adapter.removeTimelineChildAt(this.remove_child_stream[s])}};u.prototype.add_childs_continous=function(t,e){var i;var r=this.command_index_stream[e];var s=r+this.command_length_stream[e];for(var n=r;n<s;n++){i=n*3;if(typeof this.add_child_stream[i]==="undefined"){console.warn("[Timeline] - add_childs_continous - could not find child-id in child_stream for idx",i,this.add_child_stream);continue}var o=this.factory.createChildInstanceForTimeline(this,this.add_child_stream[i+2],this.add_child_stream[i]);t.adapter.addTimelineChildAtDepth(o,this.add_child_stream[i+1])}};u.prototype.start_sounds=function(t,e){var i=this.command_index_stream[e];var r=i+this.command_length_stream[e];for(var s=i;s<r;s++){var n=this.audioPool[this.add_sounds_stream[s]];if(n){if(n.cmd==15){var o=n.sound;if(!o){console.warn("[Timeline] Missed sound to start!",n);return}t.startSound(n.id,o,n.props.loopCount||0)}else if(n.cmd==16){t.stopSound(n.id)}}}};u.prototype.update_childs=function(t,e,i){if(i===void 0){i=-1}var r=this.command_index_stream[e];var s=r+this.command_length_stream[e];for(var n=r;n<s;n++){var o=t.getTimelineChildAtSessionID(this.update_child_stream[n]);if(!o){continue}this._blocked=!!(o._adapter&&o.adapter.isBlockedByScript());var a=this.update_child_props_indices_stream[n];var h=a+this.update_child_props_length_stream[n];for(var l=a;l<h;l++){u.applyFunctionMap[this.property_type_stream[l]](this,o,t,this.property_index_stream[l])}}};u.update_mtx_all=function(t,e,i,r){if(t._blocked||e.noTimelineUpdate)return;r*=6;var s=e.transform.matrix3D;var n=t.properties_stream_f32_mtx_all;s._rawData[0]=n[r++];s._rawData[1]=n[r++];s._rawData[4]=n[r++];s._rawData[5]=n[r++];s._rawData[12]=n[r++];s._rawData[13]=n[r];e.transform.invalidateComponents()};u.update_colortransform=function(t,e,i,r){if(e._adapter&&e.adapter.isColorTransformByScript())return;r*=8;var s=t.properties_stream_f32_ct;var n=e.transform.colorTransform||(e.transform.colorTransform=new G.ColorTransform);n._rawData[0]=s[r++];n._rawData[1]=s[r++];n._rawData[2]=s[r++];n._rawData[3]=s[r++];n._rawData[4]=s[r++];n._rawData[5]=s[r++];n._rawData[6]=s[r++];n._rawData[7]=s[r];e.transform.invalidateColorTransform()};u.update_masks=function(t,e,i,r){var s=[];var n=t.properties_stream_int[r++];if(n===0){e.updateTimelineMask(null);return}for(var o=0;o<n;o++){s.push(i.getTimelineChildAtSessionID(t.properties_stream_int[r+o]))}e.updateTimelineMask(s)};u.update_name=function(t,e,i,r){if(t.properties_stream_strings[r].indexOf("instance")==0){return}i.adapter.unregisterScriptObject(e);e.name=t.properties_stream_strings[r];i.adapter.registerScriptObject(e)};u.update_button_name=function(t,e,i,r){e.name=t.properties_stream_strings[r];e.addButtonListeners();i.adapter.registerScriptObject(e)};u.update_visibility=function(t,e,i,r){if(!e._adapter||!e.adapter.isVisibilityByScript()){e.visible=!!r}};u.update_mtx_scale_rot=function(t,e,i,r){if(t._blocked||e.noTimelineUpdate){return}r*=4;var s=e.transform.matrix3D;var n=t.properties_stream_f32_mtx_scale_rot;s._rawData[0]=n[r++];s._rawData[1]=n[r++];s._rawData[4]=n[r++];s._rawData[5]=n[r];e.transform.invalidateComponents();e._invalidateHierarchicalProperty(o.HierarchicalProperty.SCENE_TRANSFORM)};u.update_mtx_pos=function(t,e,i,r){if(t._blocked||e.noTimelineUpdate)return;r*=2;var s=e.transform.matrix3D;s._rawData[12]=t.properties_stream_f32_mtx_pos[r++];s._rawData[13]=t.properties_stream_f32_mtx_pos[r];e.transform.invalidatePosition()};u.enable_maskmode=function(t,e,i,r){e.maskMode=true};u.remove_masks=function(t,e,i,r){e.masks=null};u.update_filters=function(t,e,i,r){var s=t.properties_stream_int[r++];var n=t.properties_stream_int[r++];var o=e.adapter;if(n===0){o.updateFilters(null);return}o.updateFilters(t.properties_stream_filters.slice(s,s+n))};u.swap_graphics=function(t,e,i,r){if(!e.isAsset(f)){console.warn("[Timeline] - swap_graphics - child is not a Sprite");return}var s=e;var n=t.graphicsPool[t.properties_stream_int[r]];if(n.id===s.graphics.id){return}s.graphics=n};u.start_audio=function(t,e,i,r){};u.set_ratio=function(t,e,i,r){if(!e.isAsset(p)){console.warn("[Timeline] - set_ratio - child is not a MorphSprite");return}e.setRatio(t.properties_stream_int[r]/65535)};u.update_blendmode=function(t,e,i,r){e.blendMode=x(r)};u.update_rendermode=function(t,e,i,r){console.log("update rendermode "+r)};u.prototype.dispose=function(){this.keyframe_indices=[];this.avm1Exports={};this.avm1InitActions={};this.avm1ButtonActions=[];this.graphicsPool={};this.audioPool={};this.placeObjectTagsForSessionIDs={};this._labels={};this._framescripts={};this._framescripts_translated={}};u.applyFunctionMap=(m={},m[1]=u.update_mtx_all,m[2]=u.update_colortransform,m[3]=u.update_masks,m[4]=u.update_name,m[5]=u.update_button_name,m[6]=u.update_visibility,m[7]=u.update_blendmode,m[8]=u.update_rendermode,m[9]=u.update_filters,m[11]=u.update_mtx_scale_rot,m[12]=u.update_mtx_pos,m[200]=u.enable_maskmode,m[201]=u.remove_masks,m[202]=u.swap_graphics,m[203]=u.set_ratio,m[204]=u.start_audio,m);return u}();var S=function(){function t(t){if(t===void 0){t=null}this._pAutoUpdate=true;this.targetObject=t}t.prototype.pNotifyUpdate=function(){if(this._pTargetObject)this._pTargetObject._invalidateHierarchicalProperty(o.HierarchicalProperty.SCENE_TRANSFORM)};Object.defineProperty(t.prototype,"targetObject",{get:function(){return this._pTargetObject},set:function(t){if(this._pTargetObject==t)return;if(this._pTargetObject&&this._pAutoUpdate)this._pTargetObject._iController=null;this._pTargetObject=t;if(this._pTargetObject&&this._pAutoUpdate)this._pTargetObject._iController=this;this.pNotifyUpdate()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"autoUpdate",{get:function(){return this._pAutoUpdate},set:function(t){if(this._pAutoUpdate==t)return;this._pAutoUpdate=t;if(this._pTargetObject){if(this._pAutoUpdate)this._pTargetObject._iController=this;else this._pTargetObject._iController=null}},enumerable:true,configurable:true});t.prototype.update=function(t){if(t===void 0){t=true}throw new G.AbstractMethodError};t.prototype.updateController=function(){if(this._pControllerDirty&&this._pAutoUpdate){this._pControllerDirty=false;this.pNotifyUpdate()}};return t}();var A=function(h){g(t,h);function t(t,e,i,r,s,n,o){if(t===void 0){t=null}if(e===void 0){e=0}if(i===void 0){i=90}if(r===void 0){r=-90}if(s===void 0){s=90}if(n===void 0){n=8}if(o===void 0){o=false}var a=h.call(this,t)||this;a._iCurrentPanAngle=0;a._iCurrentTiltAngle=90;a._panAngle=0;a._tiltAngle=90;a._minTiltAngle=-90;a._maxTiltAngle=90;a._steps=8;a._walkIncrement=0;a._strafeIncrement=0;a._wrapPanAngle=false;a.fly=false;a.panAngle=e;a.tiltAngle=i;a.minTiltAngle=r;a.maxTiltAngle=s;a.steps=n;a.wrapPanAngle=o;a._iCurrentPanAngle=a._panAngle;a._iCurrentTiltAngle=a._tiltAngle;return a}Object.defineProperty(t.prototype,"steps",{get:function(){return this._steps},set:function(t){t=t<1?1:t;if(this._steps==t)return;this._steps=t;this.pNotifyUpdate()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"panAngle",{get:function(){return this._panAngle},set:function(t){if(this._panAngle==t)return;this._panAngle=t;this.pNotifyUpdate()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"tiltAngle",{get:function(){return this._tiltAngle},set:function(t){t=Math.max(this._minTiltAngle,Math.min(this._maxTiltAngle,t));if(this._tiltAngle==t)return;this._tiltAngle=t;this.pNotifyUpdate()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"minTiltAngle",{get:function(){return this._minTiltAngle},set:function(t){if(this._minTiltAngle==t)return;this._minTiltAngle=t;this.tiltAngle=Math.max(this._minTiltAngle,Math.min(this._maxTiltAngle,this._tiltAngle))},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"maxTiltAngle",{get:function(){return this._maxTiltAngle},set:function(t){if(this._maxTiltAngle==t)return;this._maxTiltAngle=t;this.tiltAngle=Math.max(this._minTiltAngle,Math.min(this._maxTiltAngle,this._tiltAngle))},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"wrapPanAngle",{get:function(){return this._wrapPanAngle},set:function(t){if(this._wrapPanAngle==t)return;this._wrapPanAngle=t;this.pNotifyUpdate()},enumerable:true,configurable:true});t.prototype.update=function(t){if(t===void 0){t=true}if(this._tiltAngle!=this._iCurrentTiltAngle||this._panAngle!=this._iCurrentPanAngle){this._pControllerDirty=true;if(this._wrapPanAngle){if(this._panAngle<0){this._iCurrentPanAngle+=this._panAngle%360+360-this._panAngle;this._panAngle=this._panAngle%360+360}else{this._iCurrentPanAngle+=this._panAngle%360-this._panAngle;this._panAngle=this._panAngle%360}while(this._panAngle-this._iCurrentPanAngle<-180)this._iCurrentPanAngle-=360;while(this._panAngle-this._iCurrentPanAngle>180)this._iCurrentPanAngle+=360}if(t){this._iCurrentTiltAngle+=(this._tiltAngle-this._iCurrentTiltAngle)/(this.steps+1);this._iCurrentPanAngle+=(this._panAngle-this._iCurrentPanAngle)/(this.steps+1)}else{this._iCurrentTiltAngle=this._tiltAngle;this._iCurrentPanAngle=this._panAngle}if(Math.abs(this.tiltAngle-this._iCurrentTiltAngle)<.01&&Math.abs(this._panAngle-this._iCurrentPanAngle)<.01){this._iCurrentTiltAngle=this._tiltAngle;this._iCurrentPanAngle=this._panAngle}}this.targetObject.rotationX=this._iCurrentTiltAngle;this.targetObject.rotationY=this._iCurrentPanAngle;if(this._walkIncrement){if(this.fly){this.targetObject.transform.moveForward(this._walkIncrement)}else{this.targetObject.x+=this._walkIncrement*Math.sin(this._panAngle*G.MathConsts.DEGREES_TO_RADIANS);this.targetObject.z+=this._walkIncrement*Math.cos(this._panAngle*G.MathConsts.DEGREES_TO_RADIANS)}this._walkIncrement=0}if(this._strafeIncrement){this.targetObject.transform.moveRight(this._strafeIncrement);this._strafeIncrement=0}};t.prototype.incrementWalk=function(t){if(t==0)return;this._walkIncrement+=t;this.pNotifyUpdate()};t.prototype.incrementStrafe=function(t){if(t==0)return;this._strafeIncrement+=t;this.pNotifyUpdate()};return t}(S);var T=function(r){g(t,r);function t(t,e){if(t===void 0){t=null}if(e===void 0){e=null}var i=r.call(this,t)||this;i._pOrigin=new G.Vector3D(0,0,0);if(e)i.lookAtObject=e;else i.lookAtPosition=new G.Vector3D;return i}Object.defineProperty(t.prototype,"lookAtPosition",{get:function(){return this._pLookAtPosition},set:function(t){if(this._pLookAtObject){this._pLookAtObject=null}this._pLookAtPosition=t;this.pNotifyUpdate()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"lookAtObject",{get:function(){return this._pLookAtObject},set:function(t){if(this._pLookAtPosition)this._pLookAtPosition=null;if(this._pLookAtObject==t)return;this._pLookAtObject=t;this.pNotifyUpdate()},enumerable:true,configurable:true});t.prototype.update=function(t){if(t===void 0){t=true}if(this._pTargetObject){if(this._pLookAtPosition)this._pTargetObject.lookAt(this._pLookAtPosition);else if(this._pLookAtObject)this._pTargetObject.lookAt(this._pLookAtObject.transform.matrix3D.position)}};return t}(S);var P=function(f){g(t,f);function t(t,e,i,r,s,n,o,a,h,l,u,c){if(t===void 0){t=null}if(e===void 0){e=null}if(i===void 0){i=0}if(r===void 0){r=90}if(s===void 0){s=1e3}if(n===void 0){n=-90}if(o===void 0){o=90}if(a===void 0){a=null}if(h===void 0){h=null}if(l===void 0){l=8}if(u===void 0){u=2}if(c===void 0){c=false}var _=f.call(this,t,e)||this;_._iCurrentPanAngle=0;_._iCurrentTiltAngle=90;_._panAngle=0;_._tiltAngle=90;_._distance=1e3;_._minPanAngle=-Infinity;_._maxPanAngle=Infinity;_._minTiltAngle=-90;_._maxTiltAngle=90;_._steps=8;_._yFactor=2;_._wrapPanAngle=false;_._upAxis=new G.Vector3D;_.distance=s;_.panAngle=i;_.tiltAngle=r;_.minPanAngle=a!=null?a:-Infinity;_.maxPanAngle=h!=null?h:Infinity;_.minTiltAngle=n;_.maxTiltAngle=o;_.steps=l;_.yFactor=u;_.wrapPanAngle=c;_._iCurrentPanAngle=_._panAngle;_._iCurrentTiltAngle=_._tiltAngle;return _}Object.defineProperty(t.prototype,"steps",{get:function(){return this._steps},set:function(t){t=t<1?1:t;if(this._steps==t)return;this._steps=t;this.pNotifyUpdate()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"panAngle",{get:function(){return this._panAngle},set:function(t){t=Math.max(this._minPanAngle,Math.min(this._maxPanAngle,t));if(this._panAngle==t)return;this._panAngle=t;this.pNotifyUpdate()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"tiltAngle",{get:function(){return this._tiltAngle},set:function(t){t=Math.max(this._minTiltAngle,Math.min(this._maxTiltAngle,t));if(this._tiltAngle==t)return;this._tiltAngle=t;this.pNotifyUpdate()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"distance",{get:function(){return this._distance},set:function(t){if(this._distance==t)return;this._distance=t;this.pNotifyUpdate()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"minPanAngle",{get:function(){return this._minPanAngle},set:function(t){if(this._minPanAngle==t)return;this._minPanAngle=t;this.panAngle=Math.max(this._minPanAngle,Math.min(this._maxPanAngle,this._panAngle))},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"maxPanAngle",{get:function(){return this._maxPanAngle},set:function(t){if(this._maxPanAngle==t)return;this._maxPanAngle=t;this.panAngle=Math.max(this._minPanAngle,Math.min(this._maxPanAngle,this._panAngle))},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"minTiltAngle",{get:function(){return this._minTiltAngle},set:function(t){if(this._minTiltAngle==t)return;this._minTiltAngle=t;this.tiltAngle=Math.max(this._minTiltAngle,Math.min(this._maxTiltAngle,this._tiltAngle))},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"maxTiltAngle",{get:function(){return this._maxTiltAngle},set:function(t){if(this._maxTiltAngle==t)return;this._maxTiltAngle=t;this.tiltAngle=Math.max(this._minTiltAngle,Math.min(this._maxTiltAngle,this._tiltAngle))},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"yFactor",{get:function(){return this._yFactor},set:function(t){if(this._yFactor==t)return;this._yFactor=t;this.pNotifyUpdate()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"wrapPanAngle",{get:function(){return this._wrapPanAngle},set:function(t){if(this._wrapPanAngle==t)return;this._wrapPanAngle=t;this.pNotifyUpdate()},enumerable:true,configurable:true});t.prototype.update=function(t){if(t===void 0){t=true}if(this._tiltAngle!=this._iCurrentTiltAngle||this._panAngle!=this._iCurrentPanAngle){this._pControllerDirty=true;if(this._wrapPanAngle){if(this._panAngle<0){this._iCurrentPanAngle+=this._panAngle%360+360-this._panAngle;this._panAngle=this._panAngle%360+360}else{this._iCurrentPanAngle+=this._panAngle%360-this._panAngle;this._panAngle=this._panAngle%360}while(this._panAngle-this._iCurrentPanAngle<-180)this._iCurrentPanAngle-=360;while(this._panAngle-this._iCurrentPanAngle>180)this._iCurrentPanAngle+=360}if(t){this._iCurrentTiltAngle+=(this._tiltAngle-this._iCurrentTiltAngle)/(this.steps+1);this._iCurrentPanAngle+=(this._panAngle-this._iCurrentPanAngle)/(this.steps+1)}else{this._iCurrentPanAngle=this._panAngle;this._iCurrentTiltAngle=this._tiltAngle}if(Math.abs(this.tiltAngle-this._iCurrentTiltAngle)<.01&&Math.abs(this._panAngle-this._iCurrentPanAngle)<.01){this._iCurrentTiltAngle=this._tiltAngle;this._iCurrentPanAngle=this._panAngle}}var e=this.lookAtObject?this.lookAtObject.transform.position:this.lookAtPosition?this.lookAtPosition:this._pOrigin;this.targetObject.x=e.x+this.distance*Math.sin(this._iCurrentPanAngle*G.MathConsts.DEGREES_TO_RADIANS)*Math.cos(this._iCurrentTiltAngle*G.MathConsts.DEGREES_TO_RADIANS);this.targetObject.y=e.y+this.distance*Math.sin(this._iCurrentTiltAngle*G.MathConsts.DEGREES_TO_RADIANS)*this.yFactor;this.targetObject.z=e.z+this.distance*Math.cos(this._iCurrentPanAngle*G.MathConsts.DEGREES_TO_RADIANS)*Math.cos(this._iCurrentTiltAngle*G.MathConsts.DEGREES_TO_RADIANS);this._upAxis.x=-Math.sin(this._iCurrentPanAngle*G.MathConsts.DEGREES_TO_RADIANS)*Math.sin(this._iCurrentTiltAngle*G.MathConsts.DEGREES_TO_RADIANS);this._upAxis.y=Math.cos(this._iCurrentTiltAngle*G.MathConsts.DEGREES_TO_RADIANS);this._upAxis.z=-Math.cos(this._iCurrentPanAngle*G.MathConsts.DEGREES_TO_RADIANS)*Math.sin(this._iCurrentTiltAngle*G.MathConsts.DEGREES_TO_RADIANS);if(this._pTargetObject){if(this._pLookAtPosition)this._pTargetObject.lookAt(this._pLookAtPosition,this._upAxis);else if(this._pLookAtObject)this._pTargetObject.lookAt(this._pLookAtObject.transform.matrix3D.position,this._upAxis)}};return t}(T);var D=function(s){g(t,s);function t(t,e,i,r){if(t===void 0){t=null}if(e===void 0){e=null}if(i===void 0){i=45}if(r===void 0){r=700}return s.call(this,t,e,0,i,r)||this}t.prototype.update=function(t){if(t===void 0){t=true}if(!this.lookAtObject)return;this.panAngle=this._pLookAtObject.rotationY-180;s.prototype.update.call(this)};return t}(P);var I=function(o){g(t,o);function t(t,e,i,r,s){if(t===void 0){t=null}if(e===void 0){e=null}if(i===void 0){i=1}if(r===void 0){r=40}if(s===void 0){s=4}var n=o.call(this,t,e)||this;n.positionOffset=new G.Vector3D(0,500,-1e3);n.stiffness=i;n.damping=s;n.mass=r;n._velocity=new G.Vector3D;n._dv=new G.Vector3D;n._stretch=new G.Vector3D;n._force=new G.Vector3D;n._acceleration=new G.Vector3D;n._desiredPosition=new G.Vector3D;return n}t.prototype.update=function(t){if(t===void 0){t=true}if(!this._pLookAtObject||!this._pTargetObject)return;this._pControllerDirty=true;var e=this._pLookAtObject.transform.matrix3D.deltaTransformVector(this.positionOffset);this._desiredPosition.x=this._pLookAtObject.x+e.x;this._desiredPosition.y=this._pLookAtObject.y+e.y;this._desiredPosition.z=this._pLookAtObject.z+e.z;this._stretch=this._pTargetObject.transform.position.add(this._desiredPosition);this._stretch.scaleBy(-this.stiffness);this._dv.copyFrom(this._velocity);this._dv.scaleBy(this.damping);this._force.x=this._stretch.x-this._dv.x;this._force.y=this._stretch.y-this._dv.y;this._force.z=this._stretch.z-this._dv.z;this._acceleration.copyFrom(this._force);this._acceleration.scaleBy(1/this.mass);this._velocity.incrementBy(this._acceleration);var i=this._pTargetObject.transform.position.add(this._velocity);this._pTargetObject.transform.moveTo(i.x,i.y,i.z);o.prototype.update.call(this)};return t}(T);var C=function(s){g(n,s);function n(t,e,i){if(e===void 0){e="auto"}if(i===void 0){i=false}var r=s.call(this)||this;r.preserveDimensions=false;r._onInvalidateTextureDelegate=function(t){return r._onInvalidateTexture(t)};r.material=t;r._updateDimensions();if(r._sampler)r._sampler.smooth=i;return r}n.getNewBillboard=function(t,e,i){if(e===void 0){e="auto"}if(i===void 0){i=false}if(n._billboards.length){var r=n._billboards.pop();r.material=t;return r}return new n(t,e,i)};Object.defineProperty(n.prototype,"assetType",{get:function(){return n.assetType},enumerable:true,configurable:true});Object.defineProperty(n.prototype,"billboardRect",{get:function(){return this._billboardRect},enumerable:true,configurable:true});Object.defineProperty(n.prototype,"billboardHeight",{get:function(){return this._billboardHeight},enumerable:true,configurable:true});Object.defineProperty(n.prototype,"billboardWidth",{get:function(){return this._billboardWidth},enumerable:true,configurable:true});Object.defineProperty(n.prototype,"material",{get:function(){return this._material},set:function(t){if(t==this._material)return;if(this._material)this._material.removeEventListener(X.MaterialEvent.INVALIDATE_TEXTURES,this._onInvalidateTextureDelegate);this._material=t;if(this._material)this._material.addEventListener(X.MaterialEvent.INVALIDATE_TEXTURES,this._onInvalidateTextureDelegate);this._updateDimensions();this._invalidateMaterial()},enumerable:true,configurable:true});Object.defineProperty(n.prototype,"sampler",{get:function(){return this._sampler},enumerable:true,configurable:true});Object.defineProperty(n.prototype,"width",{get:function(){return this._width},set:function(t){if(this._width==t)return;this._width=t;this.scaleX=this._width/this._billboardRect.width},enumerable:true,configurable:true});Object.defineProperty(n.prototype,"height",{get:function(){return this._height},set:function(t){if(this._height==t)return;this._height=t;this.scaleY=this._height/this._billboardRect.height},enumerable:true,configurable:true});n.prototype.advanceFrame=function(){};n.prototype.getEntity=function(){return this};n.prototype.dispose=function(){this.disposeValues();n._billboards.push(this)};n.prototype.clone=function(){var t=n.getNewBillboard(this._material);this.copyTo(t);return t};n.prototype._acceptTraverser=function(t){if(!this.material){return}var e=this.material.getTextureAt(0);if(!e){return}var i=this.image;if(!i||i.isDisposed){return}t.applyTraversable(this)};Object.defineProperty(n.prototype,"image",{get:function(){var t,e;if(!this.material){return null}var i=this.material.getTextureAt(0);if(!i){return null}var r=(t=this._style)===null||t===void 0?void 0:t.getImageAt(i);if(r){return r}r=(e=this.material.style)===null||e===void 0?void 0:e.getImageAt(i);if(r){return r}return i.getImageAt(0)},enumerable:true,configurable:true});n.prototype._updateDimensions=function(){var t,e;var i=this.image;if(i&&!i.isDisposed){var r=this.material.getTextureAt(0);this._sampler=((t=this._style)===null||t===void 0?void 0:t.getSamplerAt(r))||((e=this.material.style)===null||e===void 0?void 0:e.getSamplerAt(r))||r.getSamplerAt(0)||q.ImageUtils.getDefaultSampler();if(this._sampler.imageRect){this._billboardWidth=this._sampler.imageRect.width*i.width;this._billboardHeight=this._sampler.imageRect.height*i.height}else{this._billboardWidth=i.rect.width;this._billboardHeight=i.rect.height}this._billboardRect=this._sampler.frameRect||new G.Rectangle(0,0,this._billboardWidth,this._billboardHeight)}else{this._billboardWidth=1;this._billboardHeight=1;this._billboardRect=new G.Rectangle(0,0,1,1)}this.invalidate();this.invalidateElements();if(!this.preserveDimensions){this._width=this._billboardRect.width*this.scaleX;this._height=this._billboardRect.height*this.scaleY}else{this.scaleX=this._width/this._billboardRect.width;this.scaleY=this._height/this._billboardRect.height}};n.prototype._onInvalidateProperties=function(t){if(t===void 0){t=null}s.prototype._onInvalidateProperties.call(this,t);this._updateDimensions()};n.prototype._onInvalidateTexture=function(t){this._updateDimensions()};n._billboards=new Array;n.assetType="[asset Billboard]";return n}(c);var M=function(s){g(u,s);function u(){return s!==null&&s.apply(this,arguments)||this}u.prototype._getStageElements=function(){var t=this._asset;var e=t.billboardWidth;var i=t.billboardHeight;var r=t.billboardRect;var s=e.toString()+i.toString()+r.toString();this._id=s;var n=u._samplerElements[s];if(!n){var o=-r.x;var a=-r.y;var h=e-r.x;var l=i-r.y;n=u._samplerElements[s]=new X.TriangleElements(new q.AttributesBuffer(11,4));n.autoDeriveNormals=false;n.autoDeriveTangents=false;n.setPositions([o,a,0,h,l,0,h,a,0,o,a,0,o,l,0,h,l,0]);n.setUVs([0,0,1,1,1,0,0,0,0,1,1,1])}return n.getAbstraction(this._stage)};u.prototype.executeRender=function(t,e,i,r){if(t===void 0){t=true}if(e===void 0){e=0}if(i===void 0){i=0}if(r===void 0){r=0}this._stage.context.setCulling(q.ContextGLTriangleFace.NONE);s.prototype.executeRender.call(this,t,e,i,r)};u.prototype._getRenderMaterial=function(){var t=this._asset.material||X.MaterialUtils.getDefaultColorMaterial();return t.getAbstraction(this.renderer.getRenderElements(this.stageElements.elements))};u.prototype._getStyle=function(){return this._asset.style};u._samplerElements=new Object;return u}(X._Render_RenderableBase);var O=function(r){g(t,r);function t(t,e){var i=r.call(this,t,e)||this;i._billboardBoxDirty=true;i._onInvalidateElementsDelegate=function(t){return i._onInvalidateElements(t)};i._asset.addEventListener(X.RenderableEvent.INVALIDATE_ELEMENTS,i._onInvalidateElementsDelegate);return i}t.prototype._onInvalidateElements=function(t){this._billboardBoxDirty=true};t.prototype.onClear=function(t){this._asset.removeEventListener(X.RenderableEvent.INVALIDATE_ELEMENTS,this._onInvalidateElementsDelegate);r.prototype.onClear.call(this,t)};t.prototype.hitTestPoint=function(t,e,i){return true};t.prototype.getBoxBounds=function(t,e,i,r){if(t===void 0){t=null}if(e===void 0){e=true}if(i===void 0){i=null}if(r===void 0){r=null}if(this._billboardBoxDirty){this._billboardBoxDirty=false;var s=this._asset.billboardRect;this._billboardBox=new G.Box(s.x,s.y,0,s.width,s.height,0)}return(t?t.transformBox(this._billboardBox):this._billboardBox).union(r,r||i)};t.prototype.getSphereBounds=function(t,e,i,r,s){if(e===void 0){e=null}if(i===void 0){i=true}if(r===void 0){r=null}if(s===void 0){s=null}return s};t.prototype.testCollision=function(t,e){var i=-t.rayPosition.z/t.rayDirection.z;var r=new G.Vector3D(t.rayPosition.x+i*t.rayDirection.x,t.rayPosition.y+i*t.rayDirection.y);t.traversable=this._asset;t.rayEntryDistance=i;t.position=r;t.normal=new G.Vector3D(0,0,1);return true};return t}(o._Pick_PickableBase);X.RenderEntity.registerRenderable(M,C);o.PickEntity.registerPickable(O,C);o.PartitionBase.registerAbstraction(o.EntityNode,C);var F=function(r){g(t,r);function t(t,e){var i=r.call(this,t)||this;i._camera=e;return i}Object.defineProperty(t.prototype,"camera",{get:function(){return this._camera},enumerable:true,configurable:true});t.prototype.clone=function(){return new t(this.type,this._camera)};t.PROJECTION_CHANGED="projectionChanged";return t}(G.EventBase);var R=function(i){g(t,i);function t(t){if(t===void 0){t=null}var e=i.call(this)||this;e._projection=t||new G.PerspectiveProjection;e._projection.transform=e._transform;e.z=-1e3;return e}Object.defineProperty(t.prototype,"assetType",{get:function(){return t.assetType},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"projection",{get:function(){return this._projection},set:function(t){if(this._projection==t)return;if(!t)throw new Error("Projection cannot be null!");this._projection.transform=null;this._projection=t;this._projection.transform=this._transform;this.dispatchEvent(new F(F.PROJECTION_CHANGED,this))},enumerable:true,configurable:true});t.prototype.project=function(t,e){if(e===void 0){e=null}return this._projection.project(this._transform.inverseMatrix3D.transformVector(t,e),e)};t.prototype.unproject=function(t,e,i,r){if(r===void 0){r=null}return this._transform.matrix3D.transformVector(this._projection.unproject(t,e,i,r))};t.prototype._getDefaultBoundingVolume=function(){return o.BoundingVolumeType.NULL};t.assetType="[asset Camera]";return t}(c);var N=function(t){g(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e.prototype.acceptTraverser=function(t){};return e}(o.EntityNode);o.PartitionBase.registerAbstraction(N,R);var L=function(n){g(t,n);function t(t,e,i,r){if(r===void 0){r=1}var s=n.call(this)||this;s.material=t;s._startPosition=e;s._endPosition=i;s._halfThickness=r*.5;return s}Object.defineProperty(t.prototype,"assetType",{get:function(){return t.assetType},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"startPosition",{get:function(){return this._startPosition},set:function(t){if(this._startPosition==t)return;this._startPosition=t;this.invalidateElements()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"endPosition",{get:function(){return this._endPosition},set:function(t){if(this._endPosition==t)return;this._endPosition=t;this.invalidateElements()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"thickness",{get:function(){return this._halfThickness*2},set:function(t){if(this._halfThickness==t)return;this._halfThickness=t*.5;this.invalidateElements()},enumerable:true,configurable:true});t.prototype.getEntity=function(){return this};t.prototype._acceptTraverser=function(t){t.applyTraversable(this)};t.assetType="[asset LineSegment]";return t}(u);var k=function(t){g(n,t);function n(){return t!==null&&t.apply(this,arguments)||this}n.prototype._getStageElements=function(){var t=n._lineGraphics[this._asset.id]||(n._lineGraphics[this._asset.id]=new X.LineElements);var e=this._asset.startPosition;var i=this._asset.endPosition;var r=new Float32Array(6);var s=new Float32Array(1);r[0]=e.x;r[1]=e.y;r[2]=e.z;r[3]=i.x;r[4]=i.y;r[5]=i.z;s[0]=this._asset.thickness;t.setPositions(r);t.setThickness(s);return t.getAbstraction(this._stage)};n.prototype._getRenderMaterial=function(){var t=this._asset.material||X.MaterialUtils.getDefaultColorMaterial();return t.getAbstraction(this.renderer.getRenderElements(this.stageElements.elements))};n.prototype._getStyle=function(){return this._asset.style};n._lineGraphics=new Object;return n}(X._Render_RenderableBase);var j=function(r){g(t,r);function t(t,e){var i=r.call(this,t,e)||this;i._lineSegmentBoxDirty=true;i._lineSegmentSphereDirty=true;i._onInvalidateElementsDelegate=function(t){return i._onInvalidateElements(t)};i._asset.addEventListener(X.RenderableEvent.INVALIDATE_ELEMENTS,i._onInvalidateElementsDelegate);return i}t.prototype._onInvalidateElements=function(t){this._lineSegmentBoxDirty=true;this._lineSegmentSphereDirty=true};t.prototype.onClear=function(t){this._asset.removeEventListener(X.RenderableEvent.INVALIDATE_ELEMENTS,this._onInvalidateElementsDelegate);r.prototype.onClear.call(this,t)};t.prototype.hitTestPoint=function(t,e,i){return true};t.prototype.getBoxBounds=function(t,e,i,r){if(t===void 0){t=null}if(e===void 0){e=true}if(i===void 0){i=null}if(r===void 0){r=null}if(this._lineSegmentBoxDirty){this._lineSegmentBoxDirty=false;var s=this._asset.startPosition;var n=this._asset.endPosition;this._lineSegmentBox=new G.Box(Math.min(s.x,n.x),Math.min(s.y,n.y),Math.min(s.z,n.z),Math.abs(s.x-n.x),Math.abs(s.y-n.y),Math.abs(s.z-n.z))}return(t?t.transformBox(this._lineSegmentBox):this._lineSegmentBox).union(r,r||i)};t.prototype.getSphereBounds=function(t,e,i,r,s){if(e===void 0){e=null}if(i===void 0){i=true}if(r===void 0){r=null}if(s===void 0){s=null}if(this._lineSegmentSphereDirty){this._lineSegmentSphereDirty=false;var n=this._asset.startPosition;var o=this._asset.endPosition;var a=(o.x-n.x)/2;var h=(o.y-n.y)/2;var l=(o.z-n.z)/2;this._lineSegmentSphere=new G.Sphere(n.x+a,n.y+h,n.z+l,Math.sqrt(a*a+h*h+l*l))}return(e?e.transformSphere(this._lineSegmentSphere):this._lineSegmentSphere).union(s,s||r)};t.prototype.testCollision=function(t,e){t.traversable=null;return false};return t}(o._Pick_PickableBase);X.RenderEntity.registerRenderable(k,L);o.PickEntity.registerPickable(j,L);o.PartitionBase.registerAbstraction(o.EntityNode,L);var B=function(s){g(t,s);function t(t,e){var i;if(t===void 0){t=true}if(e===void 0){e=null}var r=s.call(this)||this;r._useAssetLib=t;r._assetLibId=e;r._onLoaderStartDelegate=function(t){return r._onLoaderStart(t)};r._onLoadProgressDelegate=function(t){return r._onLoadProgress(t)};r._onLoadCompleteDelegate=function(t){return r._onLoadComplete(t)};r._onAssetCompleteDelegate=function(t){return r._onAssetComplete(t)};r._onLoaderCompleteDelegate=function(t){return r._onLoaderComplete(t)};r._onLoadErrorDelegate=function(t){return r._onLoadError(t)};r._onParseErrorDelegate=function(t){return r._onParseError(t)};r._errorDelegateSelector=(i={},i[G.URLLoaderEvent.LOAD_ERROR]=r._onLoadErrorDelegate,i[G.ParserEvent.PARSE_ERROR]=r._onParseErrorDelegate,i);return r}Object.defineProperty(t.prototype,"content",{get:function(){return this._content},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"contentLoader",{get:function(){return this._contentLoader},enumerable:true,configurable:true});t.prototype.addEventListener=function(t,e){if(this._contentLoader&&t==G.URLLoaderEvent.LOAD_ERROR||t==G.ParserEvent.PARSE_ERROR)this._contentLoader.addEventListener(t,this._errorDelegateSelector[t]);s.prototype.addEventListener.call(this,t,e)};t.prototype.removeEventListener=function(t,e){if(this._contentLoader&&t==G.URLLoaderEvent.LOAD_ERROR||t==G.ParserEvent.PARSE_ERROR)this._contentLoader.removeEventListener(t,this._errorDelegateSelector[t]);s.prototype.removeEventListener.call(this,t,e)};t.prototype.close=function(){if(!this._contentLoader)return;if(this._useAssetLib)G.AssetLibraryBundle.getInstance(this._assetLibId).stopLoader(this._contentLoader);this._disposeLoader()};t.prototype.load=function(t,e,i,r){if(e===void 0){e=null}if(i===void 0){i=null}if(r===void 0){r=null}this._getLoader().load(t,e,i,r)};t.prototype.loadData=function(t,e,i,r){if(e===void 0){e=null}if(i===void 0){i=null}if(r===void 0){r=null}this._getLoader().loadData(t,"",e,i,r)};t.prototype._getLoader=function(){if(this._contentLoader)this.close();this._contentLoader=this._useAssetLib?G.AssetLibraryBundle.getInstance(this._assetLibId).getLoader():new G.Loader;this._contentLoader.addEventListener(G.LoaderEvent.LOADER_START,this._onLoaderStartDelegate);this._contentLoader.addEventListener(G.URLLoaderEvent.LOAD_PROGRESS,this._onLoadProgressDelegate);this._contentLoader.addEventListener(G.URLLoaderEvent.LOAD_COMPLETE,this._onLoadCompleteDelegate);this._contentLoader.addEventListener(G.AssetEvent.ASSET_COMPLETE,this._onAssetCompleteDelegate);this._contentLoader.addEventListener(G.LoaderEvent.LOADER_COMPLETE,this._onLoaderCompleteDelegate);if(this.hasEventListener(G.URLLoaderEvent.LOAD_ERROR))this._contentLoader.addEventListener(G.URLLoaderEvent.LOAD_ERROR,this._onLoadErrorDelegate);if(this.hasEventListener(G.ParserEvent.PARSE_ERROR))this._contentLoader.addEventListener(G.ParserEvent.PARSE_ERROR,this._onParseErrorDelegate);return this._contentLoader};t.prototype._disposeLoader=function(){this._contentLoader.removeEventListener(G.LoaderEvent.LOADER_START,this._onLoaderStartDelegate);this._contentLoader.removeEventListener(G.URLLoaderEvent.LOAD_PROGRESS,this._onLoadProgressDelegate);this._contentLoader.removeEventListener(G.URLLoaderEvent.LOAD_COMPLETE,this._onLoadCompleteDelegate);this._contentLoader.removeEventListener(G.AssetEvent.ASSET_COMPLETE,this._onAssetCompleteDelegate);this._contentLoader.removeEventListener(G.LoaderEvent.LOADER_COMPLETE,this._onLoaderCompleteDelegate);if(this.hasEventListener(G.URLLoaderEvent.LOAD_ERROR))this._contentLoader.removeEventListener(G.URLLoaderEvent.LOAD_ERROR,this._onLoadErrorDelegate);if(this.hasEventListener(G.ParserEvent.PARSE_ERROR))this._contentLoader.removeEventListener(G.ParserEvent.PARSE_ERROR,this._onParseErrorDelegate);if(!this._useAssetLib)this._contentLoader.stop();this._contentLoader=null};t.prototype.unload=function(){};t.enableParser=function(t){G.Loader.enableParser(t)};t.enableParsers=function(t){G.Loader.enableParsers(t)};t.prototype._onLoaderStart=function(t){this.dispatchEvent(t)};t.prototype._onLoadProgress=function(t){this.dispatchEvent(t)};t.prototype._onLoadComplete=function(t){this.dispatchEvent(t)};t.prototype._onAssetComplete=function(t){this.dispatchEvent(t)};t.prototype._onLoadError=function(t){if(this.hasEventListener(G.URLLoaderEvent.LOAD_ERROR)){this.dispatchEvent(t);return true}else{return false}};t.prototype._onParseError=function(t){if(this.hasEventListener(G.ParserEvent.PARSE_ERROR)){this.dispatchEvent(t);return true}else{return false}};t.prototype._onLoaderComplete=function(t){this._content=t.content;if(this._content)this.addChild(this._content);this.dispatchEvent(t);this._disposeLoader()};return t}(c);var U=function(){function l(){}l.setInterval=function(t,e){this._intervalID++;if(e<4){e=4}this._active_intervals[this._intervalID]={f:t,t:e,dt:0,isTimeout:false};return this._intervalID};l.setTimeOut=function(t,e){this._intervalID++;if(e<4){e=4}this._active_intervals[this._intervalID]={f:t,t:e,dt:0,isTimeout:true};return this._intervalID};l.clearInterval=function(t){delete this._active_intervals[t]};l.clearTimeout=function(t){delete this._active_intervals[t]};l.execute_intervals=function(t){if(t===void 0){t=0}var e;for(var i in this._active_intervals){e=this._active_intervals[i];e.dt+=t;while(this._active_intervals[i]&&e.dt>=e.t){e.dt-=e.t;e.f();if(e.isTimeout){delete this._active_intervals[i]}}}};l.add_child_to_dispose=function(t){this._queued_dispose.push(t)};l.get_queue=function(){if(!l._queue){l._queue={queued_mcs:[],queued_scripts:[],queued_mcs_pass2:[],queued_scripts_pass2:[],constructors:[]}}return l._queue};l.add_script_to_queue=function(t,e){var i=l.get_queue();var r=i.queued_mcs_pass2.length;var s=0;for(s=0;s<r;s++){i.queued_mcs.push(i.queued_mcs_pass2[s]);i.queued_scripts.push(i.queued_scripts_pass2[s])}i.queued_mcs_pass2.length=0;i.queued_scripts_pass2.length=0;t.adapter.allowScript=true;i.queued_mcs.push(t);i.queued_scripts.push(e)};l.add_loaded_action_to_queue=function(t){var e=l.get_queue();e.queued_mcs.push(t);e.queued_scripts.push(null)};l.add_script_to_queue_pass2=function(t,e){var i=l.get_queue();t.adapter.allowScript=true;i.queued_mcs_pass2.push(t);i.queued_scripts_pass2.push(e)};l.execute_as3_constructors_finish_scene=function(t){for(var e=0,i=t.numChildren;e<i;e++){var r=t.getChildAt(e);if(r.parent&&r.adapter.executeConstructor)l.execute_as3_constructors_recursiv(r)}};l.execute_as3_constructors_enterFrame=function(t){if(!l.invalidAS3Constructors)return;l.execute_as3_constructors_recursiv(t);l.invalidAS3Constructors=false};l.execute_as3_constructors_recursiv=function(t){var e=t.adapter;var i=e.executeConstructor;if(i){e.executeConstructor=null;i()}else{for(var r=0,s=t.numChildren;r<s;r++){var n=t.getChildAt(r);l.execute_as3_constructors_recursiv(n)}}if(t.just_added_to_timeline&&t._sessionID>=0&&e&&e.dispatchStaticEvent){e.dispatchStaticEvent("added",e);t.just_added_to_timeline=false;t.hasDispatchedAddedToStage=t.isOnDisplayList();if(t.hasDispatchedAddedToStage)e.dispatchStaticEvent("addedToStage",e)}};l.isOnStage=function(t){var e=t;while(e&&!e.isAVMScene){e=e.parent}if(e&&e.isAVMScene)return true;return false};l.execute_avm1_constructors=function(){var t=l.get_queue();if(t.queued_mcs.length==0&&t.queued_mcs_pass2.length==0)return;var e=t.queued_mcs_pass2.length;while(e>0){e--;t.queued_mcs.push(t.queued_mcs_pass2[e]);t.queued_scripts.push(t.queued_scripts_pass2[e])}t.queued_mcs_pass2.length=0;t.queued_scripts_pass2.length=0;var i=t.queued_mcs;var r;if(l.useAVM1){e=i.length;while(e>0){e--;r=i[e];if(!l.isOnStage(r))continue;if(r.onInitialize){var s=r.onInitialize;r.onInitialize=null;s()}}for(e=0;e<i.length;e++){r=i[e];if(!l.isOnStage(r))continue;if(r.onConstruct){var s=r.onConstruct;r.onConstruct=null;s()}var n=r.adapter.executeConstructor;if(n){r.adapter.executeConstructor=null;n()}}}};l.execute_queue=function(){var t=l.get_queue();if(t.queued_mcs.length==0&&t.queued_mcs_pass2.length==0)return;var e=t.queued_mcs.concat();var i=t.queued_scripts.concat();t.queued_mcs.length=0;t.queued_scripts.length=0;var r=t.queued_mcs_pass2.length;var s=0;for(s=0;s<r;s++){e.push(t.queued_mcs_pass2[s]);i.push(t.queued_scripts_pass2[s])}t.queued_mcs_pass2.length=0;t.queued_scripts_pass2.length=0;var n;if(l.useAVM1){for(s=0;s<e.length;s++){n=e[s];if(!l.isOnStage(n))continue;if(n.onInitialize){var o=n.onInitialize;n.onInitialize=null;o()}}for(s=0;s<e.length;s++){n=e[s];if(!l.isOnStage(n))continue;if(n.onConstruct){var o=n.onConstruct;n.onConstruct=null;o()}var a=n.adapter.executeConstructor;if(a){n.adapter.executeConstructor=null;a()}}}for(s=0;s<e.length;s++){n=e[s];if(l.useAVM1){if(!l.isOnStage(n))continue;if(n.onLoaded){var o=n.onLoaded;n.onLoaded=null;o()}if(!n.adapter.hasOnLoadExecuted){n.adapter.hasOnLoadExecuted=true;var h=n.adapter.alGet("onLoad");if(h){h.alCall(n.adapter)}}}if(i[s]!=null){n=e[s];if(n&&n.adapter&&!n.adapter.constructorHasRun){t.queued_mcs.push(n);t.queued_scripts.push(i[s])}else if(n&&n.adapter&&n.adapter.executeScript){n.adapter.executeScript(i[s])}else{}}else{}}};l.execute_dispose=function(){var t=this._queued_dispose.length;for(var e=0;e<t;e++)this._queued_dispose[e].dispose();this._queued_dispose.length=0};l.invalidAS3Constructors=false;l.frameScriptDebug=undefined;l.useAVM1=false;l._queued_dispose=[];l._active_intervals=new Object;l._intervalID=0;return l}();var V=function(i){g(r,i);function r(t){var e=i.call(this,t)||this;e.buttons=0;return e}Object.defineProperty(r.prototype,"bubbles",{get:function(){var t=this._iAllowedToPropagate&&this._iAllowedToImmediatlyPropagate;this._iAllowedToPropagate=true;this._iAllowedToImmediatlyPropagate=true;return t},enumerable:true,configurable:true});r.prototype.stopPropagation=function(){this._iAllowedToPropagate=false;if(this._iParentEvent)this._iParentEvent.stopPropagation()};r.prototype.stopImmediatePropagation=function(){this._iAllowedToPropagate=false;this._iAllowedToImmediatlyPropagate=false;if(this._iParentEvent)this._iParentEvent.stopImmediatePropagation()};r.prototype.clone=function(){var t=new r(this.type);t.screenX=this.screenX;t.screenY=this.screenY;t.view=this.view;t.containerNode=this.containerNode;t.rootNode=this.rootNode;t.traversable=this.traversable;t.material=this.material;t.uv=this.uv;t.position=this.position;t.normal=this.normal;t.elementIndex=this.elementIndex;t.delta=this.delta;t.ctrlKey=this.ctrlKey;t.shiftKey=this.shiftKey;t._iParentEvent=this;t._iAllowedToPropagate=this._iAllowedToPropagate;t.buttons=this.buttons;return t};Object.defineProperty(r.prototype,"scenePosition",{get:function(){return this.containerNode.getMatrix3D().transformVector(this.position)},enumerable:true,configurable:true});Object.defineProperty(r.prototype,"sceneNormal",{get:function(){var t=this.containerNode.getMatrix3D().deltaTransformVector(this.normal);t.normalize();return t},enumerable:true,configurable:true});r.prototype._dispatchEvent=function(t,e){if(!t.isMouseDisabled()||this.type==r.MOUSE_OUT||this.type==r.ROLL_OUT){t.container.dispatchEvent(this,e);U.execute_queue()}};r.MOUSE_OVER="mouseOver3d";r.MOUSE_OUT="mouseOut3d";r.ROLL_OVER="rollOver3d";r.ROLL_OUT="rollOut3d";r.MOUSE_UP="mouseUp3d";r.MOUSE_UP_OUTSIDE="mouseUpOutside3d";r.MOUSE_DOWN="mouseDown3d";r.MOUSE_MOVE="mouseMove3d";r.DRAG_MOVE="dragMove3d";r.DRAG_OUT="dragOut3d";r.DRAG_OVER="dragOver3d";r.DRAG_START="dragStart3d";r.DRAG_STOP="dragStop3d";r.FOCUS_IN="focusIn3d";r.FOCUS_OUT="focusOut3d";r.CLICK="click3d";r.DOUBLE_CLICK="doubleClick3d";r.MOUSE_WHEEL="mouseWheel3d";return r}(G.EventBase);var H=function(s){g(c,s);function c(t,e){if(e===void 0){e=false}var i=s.call(this)||this;i.symbolID=0;i.preventScript=false;i._scenes=[];i._buttonMode=false;i._isButton=false;i._time=0;i._currentFrameIndex=-1;i._isPlaying=true;i._currentSceneIndex=0;i._sceneDirty=false;i._isInit=true;i._sessionID_childs={};i._sounds={};i._skipFramesForStream=0;i._isTimelinePass=false;i._isSprite=false;i.buttonEnabled=true;i.loop=true;i.constructedKeyFrameIndex=-1;i._soundVolume=1;i._parentSoundVolume=1;i._isButton=false;i._buttonMode=false;i._useHandCursor=true;i.doingSwap=false;i.cursorType="pointer";i._onMouseOver=function(t){if(i.buttonEnabled)i.currentFrameIndex=t.buttons&1?i.currentFrameIndex==0?0:2:1;else i.currentFrameIndex=0};i._onMouseOut=function(t){i.currentFrameIndex=t.buttons&1&&i.currentFrameIndex!=0?1:0};i._onMouseDown=function(t){if(i.buttonEnabled)i.currentFrameIndex=2;else i.currentFrameIndex=0};i._onMouseUp=function(t){i.currentFrameIndex=1};i._onMouseUpOutside=function(t){i.currentFrameIndex=0};i._timeline=t;if(e){i.transformToSprite()}return i}c.stopAllSounds=function(){c._activeSoundsOwners.forEach(function(t){return t&&t.stopAllSounds()});c._activeSoundsOwners.clear()};c.getNewMovieClip=function(t){if(c._movieClips.length){var e=c._movieClips.pop();e.timeline=t;return e}return new c(t)};c.clearPool=function(){c._movieClips=[]};Object.defineProperty(c.prototype,"isSprite",{get:function(){return this._isSprite},enumerable:true,configurable:true});c.prototype.initSoundStream=function(t,e){if(!this._soundStreams){this._soundStreams=new c.movieClipSoundsManagerClass(this)}this._soundStreams.initSoundStream(t,e)};c.prototype.addSoundStreamBlock=function(t,e){if(!this._soundStreams){this._soundStreams=new c.movieClipSoundsManagerClass(this)}this._soundStreams.addSoundStreamBlock(t,e)};c.prototype.stopCurrentStream=function(t){if(this._soundStreams){return this._soundStreams.stopStream(t)}};c.prototype.resetStreamStopped=function(){if(this._soundStreams){this._soundStreams.resetStreamStopped()}};c.prototype._syncSounds=function(t){if(this._soundStreams){return this._soundStreams.syncSounds(t,this._isPlaying,this.parent)}return 0};c.prototype.transformToSprite=function(){if(this._isSprite){return}this._isSprite=true;var t=this._timeline;if(t.numFrames<=1){return}t.frame_command_indices=[t.frame_command_indices[0]];t.frame_recipe=[t.frame_recipe[0]];t.keyframe_constructframes=[t.keyframe_constructframes[0]];t.keyframe_durations=[t.keyframe_durations[0]];t.keyframe_firstframes=[t.keyframe_firstframes[0]];t.keyframe_indices=[t.keyframe_indices[0]]};c.prototype.startSound=function(t,e,i,r){var s=e.play(0,i);s.onSoundComplete=r;this._sounds[t]=e;if(!c._activeSounds[t]){c._activeSounds[t]=[]}c._activeSounds[t].push(s);c._activeSoundsOwners.add(this)};c.prototype.stopSounds=function(t){if(t===void 0){t=null}if(t){if(this._sounds[t]){this._sounds[t].stop();delete this._sounds[t];var e=c._activeSounds[t];if(e){for(var i=0,r=e;i<r.length;i++){var s=r[i];s.stop()}}delete c._activeSounds[t]}}else{for(var n in this._sounds){this._sounds[n].stop();var e=c._activeSounds[t];if(e){for(var o=0,a=e;o<a.length;o++){var s=a[o];s.stop()}}delete c._activeSounds[n]}this._sounds={}}if(Object.getOwnPropertyNames(this._sounds).length===0){c._activeSoundsOwners.delete(this)}var h=this._children.length;var l;for(var u=0;u<h;++u){l=this._children[u];if(l.isAsset(c))l.stopSounds(t)}this.stopCurrentStream(this._currentFrameIndex);c._activeSounds={};if(this._soundStreams){this._soundStreams.syncSounds(0,false,this.parent)}};c.prototype.getSceneIndexByFrame=function(t){var e=this.scenes;if(e.length<=1){return 0}for(var i=0;i<e.length;i++){if(e[i].offset>t){return i-1}}return e.length-1};c.prototype.getSceneIndex=function(t){var e=this.scenes;for(var i=0;i<e.length&&t;i++){if(e[i].name===t){return i}}return 0};Object.defineProperty(c.prototype,"currentSceneName",{get:function(){return this.scenes[this._currentSceneIndex].name},set:function(t){var e=this.getSceneIndex(t);this._sceneDirty=this._currentSceneIndex!==e;this._currentSceneIndex=e;this._currentFrameIndex=this._scenes[e].offset},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"currentScene",{get:function(){var t=this.scenes[this._currentSceneIndex];if(t.numFrames===-1){t.numFrames=this.timeline.numFrames-t.offset}return t},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"scenes",{get:function(){if(this._scenes.length===0){this._scenes[0]={name:"Scene1",offset:0,labels:[],numFrames:this.timeline.numFrames}}return this._scenes},set:function(t){this._scenes=t},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"isPlaying",{get:function(){return this._isPlaying},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"soundVolume",{get:function(){return this._soundVolume},set:function(t){if(this._soundVolume==t){return}this._soundVolume=t;for(var e in this._sounds){this._sounds[e].volume=t}var i=this._children.length;var r;for(var s=0;s<i;++s){r=this._children[s];if(r.isAsset(c))r.soundVolume=t}},enumerable:true,configurable:true});c.prototype.stopSound=function(t){if(this._sounds[t]){this._sounds[t].stop();delete this._sounds[t]}if(Object.getOwnPropertyNames(this._sounds).length===0){c._activeSoundsOwners.delete(this)}if(c._activeSounds[t]){for(var e=0;e<c._activeSounds[t].length;e++){c._activeSounds[t][e].stop()}delete c._activeSounds[t]}};c.prototype.stopAllSounds=function(){var t=Object.keys(this._sounds);for(var e=0,i=t;e<i.length;e++){var r=i[e];this.stopSounds(r)}};c.prototype.buttonReset=function(){if(this._isButton&&!this.buttonEnabled){this.currentFrameIndex=0}};c.prototype.getMouseCursor=function(){if(this.name=="scene")return"initial";if(this._useHandCursor&&this.buttonMode){return this.cursorType}return"initial"};c.prototype.queueFrameScripts=function(t,e,i){console.warn("[MovieClip] - queueFrameScripts should only be called on AVM-Adapters")};c.prototype.registerScriptObject=function(t){this[t.name]=t;if(t.isAsset(c))t.removeButtonListeners()};c.prototype.unregisterScriptObject=function(t){delete this[t.name];if(t.isAsset(c))t.removeButtonListeners()};c.prototype.dispose=function(){this.disposeValues();c._movieClips.push(this)};c.prototype.disposeValues=function(){s.prototype.disposeValues.call(this);this._sessionID_childs={};this._timeline=null};Object.defineProperty(c.prototype,"useHandCursor",{get:function(){return this._useHandCursor},set:function(t){this._useHandCursor=t},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"buttonMode",{get:function(){return this._buttonMode},set:function(t){this._buttonMode=t},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"isButton",{get:function(){return this._isButton},set:function(t){this._isButton=t},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"isInit",{get:function(){return this._isInit},set:function(t){this._isInit=t},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"timeline",{get:function(){return this._timeline},set:function(t){if(this._timeline==t)return;this._timeline=t;this.reset(false,false)},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"numFrames",{get:function(){return this._timeline.numFrames},enumerable:true,configurable:true});c.prototype.jumpToLabel=function(t,e){if(e===void 0){e=0}var i=this._currentFrameIndex;this._timeline.jumpToLabel(this,t,e);return i!==this._currentFrameIndex};c.prototype.reset=function(t,e){if(t===void 0){t=true}if(e===void 0){e=true}this._isTimelinePass=true;if(e)s.prototype.reset.call(this);if(this.id==4115)console.warn("reset",this.id);this.resetStreamStopped();this._time=0;if(e&&this._adapter)this.adapter.freeFromScript();this.constructedKeyFrameIndex=-1;for(var i=this.numChildren-1;i>=0;i--)this.removeChildAt(i);if(this._graphics)this._graphics.clear();if(t){var r=this._timeline.keyframe_indices.length;this._isPlaying=Boolean(r>1);this._currentSceneIndex=0;if(r){this._currentFrameIndex=0;this._timeline.constructNextFrame(this,t&&!this.doingSwap&&!this.preventScript,true)}else{this._currentFrameIndex=-1}}this._skipAdvance=true;this._isTimelinePass=false};Object.defineProperty(c.prototype,"currentFrameIndex",{get:function(){return this._currentFrameIndex},set:function(t){this.jumpToIndex(t)},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"currentFrameIndexRelative",{get:function(){return this._currentFrameIndex-this.currentScene.offset},set:function(t){this.jumpToIndex(t,this._currentSceneIndex)},enumerable:true,configurable:true});c.prototype.jumpToIndex=function(t,e){var i=true;var r=0;var s=this._timeline.keyframe_indices.length;this.resetStreamStopped();if(!s)return false;var n=this.scenes;if(typeof e==="undefined"){e=this.getSceneIndexByFrame(t)}else{e=typeof e==="string"?this.getSceneIndex(e):e;var o=n[e];if(o.numFrames===-1){o.numFrames=s-o.offset}r=o.offset;s=o.numFrames}this._currentSceneIndex=e;if(t<0){t=0}else if(t>=s){t=s-1;i=false}t+=r;this._skipAdvance=false;if(this._currentFrameIndex===t&&!this._sceneDirty)return false;this._sceneDirty=false;this._currentFrameIndex=t;this._timeline.gotoFrame(this,t,i,false,false);return true};c.prototype.addButtonListeners=function(){this._isButton=true;this.stop();this.addEventListener(V.MOUSE_OVER,this._onMouseOver);this.addEventListener(V.MOUSE_OUT,this._onMouseOut);this.addEventListener(V.MOUSE_DOWN,this._onMouseDown);this.addEventListener(V.MOUSE_UP,this._onMouseUp);this.addEventListener(V.MOUSE_UP_OUTSIDE,this._onMouseUpOutside);this.mouseChildren=false};c.prototype.removeButtonListeners=function(){this.removeEventListener(V.MOUSE_OVER,this._onMouseOver);this.removeEventListener(V.MOUSE_OUT,this._onMouseOut);this.removeEventListener(V.MOUSE_DOWN,this._onMouseDown);this.removeEventListener(V.MOUSE_UP,this._onMouseUp);this.removeEventListener(V.MOUSE_UP_OUTSIDE,this._onMouseUpOutside)};c.prototype.getTimelineChildAtSessionID=function(t){return this._sessionID_childs[t]};c.prototype.constructFrame=function(t,e,i,r,s,n,o){console.warn("[scene/MovieClip] - constructFrame not implemented")};c.prototype.addTimelineChildAtDepth=function(t,e,i){console.warn("[scene/MovieClip] - addTimelineChildAtDepth not implemented");return null};c.prototype.removeTimelineChildAtDepth=function(t){console.warn("[scene/MovieClip] - removeTimelineChildAtDepth not implemented")};c.prototype.removeChildAtInternal=function(t){var e=this._children[t];if(e._adapter)e.adapter.freeFromScript();if(this._isTimelinePass){this.adapter.unregisterScriptObject(e)}delete this._sessionID_childs[e._sessionID];e._sessionID=-1;if(e.adapter&&e.adapter.dispatchStaticEvent){e.adapter.dispatchStaticEvent("removed",e.adapter)}if(this.isOnDisplayList()&&e.adapter.dispatch_REMOVED_FROM_STAGE){e.adapter.dispatch_REMOVED_FROM_STAGE(e)}return s.prototype.removeChildAtInternal.call(this,t)};Object.defineProperty(c.prototype,"assetType",{get:function(){return c.assetType},enumerable:true,configurable:true});c.prototype.play=function(){if(this._timeline.keyframe_indices.length>1)this._isPlaying=true};c.prototype.stop=function(){this.resetStreamStopped();this._isPlaying=false};c.prototype.clone=function(){var t=c.getNewMovieClip(this._timeline);this.copyTo(t);return t};c.prototype.copyTo=function(t){s.prototype.copyTo.call(this,t);t.buttonMode=this.buttonMode;t.symbolID=this.symbolID;t.loop=this.loop;t._soundStreams=this._soundStreams;t._scenes=this._scenes;if(this._isSprite){t.transformToSprite()}};c.prototype.advanceFrameInternal=function(){if(this._timeline&&this._timeline.numFrames>0&&this._isPlaying&&!this._skipAdvance){if(this._currentFrameIndex===this._timeline.numFrames-1){if(this.loop){if(this._currentFrameIndex!==0){this._currentFrameIndex=0;this._currentSceneIndex=0;this.resetStreamStopped();this._timeline.gotoFrame(this,0,true,true,true)}}else this._isPlaying=false}else{this._currentFrameIndex++;this._currentSceneIndex=this.getSceneIndexByFrame(this._currentFrameIndex);this._timeline.constructNextFrame(this)}}s.prototype.advanceFrame.call(this);this._skipAdvance=false};c.prototype.advanceFrame=function(){this._isTimelinePass=true;if(this._skipFramesForStream==0){this.advanceFrameInternal()}this._skipFramesForStream=this._syncSounds(this._currentFrameIndex);while(this._skipFramesForStream>0){U.execute_queue();this.advanceFrameInternal();this._skipFramesForStream=this._syncSounds(this._currentFrameIndex)}this._isTimelinePass=false};c.prototype.logHierarchy=function(t){if(t===void 0){t=0}this.printHierarchyName(t,this);var e=this._children.length;var i;for(var r=0;r<e;r++){i=this._children[r];if(i.isAsset(c))i.logHierarchy(t+1);else this.printHierarchyName(t+1,i)}};c.prototype.printHierarchyName=function(t,e){var i="";for(var r=0;r<t;++r)i+="--";i+=" "+e.name+" = "+e.id;console.log(i)};c.prototype.clear=function(){this.resetStreamStopped();s.prototype.clear.call(this)};c.avm1ScriptQueue=[];c.avm1ScriptQueueScripts=[];c.avm1LoadedActions=[];c.movieClipSoundsManagerClass=null;c._movieClips=new Array;c._activeSounds={};c._activeSoundsOwners=new Set;c.assetType="[asset MovieClip]";return c}(f);o.PartitionBase.registerAbstraction(o.EntityNode,H);var W=function(s){g(t,s);function t(t,e,i,r){if(t===void 0){t=null}if(e===void 0){e=null}if(i===void 0){i=null}if(r===void 0){r=null}return s.call(this)||this}Object.defineProperty(t.prototype,"downState",{get:function(){return this._downState},set:function(t){this._downState=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this.enabled=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"hitTestState",{get:function(){return this._hitTestState},set:function(t){this._hitTestState=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"overState",{get:function(){return this._overState},set:function(t){this._overState=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"soundTransform",{get:function(){console.log("soundTransform not implemented yet in flash/SimpleButton");return null},set:function(t){console.log("soundTransform not implemented yet in flash/SimpleButton")},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"trackAsMenu",{get:function(){console.log("trackAsMenu not implemented yet in flash/SimpleButton");return false},set:function(t){console.log("trackAsMenu not implemented yet in flash/SimpleButton")},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"upState",{get:function(){return this._upState},set:function(t){this._upState=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"useHandCursor",{get:function(){console.log("useHandCursor not implemented yet in flash/SimpleButton");return false},set:function(t){console.log("useHandCursor not implemented yet in flash/SimpleButton")},enumerable:true,configurable:true});return t}(f);var z=function(t){g(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}Object.defineProperty(e.prototype,"assetType",{get:function(){return e.assetType},enumerable:true,configurable:true});e.assetType="[asset SkyboxElements]";return e}(X.TriangleElements);var K=function(t){g(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e.prototype._includeDependencies=function(t){};e.prototype._getVertexCode=function(t,e,i){var r="";var s=t.globalPosDependencies>0?i.globalPositionVertex:i.animatedPosition;var n=e.getFreeVertexConstant();e.getFreeVertexConstant();e.getFreeVertexConstant();e.getFreeVertexConstant();t.viewMatrixIndex=n.index*4;var o=e.getFreeVertexConstant();t.scenePositionIndex=o.index*4;var a=e.getFreeVertexConstant();var h=e.getFreeVertexVectorTemp();r+="mul "+h+", "+s+", "+a+"\n"+"add "+h+", "+h+", "+o+"\n";if(t.projectionDependencies>0){i.projectionFragment=e.getFreeVarying();r+="m44 "+h+", "+h+", "+n+"\n"+"mov "+i.projectionFragment+", "+h+"\n"+"mov op, "+h+"\n"}else{r+="m44 op, "+h+", "+n+"\n"}return r};e.prototype._getFragmentCode=function(t,e,i){return""};return e}(X._Render_ElementsBase);var Z=function(e){g(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;t._skyboxProjection=new G.Matrix3D;return t}t.prototype.draw=function(t,e,i,r){var s=e.scenePositionIndex;var n=e.view.projection.transform.matrix3D.position;e.vertexConstantData[s++]=2*n.x;e.vertexConstantData[s++]=2*n.y;e.vertexConstantData[s++]=2*n.z;e.vertexConstantData[s++]=1;e.vertexConstantData[s++]=e.vertexConstantData[s++]=e.vertexConstantData[s++]=e.view.projection.far/Math.sqrt(3);e.vertexConstantData[s]=1;var o=new G.Vector3D;this._skyboxProjection.copyFrom(e.view.viewMatrix3D);this._skyboxProjection.copyRowTo(2,o);var a=o.x;var h=o.y;var l=o.z;var u=-(o.x*n.x+o.y*n.y+o.z*n.z+Math.sqrt(a*a+h*h+l*l));var c=a>=0?1:-1;var _=h>=0?1:-1;var f=new G.Vector3D(c,_,1,1);var p=this._skyboxProjection.clone();p.invert();var d=p.transformVector(f);this._skyboxProjection.copyRowTo(3,f);var g=(d.x*f.x+d.y*f.y+d.z*f.z+d.w*f.w)/(a*d.x+h*d.y+l*d.z+u*d.w);this._skyboxProjection.copyRowFrom(2,new G.Vector3D(a*g,h*g,l*g,u*g));if(e.sceneMatrixIndex>=0)e.sceneMatrix.copyFrom(t.renderSceneTransform,true);e.viewMatrix.copyFrom(this._skyboxProjection,true);var m=this._stage.context;m.setProgramConstantsFromArray(q.ContextGLProgramType.VERTEX,e.vertexConstantData);m.setProgramConstantsFromArray(q.ContextGLProgramType.FRAGMENT,e.fragmentConstantData);if(this._indices)this.getIndexBufferGL().draw(q.ContextGLDrawMode.TRIANGLES,0,this.numIndices);else this._stage.context.drawVertices(q.ContextGLDrawMode.TRIANGLES,r,i||this.numVertices)};return t}(X._Stage_TriangleElements);X.RenderGroup.registerElements(K,z);q.Stage.registerAbstraction(Z,z);var Q=function(r){g(t,r);function t(t,e){if(t===void 0){t=16777215}if(e===void 0){e=1}var i=r.call(this)||this;i._textures=new Array;i._blendMode=q.BlendMode.NORMAL;i.animateUVs=false;i.bothSides=false;i.curves=false;i.imageRect=false;i.useColorTransform=false;i.alphaThreshold=0;i.alphaBlending=true;i._onTextureInvalidateDelegate=function(t){return i.onTextureInvalidate(t)};i._owners=[i];i.style=new X.Style;if(t instanceof q.ImageCube){i._style.image=t;i.texture=new X.ImageTextureCube}else{i._style.color=Number(t)}return i}Object.defineProperty(t.prototype,"animationSet",{get:function(){return this._animationSet},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"blendMode",{get:function(){return this._blendMode},set:function(t){if(this._blendMode==t)return;this._blendMode=t;this.invalidate()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"iOwners",{get:function(){return this._owners},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"texture",{get:function(){return this._texture},set:function(t){if(this._texture==t)return;if(this._texture)this.removeTexture(this._texture);this._texture=t;if(this._texture)this.addTexture(this._texture);this.invalidatePasses()},enumerable:true,configurable:true});t.prototype.getNumTextures=function(){return this._textures.length};t.prototype.getTextureAt=function(t){return this._textures[t]};t.prototype.getEntity=function(){return this};Object.defineProperty(t.prototype,"assetType",{get:function(){return t.assetType},enumerable:true,configurable:true});t.prototype.invalidatePasses=function(){this.dispatchEvent(new X.MaterialEvent(X.MaterialEvent.INVALIDATE_PASSES,this))};t.prototype.invalidateElements=function(){this.dispatchEvent(new X.RenderableEvent(X.RenderableEvent.INVALIDATE_ELEMENTS,this))};t.prototype.invalidateMaterial=function(){this.dispatchEvent(new X.RenderableEvent(X.RenderableEvent.INVALIDATE_MATERIAL,this))};t.prototype.invalidateStyle=function(){this.dispatchEvent(new X.RenderableEvent(X.RenderableEvent.INVALIDATE_STYLE,this))};t.prototype.addTexture=function(t){this._textures.push(t);t.addEventListener(G.AssetEvent.INVALIDATE,this._onTextureInvalidateDelegate);this.onTextureInvalidate()};t.prototype.removeTexture=function(t){this._textures.splice(this._textures.indexOf(t),1);t.removeEventListener(G.AssetEvent.INVALIDATE,this._onTextureInvalidateDelegate);this.onTextureInvalidate()};t.prototype.onTextureInvalidate=function(t){if(t===void 0){t=null}this.invalidate()};t.prototype._onInvalidateProperties=function(t){this.invalidateMaterial();this.invalidatePasses()};t.prototype._acceptTraverser=function(t){t.applyTraversable(this)};t.prototype.iAddOwner=function(t){};t.prototype.iRemoveOwner=function(t){};t.prototype._getDefaultBoundingVolume=function(){return o.BoundingVolumeType.NULL};t.prototype.testCollision=function(t,e){t.traversable=null;return false};t.assetType="[asset Skybox]";return t}(c);var J=function(r){g(t,r);function t(t,e){var i=r.call(this,t,e)||this;i._skybox=t;i._shader=new X.ShaderBase(e,i,i,i._stage);i._texture=i._skybox.texture.getAbstraction(i._shader);i._pAddPass(i);return i}t.prototype.onClear=function(t){r.prototype.onClear.call(this,t);this._texture.onClear(new G.AssetEvent(G.AssetEvent.CLEAR,this._skybox.texture));this._texture=null;this._skybox=null};t.prototype._pUpdateRender=function(){r.prototype._pUpdateRender.call(this);this.requiresBlending=this._material.blendMode!=q.BlendMode.NORMAL;this.shader.setBlendMode(this._material.blendMode==q.BlendMode.NORMAL&&this.requiresBlending?q.BlendMode.LAYER:this._material.blendMode)};t.prototype._includeDependencies=function(t){r.prototype._includeDependencies.call(this,t);t.usesPositionFragment=true};t.prototype._getFragmentCode=function(t,e){return this._texture._getFragmentCode(e.shadedTarget,t,e,e.positionVarying)};t.prototype._setRenderState=function(t){r.prototype._setRenderState.call(this,t);this._texture._setRenderState(t)};t.prototype._activate=function(){r.prototype._activate.call(this);this._stage.context.setDepthTest(false,q.ContextGLCompareMode.LESS);this._texture.activate()};return t}(X._Render_MaterialPassBase);var $=function(t){g(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e.prototype._getStageElements=function(){var t=e._elements;if(!t){t=new z(new q.AttributesBuffer(11,4));t.autoDeriveNormals=false;t.autoDeriveTangents=false;t.setIndices(Array(0,1,2,2,3,0,6,5,4,4,7,6,2,6,7,7,3,2,4,5,1,1,0,4,4,0,3,3,7,4,2,1,5,5,6,2));t.setPositions(Array(-1,1,-1,1,1,-1,1,1,1,-1,1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1))}return t.getAbstraction(this._stage)};e.prototype._getRenderMaterial=function(){return this._asset.getAbstraction(this.renderer.getRenderElements(this.stageElements.elements))};e.prototype._getStyle=function(){return this._asset.style};return e}(X._Render_RenderableBase);var tt=function(t){g(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e.prototype.isInFrustum=function(t,e,i,r){if(this.isInvisible())return false;return true};e.prototype.isCastingShadow=function(){return false};return e}(o.EntityNode);X.DefaultRenderer.registerMaterial(J,Q);X.RenderEntity.registerRenderable($,Q);o.PartitionBase.registerAbstraction(tt,Q);var et=function(){function t(){}t.CENTER="center";t.LEFT="left";t.NONE="none";t.RIGHT="right";return t}();var it=function(){function t(){}t.DYNAMIC="dynamic";t.INPUT="input";t.STATIC="input";return t}();(function(t){t["STANDART"]="standart";t["BOLD"]="bold";t["ITALIC"]="italic";t["BOLDITALIC"]="boldItalic"})(d.FontStyleName||(d.FontStyleName={}));var rt=function(){function t(){}t.CENTER="center";t.JUSTIFY="justify";t.LEFT="left";t.RIGHT="right";return t}();var st=function(){function t(t,e,i){if(t===void 0){t=null}if(e===void 0){e=null}if(i===void 0){i=null}this.fill_data=t;this.stroke_data=e;this.fill_data_path=i;this.fnt_channel=0;this.lastTesselatedScale=0;this.kerningCharCodes=[];this.kerningValues=[]}t.prototype.dispose=function(){if(this.stroke_data){this.stroke_data=null}if(this.fill_data){this.fill_data=null}if(this.fill_data_path){this.fill_data_path=null}};return t}();var nt=function(){function t(t){this._stage=t}return t}();var ot=function(){function t(){this.left=Number.MAX_VALUE;this.right=Number.MIN_VALUE;this.top=Number.MAX_VALUE;this.bottom=Number.MIN_VALUE}t.prototype.grown=function(t,e){if(t<this.left)this.left=t;if(t>this.right)this.right=t;if(e<this.top)this.top=e;if(e>this.bottom)this.bottom=e};t.prototype.toRect=function(){return new G.Rectangle(this.left,this.top,this.right-this.left,this.bottom-this.top)};return t}();var at=function(r){g(y,r);function y(t,e){if(e===void 0){e=false}var i=r.call(this,t)||this;i.debug=false;i.debug=e;return i}y.getCanvasContext=function(t,e,i){if(t===void 0){t=100}if(e===void 0){e=100}if(i===void 0){i=false}var r="OffscreenCanvas"in self&&!i?new self.OffscreenCanvas(t,e):document.createElement("canvas");r.width=t;r.height=e;return r.getContext("2d",{desynchronized:true,alpha:true})};y.freeCanvasContext=function(t){if(t.canvas instanceof self.OffscreenCanvas){return}t.canvas.width=0;t.canvas.height=0};y.transformChar=function(t){var e=t.fill_data_path;if(e.commands[0].length===0&&e.commands.length===1){return null}var i=new Path2D;var r=new ot;for(var s=0;s<e.commands.length;s++){var n=e.data[s];var o=e.commands[s];var a=0;for(var h=0,l=o;h<l.length;h++){var u=l[h];switch(u){case Y.GraphicsPathCommand.MOVE_TO:{var c=n[a++]/20;var _=n[a++]/20;r.grown(c,_);i.moveTo(c,_);break}case Y.GraphicsPathCommand.LINE_TO:{var c=n[a++]/20;var _=n[a++]/20;r.grown(c,_);i.lineTo(c,_);break}case Y.GraphicsPathCommand.CURVE_TO:{var f=n[a++]/20;var p=n[a++]/20;var d=n[a++]/20;var g=n[a++]/20;r.grown(f,p);r.grown(d,g);i.quadraticCurveTo(f,p,d,g)}}}}return{path:i,char:t,rect:r.toRect()}};y.sortPatches=function(t,e){return t.rect.height-e.rect.height};y.render=function(t,e,i,r,s){if(r===void 0){r=0}if(s===void 0){s=0}var n=t.get_font_chars();var o=[];var a=s*2;var h=0;var l=1;for(var u=0,c=n;u<c.length;u++){var _=c[u];var f=y.transformChar(_);if(!f){continue}h+=(a+f.rect.width)*(a+f.rect.height);o.push(f)}o.sort(y.sortPatches);if(r){t.initFontSize(r);l=i/t.get_font_em_size()}e.save();e.clearRect(0,0,i,i);e.fillStyle="#fff";var p=s;var d=s;var g=0;for(var m=0,v=o;m<v.length;m++){var f=v[m];if(!f.path){continue}if(p+f.rect.width+a>=i/l){p=s;d+=g+a;g=0}if(d+f.rect.height>i/l){console.warn("[FNTGeneratorCanvas] Font image overflow, font will corrupted!")}g=Math.max(f.rect.height,g);e.setTransform(l,0,0,l,(p-f.rect.x)*l,(d-f.rect.y)*l);e.fill(f.path);f.char.fnt_rect=new G.Rectangle(f.rect.x/f.char.char_width,f.rect.y/t.get_font_em_size(),f.rect.width/f.char.char_width,f.rect.height/t.get_font_em_size());f.char.fnt_uv=new G.Rectangle(p*l/i,d*l/i,f.rect.width*l/i,f.rect.height*l/i);f.char.fnt_channel=0;p+=f.rect.width+a}e.restore()};y.prototype.generate=function(t,e,i,r){var s=y.getCanvasContext(e,e,this.debug);var n=[];for(var o in t.font_styles){var a=t.font_styles[o];y.render(a,s,e,i,r);var h=s.getImageData(0,0,e,e);var l=new q.BitmapImage2D(e,e,true,0,true,this._stage);l.setPixels(new G.Rectangle(0,0,e,e),h.data);n.push(l);a.addFNTChannel(l)}if(!this.debug){y.freeCanvasContext(s)}else{this.canvas=s.canvas}return n};return y}(nt);var ht=Object.create(null);function lt(t,e){if(e===void 0){e=""}var i=ht[t._id+e];ht[t._id+e]=true;return!i}var ut=function(r){g(s,r);function s(t){if(t===void 0){t=null}var e=r.call(this)||this;e._fntSizeLimit=-1;e._font_chars=[];e._font_chars_dic=Object.create(null);e._current_size=0;e._size_multiply=0;e._ascent=0;e._descent=0;e._usesCurves=false;e._glyphIdxToChar={};e._fnt_channels=[];e._font_em_size=32;if(t){e._opentype_font=t;e._font_em_size=72;e._ascent=t.tables.hhea.ascender/(e._opentype_font.unitsPerEm/72);e._descent=-2+t.tables.hhea.descender/(e._opentype_font.unitsPerEm/72);e._current_size=0;e._size_multiply=0;var i=e._opentype_font.charToGlyph(String.fromCharCode(32));if(i){}return e}return e}s.prototype.addFNTChannel=function(t){this._fnt_channels.push(t)};s.prototype.getGlyphCount=function(){return this._font_chars.length};s.prototype.generateFNTData=function(t){if(this._fntSizeLimit>0){return}var e=new at(t,false);var i=e.generate(this.font,this._font_em_size,this._current_size,4);if(i&&i.length>0){this._fntSizeLimit=this._current_size*4}};s.prototype.generateFNTTextures=function(t,e,i){console.log("generateFNTTextures");if(e){this._fntSizeLimit=e*.5;this.initFontSize(e)}if(this._opentype_font){for(var r=0;r<this._opentype_font.glyphs.length;r++){var s=this._opentype_font.charToGlyph(String.fromCharCode(this._opentype_font.glyphs.glyphs[r].unicode));if(s){var n=s.getPath();var o=new Y.GraphicsPath;var a=0;var h=n.commands.length;var l=0;var u=0;var c=this._ascent;for(a=0;a<h;a++){var _=n.commands[a];if(_.type==="M"){o.moveTo(_.x,_.y+c);l=_.x;u=_.y+c}else if(_.type==="L"){o.lineTo(_.x,_.y+c)}else if(_.type==="Q"){o.curveTo(_.x1,_.y1+c,_.x,_.y+c)}else if(_.type==="C"){o.cubicCurveTo(_.x1,_.y1+c,_.x2,_.y2+c,_.x,_.y+c)}else if(_.type==="Z"){o.lineTo(l,u)}}var f=new st(null,null,o);f.char_width=s.advanceWidth*(1/s.path.unitsPerEm*72);f.fill_data=Y.GraphicsFactoryFills.pathToAttributesBuffer(o,true);if(!f.fill_data){console.log("error tesselating opentype glyph",this._opentype_font.glyphs.glyphs[r])}else{this._font_chars.push(f);this._font_chars_dic[this._opentype_font.glyphs.glyphs[r].unicode]=f}}else{console.log("no char found for",this._opentype_font.glyphs.glyphs[r])}}}var p;var d=0;var g=0;var m;var v;var y=[[]];var b=0;var x=0;var w=[];var E=Number.MIN_VALUE;var S=Number.MIN_VALUE;var A=Number.MAX_VALUE;var T=Number.MAX_VALUE;var P=0;var D=0;var I=0;for(var a=0;a<this._font_chars.length;a++){p=this._font_chars[a].fill_data;m=new Float32Array(p.buffer);E=Number.MIN_VALUE;S=Number.MIN_VALUE;A=Number.MAX_VALUE;T=Number.MAX_VALUE;P=0;D=0;for(v=0;v<p.count;v++){P=m[v*2];D=m[v*2+1];if(P<T)T=P;if(P>S)S=P;if(D<A)A=D;if(D>E)E=D}this._font_chars[a].fnt_rect=new G.Rectangle(T/this._font_chars[a].char_width,A/this._font_em_size,(S-T)/this._font_chars[a].char_width,(E-A)/this._font_em_size);I+=(S-T+t+t)*(E-A+t+t);w[w.length]={idx:a,minx:T,miny:A,width:S-T,height:E-A}}w.sort(function(t,e){return t.height>e.height?-1:1});var C=0;x=i;var M=1;if(e){this.initFontSize(e);M=this._size_multiply}else{M=x/Math.sqrt(I)*1.2;var O=true;var F=0;while(O){O=false;d=0;g=t;for(var a=0;a<w.length;a++){F=w[a].height*M;P=0;D=0;d+=t;if(d+w[a].width*M+t>=x){d=t;g+=C+t*2;C=0}if(F>C){C=F}if(g+F+t*2>=x){O=true;M=M*.995;break}d+=w[a].width*M+t}}}this._fntSizeLimit=M*this._font_em_size*.5;var R;d=0;g=t;for(var a=0;a<w.length;a++){R=this._font_chars[w[a].idx];p=R.fill_data;m=new Float32Array(p.buffer);T=w[a].minx;S=Number.MIN_VALUE;A=w[a].miny;E=Number.MIN_VALUE;P=0;D=0;d+=t;if(d+w[a].width*M+t>=x){d=t;g+=C+t*2;C=0}w[a].height*=M;if(w[a].height>C){C=w[a].height}if(g+C+t*2>=x){d=t;g=t;C=0;b++;y[b]=[]}R.fnt_channel=b;for(v=0;v<p.count;v++){P=(m[v*2]-T)*M+d;D=(m[v*2+1]-A)*M+g;y[b][y[b].length]=P;y[b][y[b].length]=D;if(P>S){S=P}if(D>E){E=D}}R.fnt_uv=new G.Rectangle(d/x,1-g/x,(S-d)/x,(E-g)/x);d+=w[a].width*M+t}var N=[];for(var a=0;a<y.length;a++){var L=2;var k=new q.AttributesView(Float32Array,L);k.set(y[a]);var j=k.attributesBuffer.cloneBufferView();k.dispose();var B=new X.TriangleElements(j);B.setPositions(new q.Float2Attributes(j));var U=Y.Shape.getShape(B);var V=new q.ImageSampler;U.style=new X.Style;var H=16777215;var W=1;var z=Y.MaterialManager.get_material_for_color(H,W);U.material=z.material;if(z.colorPos){U.style.addSamplerAt(V,U.material.getTextureAt(0));U.material.animateUVs=true;U.style.uvMatrix=new G.Matrix(0,0,0,0,z.colorPos.x,z.colorPos.y)}N[a]=U}return N};s.prototype.getRatio=function(t){return this._size_multiply};s.prototype.hasChar=function(t){var e=!!this._font_chars_dic[t];if(!e&&this._opentype_font){e=!!this._opentype_font.charToGlyph(String.fromCharCode(parseInt(t)))}return e};s.prototype.changeOpenTypeFont=function(t,e){if(e===void 0){e=true}if(e&&this._opentype_font){}this._opentype_font=t;this._ascent=t.ascender;this._descent=t.descender;this._font_em_size=t.unitsPerEm;var i=this.getChar("32");if(i){this._whitespace_width=i.char_width}};s.prototype.initFontSize=function(t){if(this._current_size===t){return}this._current_size=t;this._size_multiply=t/this._font_em_size;if(!this._size_multiply){debugger}};s.prototype.getCharVertCnt=function(t){var e=this._font_chars_dic[t];if(e){return e.fill_data.length}return 0};s.prototype.getCharWidth=function(t){var e=this._whitespace_width*this._size_multiply||s.DEFAULT_SPACE;if(t=="32"){return(e*20|0)/20}if(t=="9"){return e*2*20/20}var i=this.getChar(t,false);if(i){return(i.char_width*this._size_multiply*20|0)/20}else if(t=="9679"){i=this.createPointGlyph_9679();return(i.char_width*this._size_multiply*20|0)/20}return 0};Object.defineProperty(s.prototype,"usesCurves",{get:function(){return this._usesCurves},enumerable:true,configurable:true});s.prototype.getLineHeight=function(){return this._size_multiply*(this._ascent-this.descent)};s.prototype.getUnderLineHeight=function(){return this._size_multiply*(this._ascent-this.descent/2)};Object.defineProperty(s.prototype,"assetType",{get:function(){return s.assetType},enumerable:true,configurable:true});s.prototype.dispose=function(){for(var t=0;t<this._font_chars.length;t++){this._font_chars[t].dispose()}this._font_chars.length=0;this._font_chars_dic=null};Object.defineProperty(s.prototype,"fntSizeLimit",{get:function(){return this._fntSizeLimit},set:function(t){this._fntSizeLimit=t},enumerable:true,configurable:true});Object.defineProperty(s.prototype,"ascent",{get:function(){return this._ascent},set:function(t){this._ascent=t},enumerable:true,configurable:true});Object.defineProperty(s.prototype,"descent",{get:function(){return this._descent},set:function(t){this._descent=t},enumerable:true,configurable:true});Object.defineProperty(s.prototype,"offset_x",{get:function(){return this._offset_x},set:function(t){this._offset_x=t},enumerable:true,configurable:true});Object.defineProperty(s.prototype,"offset_y",{get:function(){return this._offset_y},set:function(t){this._offset_y=t},enumerable:true,configurable:true});s.prototype.get_font_chars=function(){return this._font_chars};s.prototype.get_font_em_size=function(){return this._font_em_size};s.prototype.set_whitespace_width=function(t){this._whitespace_width=t};s.prototype.get_whitespace_width=function(){return this._whitespace_width};s.prototype.set_font_em_size=function(t){this._font_em_size=t};s.prototype.buildTextLineFromIndices=function(t,e,i,r,s,n){var o=t.getTextShapeForIdentifierAndFormat(e.color.toString(),e);var a=i;var h=s.length;var l=[];var u=0;r-=this._ascent*this._size_multiply;for(var c=0;c<h;c++){var _=s[c];var f=this._glyphIdxToChar[_];if(!f){i+=n[c];continue}if(f.fill_data===null){if(f.fill_data_path.commands[0][0]==1&&f.fill_data_path.data[0][0]==0&&f.fill_data_path.data[0][1]==0){f.fill_data_path.data[0].shift();f.fill_data_path.data[0].shift();f.fill_data_path.commands[0].shift();f.fill_data_path.commands[0][0]=2}f.fill_data=Y.GraphicsFactoryFills.pathToAttributesBuffer(f.fill_data_path,true)}var p=f.fill_data;if(p){l.push({char:f,x:i,y:r,selected:false});u+=p.buffer.byteLength/4}i+=n[c]}var d=new Float32Array(u);this._fillBuffer(d,l,false);o.addChunk(d);return new G.Point(i-a,this.getLineHeight())};s.prototype.fillTextRun=function(t,e,i,r){var s=this._fntSizeLimit>=0&&this._fntSizeLimit>=e.size;if(s){return this.fillTextRunFNT(t,e,i,r)}var n=this._queryShape(t,e);var o;var a;var h=i+r;var l=this._size_multiply;var u=t.selectionBeginIndex;var c=t.selectionEndIndex;var _=0;if(t.selectable){a=e.clone();a.color=16777215;o=this._queryShape(t,a);if(a.underline&&i+1<t.words.length){_=t.words.get(i).x}if(t.selectionEndIndex<t.selectionBeginIndex){u=t.selectionEndIndex;c=t.selectionBeginIndex}}var f=0;var p=0;var d=[];var g=[];var m=[];for(var v=i;v<h;v+=1){var y=t.words.get(v);var b=y.x;var x=y.y;var w=y.start;var E=w+y.len;for(var S=w;S<E;S++){var A=t.isInFocus&&S>=u&&S<c?o:n;var T=t.chars_codes[S];if(T===32||T===9){continue}var P=this.getChar(T,true);if(!P){if(lt(this,"miss"+t.chars_codes[S])){console.debug("[TesselatedFontTable] Error: char not found in fontTable",t.chars_codes[S],String.fromCharCode(t.chars_codes[S]))}continue}if(A===o){g.push({char:P,x:b,y:x,selected:true});f+=P.fill_data.buffer.byteLength/4}else{d.push({char:P,x:b,y:x,selected:false});p+=P.fill_data.buffer.byteLength/4}b+=P.char_width*l}var D=.25*t.internalScale.y;var I=x+this.getUnderLineHeight()+D;var C=x+this.getUnderLineHeight()-D;if(t.selectable&&a.underline&&i+1<t.words.length){var M=new Float32Array(12);M[0]=_;M[1]=C;M[2]=_;M[3]=I;M[4]=b;M[5]=I;M[6]=b;M[7]=I;M[8]=b;M[9]=C;M[10]=_;M[11]=C;m.push(M)}}if(p>0){p+=m.length*12;var O=new Float32Array(p);var F=this._fillBuffer(O,d,false);for(var R=0,N=m;R<N.length;R++){var L=N[R];O.set(L,F);F+=L.length}n.addChunk(O)}if(f>0){var O=new Float32Array(f);this._fillBuffer(O,g,true);o.addChunk(O)}};s.prototype._cacheKey=function(t,e){if(t===void 0){t=16777215}if(e===void 0){e=-1}var i=e>=0;return""+t+i+(i?e:0)};s.prototype._queryShape=function(t,e,i){if(i===void 0){i=-1}var r=t.getTextShapeForIdentifierAndFormat(this._cacheKey(e.color,i),e);if(i>=0&&!r.fntMaterial){var s=G.ColorUtils.float32ColorToARGB(e.color);var n=new h.MethodMaterial(this._fnt_channels[i]);n.colorTransform=new G.ColorTransform(s[1]/255,s[2]/255,s[3]/255);n.bothSides=true;n.alphaBlending=true;n.useColorTransform=true;n.style.sampler=new q.ImageSampler(false,true,true);r.fntMaterial=n}return r};s.prototype.fillTextRunFNT=function(t,e,i,r){var s=this._queryShape(t,e,0);var n={};var o={};var a=i+r;var h=this._size_multiply;var l;var u=t.selectionBeginIndex;var c=t.selectionEndIndex;var _=0;if(t.selectable){var f=e.clone();f.color=16777215;l=this._queryShape(t,f,0);o[l.cacheId]=l;if(f.underline&&i+1<t.words.length){_=t.words.get(i).x}if(t.selectionEndIndex<t.selectionBeginIndex){u=t.selectionEndIndex;c=t.selectionBeginIndex}}n[s.cacheId]=s;var p=new Map;var d=[];for(var g=i;g<a;g+=1){var m=t.words.get(g);var v=m.x;var y=m.y;var b=m.start;var x=b+m.len;var w=null;var E=null;var S=0;var A=-1;for(var T=b;T<x;T++){if(t.chars_codes[T]===32||t.chars_codes[T]===9){continue}var P=this.getChar(t.chars_codes[T],false);if(!P){if(lt(this,"miss"+t.chars_codes[T])){console.debug("[TesselatedFontTable] Error: char not found in fontTable",t.chars_codes[T],String.fromCharCode(t.chars_codes[T]))}continue}var D=t.isInFocus&&T>=u&&T<c;var I=s;var C=n;if(D){I=l;C=o}var M=I.format;var O=w?w.cacheId:"";if(!O||S!==M.color||P.fnt_channel!==A){O=this._cacheKey(M.color,P.fnt_channel);S=M.color;A=P.fnt_channel}var F=w&&w.cacheId!==O?C[O]:w;if(!F){F=this._queryShape(t,M,P.fnt_channel);C[F.cacheId]=F}if(w!==F||!E){E=p.get(F)||{uv:[],pos:[]};p.set(F,E);w=F}this._emitCharFNT(E,P,v,y);v+=P.char_width*h}}var R=Array.from(p.keys());for(var N=0,L=R;N<L.length;N++){var k=L[N];var j=p.get(k);k.addChunk(new Float32Array(j.pos),new Float32Array(j.uv))}};s.prototype._emitCharFNT=function(t,e,i,r){var s=this._size_multiply;var n=this._font_em_size*s;var o=e.fnt_rect;var a=e.fnt_uv;var h=e.char_width*s;if(!o){return}var l=i+h*o.x*20;var u=l+h*o.width*20;var c=r+n*o.y*20;var _=c+n*o.height*20;t.pos.push(l,c,l,_,u,c,u,c,l,_,u,_);t.uv.push(a.x,a.y,a.x,a.bottom,a.right,a.y,a.right,a.y,a.x,a.bottom,a.right,a.bottom)};s.prototype.createPointGlyph_9679=function(){var t=[];Y.GraphicsFactoryHelper.drawElipse(this._font_em_size/2,this._font_em_size/2,this._font_em_size/8,this._font_em_size/8,t,0,360,5,false);var e=new q.AttributesView(Float32Array,2);e.set(t);var i=e.attributesBuffer.cloneBufferView();e.dispose();var r=new st(i,null,null);r.char_width=this._font_em_size;this._font_chars.push(r);this._font_chars_dic["9679"]=r;return r};s.prototype.getCharOpenType=function(t){if(!this._opentype_font){return null}var e=this._opentype_font.charToGlyph(String.fromCharCode(parseInt(t)));if(!e){return null}var i=e.getPath();var r=new Y.GraphicsPath;var s=0;var n=i.commands.length;var o=0;var a=0;var h=this._ascent;var l=this._opentype_font.unitsPerEm/72;for(s=0;s<n;s++){var u=i.commands[s];if(u.type==="M"){r.moveTo(l*u.x,l*u.y+h);o=l*u.x;a=l*u.y+h}else if(u.type==="L"){r.lineTo(l*u.x,l*u.y+h)}else if(u.type==="Q"){r.curveTo(l*u.x1,l*u.y1+h,l*u.x,l*u.y+h)}else if(u.type==="C"){var c=u.x1+(u.x2-u.x1)/2;var _=u.y1+(u.y2-u.y1)/2;r.curveTo(l*u.x1,l*u.y1+h,l*c,l*_+h);r.curveTo(l*u.x2,l*u.y2+h,l*u.x,l*u.y+h)}else if(u.type==="Z"){r.lineTo(o,a)}}var f=new st(null,null,r);f.char_width=e.advanceWidth;f.fill_data=Y.GraphicsFactoryFills.pathToAttributesBuffer(r,true,null,l*b.FONT_TESSELATION_QUALITY);f.lastTesselatedScale=l;if(!f.fill_data){if(lt(this,"tess"+t)){console.debug("[TesselatedFontTable] Error:tesselating opentype glyph:",t.charCodeAt(0))}return null}this._font_chars.push(f);this._font_chars_dic[t]=f};s.prototype.getChar=function(t,e){if(e===void 0){e=true}t=""+t;var i=this._font_chars_dic[t];if(!e&&i){return i}if(!i){if(this._opentype_font){return this.getCharOpenType(t)}if(t=="9679"){return this.createPointGlyph_9679()}return null}var r=this._size_multiply;var s=Math.max(.01,Math.round(r*100)/100);if(i.fill_data_path===null){return null}if(!(i.fill_data==null&&i.stroke_data==null)&&i.lastTesselatedScale>=s){return i}var n=i.fill_data_path;if(n.commands[0][0]==1&&n.data[0][0]==0&&n.data[0][1]==0){n.data[0].shift();n.data[0].shift();n.commands[0].shift();n.commands[0][0]=2}if(i.fill_data){i.fill_data.clear()}i.fill_data=Y.GraphicsFactoryFills.pathToAttributesBuffer(i.fill_data_path,true,null,s*b.FONT_TESSELATION_QUALITY);if(i.lastTesselatedScale>0){console.debug("[TesselatedFontTable] Retesselate char from scale:",i.lastTesselatedScale,s,String.fromCharCode(+t))}i.lastTesselatedScale=s;if(!i.fill_data){if(lt(this,"tess"+t)){console.debug("[TesselatedFontTable] Error:tesselating glyph:",t.charCodeAt(0))}return null}return i};s.prototype.setChar=function(t,e,i,r,s,n,o){if(i===void 0){i=null}if(r===void 0){r=null}if(s===void 0){s=false}if(n===void 0){n=0}if(o===void 0){o=null}e=Math.floor(e*20)/20;if(i==null&&r==null&&o==null)throw"TesselatedFontTable: trying to create a TesselatedFontChar with no data \n\t\t\t\t(fills_data, stroke_data and fill_data_path is null)";if(this._font_chars.length>0){if(s!=this._usesCurves){throw"TesselatedFontTable: Can not set different types of graphic-glyphs\n\t\t\t\t\t(curves vs non-cuves) on the same FontTable!"}}else{this._usesCurves=s}var a=new st(i,r,o);a.char_width=e;a.glyph_idx=n;a.name=t;this._glyphIdxToChar[n]=a;this._font_chars.push(a);this._font_chars_dic[t]=a};s.prototype.roundTo=function(t){var e=b.TEXT_SHAPE_ROUND_PRECISION;var i=1/(e||1);return Math.floor(t*i)*e};s.prototype._fillBuffer=function(t,e,i){if(i===void 0){i=false}var r=this._size_multiply;var s=0;for(var n=0,o=e;n<o.length;n++){var a=o[n];if(a.selected!==i){continue}var h=a.x,l=a.y,u=a.char;var c=new Float32Array(u.fill_data.buffer);var _=c.length;for(var f=0;f<_;f+=2){t[s+f+0]=this.roundTo(c[f+0]*r+h);t[s+f+1]=this.roundTo(c[f+1]*r+l)}s+=c.length}return s};s.assetType="[asset TesselatedFontTable]";s.DEFAULT_SPACE=14;return s}(G.AssetBase);var ct=function(){function t(t,e,i,r,s,n,o,a,h,l){this.id=t;this.x=e;this.y=i;this.width=r;this.height=s;this.x_offset=n;this.y_offset=o;this.x_advance=a;this.page=h;this.channel=l}return t}();var _t=function(e){g(t,e);function t(){var t=e.call(this)||this;t._font_chars=[];t._materials=[];t._font_chars_dic=new Object;t._ascent=0;t._descent=0;t._current_size=0;t._size_multiply=0;t._init_size=0;t._texture_width=0;t._texture_height=0;t._adjust_size=0;return t}t.prototype.getGlyphCount=function(){return this._font_chars.length};Object.defineProperty(t.prototype,"assetType",{get:function(){return t.assetType},enumerable:true,configurable:true});t.prototype.initFontSize=function(t){if(this._adjust_size)t*=this._adjust_size;if(this._current_size==t)return;this._current_size=t;this._size_multiply=t/this._init_size};t.prototype.getCharDataCanvas=function(t){var e=this._font_chars_dic[t];if(e){return[e.x,e.y,e.width,e.height,e.x_offset*this._size_multiply,e.y_offset*this._size_multiply]}return[]};t.prototype.getCharData=function(t){var e=this._font_chars_dic[t];if(e){var i=e.height/this._init_size*this._current_size;var r=e.width/this._init_size*this._current_size;return[e.x/this._texture_width,e.y/this._texture_height,e.width/this._texture_width,e.height/this._texture_height,e.x_offset*this._size_multiply,e.y_offset*this._size_multiply,i,r]}return[]};t.prototype.getCharVertCnt=function(t){return 6*4};Object.defineProperty(t.prototype,"texture_width",{get:function(){return this._texture_width},set:function(t){this._texture_width=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"texture_height",{get:function(){return this._texture_height},set:function(t){this._texture_height=t},enumerable:true,configurable:true});t.prototype.hasChar=function(t){return this._font_chars_dic[t]!=null};t.prototype.getCharWidth=function(t){var e=this._font_chars_dic[t];if(e)return this._size_multiply*e.x_advance;return 0};t.prototype.fillTextRun=function(t,e,i,r){};t.prototype.getLineHeight=function(){return this._current_size};t.prototype.dispose=function(){var t=this._materials.length;for(var e=0;e<t;++e){this._materials[e].dispose()}this._materials.length=0;this._font_chars.length=0;this._font_chars_dic=null};t.prototype.addMaterial=function(t){this._materials.push(t)};t.prototype.getMaterial=function(t){if(t===void 0){t=0}return this._materials[t]};Object.defineProperty(t.prototype,"ascent",{get:function(){return this._ascent},set:function(t){this._ascent=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"descent",{get:function(){return this._descent},set:function(t){this._descent=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"offset_x",{get:function(){return this._offset_x},set:function(t){this._offset_x=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"offset_y",{get:function(){return this._offset_y},set:function(t){this._offset_y=t},enumerable:true,configurable:true});t.prototype.get_font_chars=function(){return this._font_chars};t.prototype.get_font_em_size=function(){return this._font_em_size};t.prototype.set_whitespace_width=function(t){this._whitespace_width=t};t.prototype.get_whitespace_width=function(){return this._whitespace_width};t.prototype.set_font_em_size=function(t){this._font_em_size=t};t.prototype.getChar=function(t){return this._font_chars_dic[t]};t.prototype.setChar=function(t,e,i,r,s,n,o,a,h,l){var u=new ct(t,e,i,r,s,n,o,a,h,l);this._font_chars.push(u);this._font_chars_dic[t]=u};t.assetType="[asset BitmapFontTable]";return t}(G.AssetBase);var ft=function(e){g(t,e);function t(){var t=e.call(this)||this;t._font_styles={};t.fontName=null;t.regularFontStyle=null;return t}Object.defineProperty(t,"emptyFontTable",{get:function(){if(!this._emptyFontTable){this._emptyFontTable=new ut}return this._emptyFontTable},enumerable:true,configurable:true});t.registerFont=function(t){};Object.defineProperty(t.prototype,"font_styles",{get:function(){return this._font_styles},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"assetType",{get:function(){return t.assetType},enumerable:true,configurable:true});t.prototype.dispose=function(){for(var t in this._font_styles){this._font_styles[t].dispose()}this._font_styles=null};t.prototype.replace_font_table=function(t,e){this._font_styles[t]=e};t.prototype.create_font_table=function(t,e,i){if(e===void 0){e=ut.assetType}if(i===void 0){i=null}var r=this.get_font_table(t,e,i);if(r){console.warn("[Font] - create_font_table - "+t+" - already exists")}var s=null;if(e==ut.assetType){s=new ut(i)}else if(e==_t.assetType){s=new _t}s.name=t;s.font=this;this._font_styles[t]=s;return s};t.prototype.get_font_table=function(t,e,i,r){if(e===void 0){e=ut.assetType}if(i===void 0){i=null}if(r===void 0){r=false}var s=this._font_styles[t];if(s){if(s.assetType!=e){throw"[Font] - get_font_table - existing table has wrong assetType"}return s}if(r&&Object.keys(this._font_styles).length>0){for(var n in this._font_styles){console.log("font style not found return different",n);return this._font_styles[n]}}return null};t.assetType="[asset Font]";return t}(G.AssetBase);var pt=function(){function t(){}t.getDeviceFont=function(t){t=this.getDeviceFontName(t);if(this._deviceFonts[t])return this._deviceFonts[t];var e=new ft;e.name=t;this._deviceFonts[t]=e;return this._deviceFonts[t]};t.getDeviceFontName=function(t){if(!t){return"sans"}for(var e in this.deviceFontMap){var i=this.deviceFontMap[e].indexOf(t);if(i>=0){return e}}console.warn("[DeviceFontManager] - no mapping exists for "+t+"\n\t\t - falling back to "+"sans");return"sans"};t.deviceFontMap={};t._deviceFonts={};return t}();pt.deviceFontMap["sans"]=["_sans","Arial"];pt.deviceFontMap["Arial Narrow"]=["Arial Narrow"];pt.deviceFontMap["Arial Black"]=["Arial Black"];pt.deviceFontMap["serif"]=[];pt.deviceFontMap["typewriter"]=[];var dt=function(){function t(){}t.defineFont_CFF=function(t,e){if(e===void 0){e=G.AssetBase.DEFAULT_NAMESPACE}this._embbedCFF_fonts||(this._embbedCFF_fonts={});this._embbedCFF_fonts[e]||(this._embbedCFF_fonts[e]={});var i=this._embbedCFF_fonts[e][t];if(i){return i}i=new ft;i.name=t;this._embbedCFF_fonts[e][t]=i;return i};t.getFont_CFF=function(t,e){if(e===void 0){e=G.AssetBase.DEFAULT_NAMESPACE}if(!t){return pt.getDeviceFont(t)}var i=e||G.AssetBase.DEFAULT_NAMESPACE;this._embbedCFF_fonts||(this._embbedCFF_fonts={});this._embbedCFF_fonts[i]||(this._embbedCFF_fonts[i]={});var r=this._embbedCFF_fonts[i][t];if(r){return r}for(var s in this._embbedCFF_fonts){if(this._embbedCFF_fonts[s][t]){return this._embbedCFF_fonts[s][t]}}return pt.getDeviceFont(t)};t.defineFont=function(t,e){if(e===void 0){e=G.AssetBase.DEFAULT_NAMESPACE}this._registered_fonts||(this._registered_fonts={});this._registered_fonts[e]||(this._registered_fonts[e]={});if(this.deviceFontsLoading){return pt.getDeviceFont(t)}var i=this._registered_fonts[e][t];if(i){return i}i=new ft;i.name=t;if(this._namespaces.indexOf(e)===-1){this._namespaces.push(e)}this._registered_fonts[e][t]=i;return i};t.registerFontForClassName=function(t,e){this._registered_fonts_by_className[e]=t};t.getFont=function(t,e){if(e===void 0){e=undefined}if(!t)return null;if(this._registered_fonts_by_className[t]){return this._registered_fonts_by_className[t]}var i=e||G.AssetBase.DEFAULT_NAMESPACE;this._registered_fonts||(this._registered_fonts={});this._registered_fonts[i]||(this._registered_fonts[i]={});var r=this._registered_fonts[i][t];if(r){return r}else if(this._namespaces.length>0&&!e){for(var s=0,n=this._namespaces;s<n.length;s++){var o=n[s];if(this._registered_fonts[o][t]){return this._registered_fonts[o][t]}}}return pt.getDeviceFont(t)};t.clearAll=function(){this.deviceFontsLoading=false;this._registered_fonts={}};t.deviceFontsLoading=false;t._registered_fonts={};t._registered_fonts_by_className={};t._namespaces=[];t._embbedCFF_fonts={};return t}();(function(t){t["DEFAULT"]="DEFAULT";t["DEVICE"]="device";t["EMBED_CFF"]="embeddedCFF"})(d.FontLookUpMode||(d.FontLookUpMode={}));var gt=["font","align","leftMargin","rightMargin","indent","size","color","bold","italic","underline","leading","letterSpacing"];var mt=function(p){g(e,p);function e(t,e,i,r,s,n,o,a,h,l,u,c,_){if(t===void 0){t=null}if(e===void 0){e=null}if(i===void 0){i=null}if(r===void 0){r=null}if(s===void 0){s=null}if(n===void 0){n=null}if(o===void 0){o=null}if(a===void 0){a=null}if(h===void 0){h=null}if(l===void 0){l=null}if(u===void 0){u=null}if(c===void 0){c=null}if(_===void 0){_=null}var f=p.call(this)||this;f.fontLookUpMode=d.FontLookUpMode.DEFAULT;f._updateID=0;f._fontTableDirty=true;f.tabStops=[];f._size=e;f._color=i;f._bold=r;f._italic=s;f._underline=n;f.url=o;f.link_target=a;f._align=h;f._leftMargin=l;f._rightMargin=u;f._indent=c;f._leading=_;if(typeof t==="string"){f.font_name=t}else{f.font=t}return f}Object.defineProperty(e.prototype,"updateID",{get:function(){return this._updateID},enumerable:true,configurable:true});e.prototype.hasPropertySet=function(t){return this["_"+t]!==null};Object.defineProperty(e.prototype,"align",{get:function(){return this._align?this._align:rt.LEFT},set:function(t){if(this._align!==t){this._updateID++}this._align=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"blockIndent",{get:function(){return this._blockIndent?this._blockIndent:0},set:function(t){if(this._blockIndent!==t){this._updateID++}this._blockIndent=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"leftMargin",{get:function(){return this._leftMargin?this._leftMargin:0},set:function(t){if(t!==this._leftMargin){this._updateID++}this._leftMargin=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"rightMargin",{get:function(){return this._rightMargin?this._rightMargin:0},set:function(t){if(t!==this._rightMargin){this._updateID++}this._rightMargin=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"indent",{get:function(){return this._indent?this._indent:0},set:function(t){if(t!==this._indent){this._updateID++}this._indent=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"color",{get:function(){return this._color!==null?this._color:0},set:function(t){if(t!==this._color){this._updateID++}this._color=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"kerning",{get:function(){return this._kerning?this._kerning:false},set:function(t){if(t!==this._kerning){this._updateID++}this._kerning=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"leading",{get:function(){return this._leading?this._leading:0},set:function(t){if(t!==this._leading){this._updateID++}this._leading=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"letterSpacing",{get:function(){return this._letterSpacing?this._letterSpacing:0},set:function(t){if(t!==this._letterSpacing){this._updateID++}this._letterSpacing=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"size",{get:function(){return this._size?this._size:12},set:function(t){if(t!==this._size){this._updateID++}this._size=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"bold",{get:function(){return this._bold?this._bold:false},set:function(t){if(t!==this._bold){this._updateID++}this._bold=t;this._fontTableDirty=true},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"italic",{get:function(){return this._italic?this._italic:false},set:function(t){if(t!==this._italic){this._updateID++}this._italic=t;this._fontTableDirty=true},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"underline",{get:function(){return this._underline?this._underline:false},set:function(t){if(t!==this._underline){this._updateID++}this._underline=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"font_table",{get:function(){if(!this._font_table||this._fontTableDirty)this.update_font_table();return this._font_table},set:function(t){this._font_table=t;this._fontTableDirty=false},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"font_name",{get:function(){var t;return(t=this.font)===null||t===void 0?void 0:t.name},set:function(t){var e;if(((e=this.font)===null||e===void 0?void 0:e.name)==t)return;if(this.fontLookUpMode==d.FontLookUpMode.DEFAULT){this._font=dt.getFont(t)}else if(this.fontLookUpMode==d.FontLookUpMode.DEVICE){this._font=pt.getDeviceFont(t)}else if(this.fontLookUpMode==d.FontLookUpMode.EMBED_CFF){this._font=dt.getFont_CFF(t)}this._fontTableDirty=true;this._updateID++},enumerable:true,configurable:true});e.prototype.update_font_table=function(){this._fontTableDirty=false;var t=d.FontStyleName.STANDART;if(this._italic&&!this._bold)t=d.FontStyleName.ITALIC;else if(!this._italic&&this._bold)t=d.FontStyleName.BOLD;else if(this._italic&&this._bold)t=d.FontStyleName.BOLDITALIC;if(this._font){var e=this._font.get_font_table(t,ut.assetType,null,true);if(this._font_table&&!e)return;this._font_table=e?e:ft.emptyFontTable}};Object.defineProperty(e.prototype,"font",{get:function(){return this._font},set:function(t){if(this._font==t)return;this._font=t;this._fontTableDirty=true;this._updateID++},enumerable:true,configurable:true});e.prototype.clone=function(){var t=new e(this._font,this._size,this._color,this._bold,this._italic,this._underline,this.url,this.link_target,this._align,this._leftMargin,this._rightMargin,this._indent,this._leading);t.font_table=this._font_table;return t};e.prototype.equal=function(t){for(var e=0,i=gt;e<i.length;e++){var r=i[e];if(this[r]!==t[r]){return false}}return true};e.prototype.applyToFormat=function(t){for(var e=0,i=gt;e<i.length;e++){var r=i[e];if(this["_"+r]!==null){t[r]=this["_"+r]}}return t};e.prototype.mergeFormat=function(t){for(var e=0,i=gt;e<i.length;e++){var r=i[e];if(this["_"+r]!==t[r]){this["_"+r]=null}}};Object.defineProperty(e.prototype,"assetType",{get:function(){return e.assetType},enumerable:true,configurable:true});e.assetType="[asset TextFormat]";return e}(G.AssetBase);var vt=function(){function t(t,e,i,r,s,n){if(t===void 0){t=0}if(e===void 0){e=0}if(i===void 0){i=0}if(r===void 0){r=0}if(s===void 0){s=0}if(n===void 0){n=0}this.x=t;this.width=e;this.height=i;this.ascent=r;this.descent=s;this.leading=n}return t}();var yt=function(s){g(t,s);function t(t,e,i){if(i===void 0){i=0}var r=s.call(this,t)||this;r._char=e;r._charCode=i;r.isShift=false;r.isCTRL=false;r.isAlt=false;return r}Object.defineProperty(t.prototype,"char",{get:function(){return this._char},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"charCode",{get:function(){return this._charCode},enumerable:true,configurable:true});t.prototype.clone=function(){return new t(this.type,this._char,this._charCode)};t.KEYDOWN="keydown";t.KEYUP="keyup";return t}(G.EventBase);var bt=function(e){g(i,e);function i(t){return e.call(this,t)||this}i.prototype.clone=function(){var t=new i(this.type);return t};i.CHANGED="onChanged";return i}(G.EventBase);var xt=function(e){g(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype._iInternalUpdate=function(){e.prototype._iInternalUpdate.call(this);var t=this.parentTextField;if(t._textFormat&&!t._textFormat.font_table.isAsset(ut)&&!t._textFormat.material){this.transform.colorTransform.color=t.textColor!=null?t.textColor:t._textFormat.color;this._invalidateHierarchicalProperty(o.HierarchicalProperty.COLOR_TRANSFORM)}};return t}(f);var wt=function(){function t(t,e){this.format=t;this.cacheId=e;this.verts=[];this.uvs=[];this._length=0;this.verts=[];this.uvs=[]}Object.defineProperty(t.prototype,"length",{get:function(){return this._length},set:function(t){if(t>this._length){return}var e=this.verts;var i=this.uvs;if(t===0){this._length=0;e.length=0;i.length=0;return}var r=0;var s=t;while(r<e.length&&s>0){s-=e[r].length;r++}if(s<0){e[r-1]=e[r-1].subarray(0,s+e[r-1].length);if(i[r-1]){i[r-1]=i[r-1].subarray(0,s+i[r-1].length)}}e.length=r;this._length=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"hasUV",{get:function(){return this.uvs.length>0},enumerable:true,configurable:true});t.prototype.addChunk=function(t,e){if(this.verts.length!==this.uvs.length&&e){throw"You can't mix TextShape with UV and without in same place"}if(e&&t.length!==e.length){throw"Position buffer and UV buffer should has equal size"}this._length+=t.length;this.verts.push(t);if(e){this.uvs.push(e)}};Object.defineProperty(t.prototype,"tall",{get:function(){return this.verts[this.verts.length-1]},enumerable:true,configurable:true});return t}();var Et=[{test:/\&gt;/g,replace:">"}];var St=function(){function t(){}t.get=function(){if(!t.instance)t.instance=new t;return t.instance};t.prototype.processHTML=function(t,e){e=e.replace(/&apos;/g,"'");e=e.replace(new RegExp("&nbsp;","g")," ");e=e.replace(new RegExp("√","g"),String.fromCharCode(8730));e=e.replace(new RegExp("×","g"),String.fromCharCode(215));e=e.replace(new RegExp("<\\\\","g"),"</");e=e.replace(new RegExp("<br>","g"),"<br/>");e=e.replace(new RegExp("<BR>","g"),"<br/>");e=e.replace(new RegExp("<BR/>","g"),"<br/>");e=e.replace(new RegExp("<B","g"),"<b");e=e.replace(new RegExp("</B>","g"),"</b>");e=e.replace(new RegExp("<I","g"),"<i");e=e.replace(new RegExp("</I>","g"),"</i>");e=e.replace(new RegExp("<P","g"),"<p");e=e.replace(new RegExp("</P>","g"),"</p>");e=e.replace(new RegExp("<U","g"),"<u");e=e.replace(new RegExp("</U>","g"),"</u>");e=e.replace(new RegExp("<LI","g"),"<li");e=e.replace(new RegExp("</LI>","g"),"</li>");e=e.replace(new RegExp("<FONT","g"),"<font");e=e.replace(new RegExp("</FONT>","g"),"</font>");e=e.replace(new RegExp("& ","g"),"&amp; ");var i=0;var r=[];var s=[];var n=[];while(i<e.length){if(e[i]=="<"){if(e[i+1]=="p"){r[r.length]="p"}else if(e[i+1]=="b"&&e[i+2]!="r"){r[r.length]="b"}else if(e[i+1]=="i"){r[r.length]="i"}else if(e[i+1]=="u"){r[r.length]="u"}else if(e[i+1]=="f"&&e[i+2]=="o"&&e[i+3]=="n"&&e[i+4]=="t"){r[r.length]="font";i+=2}else if(e[i+1]=="l"&&e[i+2]=="i"){r[r.length]="li";i++}else if(e[i+1]=="/"&&e[i+2]=="p"){var o=r.length;var a=-1;while(o>0){o--;if(r[o]=="p"){a=o;break}}if(a<0){s[s.length]=i;n[n.length]=4}else{o=r.length-1;while(o>a){s[s.length]=i;n[n.length]="</"+r[o]+">";r.pop();o--}r.pop()}}else if(e[i+1]=="/"&&e[i+2]=="b"){var h=r.length;var a=-1;while(h>0){h--;if(r[h]=="b"){a=h;break}}if(a<0){s[s.length]=i;n[n.length]=4}else{h=r.length-1;while(h>a){s[s.length]=i;n[n.length]="</"+r[h]+">";r.pop();h--}r.pop()}}else if(e[i+1]=="/"&&e[i+2]=="i"){var l=r.length;var a=-1;while(l>0){l--;if(r[l]=="i"){a=l;break}}if(a<0){s[s.length]=i;n[n.length]=4}else{l=r.length-1;while(l>a){s[s.length]=i;n[n.length]="</"+r[l]+">";r.pop();l--}r.pop()}}else if(e[i+1]=="/"&&e[i+2]=="u"){var u=r.length;var a=-1;while(u>0){u--;if(r[u]=="u"){a=u;break}}if(a<0){s[s.length]=i;n[n.length]=4}else{u=r.length-1;while(u>a){s[s.length]=i;n[n.length]="</"+r[u]+">";r.pop();u--}r.pop()}}else if(e[i+1]=="/"&&e[i+2]=="l"&&e[i+3]=="i"){var c=r.length;var a=-1;while(c>0){c--;if(r[c]=="li"){a=c;break}}if(a<0){s[s.length]=i;n[n.length]=7}else{c=r.length-1;while(c>a){s[s.length]=i;n[n.length]="</"+r[c]+">";r.pop();c--}r.pop()}}else if(e[i+1]=="/"&&e[i+2]=="f"&&e[i+3]=="o"&&e[i+4]=="n"&&e[i+5]=="t"){var _=r.length;var a=-1;while(_>0){_--;if(r[_]=="font"){a=_;break}}if(a<0){s[s.length]=i;n[n.length]=7}else{_=r.length-1;while(_>a){s[s.length]=i;n[n.length]="</"+r[_]+">";r.pop();_--}r.pop()}}i++}else{i++}}var f=r.length;while(f>0){f--;s[s.length]=i;n[n.length]="</"+r[f]+">"}var p=0;var d=n.length;for(var g=0;g<d;g++){if(typeof n[g]==="number"){e=e.slice(0,s[g]+p)+e.slice(s[g]+p+n[g]);p-=n[g]}else{e=e.slice(0,s[g]+p)+n[g]+e.slice(s[g]+p);p+=n[g].length}}var m={text:""};t._textFormats=[t._textFormat];t._textFormatsIdx=[0];var v=y.parse(e);if(v&&v.firstChild){m.multiline=v.firstChild.childNodes.length>0;this.readHTMLTextPropertiesRecursive(t,v,m,t._textFormat)}if(m.text!=""&&(m.text.charCodeAt(m.text.length-1)==13||m.text.charCodeAt(m.text.length-1)==10)){m.text=m.text.slice(0,m.text.length-1)}if(m.text!=""&&(m.text.length>=2&&m.text[m.text.length-1]=="n"&&m.text[m.text.length-2]=="\\")){m.text=m.text.slice(0,m.text.length-2)}if(m.text!=""&&(m.text.length>=2&&m.text[m.text.length-1]=="n"&&m.text[m.text.length-2]=="\\")){m.text=m.text.slice(0,m.text.length-2)}t._textFormatsIdx[t._textFormatsIdx.length-1]=m.text.length;return m.text};t.prototype.readHTMLTextPropertiesRecursive=function(t,e,i,r){var s=[];var n=[];if(e.attributes){if(e.attributes.size||e.attributes.SIZE){var o=e.attributes.size?e.attributes.size:e.attributes.SIZE;o=o.replace(/[^0-9.]/g,"");s[s.length]=parseInt(o);n[n.length]="size"}if(e.attributes.color||e.attributes.COLOR){var o=e.attributes.color?e.attributes.color:e.attributes.COLOR;o=o.replace("#","0x");s[s.length]=parseInt(o);n[n.length]="color"}if(e.attributes.indent||e.attributes.INDENT){var o=e.attributes.indent?e.attributes.indent:e.attributes.INDENT;o=o.replace(/[^0-9.]/g,"");s[s.length]=parseInt(o);n[n.length]="indent"}if(e.attributes.leftMargin||e.attributes.LEFTMARGIN){var o=e.attributes.leftMargin?e.attributes.leftMargin:e.attributes.LEFTMARGIN;o=o.replace(/[^0-9.]/g,"");s[s.length]=parseInt(o);n[n.length]="leftMargin"}if(e.attributes.rightMargin||e.attributes.RIGHTMARGIN){var o=e.attributes.rightMargin?e.attributes.rightMargin:e.attributes.RIGHTMARGIN;o=o.replace(/[^0-9.]/g,"");s[s.length]=parseInt(o);n[n.length]="rightMargin"}if(e.attributes.align||e.attributes.ALIGN){var o=e.attributes.align?e.attributes.align:e.attributes.ALIGN;s[s.length]=o;n[n.length]="align"}if(e.attributes.face||e.attributes.FACE){var o=e.attributes.face?e.attributes.face:e.attributes.FACE;s[s.length]=o;n[n.length]="font_name"}}if(e.tagName=="b"||e.rawTagName=="b"){if(!r.bold){s[s.length]=true;n[n.length]="bold"}}else if(e.tagName=="i"||e.rawTagName=="i"){if(!r.italic){s[s.length]=true;n[n.length]="italic"}}else if(e.tagName=="u"||e.rawTagName=="u"){if(!r.underline){s[s.length]=true;n[n.length]="underline"}}else if(e.tagName=="font"||e.rawTagName=="font"){}else if(e.tagName=="li"||e.rawTagName=="li"){i.text+="\n ● "}else if((e.tagName=="br"||e.rawTagName=="br")&&t.multiline){i.text+="\n"}else if((e.tagName=="sbr"||e.rawTagName=="sbr")&&t.multiline){i.text+="\n"}var a=false;var h=s.length;while(h>0){h--;if(r[n[h]]!=s[h]){a=true;break}}var l=r;if(a){l=r.clone();h=s.length;while(h>0){h--;l[n[h]]=s[h]}t._textFormats.push(l);t._textFormatsIdx[t._textFormatsIdx.length-1]=i.text.length;t._textFormatsIdx.push(i.text.length)}if(e.childNodes&&e.childNodes.length>0){for(var u=0;u<e.childNodes.length;u++){if(t._textFormats[t._textFormats.length-1]!=l){t._textFormats.push(l);t._textFormatsIdx[t._textFormatsIdx.length-1]=i.text.length;t._textFormatsIdx.push(i.text.length)}this.readHTMLTextPropertiesRecursive(t,e.childNodes[u],i,l)}}else{var c=e.text.replace(/[\s\r\n]/gi,"");if(c!=""){var _=e.text;for(var f=0,p=Et;f<p.length;f++){var d=p[f];_=_.replace(d.test,d.replace)}i.text+=_}}if(e.tagName=="ul"||e.rawTagName=="ul"||e.tagName=="li"||e.rawTagName=="li"){}else if(e.tagName=="p"||e.rawTagName=="p"){i.text+="\n"}};return t}();var At=function(){function t(t){if(t===void 0){t=40}this.index=-1;this.store=Array.from({length:t},function(t){return{x:Infinity,y:Infinity,start:0,width:0,len:0}})}t.prototype.put=function(t,e,i,r,s){this.index++;var n=this.store[this.index]||(this.store[this.index]={});n.start=t;n.x=e;n.y=i;n.width=r;n.len=s;return n};Object.defineProperty(t.prototype,"last",{get:function(){return this.store[this.index]},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"length",{get:function(){return this.index+1},set:function(t){this.index=t-1},enumerable:true,configurable:true});t.prototype.get=function(t){return this.store[t]};t.prototype.free=function(){this.index=-1};t.prototype.dispose=function(){this.store=null;this.index=0};return t}();var Tt=[{test:/&apos;/g,replace:"'"},{test:/&gt;/g,replace:">"}];var Pt=function(r){g(d,r);function d(){var e=r.call(this)||this;e.textOffsetX=0;e.textOffsetY=0;e._selectionBeginIndex=0;e._selectionEndIndex=0;e._biggestLine=0;e._iText="";e._iTextDiffStart=0;e._text="";e._iTextWoLineBreaks="";e.inMaskMode=false;e.cursorIntervalID=-1;e.cursorBlinking=false;e.showSelection=false;e._textDirty=false;e._positionsDirty=false;e._glyphsDirty=false;e._shapesDirty=false;e._textShapesDirty=false;e.chars_codes=[];e.chars_width=[];e.tf_per_char=[];e.words=new At(10);e._textRuns_formats=[];e._textRuns_words=[];e._paragraph_textRuns_indices=[];e._maxWidthLine=0;e._labelData=null;e.lines_wordStartIndices=[];e.lines_wordEndIndices=[];e.lines_start_y=[];e.lines_start_x=[];e.lines_charIdx_start=[];e.lines_charIdx_end=[];e.lines_width=[];e.lines_height=[];e.lines_numSpacesPerline=[];e.char_positions_x=[];e.char_positions_y=[];e.sourceTextField=null;e._maskWidth=0;e._maskHeight=0;e._maskTextOffsetX=0;e._maskTextOffsetY=0;e.isStatic=false;e._internalScale=new G.Vector3D(1,1,1);e.onKeyDelegate=function(t){return e.onKey(t)};e.startSelectionByMouseDelegate=function(t){return e.startSelectionByMouse(t)};e.stopSelectionByMouseDelegate=function(t){return e.stopSelectionByMouse(t)};e.updateSelectionByMouseDelegate=function(t){return e.updateSelectionByMouse(t)};e._onClipboardPasteDelegate=function(t){return e.onClipboardPaste(t)};e.cursorIntervalID=-1;e._tabEnabled=true;e.cursorType="";e.textOffsetX=0;e.textOffsetY=0;e.textShapes={};e._textColor=0;e._width=100;e._height=100;e._textWidth=0;e._textHeight=0;e._type=it.DYNAMIC;e._selectable=false;e._numLines=0;e.multiline=false;e._autoSize=et.NONE;e._wordWrap=false;e._background=false;e._backgroundColor=16777215;e._border=false;e._borderColor=0;e.html=false;e.maxChars=0;e._selectionBeginIndex=0;e._selectionEndIndex=0;e._scrollH=0;e._scrollV=0;e._textFormats=[];e._graphics=Y.Graphics.getGraphics();e.mouseEnabled=e._selectable;return e}d.getNewTextField=function(){return d._textFields.length?d._textFields.pop():new d};d.clearPool=function(){d._textFields=[]};d.prototype.updateMaskMode=function(){if(this.inMaskMode){if(this._maskWidth!=this._width||this._maskHeight!=this._height||this._maskTextOffsetX!=this.textOffsetX||this._maskTextOffsetY!=this.textOffsetY){this._maskWidth=this._width;this._maskHeight=this._height;this._maskTextOffsetX=this.textOffsetX;this._maskTextOffsetY=this.textOffsetY;this.maskChild.graphics.clear();this.maskChild.graphics.beginFill(16777215);this.maskChild.graphics.drawRect(this.textOffsetX,this.textOffsetY,this._width,this._height);this.maskChild.graphics.endFill()}this._graphics.clear()}if(!this.inMaskMode){this.inMaskMode=true;if(!this.maskChild)this.maskChild=new f;if(!this.textChild)this.textChild=new xt;this.textChild.mouseEnabled=false;this.textChild.parentTextField=this;this.maskChild.mouseEnabled=false;this.maskChild.graphics.beginFill(16777215);this.maskChild.graphics.drawRect(this.textOffsetX,this.textOffsetY,this._width,this._height);this.maskChild.graphics.endFill();this.addChild(this.maskChild);this.addChild(this.textChild);this.maskChild.maskMode=true;this._graphics.clear();this.targetGraphics=this.textChild.graphics;return}if(this._textWidth>this._width||this._textHeight>this._height){this.textChild.masks=[this.maskChild]}else{this.textChild.masks=null}return};d.prototype.getMouseCursor=function(){return this.cursorType};Object.defineProperty(d.prototype,"isInFocus",{get:function(){return this._isInFocus},set:function(t){},enumerable:true,configurable:true});d.prototype.setFocus=function(t,e,i){if(e===void 0){e=false}if(i===void 0){i=true}if(this._isInFocus==t){return}r.prototype.setFocus.call(this,t,e,i);this.enableInput(t);if(!this._selectable){return}this.setSelection(0,0);this._glyphsDirty=true;this.invalidate()};d.prototype.enableInput=function(t){if(t===void 0){t=true}if(this.cursorIntervalID>=0){window.clearInterval(this.cursorIntervalID);this.cursorIntervalID=-1}if(t&&this._isInFocus&&this.selectable){this.drawSelectionGraphics();var e=this;this.cursorIntervalID=window.setInterval(function(){e.cursorBlinking=!e.cursorBlinking;if(!e.selectable){e.cursorBlinking=true}e._shapesDirty=true;e.invalidate()},500)}};d.prototype.findCharIdxForMouse=function(t){var e=new G.Point(t.position.x,t.position.y);var i=this.getLineIndexAtPoint(e.x,e.y);var r=this.getCharIndexAtPoint(e.x,e.y,i);if(i>=this.lines_start_x.length){i=this.lines_start_x.length-1}if(i<0){i=0}if(i>=0&&r<0&&this.lines_start_x[i]!==undefined){if(e.x<=this.lines_start_x[i]){r=this.lines_charIdx_start[i]}else{r=this.lines_charIdx_end[i]}}if(i<0||r<0){r=0}return r};d.prototype.startSelectionByMouse=function(t){this._selectionBeginIndex=this.findCharIdxForMouse(t);this._selectionEndIndex=this._selectionBeginIndex;if(this.cursorShape)this.cursorShape.invalidate();this.cursorShape=undefined;if(this.bgShapeSelect)this.bgShapeSelect.invalidate();this.bgShapeSelect=undefined;this._glyphsDirty=true;this._shapesDirty=true;this._textShapesDirty=true;this.cursorBlinking=false;this.drawSelectionGraphics()};d.prototype.stopSelectionByMouse=function(t){this._selectionEndIndex=this.findCharIdxForMouse(t);this._glyphsDirty=true;this.reConstruct();this.drawSelectionGraphics()};d.prototype.updateSelectionByMouse=function(t){this._selectionEndIndex=this.findCharIdxForMouse(t);if(this.bgShapeSelect)this.bgShapeSelect.invalidate();this.bgShapeSelect=undefined;this._glyphsDirty=true;this.reConstruct();this.drawSelectionGraphics()};d.prototype.drawSelectionGraphics=function(){if(this._selectionBeginIndex<0){this._selectionBeginIndex=0}if(this._selectionBeginIndex>this.char_positions_x.length){this._selectionBeginIndex=this.char_positions_x.length}if(this._selectionEndIndex<0){this._selectionEndIndex=0}if(this._selectionEndIndex>this.char_positions_x.length){this._selectionEndIndex=this.char_positions_x.length}if(this._selectionBeginIndex===this._selectionEndIndex){this.showSelection=false;this.drawCursor()}else{this.showSelection=true;this.cursorBlinking=true;this.drawSelectedBG()}};d.prototype.scrollToCursor=function(t,e){};d.prototype.drawCursor=function(){this._shapesDirty=true;if(this.cursorBlinking||!this.selectable||this.selectionBeginIndex!==this.selectionEndIndex){return}var t=0;var e=0;var i=this.newTextFormat;if(this.char_positions_x.length==0){t=this.textOffsetX+this._width/2+this._textWidth/2;if(i.align=="justify"){}else if(i.align=="center"){}else if(i.align=="right"){t=this.textOffsetX+this._width-2}else if(i.align=="left"){t=this.textOffsetX+4+this._textWidth}}else if(this._selectionBeginIndex==this.char_positions_x.length){t=this.char_positions_x[this._selectionBeginIndex-1]+this.chars_width[this._selectionBeginIndex-1];e=this.char_positions_y[this._selectionBeginIndex-1];i=this.tf_per_char[this._selectionBeginIndex-1]}else{t=this.char_positions_x[this._selectionBeginIndex];e=this.char_positions_y[this._selectionBeginIndex];i=this.tf_per_char[this._selectionBeginIndex]}i.font_table.initFontSize(i.size);var r=i.font_table.getLineHeight();var s=this.getTextColorForTextFormat(i);var n=this.internalScale.x;if(n<=0){n=1}var o=[t-.5*n,e,n,r];if(!this.cursorShape){this.cursorShape=Y.GraphicsFactoryHelper.drawRectangles(o,s,1);this.cursorShape.usages++}else{Y.GraphicsFactoryHelper.updateRectanglesShape(this.cursorShape,o)}if(this.cursorShape.style.color!==s){var a=G.ColorUtils.float32ColorToARGB(s)[0];var h=Y.MaterialManager.get_material_for_color(s,a/255||1);if(h.colorPos){this.cursorShape.style=new X.Style;var l=new q.ImageSampler;h.material.animateUVs=true;this.cursorShape.style.color=s;this.cursorShape.style.addSamplerAt(l,h.material.getTextureAt(0));this.cursorShape.style.uvMatrix=new G.Matrix(0,0,0,0,h.colorPos.x,h.colorPos.y)}}this.scrollToCursor(t,e)};d.prototype.drawSelectedBG=function(){this._shapesDirty=true;this._textShapesDirty=true;if(this._selectionBeginIndex<0){this._selectionBeginIndex=0}if(this._selectionBeginIndex>this.char_positions_x.length){this._selectionBeginIndex=this.char_positions_x.length}var t=this._selectionBeginIndex;var e=this._selectionEndIndex;if(this._selectionEndIndex<this._selectionBeginIndex){t=this._selectionEndIndex;e=this._selectionBeginIndex}var i=0;var r=0;var s=-1;var n=null;var o=-1;var a=0;var h=0;var l=[];if(this.char_positions_x.length!=0&&this._selectionEndIndex!=this._selectionBeginIndex){var u=e>this.char_positions_x.length?this.char_positions_x.length:e;for(var c=t;c<u;c++){if(c==this.char_positions_x.length){i=this.char_positions_x[c-1]+this.chars_width[c-1];r=this.char_positions_y[c-1];n=this.tf_per_char[c-1]}else{i=this.char_positions_x[c];r=this.char_positions_y[c];n=this.tf_per_char[c]}if(o<0){o=i}if(s>=0&&s!=r){l.push(o,s,a,h);a=0;o=i}a+=this.chars_width[c];s=r;n.font_table.initFontSize(n.size);h=Math.max(h,n.font_table.getLineHeight())}}if(a>0){l.push(o,s,a,h);if(!this.bgShapeSelect){this.bgShapeSelect=Y.GraphicsFactoryHelper.drawRectangles(l,0,1);this.bgShapeSelect.usages++}else{Y.GraphicsFactoryHelper.updateRectanglesShape(this.bgShapeSelect,l)}return}this.scrollToCursor(o+a,s+h)};d.prototype.drawBG=function(){this._graphics.beginFill(this.backgroundColor,!this._background?0:1);this._graphics.drawRect(this.textOffsetX,this.textOffsetY,this.width,this.height);this._graphics.endFill()};d.prototype.drawBorder=function(){var t=this.border?.25*this.internalScale.x:0;var e=this.border?.25*this.internalScale.y:0;this._graphics.beginFill(this._borderColor,1);this._graphics.drawRect(this.textOffsetX,this.textOffsetY,this._width,e*2);this._graphics.drawRect(this.textOffsetX,this.textOffsetY+this._height-e*2,this._width,e*2);this._graphics.drawRect(this.textOffsetX,this.textOffsetY+e*2,t*2,this._height-e*2);this._graphics.drawRect(this.textOffsetX+this._width-t*2,this.textOffsetY+e*2,t*2,this._height-e*2);this._graphics.endFill()};d.prototype.getTextShapeForIdentifierAndFormat=function(t,e){if(this.textShapes[t]){return this.textShapes[t]}return this.textShapes[t]=new wt(e,t)};Object.defineProperty(d.prototype,"autoSize",{get:function(){return this._autoSize},set:function(t){if(this._autoSize==t)return;if(typeof t==="string"){if(t!=et.CENTER&&t!=et.NONE&&t!=et.LEFT&&t!=et.RIGHT){return}}else{if(typeof t==="boolean"){if(t)t=et.LEFT;else t=et.NONE}if(typeof t==="number"){if(t>0)t=et.LEFT;else t=et.NONE}}this._autoSize=t;this._positionsDirty=true;if(this._autoSize!=et.NONE)this.invalidate()},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"internalScale",{get:function(){return this._internalScale},enumerable:true,configurable:true});d.prototype._iInternalUpdate=function(){r.prototype._iInternalUpdate.call(this);this.reConstruct(true)};Object.defineProperty(d.prototype,"assetType",{get:function(){return d.assetType},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"background",{get:function(){return this._background},set:function(t){if(this._background==t)return;this._background=t;this._shapesDirty=true},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(t){this._backgroundColor=t;this._shapesDirty=true},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"border",{get:function(){return this._border},set:function(t){if(t==this._border)return;this._border=t;this._shapesDirty=true},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"borderColor",{get:function(){return this._borderColor},set:function(t){if(t==this.borderColor)return;this._borderColor=t;this._shapesDirty=true},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"bottomScrollV",{get:function(){return this._bottomScrollV},set:function(t){if(t==this._bottomScrollV)return;this._bottomScrollV=t},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"caretIndex",{get:function(){return this._caretIndex},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"height",{get:function(){if(this._autoSize!=et.NONE)this.reConstruct();return this._height},set:function(t){if(this._height==t)return;if(this._autoSize!=et.NONE)return;this._height=t;this._positionsDirty=true;this.invalidate()},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"htmlText",{get:function(){return this._htmlText},set:function(t){if(t==this._htmlText)return;this._htmlText=t;var e=St.get().processHTML(this,t);this._labelData=null;this._text=e;this._iText=e;this._iTextWoLineBreaks=e.replace(/(\r\n|\n|\\n|\r)/gm,"");this._textDirty=true;this.newTextFormat=this._textFormats[this._textFormats.length-1];this.invalidate()},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"length",{get:function(){return this._iText.length},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"maxScrollH",{get:function(){this.reConstruct();return this._maxScrollH},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"maxScrollV",{get:function(){this.reConstruct();return this._maxScrollV},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"numLines",{get:function(){this.reConstruct();return this._numLines},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"restrict",{get:function(){return this._restrict},set:function(t){if(t==this._restrict)return;this._restrict=t;this._restrictRegex=null;if(typeof t=="undefined")return;t=t.toString();if(t.length>=2&&t[0]=="-"&&!isNaN(parseInt(t[1])))t="0"+t;t=t.replace(/\\/g,"");t=t.replace(/\^/g,"");t=t.replace(/([^a-zA-Z0-9])\-/g,"$1\\-");t=t.replace(/\./g,"\\.");t=t.replace(/\</g,"\\<");t=t.replace(/\>/g,"\\>");t=t.replace(/\+/g,"\\+");t=t.replace(/\*/g,"\\*");t=t.replace(/\?/g,"\\?");t=t.replace(/\[/g,"\\[");t=t.replace(/\]/g,"\\]");t=t.replace(/\$/g,"\\$");t=t.replace(/\(/g,"\\(");t=t.replace(/\)/g,"\\)");t=t.replace(/\{/g,"\\{");t=t.replace(/\}/g,"\\}");t=t.replace(/\=/g,"\\=");t=t.replace(/\!/g,"\\!");t=t.replace(/\:/g,"\\:");t=t.replace(/\|/g,"\\|");t=t.replace(/\//g,"\\/");t=t.replace(/\%/g,"\\%");this._restrictRegex=new RegExp("[^"+t+"]","g")},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"scrollH",{get:function(){return this._scrollH},set:function(t){if(t==this._scrollH)return;this._scrollH=t},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"scrollV",{get:function(){return this._scrollV},set:function(t){var e=Math.round(t);if(e===this._scrollV)return;this._scrollV=e;if(this._scrollV>this._maxScrollV)this._scrollV=this._maxScrollV;if(this._scrollV<=0){this._scrollV=0}if(!this.textChild){return}this.textChild.y=-this.lines_start_y[this._scrollV]},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"selectable",{get:function(){return this._selectable},set:function(t){if(this.selectable==t){return}this._selectable=t;this.mouseEnabled=t;this.cursorType=t?"text":"";if(t){this.addEventListener(V.DRAG_START,this.startSelectionByMouseDelegate);this.addEventListener(V.DRAG_STOP,this.stopSelectionByMouseDelegate);this.addEventListener(V.DRAG_MOVE,this.updateSelectionByMouseDelegate)}else{this.removeEventListener(V.DRAG_START,this.startSelectionByMouseDelegate);this.removeEventListener(V.DRAG_STOP,this.stopSelectionByMouseDelegate);this.removeEventListener(V.DRAG_MOVE,this.updateSelectionByMouseDelegate)}},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"selectionBeginIndex",{get:function(){return this._selectionBeginIndex},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"selectionEndIndex",{get:function(){return this._selectionEndIndex},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"text",{get:function(){return this._text},set:function(t){t=typeof t==="undefined"?"":t.toString();t=t.replace(String.fromCharCode(160)," ");if(this._text==t)return;this._labelData=null;this._text=t;if(t!=""&&(t.charCodeAt(t.length-1)==13||t.charCodeAt(t.length-1)==10)){t=t.slice(0,t.length-1)}if(t!=""&&(t.length>=3&&t[t.length-1]=="n"&&t[t.length-2]=="\\"&&t[t.length-3]=="\\")){t=t.slice(0,t.length-3)}if(t!=""&&(t.length>=3&&t[t.length-1]=="n"&&t[t.length-2]=="\\")){t=t.slice(0,t.length-2)}for(var e=0,i=Tt;e<i.length;e++){var r=i[e];t=t.replace(r.test,r.replace)}this._iText=t;this._iTextWoLineBreaks=t.replace(/(\r\n|\n|\\n|\r)/gm,"");this._textFormats=[this.newTextFormat];this._textFormatsIdx=[this._iText.length];this._textDirty=true;this.invalidate()},enumerable:true,configurable:true});d.prototype.setLabelData=function(t){this._labelData=t;this.isStatic=true;this._iText="";this._iTextWoLineBreaks="";this._textDirty=false;this._positionsDirty=false;this._glyphsDirty=true;this.invalidate()};Object.defineProperty(d.prototype,"newTextFormat",{get:function(){return this._newTextFormat?this._newTextFormat:this._textFormat?this._textFormat:new mt},set:function(t){if(t){this._newTextFormat=t.applyToFormat(this._textFormat.clone());return}this._newTextFormat=null},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"textFormat",{get:function(){if(this._textFormat==null){this._textFormat=new mt}return this._textFormat},set:function(t){if(!t)throw new Error("TextField::: set textFormat - no value!");if(this._textFormat==t){return}this._textDirty=true;this._textFormat=t;this._textShapesDirty=true;this._textDirty=true;this.invalidate()},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"scaleX",{get:function(){return this._transform.scale.x},set:function(t){if(this._transform.scale.x==t){return}this._setScaleX(t)},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"scaleY",{get:function(){return this._transform.scale.y},set:function(t){if(this._transform.scale.y==t){return}this._setScaleY(t)},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"textColor",{get:function(){return this._textColor},set:function(t){if(this._textColor==t){return}this._textColor=t;if(this._textFormats){var e=this._textFormats.length;while(e>0){e--;if(this._textFormats[e])this._textFormats[e].color=t}this._textDirty=true}this._glyphsDirty=true;this.invalidate()},enumerable:true,configurable:true});d.prototype.getTextColorForTextFormat=function(t){if(t.hasPropertySet("color")){return t.color}return this._textColor};Object.defineProperty(d.prototype,"textInteractionMode",{get:function(){return this._textInteractionMode},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"textWidth",{get:function(){this.reConstruct();return this._textWidth},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"textHeight",{get:function(){this.reConstruct();if(this.type==it.INPUT&&this._iText==""){this.textFormat.font_table.initFontSize(this.textFormat.size);return this.textFormat.font_table.getLineHeight()}return this._textHeight},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"type",{get:function(){return this._type},set:function(t){if(this._type==t)return;this._type=t;this._textDirty=true;if(t==it.INPUT){this.enableInput(true);this.addEventListener(yt.KEYDOWN,this.onKeyDelegate)}else{this.enableInput(false);this.removeEventListener(yt.KEYDOWN,this.onKeyDelegate)}this.invalidate()},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"x",{get:function(){if(this._autoSize!=et.NONE&&!this._wordWrap){this.reConstruct()}return this._transform.position.x},set:function(t){if(this._autoSize!=et.NONE&&!this._wordWrap)this.reConstruct();if(this._transform.position.x==t)return;this._transform.matrix3D._rawData[12]=t;this._transform.invalidatePosition()},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"width",{get:function(){if(this._autoSize!=et.NONE&&!this._wordWrap){this.reConstruct()}return this._width},set:function(t){if(this._width==t)return;this._width=t;this._positionsDirty=true;this.invalidate()},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"wordWrap",{get:function(){return this._wordWrap},set:function(t){if(this._wordWrap==t)return;this._wordWrap=t;this._positionsDirty=true;if(!t)this.invalidate()},enumerable:true,configurable:true});d.prototype.advanceFrame=function(){};d.prototype.getEntity=function(){return this._graphics};d.prototype.clear=function(){r.prototype.clear.call(this)};d.prototype.dispose=function(){this.disposeValues();d._textFields.push(this)};d.prototype.disposeValues=function(){r.prototype.disposeValues.call(this);if(this.maskChild){this.maskChild.dispose();this.maskChild=null}if(this.textChild){this.textChild.dispose();this.textChild=null}if(this.cursorShape){this.cursorShape.dispose();this.cursorShape=null}if(this.bgShapeSelect){this.bgShapeSelect.dispose();this.bgShapeSelect=null}if(this._labelData){this._labelData=null}this._resetParagraph();this._clearTextShapes();this._textFormat=null};d.prototype.reConstruct=function(t){if(t===void 0){t=false}if(!this._textDirty&&!this._positionsDirty&&!this._glyphsDirty&&!this._shapesDirty)return;if(this._textDirty){this._positionsDirty=true;this._lastWordsCount=this.words.length;this.char_positions_x.length=0;this.char_positions_y.length=0;this.words.length=0;this.lines_wordStartIndices.length=0;this.lines_wordEndIndices.length=0;this.lines_start_y.length=0;this.lines_start_x.length=0;this.lines_charIdx_start.length=0;this.lines_charIdx_end.length=0;this.lines_width.length=0;this.lines_height.length=0;this.lines_numSpacesPerline.length=0;this._maxScrollH=0;this._maxScrollV=0;this._maxWidthLine=0;if(!this._textFormat&&this._textFormats.length>0)this._textFormat=this._textFormats[0];this.buildParagraphs()}if(this._positionsDirty){this._glyphsDirty=true;if(this._iText!=""&&this._textFormat!=null){this.getWordPositions()}else{this._textWidth=0;this._textHeight=0;if(this._autoSize!=et.NONE){if(!this.wordWrap)this.adjustPositionForAutoSize(0);this._height=4;if(this._type==it.INPUT){this.newTextFormat.font_table.initFontSize(this.newTextFormat.size);this._height=this.newTextFormat.font_table.getLineHeight()+4}}if(this._type==it.INPUT)this.drawSelectionGraphics()}this.updateMaskMode()}this._textDirty=false;this._positionsDirty=false;if(!t)return;if(this._glyphsDirty){if(this._labelData){this.buildGlyphsForLabelData()}else{this.buildGlyphs()}}this._glyphsDirty=false;if(this._labelData){return}this.buildShapes();this._shapesDirty=false};d.prototype.reset=function(){r.prototype.reset.call(this);if(this.sourceTextField){this.sourceTextField.copyTo(this)}};d.prototype.onClipboardPaste=function(t){var e=(t.clipboardData||self.clipboardData).getData("text");if(!e){return}t.preventDefault();if(this._selectionBeginIndex>0||this._selectionEndIndex>this.length){this._insertNewText(e);return}this.text=e};d.prototype._resetParagraph=function(){this._textShapesDirty=this._textShapesDirty||this.chars_codes.length>0;this.tf_per_char.length=0;this.chars_width.length=0;this.chars_codes.length=0;this._paragraph_textRuns_indices.length=0;this._textRuns_formats.length=0;this._textRuns_words.length=0};d.prototype.buildParagraphs=function(){if(!this._textDirty){return}if(this._iText===""||!this._textFormat){this._resetParagraph();return}var e=0;var i=0;var r=0;var s=0;var n=0;var t=0;var o=0;var a=this._iText;var h=this._textFormatsIdx.length;var l=this._paragraph_textRuns_indices;var u=this._textRuns_formats;var c=this._textRuns_words;var _=this.chars_codes;var f=this.tf_per_char;var p=this.chars_width;var d=function(t){l[e]=t;e++};var g=function(t,e){if(e===void 0){e=false}e&&d(i);u[i++]=t;return t};var m=function(t){c[r++]=t;return t};var v=function(t,e,i){n+=+(t!==_[s]);n+=+(e!==f[s]);n+=+(i!==p[s]);_[s]=t;f[s]=e;p[s]=i;s++};d(i);for(var y=0;y<h;y++){var b=0;var x=0;var w=true;var E=this._textFormats[y];var S=this._width-(E.indent+E.leftMargin+E.rightMargin);E.font_table.initFontSize(E.size);var A=y===h-1?a.length:this._textFormatsIdx[y];if(A>o){g(E);var T=m({start:this.words.length,count:0,width:0,space:0});for(var P=o;P<A;P++){var D=a.charCodeAt(P);var I=a.charCodeAt(P+1);if(D===13){D=10}if(D===92&&I===114){P+=1;continue}if(D===92&&I===110){P+=1;D=10;I=a.charCodeAt(P+1)}var C=D===10;if(C){T.count=b;T.width=t;T.space=x;g(E,true);T=m({start:this.words.length,count:0,width:0,space:0});w=true;x=0;b=0;if(this._maxWidthLine<t){this._maxWidthLine=t}t=0;continue}var M=E.font_table.getCharWidth(D.toString());var O=D==9||D==32;if(!O&&P<A-1){if(I!=9&&I!=32){M+=E.letterSpacing}}t+=M;v(D,E,M);if(O){x++;this.words.put(s-1,0,0,M,1);b++;w=true}else{if(b>0&&this._autoSize==et.NONE&&this._wordWrap){if(this.words.last.width+M>=S){w=true}}if(w){this.words.put(s-1,0,0,M,1);b++}else{this.words.last.width+=M;this.words.last.len+=1}w=false}}T.count=b;T.width=t;T.space=x;if(this._maxWidthLine<t){this._maxWidthLine=t}}o=A}this._textShapesDirty=this._textShapesDirty||n>0||_.length!==s;l.length=e;c.length=r;u.length=i;_.length=s;f.length=s;p.length=s};d.prototype.adjustPositionForAutoSize=function(t){var e=this._width;this._width=4+t;if(this._autoSize==et.RIGHT){this._transform.matrix3D._rawData[12]-=this._width-e;this._transform.invalidatePosition()}else if(this._autoSize==et.CENTER){this._transform.matrix3D._rawData[12]-=(this._width-e)/2;this._transform.invalidatePosition()}};d.prototype.getWordPositions=function(){var t=0;var e=this._textRuns_formats.length;var i=0;var r=0;var s=0;var n;var o=0;var a=0;this._numLines=0;var h=0;var l=0;var u=0;var c=this.textOffsetY+2;if(this._autoSize!=et.NONE&&!this._wordWrap&&this._textDirty){var _=this._maxWidthLine+this._textFormat.indent+this._textFormat.leftMargin+this._textFormat.rightMargin;this.adjustPositionForAutoSize(_)}var f=this._width-(this._textFormat.indent+this._textFormat.leftMargin+this._textFormat.rightMargin);var p=0;var d=this._paragraph_textRuns_indices.length;h=0;this.lines_wordStartIndices.length=0;this.lines_wordEndIndices.length=0;this.lines_start_y.length=0;this.lines_start_x.length=0;this.lines_width.length=0;this.lines_height.length=0;this.lines_numSpacesPerline.length=0;this.lines_charIdx_start.length=0;this.lines_charIdx_end.length=0;var g=[];var m=[];for(p=0;p<d;p++){e=p==d-1?this._textRuns_formats.length:this._paragraph_textRuns_indices[p+1];s=0;g[g.length]=0;for(t=this._paragraph_textRuns_indices[p];t<e;t++){n=this._textRuns_formats[t];n.font_table.initFontSize(n.size);if(g[g.length-1]<n.font_table.getLineHeight()+n.leading){g[g.length-1]=n.font_table.getLineHeight()+n.leading}r=this._textRuns_words[t].start+this._textRuns_words[t].count;s+=this._textRuns_words[t].width}this.lines_wordStartIndices[this.lines_wordStartIndices.length]=this._textRuns_words[this._paragraph_textRuns_indices[p]].start;this.lines_wordEndIndices[this.lines_wordEndIndices.length]=r;this.lines_width[this.lines_width.length]=0;this.lines_numSpacesPerline[this.lines_numSpacesPerline.length]=0;var v=0;this.lines_height[this.lines_height.length]=g[v];m[h]=n;for(t=this._paragraph_textRuns_indices[p];t<e;t++){n=this._textRuns_formats[t];n.font_table.initFontSize(n.size);a=n.indent;r=this._textRuns_words[t].start+this._textRuns_words[t].count;if(s<=f||!this.wordWrap){for(i=this._textRuns_words[t].start;i<r;i+=1){var y=this.words.get(i);u=y.width;l+=u;this.lines_wordEndIndices[h]=i+1;this.lines_width[h]+=u;m[h]=n;if(this.chars_codes[y.start]==32||this.chars_codes[y.start]==9){this.lines_numSpacesPerline[h]+=1}}}else{u=0;a=0;for(i=this._textRuns_words[t].start;i<r;i+=1){var y=this.words.get(i);u=y.width;var b=false;if(this.chars_codes[y.start]==32||this.chars_codes[y.start]==9){this.lines_numSpacesPerline[h]+=1;b=true}if(b||this.lines_width[h]+u<=f-a-1*n.font_table.getCharWidth("32")||this.lines_width[h]==0){this.lines_wordEndIndices[h]=i+1;this.lines_width[h]+=u;m[h]=n}else{h++;this.lines_wordStartIndices[h]=i;this.lines_wordEndIndices[h]=i+1;this.lines_width[h]=u;this.lines_numSpacesPerline[h]=0;this.lines_height[this.lines_height.length]=g[v];m[h]=n;a=n.indent}}}}v++;h++}var x=this.textOffsetX;var w;var E;var S;var A;var T;var P;var D=0;var I=this.lines_wordStartIndices.length;var C=0;this._biggestLine=0;this._numLines=I;for(P=0;P<I;P++){l=this.lines_width[P];S=this.lines_height[P];w=this.lines_wordStartIndices[P];A=this.lines_wordEndIndices[P];E=this.lines_numSpacesPerline[P];n=m[P];T=f-l;x=this.textOffsetX+n.leftMargin+n.indent;if(n.align==rt.JUSTIFY){if(P!=I-1&&T>0&&E>0){}if(P!=0){x-=n.indent}}else if(n.align==rt.CENTER){if(T>0)x+=T/2;else{x+=2}}else if(n.align==rt.RIGHT){if(T>0)x+=T-2;else{x+=2}}else if(n.align==rt.LEFT){x+=2}var M=0;var O=x;this.lines_start_x[P]=x;this.lines_start_y[P]=c;this.lines_charIdx_start[P]=C;var F=0;for(i=w;i<A;i+=1){var y=this.words.get(i);y.x=x;O=0;w=y.start;M=w+y.len;var R=this.tf_per_char[w];R.font_table.initFontSize(R.size);var N=S-(R.font_table.getLineHeight()+R.leading);N=N>0?N-2:0;y.y=c+N;for(D=w;D<M;D++){this.char_positions_x[this.char_positions_x.length]=x+O;this.char_positions_y[this.char_positions_y.length]=c+N;O+=this.chars_width[D];C++}x+=O;F+=O}this.lines_charIdx_end[P]=C;c+=S;if(F>o){this._biggestLine=P;o=F}}this._textWidth=o;this._textHeight=c;if(this.autoSize!=et.NONE)this._height=this._textHeight+4;if(this._textWidth>this._width){w=this.lines_charIdx_start[this._biggestLine];D=this.lines_charIdx_end[this._biggestLine];var L=0;while(D>w){D--;L+=this.chars_width[D];if(L>this._width){this._maxScrollH=D;break}}}if(this._textHeight>this._height){var k=this.lines_height.length;var L=4;while(k>0){k--;L+=this.lines_height[k];if(L>this._height){this._maxScrollV=k+1;break}}}};d.prototype.buildGlyphsForLabelData=function(){this._clearTextShapes();var t=[];var e=[];var i=[];var r=[];var s=this.staticMatrix.tx/20;var n=this.staticMatrix.ty/20;var o;var a=0;for(var h=0;h<this._labelData.records.length;h++){t[h]=new mt;e[h]=[];i[h]=[];o=this._labelData.records[h];if(o.font_table){t[h].font_table=o.font_table}else if(h>0){t[h].font_table=t[h-1].font_table}else{console.log("error - no font for label")}if(o.fontHeight){t[h].size=o.fontHeight/20}else if(h>0){t[h].size=t[h-1].size}if(o.color){t[h].color=G.ColorUtils.f32_RGBA_To_f32_ARGB(o.color)}else if(h>0){t[h].color=t[h-1].color}if(o.moveY!=null){n+=o.moveY/20-a;a=n}else{}if(o.moveX!=null){s=this.staticMatrix.tx/20+o.moveX/20}r.push(s);r.push(n);for(var l=0;l<o.entries.length;l++){e[h][l]=o.entries[l].glyphIndex;i[h][l]=o.entries[l].advance/20;s+=i[h][l]}}var u;var c=0;var _=t.length;var f;var p=0;var d=0;for(c=0;c<_;c++){t[c].font_table.initFontSize(t[c].size);f=t[c].font_table.buildTextLineFromIndices(this,t[c],r[c*2],r[c*2+1],e[c],i[c]);d+=f.y;p=f.x>p?f.x:p}this._textWidth=p;this._textHeight=d;this.targetGraphics=this._graphics;this.targetGraphics.clear();this.drawBG();if(this.border||!this._background&&this._type!=it.INPUT)this.drawBorder();for(var g in this.textShapes){u=this.textShapes[g];var m=new q.Float2Attributes(u.length/2);var v=new Float32Array(m.attributesBuffer.buffer);var y=0;for(var b=0,x=u.verts;b<x.length;b++){var w=x[b];v.set(w,y);y+=w.length}u.elements=new X.TriangleElements;u.elements.setPositions(m);u.elements.invalidate();u.shape=this.targetGraphics.addShape(Y.Shape.getShape(u.elements));u.shape.deepHitCheck=true;u.shape.usages++;var E=new q.ImageSampler;u.shape.style=new X.Style;if(u.format.material&&this._textColor==0){u.shape.material=this._textFormat.material;u.shape.style.addSamplerAt(E,u.shape.material.getTextureAt(0));u.shape.material.animateUVs=true;u.shape.style.uvMatrix=new G.Matrix(0,0,0,0,u.format.uv_values[0],u.format.uv_values[1])}else{var S=this.getTextColorForTextFormat(u.format);var A=G.ColorUtils.float32ColorToARGB(S)[0];if(A==0){A=255}var T=Y.MaterialManager.get_material_for_color(S,A/255);u.shape.material=T.material;if(T.colorPos){u.shape.style.addSamplerAt(E,u.shape.material.getTextureAt(0));u.shape.material.animateUVs=true;u.shape.style.uvMatrix=new G.Matrix(0,0,0,0,T.colorPos.x,T.colorPos.y)}}}};d.prototype.buildGlyphs=function(){var t=this._textRuns_formats;var e=this._textRuns_words;var i=t.length;if(this._textShapesDirty)this._clearTextShapes();for(var r=0;r<i;r++){var s=e[r];if(s.count==0){continue}t[r].font_table.initFontSize(t[r].size);if(b.USE_UNSAFE_FNT){t[r].font_table.generateFNTData(null)}t[r].font_table.fillTextRun(this,t[r],s.start,s.count)}var n;for(var o in this.textShapes){n=this.textShapes[o];if(n.length===0){continue}var a=new q.Float2Attributes(n.length/2);var h=new Float32Array(a.attributesBuffer.buffer);var l=n.hasUV?new q.Float2Attributes(n.length/2):null;var u=l?new Float32Array(l.attributesBuffer.buffer):null;var c=0;for(var _=0;_<n.verts.length;_++){var f=n.verts[_];h.set(f,c);if(u){u.set(n.uvs[_],c)}c+=f.length}n.length=0;n.addChunk(h,u);if(n.shape){var p=n.shape.elements;p.setPositions(h);if(u){p.setUVs(u)}p.invalidate();a.dispose();if(l){l.dispose()}continue}var d=this.getTextColorForTextFormat(n.format);var g=G.ColorUtils.float32ColorToARGB(d)[0]||255;n.elements=new X.TriangleElements;n.elements.setPositions(a);if(l){n.elements.setUVs(l)}n.elements.invalidate();n.shape=Y.Shape.getShape(n.elements);n.shape.deepHitCheck=true;n.shape.usages++;var m=new q.ImageSampler(false,true,true);n.shape.style=new X.Style;if(n.fntMaterial){n.shape.material=n.fntMaterial;n.shape.style.addSamplerAt(m,n.shape.material.getTextureAt(0))}else if(n.format.material&&this._textColor==0){n.shape.material=this._textFormat.material;n.shape.style.addSamplerAt(m,n.shape.material.getTextureAt(0));n.shape.material.animateUVs=true;n.shape.style.uvMatrix=new G.Matrix(0,0,0,0,n.format.uv_values[0],n.format.uv_values[1])}else{var v=Y.MaterialManager.get_material_for_color(d,g/255);n.shape.material=v.material;if(v.colorPos){n.shape.style.addSamplerAt(m,n.shape.material.getTextureAt(0));n.shape.material.animateUVs=true;n.shape.style.uvMatrix=new G.Matrix(0,0,0,0,v.colorPos.x,v.colorPos.y)}}}};d.prototype.buildShapes=function(){if(!this.targetGraphics){this.targetGraphics=this._graphics}else{this._graphics.clear()}this.targetGraphics.clear();this.drawBG();if(this._border||!this._background){this.drawBorder()}this.drawSelectionGraphics();if(this.bgShapeSelect&&this.isInFocus&&this.showSelection){this.targetGraphics.addShape(this.bgShapeSelect)}var t;for(var e in this.textShapes){t=this.textShapes[e];if(!t.shape){continue}this.targetGraphics.addShape(t.shape)}if(this.type===it.INPUT&&this.isInFocus&&this.cursorShape&&!this.cursorBlinking){this.targetGraphics.addShape(this.cursorShape)}};d.prototype.appendText=function(t){if(!t.length){return}this._iText+=t;this._textDirty=true;this.invalidate()};d.prototype.closeParagraph=function(){this._iText+="\n";this._textDirty=true;this.invalidate()};d.prototype.getCharBoundaries=function(t){var e=new G.Rectangle;if(t>=this.char_positions_x.length){return e}e.x=this.char_positions_x[t];e.width=this.chars_width[t];e.y=this.char_positions_y[t];e.height=10;return e};d.prototype.getCharIndexAtPoint=function(t,e,i){if(i===void 0){i=-1}if(i<0){i=this.getLineIndexAtPoint(t,e)}var r=this.lines_charIdx_start[i];var s=this.lines_charIdx_end[i];for(var n=r;n<s;n++){if(t>=this.char_positions_x[n]){if(t<=this.char_positions_x[n]+this.chars_width[n]/2){return n}else if(t<=this.char_positions_x[n]+this.chars_width[n]){return n+1}}}return-1};d.prototype.getFirstCharInParagraph=function(t){console.log("Textfield.getFirstCharInParagraph() not implemented");return this._firstCharInParagraph};d.prototype.getImageReference=function(t){console.log("TextField.getImageReference() not implemented");return this._imageReference};d.prototype.getLineIndexAtPoint=function(t,e){var i=this.lines_start_y.length;for(var r=0;r<i-1;r++){if(e>=this.lines_start_y[r]&&e<=this.lines_start_y[r+1])return r}if(e>=this.lines_start_y[i-1])return i-1;return 0};d.prototype.getLineIndexOfChar=function(t){this.buildParagraphs();var e=this.lines_charIdx_start.length-1;for(var i=void 0;i<e;i++){if(t>=this.lines_charIdx_start[i]&&t<=this.lines_charIdx_end[i+1])return i}return e};d.prototype.getLineLength=function(t){if(this.lines_width.length==0){return 0}if(t>=this.lines_width.length)return this.lines_width[this.lines_width.length-1];return this.lines_width[t]};d.prototype.getLineMetrics=function(t){var e=new vt;if(!this.lines_width.length){return e}if(t>=this.lines_width.length){t=this.lines_width.length-1}e.x=this.lines_start_x[t];e.width=this.lines_width[t];e.height=this.lines_height[t];return e};d.prototype.getLineOffset=function(t){if(this.lines_charIdx_start.length==0){return 0}if(t>=this.lines_charIdx_start.length)return this.lines_charIdx_start[this.lines_charIdx_start.length-1];return this.lines_charIdx_start[t]};d.prototype.getLineText=function(t){if(this.lines_charIdx_start.length==0){return""}if(t>=this.lines_width.length)t=this.lines_width.length-1;return this._iText.slice(this.lines_charIdx_start[t],this.lines_charIdx_end[t])};d.prototype.getParagraphLength=function(t){return this._paragraphLength};d.prototype.getTextFormat=function(t,e){if(t===void 0){t=-1}if(e===void 0){e=-1}if(!this.tf_per_char||!this.tf_per_char.length){if(this._textFormat)return this._textFormat.clone();return new mt}if(t<0)t=0;if(e>this.tf_per_char.length){e=this.tf_per_char.length}var i=this.tf_per_char[t].clone();var r=this.tf_per_char[t];for(var s=t+1;s<e;s++){if(this.tf_per_char[s]==r){continue}i.mergeFormat(this.tf_per_char[s]);r=this.tf_per_char[s]}return i};d.prototype.replaceSelectedText=function(t){return this._insertNewText(t)};d.prototype.replaceText=function(t,e,i){var r=this._iTextWoLineBreaks.slice(0,t-1);var s=this._iTextWoLineBreaks.slice(e,this._iTextWoLineBreaks.length);this.text=r+i+s;this._selectionEndIndex=this._selectionBeginIndex+i.length};d.prototype.setSelection=function(t,e){if(this._selectionBeginIndex==t&&this._selectionBeginIndex==e)return;this._selectionBeginIndex=t;this._selectionEndIndex=e;this._glyphsDirty=true;this.reConstruct();this.drawSelectionGraphics()};d.prototype.setTextFormat=function(t,e,i){if(e===void 0){e=-1}if(i===void 0){i=-1}if(!t||this._iTextWoLineBreaks.length==0)return;if(e==-1&&i==-1||e==0&&i==-1||(e==-1||e==0)&&i>=this._iTextWoLineBreaks.length){var r=this._textFormats.length;if(this._textFormats.length===1&&this._textFormats[0].equal(t)){return}for(var s=0;s<r;s++){this._textFormats[s]=this._textFormats[s].clone();t.applyToFormat(this._textFormats[s])}this._textDirty=true;this._textShapesDirty=true;return}var n=0;var o=[];var a=[];var h=0;var l=-1;var u;var c=this._textFormats.length;var _=this._iTextWoLineBreaks.length;if(e==-1)e=0;if(i==-1)i=_;if(i<e){var f=i;i=e;e=f}if(i==e)i++;for(var p=0;p<c;p++){if(p>0)h=l;l=this._textFormatsIdx[p];u=this._textFormats[p];if(h<=e&&l>e){if(h<e){o.push(u);a.push(e)}while(l<i){var d=this._textFormats[p].clone();t.applyToFormat(d);o.push(d);a.push(l);p++;if(p<c){l=this._textFormatsIdx[p];u=this._textFormats[p]}else{l=i+1}}if(l==i){var d=u.clone();t.applyToFormat(d);o.push(d);a.push(i)}if(l>i){var d=u.clone();t.applyToFormat(d);o.push(d);a.push(i);o.push(u);a.push(l)}}else{o.push(this._textFormats[p]);a.push(this._textFormatsIdx[p])}}this._textFormats.length=0;this._textFormatsIdx.length=0;for(n=0;n<o.length;n++){this._textFormats[n]=o[n];this._textFormatsIdx[n]=a[n]}this._textDirty=true;this._textShapesDirty=true};d.isFontCompatible=function(t,e){return false};d.prototype.onKey=function(t){var e=t;this.addChar(e.char,e.isShift,e.isCTRL,e.isAlt)};d.prototype.addCharCode=function(t){this.addChar(String.fromCharCode(t))};d.prototype.deleteSelectedText=function(t){if(t===void 0){t="Backspace"}if(this.text.length==0)return;if(this._selectionBeginIndex!=this._selectionEndIndex){var e=this._selectionBeginIndex!=0?this._iText.slice(0,this._selectionBeginIndex):"";var i=this._selectionEndIndex<this._iText.length?this._iText.slice(this._selectionEndIndex,this._iText.length):"";this.text=e+i;this._selectionEndIndex=this._selectionBeginIndex;return}if(t=="Backspace"){if(this._selectionBeginIndex==0){return}var e=this._iText.slice(0,this._selectionBeginIndex-1);var i=this._iText.slice(this._selectionEndIndex,this._iText.length);this.text=e+i;this._selectionBeginIndex-=1;this._selectionEndIndex=this._selectionBeginIndex}else if(t=="Delete"){var e=this._iText.slice(0,this._selectionBeginIndex);var i=this._iText.slice(this._selectionEndIndex+1,this._iText.length);this.text=e+i;this._selectionEndIndex=this._selectionBeginIndex}};d.prototype.addChar=function(t,e,i,r){var s=this;if(e===void 0){e=false}if(i===void 0){i=false}if(r===void 0){r=false}var n=false;var o=this._iText;if(!this._selectionBeginIndex){this._selectionBeginIndex=0}if(!this._selectionEndIndex){this._selectionEndIndex=0}if(this._selectionEndIndex<this._selectionBeginIndex){var a=this._selectionEndIndex;this._selectionEndIndex=this._selectionBeginIndex;this._selectionBeginIndex=a}if(!r&&!i){if(t=="Backspace"||t=="Delete"){this.deleteSelectedText(t);n=true}else if(t=="ArrowRight"){if(!e&&this._selectionEndIndex!=this._selectionBeginIndex){if(this._selectionEndIndex>this._selectionBeginIndex){this._selectionBeginIndex=this._selectionEndIndex}else{this._selectionEndIndex=this._selectionBeginIndex}}else{if(this._selectionEndIndex>this._selectionBeginIndex){this._selectionEndIndex+=1;if(!e)this._selectionBeginIndex=this._selectionEndIndex}else{this._selectionBeginIndex+=1;if(!e)this._selectionEndIndex=this._selectionBeginIndex}}n=true}else if(t=="ArrowLeft"){if(!e&&this._selectionEndIndex!=this._selectionBeginIndex){if(this._selectionEndIndex>this._selectionBeginIndex)this._selectionEndIndex=this._selectionBeginIndex;else this._selectionBeginIndex=this._selectionEndIndex}else{if(this._selectionEndIndex>this._selectionBeginIndex){this._selectionBeginIndex-=1;if(!e)this._selectionEndIndex=this._selectionBeginIndex}else{this._selectionEndIndex-=1;if(!e)this._selectionBeginIndex=this._selectionEndIndex}}n=true}else if(t=="Enter"&&this.multiline){this._insertNewText("\n");n=true}else if(t.length==1){if(this._restrictRegex){var h=t.replace(this._restrictRegex,"");if(h.length<t.length){var l=t.toUpperCase().replace(this._restrictRegex,"");var u=t.toLowerCase().replace(this._restrictRegex,"");t=l;if(l.length<u.length){t=u}if(h.length>t.length){t=h}}if(t=="")return}if(this.newTextFormat.font_table){var c=this.newTextFormat.font_table;var _=t.charCodeAt(0).toString();var f=false;f=f||c.hasChar(_);f=f||c.hasChar(_.toLowerCase());f=f||c.hasChar(_.toUpperCase());if(!f){console.log("Char not found",_);return}}this._insertNewText(t);n=true}else if(t.length>1){console.log("invalid keyboard input: ",t)}if(n){this._glyphsDirty=true;this.invalidate();if(o!==this._iText){this.dispatchEvent(d._onChangedEvent)}}}else{if(i&&!e&&t==="v"){if(navigator.clipboard.readText){navigator.clipboard.readText().then(function(t){s._insertNewText(t)}).catch(function(t){console.warn("[TextField] Can't paste text:",t.message)})}}}if(t&&t.length>0&&this.adapter!=this){var p=void 0;switch(t){case"Backspace":p=8;break;case"Delete":p=46;break;case"ArrowRight":p=39;break;case"ArrowLeft":p=37;break;case".":p=189;break;default:p=t.charCodeAt(0);break}this.adapter.dispatchKeyEvent(p,e,i,r)}};d.prototype._insertNewText=function(t){if(this._selectionBeginIndex!=this._selectionEndIndex){var e=this._iText.slice(0,this._selectionBeginIndex);var i=this._iText.slice(this._selectionEndIndex,this._iText.length);if(this.maxChars>0&&e.length+i.length+t.length>this.maxChars){var r=this.maxChars-e.length+i.length;if(r>0){t=t.slice(0,r)}}this.text=e+t+i;this._textShapesDirty=true;this._selectionBeginIndex+=1;this._selectionEndIndex=this._selectionBeginIndex}else{if(this.maxChars>0&&this._iText.length>=this.maxChars){}else{var e=this._iText.slice(0,this._selectionBeginIndex);var i=this._iText.slice(this._selectionEndIndex,this._iText.length);this.text=e+t+i;this._textShapesDirty=true;this._selectionBeginIndex+=1;this._selectionEndIndex=this._selectionBeginIndex}}};d.prototype.clone=function(){var t=d.getNewTextField();this.copyTo(t);return t};d.prototype.copyTo=function(t){r.prototype.copyTo.call(this,t);t.autoSize=this.autoSize;t.type=this._type;t.html=this.html;t.width=this._width;t.height=this._height;if(this._textFormat)t.textFormat=this._textFormat.clone();t.textColor=this._textColor;t.border=this._border;t.borderColor=this._borderColor;t.background=this._background;t.backgroundColor=this._backgroundColor;t.textOffsetX=this.textOffsetX;t.textOffsetY=this.textOffsetY;t.staticMatrix=this.staticMatrix;t.selectable=this._selectable;t.multiline=this.multiline;t.wordWrap=this.wordWrap;t.maxChars=this.maxChars;t.sourceTextField=this;if(t.html){t.htmlText=this.htmlText}else{t.text=this.text}if(this._labelData){t.setLabelData(this._labelData)}};d.prototype._clearTextShapes=function(){this._textShapesDirty=false;this._lastWordsCount=0;if(this.targetGraphics)this.targetGraphics.clear();var t;for(var e in this.textShapes){t=this.textShapes[e];if(t.shape){t.shape.dispose()}t.shape=null;t.elements=null;t.length=0;delete this.textShapes[e]}};d._textFields=[];d.assetType="[asset TextField]";d._onChangedEvent=new bt(bt.CHANGED);return d}(c);var Dt=function(e){g(t,e);function t(t){return e.call(this,t)||this}return t}(G.ErrorBase);var It=function(e){g(i,e);function i(t){return e.call(this,t)||this}i.prototype.clone=function(){var t=new i(this.type);t.view=this.view;t.entity=this.entity;return t};i.prototype._dispatchEvent=function(t){t.container.dispatchEvent(this);U.execute_queue()};i.FOCUS_IN="focusIn3d";i.FOCUS_OUT="focusOut3d";return i}(G.EventBase);var Ct=function(s){g(t,s);function t(t,e,i){if(e===void 0){e=NaN}if(i===void 0){i=NaN}var r=s.call(this,t)||this;r._oldHeight=e;r._oldWidth=i;return r}Object.defineProperty(t.prototype,"oldHeight",{get:function(){return this._oldHeight},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"oldWidth",{get:function(){return this._oldWidth},enumerable:true,configurable:true});t.prototype.clone=function(){return new t(this.type,this._oldHeight,this._oldWidth)};t.RESIZE="resize";return t}(G.EventBase);var Mt=function(e){g(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;t.awaySymbols={};return t}t.prototype.createMovieClip=function(t,e){if(t===void 0){t=null}if(e===void 0){e=null}return new H(t||new E(this))};t.prototype.createSprite=function(t,e,i){if(t===void 0){t=null}if(e===void 0){e=null}if(i===void 0){i=null}if(t)return t.getNewObject();return new f};t.prototype.createDisplayObjectContainer=function(t){if(t===void 0){t=null}return new c};t.prototype.createTextField=function(t){if(t===void 0){t=null}return new Pt};t.prototype.createBillboard=function(t,e){if(e===void 0){e=null}return new C(t)};t.prototype.createMaterial=function(t,e,i){if(i===void 0){i=null}return new h.MethodMaterial(t,e)};t.prototype.createFrameScripts=function(t,e,i,r){throw"[DefaultSceneGraphFactory] - createFrameScripts should be overwritten by AVM"};t.prototype.createChildInstanceForTimeline=function(t,e,i){throw"[DefaultSceneGraphFactory] - createChildInstanceForTimeline should be overwritten by AVM"};return t}(q.DefaultStageFactory);var Ot=new G.Point(0,0);var Ft=function(a){g(v,a);function v(t,e,i,r,s,n){if(i===void 0){i=true}if(r===void 0){r=4294967295}if(s===void 0){s=true}if(n===void 0){n=null}var o=a.call(this,t,e,i,null,s,n)||this;o._initalFillColor=null;o._lastUsedFill=null;o._internalSync=false;o._msaaNeedDrop=false;o._enforceMSAASupport=false;o._antialiasQuality=b.ALLOW_FORCE_MSAA;o._clearFromDispose=false;o._initalFillColor=r;o._lastUsedFill=r;return o}v.getImage=function(t,e,i,r,s,n,o){if(i===void 0){i=true}if(r===void 0){r=4294967295}if(s===void 0){s=true}if(n===void 0){n=null}if(o===void 0){o=false}var a=new v(t,e,i,r,s,n);if(!o){a._msaaNeedDrop=true;a._antialiasQuality=0}else{a._enforceMSAASupport=true}return a};v.tryStoreImage=function(t,e){e.filterManager.pushTemp(t)};v.getTemp=function(t,e,i,r){if(r===void 0){r=false}var s=i.filterManager.popTemp(t,e,r&&b.ALLOW_FORCE_MSAA>1);s.antialiasQuality=r?b.ALLOW_FORCE_MSAA:0;return s};v.prototype._dropMSAA=function(){if(this._msaaNeedDrop||!this.canUseMSAAInternaly){return}this._enforceMSAASupport=false;this._msaaNeedDrop=true;if(this.wasUpload){a.prototype.unload.call(this)}console.debug("[SceneImage2D Experemental] Drop MSAA support because a setPixel* operation called after upload.",this.id)};Object.defineProperty(v.prototype,"canUseMSAAInternaly",{get:function(){if(this._enforceMSAASupport){return true}var t=b.MSAA_MINIMAL_IMAGE_SIZE;var e=b.MSAA_MINIMAL_IMAGE_SIZE;if(this._stage){e=Math.min(this._stage.height,e);t=Math.min(this._stage.width,t)}return this.width>=t&&this.height>=e&&!this._msaaNeedDrop},enumerable:true,configurable:true});Object.defineProperty(v.prototype,"antialiasQuality",{get:function(){return this.canUseMSAAInternaly?this._antialiasQuality:0},enumerable:true,configurable:true});v.prototype.syncData=function(t){var e=this;if(t===void 0){t=false}if(t&&this._asyncRead){return this._asyncRead}if(!t&&this._asyncRead){throw"[SceneImage2D] Synced read not allowed while async read is requested!"}this.applySymbol();if(!this._imageDataDirty){return t?Promise.resolve(false):false}var i=this._stage.context;this._stage.setRenderTarget(this,false);if(!this._data){this._data=new Uint8ClampedArray(this.width*this.height*4)}this._internalSync=true;this._asyncRead=i.drawToBitmapImage2D(this,false,t);this._internalSync=false;this._stage.setRenderTarget(null);if(!t){this._imageDataDirty=false;this._unpackPMA=false;return true}return this._asyncRead.then(function(t){e._imageDataDirty=false;e._unpackPMA=false;e._asyncRead=null;return true})};v.prototype.getDataInternal=function(t,e){if(t===void 0){t=true}if(e===void 0){e=false}if(!e&&this._imageDataDirty&&!this._internalSync){this.syncData(false);return this._data}if(this._initalFillColor===null){return a.prototype.getDataInternal.call(this,t,true)}var i=a.prototype.getDataInternal.call(this,false,true);if(!i){a.prototype.fillRect.call(this,this.rect,this._initalFillColor);this._initalFillColor=null;return this._data}return i};Object.defineProperty(v.prototype,"assetType",{get:function(){return v.assetType},enumerable:true,configurable:true});v.prototype.createRenderer=function(){var t=new G.PerspectiveProjection;t.coordinateSystem=G.CoordinateSystem.RIGHT_HANDED;t.originX=-1;t.originY=1;t.transform=new G.Transform;t.transform.scaleTo(1,-1,1);t.transform.moveTo(0,0,-1e3);v._view=new o.View(t,this._stage);v._root=new c;v._rootNode=v._view.getNode(v._root);v._renderer=X.RenderGroup.getInstance(X.DefaultRenderer).getRenderer(v._rootNode.partition);v._view.backgroundAlpha=0;v._view.backgroundColor=0;v._renderer.disableClear=true;v._renderer.renderableSorter=null};v.prototype.createBillboardRenderer=function(){var t=new G.PerspectiveProjection;t.coordinateSystem=G.CoordinateSystem.RIGHT_HANDED;t.originX=-1;t.originY=1;t.transform=new G.Transform;t.transform.moveTo(0,0,-1e3);t.transform.lookAt(new G.Vector3D);v._billboardView=new o.View(t,this._stage);v._billboardRoot=new c;v._billboardRenderer=X.RenderGroup.getInstance(X.DefaultRenderer).getRenderer(v._billboardView.getNode(v._billboardRoot).partition);v._billboardView.backgroundAlpha=0;v._billboardView.backgroundColor=0;v._billboardRenderer.disableClear=true;v._billboardRenderer.renderableSorter=null;var e=new h.MethodMaterial(new q.BitmapImage2D(128,128,true,0));e.bothSides=true;e.alphaBlending=true;v._billboard=new C(e);v._billboard.style=new X.Style;v._billboardRoot.addChild(v._billboard)};v.prototype.dispose=function(){this._clearFromDispose=true;this.dropAllReferences();this.unmarkToUnload();this.unuseWeakRef();this._data=null;this._locked=false;a.prototype.dispose.call(this);this._clearFromDispose=false};v.prototype.unload=function(){var t=this;var e=this.syncData(true);if(typeof e!=="boolean"){e.then(function(){return a.prototype.unload.call(t)});return}a.prototype.unload.call(this)};v.prototype.deepClone=function(t){this.copyPixels(t,this._rect,new G.Point(0,0))};v.prototype.fillRect=function(t,e){this.dropAllReferences();var i=G.ColorUtils.float32ColorToARGB(e);var r=this._transparent?i[0]/255:1;var s=t!==this._rect&&!this._rect.equals(t);this._stage.setRenderTarget(this,true,0,0,true);this._stage.setScissor(t);this._lastUsedFill=s?null:e;this._stage.clear(i[1]/255*r,i[2]/255*r,i[3]/255*r,r);this._stage.setScissor(null);this._imageDataDirty=true};v.prototype.copyPixels=function(t,e,i,r,s,n){this._lastUsedFill=null;this.dropAllReferences();this.unmarkToUnload();n=this.transparent!==t.transparent||n;if(!t._imageDataDirty&&e.equals(this._rect)&&this._rect.equals(t.rect)&&!n&&(!this.wasUpload||!t.wasUpload)){var o=t.getDataInternal(true);if(this._data){this._data.set(o)}else{this._data=o.slice()}this._unpackPMA=t._unpackPMA;this._initalFillColor=null;this._imageDataDirty=false;this.invalidateGPU();return}if(t.width*t.height<=b.CPU_COPY_PIXELS_COUNT&&!n){}if(this._initalFillColor!==null){this.fillRect(this._rect,this._initalFillColor);this._initalFillColor=null}var a=t;if(r){a=this._stage.filterManager.popTemp(t.width,t.height);this._stage.filterManager.copyPixels(r,a,new G.Rectangle(s.x,s.y,e.width,e.height),new G.Point(0,0));this._stage.filterManager.copyPixels(t,a,t.rect,new G.Point(0,0),true,"alpha_back")}this._stage.filterManager.copyPixels(a,this,e,i,n);if(r){this._stage.filterManager.pushTemp(a)}this._imageDataDirty=true};v.prototype.threshold=function(t,e,i,r,s,n,o,a){this._lastUsedFill=null;this.dropAllReferences();this.unmarkToUnload();this._stage.threshold(t,this,e,i,r,s,n,o,a);this._imageDataDirty=true};v.prototype.applyFilter=function(t,e,i,r){if(!b.USE_UNSAFE_FILTERS||!r||!r.filterName){return false}this.dropAllReferences(false);var s=this._stage.filterManager.applyFilter(t,this,e,i,r.filterName,r);this._imageDataDirty=s;return s};v.prototype.colorTransform=function(t,e){this.dropAllReferences();this.unmarkToUnload();this._lastUsedFill=null;this._stage.colorTransform(this,this,t,e);this._imageDataDirty=true};v.prototype.setPixel=function(t,e,i){if(this.canUseMSAAInternaly){this._dropMSAA()}a.prototype.setPixel.call(this,t,e,i)};v.prototype.setPixel32=function(t,e,i){if(this.canUseMSAAInternaly){this._dropMSAA()}a.prototype.setPixel32.call(this,t,e,i)};v.prototype.setPixels=function(t,e){if(this.wasUpload&&this.canUseMSAAInternaly){this._dropMSAA()}a.prototype.setPixels.call(this,t,e)};v.prototype.clear=function(){var t=this;if(this._clearFromDispose){a.prototype.clear.call(this);return}var e=this.syncData(true);this.unmarkToUnload();this.lastUsedTime=-1;if(typeof e==="boolean"){this.wasUpload=false;a.prototype.clear.call(this);return}e.then(function(){t.wasUpload=false;a.prototype.clear.call(t)})};v.prototype.getPixel32=function(t,e){this.syncData();return a.prototype.getPixel32.call(this,t,e)};v.prototype.getPixel=function(t,e){var i=this.getPixel32(t,e);return i&16777215};v.prototype.draw=function(t,e,i,r,s,n){this.dropAllReferences();this.unmarkToUnload();if(t instanceof u){this._drawAsDisplay(t,e,i,r,s,n)}else{this._drawAsBitmap(t,e,i,r,s,n)}this._lastUsedFill=null;this._imageDataDirty=true;this.invalidate()};v._mapSupportedBlendMode=function(t){if(t===void 0){t=""}switch(t){case null:case"":case q.BlendMode.NORMAL:case q.BlendMode.LAYER:return q.BlendMode.LAYER;case q.BlendMode.MULTIPLY:case q.BlendMode.ADD:case q.BlendMode.ALPHA:return t}return q.BlendMode.LAYER};v.prototype._drawAsBitmap=function(t,e,i,r,s,n){if(!v._billboardRenderer){this.createBillboardRenderer()}if(this._initalFillColor!==null){this.fillRect(this._rect,this._initalFillColor);this._initalFillColor=null}var o=this._stage;var a=v._mapSupportedBlendMode(r);var h=!r||a!==q.BlendMode.LAYER||r==q.BlendMode.LAYER;var l=!h||this===t;var u=l?o.filterManager.popTemp(this.width,this.height,false):this;var c=v._billboardRenderer;var _=v._billboardRoot;var f=v._billboard;f.sampler.smooth=n;c.disableClear=!l;c.view.target=u;c.view.projection.scale=1e3/u.height;f.material.style.image=t;f.material.blendMode=!l?v._mapSupportedBlendMode(r):q.BlendMode.LAYER;f.material.useColorTransform=!!i;if(e){var p=_.transform.matrix3D;p.identity();p._rawData[0]=e.a;p._rawData[1]=-e.b;p._rawData[4]=e.c;p._rawData[5]=-e.d;p._rawData[12]=e.tx;p._rawData[13]=u.height-e.ty;_.transform.invalidateComponents()}else{_.transform.rotateTo(0,0,0);_.transform.scaleTo(1,-1,1);_.transform.moveTo(0,u.height,0)}_.transform.colorTransform=i;c.render();if(l){o.filterManager.copyPixels(u,this,this.rect,Ot,true,r);o.filterManager.pushTemp(u)}};v.prototype._drawAsDisplay=function(t,e,i,r,s,n){if(r===void 0){r=""}r=r||q.BlendMode.LAYER;if(!v._renderer){this.createRenderer()}var o=v._root;var a=v._rootNode;var h=v._renderer;var l=this.canUseMSAAInternaly;var u=!t.isAsset(C)&&this._stage.context.glVersion===2&&b.ALLOW_FORCE_MSAA>1&&!l;var c=this;var _=r!==q.BlendMode.LAYER||this._lastUsedFill===null;var f=_||u;if((!u||_)&&this._initalFillColor!==null){this.fillRect(this._rect,this._initalFillColor);this._initalFillColor=null}if(f){c=v.getTemp(this.width,this.height,this._stage,u);if(!_&&this._lastUsedFill!==null){h.disableClear=false;h.view.backgroundColor=this._lastUsedFill&16777215;h.view.backgroundAlpha=this._transparent?(this._lastUsedFill>>>24&255)/255:1}else{h.disableClear=false;h.view.backgroundColor=0;h.view.backgroundAlpha=0}}var p=h.view.projection.transform;var d=p.matrix3D;d.identity();if(e){var g=d._rawData;g[0]=e.a;g[1]=e.b;g[4]=e.c;g[5]=e.d;g[10]=1;g[12]=e.tx;g[13]=e.ty}d.appendScale(1,-1,1);d.appendTranslation(0,this._rect.height,1e3);d.invert();p.matrix3D=d;h.antiAlias=(l?this.antialiasQuality:c.antialiasQuality)||0;h.view.target=c;h.view.projection.scale=1e3/this._rect.height;h.view.projection.ratio=this._rect.width/this._rect.height;h.view.x=-(c.width-this.width);h.view.y=-(c.height-this.height);h.view.width=this.width;h.view.height=this.height;var m=a.addChildAt(t,0);m.transformDisabled=true;m.colorTransformDisabled=false;o.transform.colorTransform=i;o.blendMode=v._mapSupportedBlendMode(r);h.render();h.antiAlias=0;h.disableClear=true;a.removeChildAt(0);if(f){this._stage.filterManager.copyPixels(c,this,this._rect,Ot,_,r);v.tryStoreImage(c,this._stage)}};v.prototype.reset=function(){};v.prototype.clone=function(){var t=v.getImage(this.width,this.height,this.transparent,null,false,this._stage,false);t.deepClone(this);return t};v.assetType="[image SceneImage2D]";return v}(q.BitmapImage2D);q.Stage.registerAbstraction(q._Stage_BitmapImage2D,Ft);var Rt=function(){function i(t){this._pickerLookup=new Array;this.allowKeyInput=true;this._collisionIsEnabledButton=false;this._eventBubbling=true;this._allowFocusOnUnfocusable=true;this._cursorType="auto";this._nullVector=new G.Vector3D;this._queuedEvents=new Array;this._mouseUp=new V(V.MOUSE_UP);this._mouseUpOutside=new V(V.MOUSE_UP_OUTSIDE);this._mouseClick=new V(V.CLICK);this._mouseOut=new V(V.MOUSE_OUT);this._dragOut=new V(V.DRAG_OUT);this._dragOver=new V(V.DRAG_OVER);this._mouseDown=new V(V.MOUSE_DOWN);this._mouseMove=new V(V.MOUSE_MOVE);this._mouseOver=new V(V.MOUSE_OVER);this._mouseWheel=new V(V.MOUSE_WHEEL);this._mouseDoubleClick=new V(V.DOUBLE_CLICK);this._rollOver=new V(V.ROLL_OVER);this._rollOut=new V(V.ROLL_OUT);this._dragMove=new V(V.DRAG_MOVE);this._dragStart=new V(V.DRAG_START);this._dragStop=new V(V.DRAG_STOP);this._focusIn=new It(It.FOCUS_IN);this._focusOut=new It(It.FOCUS_OUT);this._useSoftkeyboard=false;this._isAVM1Dragging=false;this._isDown=false;this._stage=t;this.onDoubleClick=this.onDoubleClick.bind(this);this.onMouseDown=this.onMouseDown.bind(this);this.onMouseMove=this.onMouseMove.bind(this);this.onMouseUp=this.onMouseUp.bind(this);this.onMouseWheel=this.onMouseWheel.bind(this);this.onMouseOver=this.onMouseOver.bind(this);this.onMouseOut=this.onMouseOut.bind(this);this.onKeyDown=this.onKeyDown.bind(this);this.onKeyUp=this.onKeyUp.bind(this);this.buttonEnabledDirty=false;this._isTouch="ontouchstart"in self||navigator["msMaxTouchPoints"]>0;this._showCursor=true;this._mouseDragging=false;var e=this._stage.container;e.addEventListener("touchstart",this.onMouseDown);e.addEventListener("mousedown",this.onMouseDown);window.addEventListener("touchmove",this.onMouseMove);window.addEventListener("mousemove",this.onMouseMove);window.addEventListener("mouseup",this.onMouseUp);e.addEventListener("touchend",this.onMouseUp);e.addEventListener("mousewheel",this.onMouseWheel);e.addEventListener("mouseover",this.onMouseOver);e.addEventListener("mouseout",this.onMouseOut);window.addEventListener("keydown",this.onKeyDown);window.addEventListener("keyup",this.onKeyUp);window.addEventListener("contextmenu",function(t){return t.preventDefault()})}i.prototype.startDragObject=function(t){this._isAVM1Dragging=true;if(t)this._mouseDragCollision=t};i.prototype.stopDragObject=function(){this._isAVM1Dragging=false};Object.defineProperty(i.prototype,"showCursor",{get:function(){return this._showCursor},set:function(t){this._showCursor=t;this.cursorType=this._cursorType},enumerable:true,configurable:true});Object.defineProperty(i.prototype,"cursorType",{get:function(){return this._cursorType},set:function(t){this._cursorType=t;this._stage.container.style.cursor=this._showCursor?t:"none"},enumerable:true,configurable:true});Object.defineProperty(i.prototype,"eventBubbling",{get:function(){return this._eventBubbling},set:function(t){this._eventBubbling=t},enumerable:true,configurable:true});Object.defineProperty(i.prototype,"useSoftkeyboard",{get:function(){return this._useSoftkeyboard},set:function(t){this._useSoftkeyboard=t;if(!t){window.addEventListener("keydown",this.onKeyDown);window.addEventListener("keyup",this.onKeyUp)}else if(t){window.removeEventListener("keydown",this.onKeyDown);window.removeEventListener("keyup",this.onKeyUp)}},enumerable:true,configurable:true});i.prototype.dispose=function(){var t=this._stage.container;t.removeEventListener("dblclick",this.onDoubleClick);t.removeEventListener("touchstart",this.onMouseDown);t.removeEventListener("mousedown",this.onMouseDown);window.removeEventListener("touchmove",this.onMouseMove);window.removeEventListener("mousemove",this.onMouseMove);window.removeEventListener("mouseup",this.onMouseUp);t.removeEventListener("touchend",this.onMouseUp);t.removeEventListener("wheel",this.onMouseWheel);t.removeEventListener("mouseover",this.onMouseOver);t.removeEventListener("mouseout",this.onMouseOut);window.removeEventListener("keydown",this.onKeyDown);window.removeEventListener("keyup",this.onKeyUp);this._stage=null;this._mouseMoveEvent=null;this._mouseUp=null;this._mouseUpOutside=null;this._mouseClick=null;this._mouseOut=null;this._dragOut=null;this._dragOver=null;this._mouseDown=null;this._mouseMove=null;this._mouseOver=null;this._mouseWheel=null;this._mouseDoubleClick=null;this._dragMove=null;this._dragStart=null;this._dragStop=null};i.clearInstance=function(t){if(this._instancePool[t.id]){this._instancePool[t.id].dispose();delete this._instancePool[t.id]}};i.getInstance=function(t){return this._instancePool[t.id]||(this._instancePool[t.id]=new i(t))};i.prototype.setFocus=function(t){if(this._focusNode==t)return;if(this._allowFocusOnUnfocusable||this._focusNode.container.tabEnabled){if(this._focusNode){this.dispatchEvent(this._focusOut,this._focusNode);this._focusNode.container.setFocus(false,true)}this._focusNode=t;if(this._focusNode){this.dispatchEvent(this._focusIn,this._focusNode);this._focusNode.container.setFocus(true,true)}}};i.prototype.getFocus=function(){return this._focusNode};i.prototype.dispatchEvent=function(t,e){var i;if(!this._eventBubbling){if(e){t._dispatchEvent(e,e.container)}return}var r=(i=e)===null||i===void 0?void 0:i.container;while(e){if(t.commonAncestor&&e==t.commonAncestor){return}t._dispatchEvent(e,r);if(!t._iAllowedToPropagate){e=null}else{e=e.parent}}};i.prototype.setupAndDispatchEvent=function(t,e,i,r){if(r===void 0){r=null}if(e){t.delta=e.wheelDelta;t.ctrlKey=e.ctrlKey;t.altKey=e.altKey;t.shiftKey=e.shiftKey;t.buttons=e.buttons}t=this.setUpEvent(t,i,r);this.dispatchEvent(t,t.rootNode)};i.prototype.fireMouseEvents=function(t){if(t===void 0){t=null}var e,i,r,s;var n;if(t){n=t.getViewCollision(this._stage.screenX,this._stage.screenY)}else if(this._updateDirty){for(var o=0;o<this._pickerLookup.length;o++)if(!n||this._pickerLookup[o].layeredView)n=this._pickerLookup[o].getViewCollision(this._stage.screenX,this._stage.screenY,false,n)}if(!t&&!this._updateDirty)return;var a;var h;var l=this._queuedEvents.length;for(var o=0;o<l;++o){a=this._queuedEvents[o];h=(e=n)===null||e===void 0?void 0:e.rootNode;this.setUpEvent(a,n);if(a.type==V.MOUSE_DOWN){this._mouseDragging=true;if(!this._eventBubbling)this._stage.dispatchEvent(a);if(this._isTouch)this.setupAndDispatchEvent(this._mouseOver,this._mouseMoveEvent,n);this._mouseDragCollision=n;if(h){this.dispatchEvent(a,h)}else if(this._eventBubbling)this._stage.dispatchEvent(a);if(this._mouseDragCollision){this.setFocus((i=this._mouseDragCollision)===null||i===void 0?void 0:i.rootNode);this.setupAndDispatchEvent(this._dragStart,a,this._mouseDragCollision)}}else if(a.type==V.MOUSE_UP){if(!this._eventBubbling)this._stage.dispatchEvent(a);var u=null;var c=null;if(this._isAVM1Dragging&&this._mouseDragCollision){c=this._mouseDragCollision.rootNode;u=this._mouseDragCollision.containerNode}else if(this._mouseDragging&&this._mouseDragCollision&&this._mouseDragCollision.rootNode!=h){}else if(this._mouseDragging&&this._mouseDragCollision&&this._mouseDragCollision.rootNode==h){c=this._mouseDragCollision.rootNode;u=this._mouseDragCollision.containerNode}if(c){this.dispatchEvent(a,c)}else if(this._eventBubbling&&h)this.dispatchEvent(a,h);else if(this._eventBubbling)this._stage.dispatchEvent(a);if(u){if(!this._isAVM1Dragging)this.setupAndDispatchEvent(this._mouseClick,this._isTouch?this._mouseMoveEvent:a,this._mouseDragCollision);this.setupAndDispatchEvent(this._dragStop,a,this._mouseDragCollision)}else if(this._mouseDragging&&this._mouseDragCollision){this.setupAndDispatchEvent(this._mouseUpOutside,a,this._mouseDragCollision)}this._mouseDragCollision=null;this._mouseDragging=false;this._isAVM1Dragging=false}else if(a.type==V.MOUSE_MOVE){if(!this._eventBubbling){this._stage.dispatchEvent(a)}if(a.rootNode){this.dispatchEvent(a,a.rootNode)}if(this._mouseDragCollision){this.setupAndDispatchEvent(this._dragMove,a,this._mouseDragCollision)}if(this._eventBubbling){this._stage.dispatchEvent(a)}}else{this.dispatchEvent(a,h)}}this._queuedEvents.length=0;this._rollOut.commonAncestor=null;this._rollOver.commonAncestor=null;var _=(r=n)===null||r===void 0?void 0:r.rootNode;var f=(s=this._prevCollision)===null||s===void 0?void 0:s.rootNode;if(_!=f){if(f){this.setupAndDispatchEvent(this._mouseOut,this._mouseMoveEvent,this._prevCollision);if(this._mouseDragging&&this._mouseDragCollision&&this._mouseDragCollision.rootNode==f)this.setupAndDispatchEvent(this._dragOut,this._mouseMoveEvent,this._prevCollision)}if(!f&&_){this.setupAndDispatchEvent(this._rollOut,this._mouseMoveEvent,this._prevCollision);this.setupAndDispatchEvent(this._rollOver,this._mouseMoveEvent,n)}if(f&&!_){this.setupAndDispatchEvent(this._rollOut,this._mouseMoveEvent,this._prevCollision);this.setupAndDispatchEvent(this._rollOver,this._mouseMoveEvent,n)}if(f&&_){var p=[];var d=f;while(d&&!d.container.isAVMScene){p.push(d);d=d.parent}var g=null;d=_;while(d&&!d.container.isAVMScene){var m=p.indexOf(d);if(m==-1){d=d.parent}else{g=d;d=null}}if(g!=f)this.setupAndDispatchEvent(this._rollOut,this._mouseMoveEvent,this._prevCollision,g);if(g!=_)this.setupAndDispatchEvent(this._rollOver,this._mouseMoveEvent,n,g)}this._collisionIsEnabledButton=_?_.buttonEnabled:false;if(_){this.setupAndDispatchEvent(this._mouseOver,this._mouseMoveEvent,n);if(this._mouseDragging)this.setupAndDispatchEvent(this._dragOver,this._mouseMoveEvent,n)}this._prevCollision=n}else{var v=_?_.buttonEnabled:false;if(this._collisionIsEnabledButton!=v&&v){if(!this._isTouch)this.setupAndDispatchEvent(this._mouseOver,this._mouseMoveEvent,n);else if(this._mouseDragCollision&&this._mouseDragCollision.rootNode==_)this.setupAndDispatchEvent(this._dragOver,this._mouseMoveEvent,n)}this._collisionIsEnabledButton=v}if(!this._mouseDragging){this.cursorType=_?_.container.getMouseCursor():"auto"}this._updateDirty=false};i.prototype.registerPicker=function(t){this._pickerLookup.push(t)};i.prototype.unregisterPicker=function(t){this._pickerLookup.splice(this._pickerLookup.indexOf(t),1)};i.prototype.addEventsForSceneBinary=function(t,e){if(e===void 0){e=0}var i={};i.clientX=null;i.clientY=null;i.touches=[];i.changedTouches=[];i.preventDefault=function(){};var r=new Float32Array(t);var s=0;var n=0;var o=0;n++;var a=r[n++];var h=r[n++];var l=r[n++];if(h!=1&&h!=6&&h!=12&&h!=262&&h!=518){for(s=0;s<a;s++){var u={};u.identifier=r[n++];u.clientX=r[n++];u.clientY=r[n++];i.touches[s]=u}i.changedTouches[0]=i.touches[l]}else{if(a==1){var u={};u.identifier=r[n++];u.clientX=r[n++];u.clientY=r[n++];i.clientX=u.clientX;i.clientY=u.clientY}else{for(s=0;s<a;s++){var u={};u.identifier=r[n++];u.clientX=r[n++];u.clientY=r[n++];if(s!=l){i.touches[o]=u}else{i.clientX=u.clientX;i.clientY=u.clientY}}}}if(h==0||h==5||h==11||h==261||h==517){this.onMouseDown(i)}else if(h==1||h==6||h==12||h==262||h==518){this.onMouseUp(i)}else if(h==2){this.onMouseMove(i)}else{console.log("recieved unknown touch event-type: "+h)}};i.prototype.fireEventsForSceneFromString=function(t,e){if(e===void 0){e=0}var i={};i.clientX=null;i.clientY=null;i.preventDefault=function(){};var r=t.split(",");var s=0;var n=0;var o=parseInt(r[n++]);var a=parseInt(r[n++]);var h=parseInt(r[n++]);i.touches=[];i.changedTouches=[];if(a!=1&&a!=6){for(s=0;s<o;s++){var l={};l.identifier=r[n++];l.clientX=r[n++];l.clientY=r[n++];i.touches[s]=l;i.changedTouches[s]=l}i.changedTouches[s]=i.touches[h]}else{for(s=0;s<o;s++){if(s!=h){var l={};l.identifier=r[n++];l.clientX=r[n++];l.clientY=r[n++];i.touches[s]=l;i.changedTouches[s]=l}else{i.clientX=r[n++];i.clientY=r[n++];n++}}}if(a==0){this.onMouseDown(i)}else if(a==1){this.onMouseUp(i)}else if(a==2){this.onMouseMove(i)}else if(a==261){this.onMouseDown(i)}else if(a==6){this.onMouseUp(i)}};i.prototype.setUpEvent=function(t,e,i){if(i===void 0){i=null}var r,s;t._iAllowedToImmediatlyPropagate=true;t._iAllowedToPropagate=true;t.screenX=this._stage.screenX;t.screenY=this._stage.screenY;if(e){t.containerNode=e.containerNode;t.rootNode=e.rootNode;t.traversable=e.traversable;t.uv=e.uv;t.position=(r=e.position)===null||r===void 0?void 0:r.clone();t.normal=(s=e.normal)===null||s===void 0?void 0:s.clone();t.elementIndex=e.elementIndex}else{t.containerNode=null;t.rootNode=null;t.traversable=null;t.uv=null;t.position=this._nullVector;t.normal=this._nullVector;t.elementIndex=0}t.commonAncestor=i;return t};i.prototype.queueDispatch=function(t,e){t.delta=e instanceof WheelEvent?-3*e.deltaY/100:0;t.ctrlKey=e.ctrlKey;t.altKey=e.altKey;t.shiftKey=e.shiftKey;t.buttons=e instanceof MouseEvent?e.buttons:0;this._queuedEvents.push(t)};i.prototype.onKeyDown=function(t){!i.inputRecorder||i.inputRecorder.recordEvent(t);if(this.allowKeyInput){switch(t.keyCode){case 37:case 39:case 38:case 40:t.preventDefault();break;default:break}if(this._focusNode||this._stage){var e=new yt(yt.KEYDOWN,t.key,t.code);e.isShift=t.shiftKey;e.isCTRL=t.ctrlKey;e.isAlt=t.altKey;e.keyCode=t.keyCode;if(this._focusNode)this._focusNode.container.dispatchEvent(e);if(this._stage)this._stage.dispatchEvent(e)}}};i.prototype.onKeyUp=function(t){!i.inputRecorder||i.inputRecorder.recordEvent(t);if(this.allowKeyInput){switch(t.keyCode){case 37:case 39:case 38:case 40:t.preventDefault();break;default:break}if(this._focusNode||this._stage){var e=new yt(yt.KEYUP,t.key,t.code);e.isShift=t.shiftKey;e.isCTRL=t.ctrlKey;e.isAlt=t.altKey;e.keyCode=t.keyCode;if(this._focusNode)this._focusNode.container.dispatchEvent(e);if(this._stage)this._stage.dispatchEvent(e)}}};i.prototype.onMouseMove=function(t){!i.inputRecorder||i.inputRecorder.recordEvent(t);this._isTouch=t.type!="mousemove";this.updateColliders(t);this.queueDispatch(this._mouseMove,this._mouseMoveEvent=t)};i.prototype.onMouseOut=function(t){!i.inputRecorder||i.inputRecorder.recordEvent(t);this.updateColliders(t);this.queueDispatch(this._mouseOut,t)};i.prototype.onMouseOver=function(t){!i.inputRecorder||i.inputRecorder.recordEvent(t);this.updateColliders(t);this.queueDispatch(this._mouseOver,t)};i.prototype.onDoubleClick=function(t){!i.inputRecorder||i.inputRecorder.recordEvent(t);this.updateColliders(t);if(t instanceof MouseEvent&&t.buttons&6){t.preventDefault()}this.queueDispatch(this._mouseDoubleClick,t)};i.prototype.onMouseDown=function(t){this._isTouch=t.type!=="mousedown";if(this._isDown){return}!i.inputRecorder||i.inputRecorder.recordEvent(t);this._isDown=true;this.updateColliders(t);var e=this._isTouch;if(t instanceof MouseEvent&&t.buttons&6){e=true}if(e){t.preventDefault();this._stage.container.focus()}this.queueDispatch(this._mouseDown,t)};i.prototype.onMouseUp=function(t){if(!this._isDown){return}!i.inputRecorder||i.inputRecorder.recordEvent(t);this._isDown=false;this.updateColliders(t);var e=this._isTouch;if(t instanceof MouseEvent&&t.button===1){e=true}if(e){t.preventDefault();this._stage.container.focus()}this.queueDispatch(this._mouseUp,t)};i.prototype.onMouseWheel=function(t){!i.inputRecorder||i.inputRecorder.recordEvent(t);this.updateColliders(t);this.queueDispatch(this._mouseWheel,t)};i.prototype.updateColliders=function(t){this._stage.interactionHandler(t);this._updateDirty=true};i._instancePool={};return i}();var Nt=function(h){g(t,h);function t(t,e,i,r,s,n,o){if(t===void 0){t=null}if(e===void 0){e="triangle"}if(i===void 0){i=50}if(r===void 0){r=100}if(s===void 0){s=16}if(n===void 0){n=15}if(o===void 0){o=true}var a=h.call(this,t,e)||this;a._numVertices=0;a._radius=i;a._height=r;a._segmentsW=s;a._segmentsH=n%2==0?n+1:n;a._yUp=o;return a}Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(t){this._radius=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"segmentsW",{get:function(){return this._segmentsW},set:function(t){this._segmentsW=t;this._pInvalidatePrimitive();this._pInvalidateUVs()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"segmentsH",{get:function(){return this._segmentsH},set:function(t){this._segmentsH=t%2==0?t+1:t;this._pInvalidatePrimitive();this._pInvalidateUVs()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"yUp",{get:function(){return this._yUp},set:function(t){this._yUp=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});t.prototype._pBuildGraphics=function(t,e){var i;var r;var s;var n;var o;var a;var h;var l=0;var u=0;var c;var _,f,p,d;var g=0;if(e==X.ElementsType.TRIANGLE){var m=t;this._numVertices=(this._segmentsH+1)*(this._segmentsW+1);g=(this._segmentsH-1)*this._segmentsW*6;if(this._numVertices==m.numVertices){m.invalidateIndices();m.invalidateVertices(m.positions);m.invalidateVertices(m.normals);m.invalidateVertices(m.tangents)}else{m.setIndices(new Uint16Array(g));m.setPositions(new Float32Array(this._numVertices*3));m.setNormals(new Float32Array(this._numVertices*3));m.setTangents(new Float32Array(this._numVertices*3));this._pInvalidateUVs()}i=m.indices.get(m.numElements);r=m.positions.get(this._numVertices);s=m.normals.get(this._numVertices);n=m.tangents.get(this._numVertices);o=m.concatenatedBuffer.stride/4;for(h=0;h<=this._segmentsH;++h){var v=Math.PI*h/this._segmentsH;var y=-this._radius*Math.cos(v);var b=this._radius*Math.sin(v);c=u;for(a=0;a<=this._segmentsW;++a){var x=2*Math.PI*a/this._segmentsW;var w=b*Math.cos(x);var E=h>this._segmentsH/2?this._height/2:-this._height/2;var S=b*Math.sin(x);var A=1/Math.sqrt(w*w+S*S+y*y);var T=Math.sqrt(S*S+w*w);if(this._yUp){p=0;d=T>.007?w/T:0;_=-y;f=S}else{p=T>.007?w/T:0;d=0;_=S;f=y}if(a==this._segmentsW){r[u]=r[c];r[u+1]=r[c+1];r[u+2]=r[c+2];s[u]=(s[c]+w*A)*.5;s[u+1]=(s[c+1]+_*A)*.5;s[u+2]=(s[c+2]+f*A)*.5;n[u]=(n[c]+(T>.007?-S/T:1))*.5;n[u+1]=(n[c+1]+p)*.5;n[u+2]=(n[c+2]+d)*.5}else{r[u]=w;r[u+1]=this._yUp?_-E:_;r[u+2]=this._yUp?f:f+E;s[u]=w*A;s[u+1]=_*A;s[u+2]=f*A;n[u]=T>.007?-S/T:1;n[u+1]=p;n[u+2]=d}if(a>0&&h>0){var P=(this._segmentsW+1)*h+a;var D=(this._segmentsW+1)*h+a-1;var I=(this._segmentsW+1)*(h-1)+a-1;var C=(this._segmentsW+1)*(h-1)+a;if(h==this._segmentsH){r[u]=r[c];r[u+1]=r[c+1];r[u+2]=r[c+2];i[l++]=P;i[l++]=I;i[l++]=C}else if(h==1){i[l++]=P;i[l++]=D;i[l++]=I}else{i[l++]=P;i[l++]=D;i[l++]=I;i[l++]=P;i[l++]=I;i[l++]=C}}u+=o}}}else if(e==X.ElementsType.LINE){}};t.prototype._pBuildUVs=function(t,e){var i,r;var s;var n;if(e==X.ElementsType.TRIANGLE){var o=t;if(o.uvs&&this._numVertices==o.numVertices){o.invalidateVertices(o.uvs)}else{o.setUVs(new Float32Array(this._numVertices*2))}s=o.uvs.get(this._numVertices);n=o.uvs.stride;var a=0;for(r=0;r<=this._segmentsH;++r){for(i=0;i<=this._segmentsW;++i){s[a]=i/this._segmentsW*this._scaleU;s[a+1]=r/this._segmentsH*this._scaleV;a+=n}}}else if(e==X.ElementsType.LINE){}};return t}(s);var Lt=function(_){g(t,_);function t(t,e,i,r,s,n,o,a,h,l,u){if(t===void 0){t=null}if(e===void 0){e="triangle"}if(i===void 0){i=50}if(r===void 0){r=50}if(s===void 0){s=100}if(n===void 0){n=16}if(o===void 0){o=1}if(a===void 0){a=true}if(h===void 0){h=true}if(l===void 0){l=true}if(u===void 0){u=true}var c=_.call(this,t,e)||this;c._numVertices=0;c._topRadius=i;c._pBottomRadius=r;c._height=s;c._pSegmentsW=n;c._pSegmentsH=o;c._topClosed=a;c._bottomClosed=h;c._surfaceClosed=l;c._yUp=u;return c}Object.defineProperty(t.prototype,"topRadius",{get:function(){return this._topRadius},set:function(t){this._topRadius=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"bottomRadius",{get:function(){return this._pBottomRadius},set:function(t){this._pBottomRadius=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"segmentsW",{get:function(){return this._pSegmentsW},set:function(t){this.setSegmentsW(t)},enumerable:true,configurable:true});t.prototype.setSegmentsW=function(t){this._pSegmentsW=t;this._pInvalidatePrimitive();this._pInvalidateUVs()};Object.defineProperty(t.prototype,"segmentsH",{get:function(){return this._pSegmentsH},set:function(t){this.setSegmentsH(t)},enumerable:true,configurable:true});t.prototype.setSegmentsH=function(t){this._pSegmentsH=t;this._pInvalidatePrimitive();this._pInvalidateUVs()};Object.defineProperty(t.prototype,"topClosed",{get:function(){return this._topClosed},set:function(t){this._topClosed=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"bottomClosed",{get:function(){return this._bottomClosed},set:function(t){this._bottomClosed=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"yUp",{get:function(){return this._yUp},set:function(t){this._yUp=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});t.prototype._pBuildGraphics=function(t,e){var i;var r;var s;var n;var o;var a;var h;var l;var u;var c;var _;var f;var p;var d;var g;var m;var v;var y=0;var b;var x;var w=0;var E=0;var S=0;var A;var T;this._numVertices=0;var P=2*Math.PI/this._pSegmentsW;if(e==X.ElementsType.TRIANGLE){var D=t;if(this._surfaceClosed){this._numVertices+=(this._pSegmentsH+1)*(this._pSegmentsW+1);y+=this._pSegmentsH*this._pSegmentsW*6}if(this._topClosed){this._numVertices+=2*(this._pSegmentsW+1);y+=this._pSegmentsW*3}if(this._bottomClosed){this._numVertices+=2*(this._pSegmentsW+1);y+=this._pSegmentsW*3}if(this._numVertices==D.numVertices){D.positions.invalidate();D.normals.invalidate();D.tangents.invalidate();D.indices.invalidate()}else{D.setIndices(new Uint16Array(y));D.setPositions(new Float32Array(this._numVertices*3));D.setNormals(new Float32Array(this._numVertices*3));D.setTangents(new Float32Array(this._numVertices*3));this._pInvalidateUVs()}i=D.indices.get(D.numElements);r=D.positions.get(this._numVertices);s=D.normals.get(this._numVertices);n=D.tangents.get(this._numVertices);o=D.concatenatedBuffer.stride/4;_=0;f=0;if(this._topClosed&&this._topRadius>0){c=-.5*this._height;if(this._yUp){A=1;T=0;b=-c;x=0}else{A=0;T=-1;b=0;x=c}r[_]=0;r[_+1]=b;r[_+2]=x;s[_]=0;s[_+1]=A;s[_+2]=T;n[_]=1;n[_+1]=0;n[_+2]=0;_+=o;E++;for(a=0;a<=this._pSegmentsW;++a){d=a*P;l=this._topRadius*Math.cos(d);u=this._topRadius*Math.sin(d);if(this._yUp){b=-c;x=u}else{b=u;x=c}if(a==this._pSegmentsW){r[_]=r[w+o];r[_+1]=r[w+o+1];r[_+2]=r[w+o+2]}else{r[_]=l;r[_+1]=b;r[_+2]=x}s[_]=0;s[_+1]=A;s[_+2]=T;n[_]=1;n[_+1]=0;n[_+2]=0;_+=o;if(a>0){i[f++]=E-1;i[f++]=S;i[f++]=E}E++}}if(this._bottomClosed&&this._pBottomRadius>0){c=.5*this._height;w=E*o;S=E;if(this._yUp){A=-1;T=0;b=-c;x=0}else{A=0;T=1;b=0;x=c}if(a>0){r[_]=0;r[_+1]=b;r[_+2]=x;s[_]=0;s[_+1]=A;s[_+2]=T;n[_]=1;n[_+1]=0;n[_+2]=0;_+=o}E++;for(a=0;a<=this._pSegmentsW;++a){d=a*P;l=this._pBottomRadius*Math.cos(d);u=this._pBottomRadius*Math.sin(d);if(this._yUp){b=-c;x=u}else{b=u;x=c}if(a==this._pSegmentsW){r[_]=r[w+o];r[_+1]=r[w+o+1];r[_+2]=r[w+o+2]}else{r[_]=l;r[_+1]=b;r[_+2]=x}s[_]=0;s[_+1]=A;s[_+2]=T;n[_]=1;n[_+1]=0;n[_+2]=0;_+=o;if(a>0){i[f++]=E-1;i[f++]=E;i[f++]=S}E++}}g=this._pBottomRadius-this._topRadius;m=g/this._height;v=m==0?1:this._height/g;if(this._surfaceClosed){var I=void 0;var C=void 0;var M=void 0;var O=void 0;var F=void 0,R=void 0,N=void 0,L=void 0;for(h=0;h<=this._pSegmentsH;++h){p=this._topRadius-h/this._pSegmentsH*(this._topRadius-this._pBottomRadius);c=-(this._height/2)+h/this._pSegmentsH*this._height;w=E*o;for(a=0;a<=this._pSegmentsW;++a){d=a*P;l=p*Math.cos(d);u=p*Math.sin(d);F=v*Math.cos(d);R=v*Math.sin(d);if(this._yUp){A=0;T=-F;b=-c;x=u;N=m;L=R}else{A=-F;T=0;b=u;x=c;N=R;L=m}if(a==this._pSegmentsW){r[_]=r[w];r[_+1]=r[w+1];r[_+2]=r[w+2];s[_]=F;s[_+1]=m;s[_+2]=R;n[_]=R;n[_+1]=A;n[_+2]=T}else{r[_]=l;r[_+1]=b;r[_+2]=x;s[_]=F;s[_+1]=N;s[_+2]=L;n[_]=-R;n[_+1]=A;n[_+2]=T}_+=o;if(a>0&&h>0){I=E;C=E-1;M=C-this._pSegmentsW-1;O=I-this._pSegmentsW-1;i[f++]=I;i[f++]=C;i[f++]=M;i[f++]=I;i[f++]=M;i[f++]=O}E++}}}}else if(e==X.ElementsType.LINE){var k=t;var j=this._pSegmentsH*this._pSegmentsW*2+this._pSegmentsW;r=new Float32Array(j*6);var B=new Float32Array(j);_=0;f=0;for(h=0;h<=this._pSegmentsH;++h){p=this._topRadius-h/this._pSegmentsH*(this._topRadius-this._pBottomRadius);c=-(this._height/2)+h/this._pSegmentsH*this._height;for(a=0;a<=this._pSegmentsW;++a){d=a*P;l=p*Math.cos(d);u=p*Math.sin(d);if(this._yUp){b=-c;x=u}else{b=u;x=c}if(a>0){r[_++]=l;r[_++]=b;r[_++]=x;B[f++]=1;if(h>0){var U=h==1?3-(6*(this._pSegmentsW-a)+12*a):3-this._pSegmentsW*12;r[_]=r[_+++U];r[_]=r[_+++U];r[_]=r[_+++U];r[_++]=l;r[_++]=b;r[_++]=x;B[f++]=1}}if(a<this._pSegmentsW){r[_++]=l;r[_++]=b;r[_++]=x}}}k.setPositions(r);k.setThickness(B)}};t.prototype._pBuildUVs=function(t,e){var i;var r;var s;var n;var o;var a;var h;if(e==X.ElementsType.TRIANGLE){var l=t;if(l.uvs&&this._numVertices==l.numVertices){l.invalidateVertices(l.uvs)}else{l.setUVs(new Float32Array(this._numVertices*2))}a=l.uvs.get(this._numVertices);h=l.uvs.stride;var u=2*Math.PI/this._pSegmentsW;var c=0;if(this._topClosed){a[c]=.5*this._scaleU;a[c+1]=.5*this._scaleV;c+=h;for(i=0;i<=this._pSegmentsW;++i){o=i*u;s=.5+.5*-Math.cos(o);n=.5+.5*Math.sin(o);a[c]=s*this._scaleU;a[c+1]=n*this._scaleV;c+=h}}if(this._bottomClosed){a[c]=.5*this._scaleU;a[c+1]=.5*this._scaleV;c+=h;for(i=0;i<=this._pSegmentsW;++i){o=i*u;s=.5+.5*Math.cos(o);n=.5+.5*Math.sin(o);a[c]=s*this._scaleU;a[c+1]=n*this._scaleV;c+=h}}if(this._surfaceClosed){for(r=0;r<=this._pSegmentsH;++r){for(i=0;i<=this._pSegmentsW;++i){a[c]=i/this._pSegmentsW*this._scaleU;a[c+1]=r/this._pSegmentsH*this._scaleV;c+=h}}}}else if(e==X.ElementsType.LINE){}};return t}(s);var kt=function(h){g(t,h);function t(t,e,i,r,s,n,o,a){if(t===void 0){t=null}if(e===void 0){e="triangle"}if(i===void 0){i=50}if(r===void 0){r=100}if(s===void 0){s=16}if(n===void 0){n=1}if(o===void 0){o=true}if(a===void 0){a=true}return h.call(this,t,e,0,i,r,s,n,false,o,true,a)||this}Object.defineProperty(t.prototype,"radius",{get:function(){return this._pBottomRadius},set:function(t){this._pBottomRadius=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});return t}(Lt);var jt=function(l){g(t,l);function t(t,e,i,r,s,n,o,a){if(t===void 0){t=null}if(e===void 0){e="triangle"}if(i===void 0){i=100}if(r===void 0){r=100}if(s===void 0){s=1}if(n===void 0){n=1}if(o===void 0){o=true}if(a===void 0){a=false}var h=l.call(this,t,e)||this;h._segmentsW=s;h._segmentsH=n;h._yUp=o;h._width=i;h._height=r;h._doubleSided=a;return h}Object.defineProperty(t.prototype,"segmentsW",{get:function(){return this._segmentsW},set:function(t){this._segmentsW=t;this._pInvalidatePrimitive();this._pInvalidateUVs()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"segmentsH",{get:function(){return this._segmentsH},set:function(t){this._segmentsH=t;this._pInvalidatePrimitive();this._pInvalidateUVs()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"yUp",{get:function(){return this._yUp},set:function(t){this._yUp=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"doubleSided",{get:function(){return this._doubleSided},set:function(t){this._doubleSided=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});t.prototype._pBuildGraphics=function(t,e){var i;var r,s;var n;var o;var a;var h=this._segmentsW+1;var l,u;var c;var _;if(e==X.ElementsType.TRIANGLE){var f=t;var p=(this._segmentsH+1)*h;if(this._doubleSided)p*=2;n=this._segmentsH*this._segmentsW*6;if(this._doubleSided)n*=2;if(f.indices!=null&&n==f.indices.length){f.invalidateIndices()}else{f.setIndices(new Uint16Array(n));this._pInvalidateUVs()}i=f.indices.get(f.numElements);if(p==f.numVertices){f.invalidateVertices(f.positions);f.invalidateVertices(f.normals);f.invalidateVertices(f.tangents)}else{f.setPositions(new Float32Array(p*3));f.setNormals(new Float32Array(p*3));f.setTangents(new Float32Array(p*3));this._pInvalidateUVs()}var d=f.positions.get(p);var g=f.normals.get(p);var m=f.tangents.get(p);o=f.concatenatedBuffer.stride/4;u=0;l=0;for(_=0;_<=this._segmentsH;++_){for(c=0;c<=this._segmentsW;++c){r=(c/this._segmentsW-.5)*this._width;s=(_/this._segmentsH-.5)*this._height;d[l]=r;if(this._yUp){d[l+1]=0;d[l+2]=s}else{d[l+1]=s;d[l+2]=0}g[l]=0;if(this._yUp){g[l+1]=1;g[l+2]=0}else{g[l+1]=0;g[l+2]=-1}m[l]=1;m[l+1]=0;m[l+2]=0;l+=o;if(this._doubleSided){for(var v=l;v<l+3;++v){d[v]=d[v-3];g[v]=-g[v-3];m[v]=-m[v-3]}l+=o}if(c!=this._segmentsW&&_!=this._segmentsH){a=c+_*h;var y=this._doubleSided?2:1;i[u++]=a*y;i[u++]=(a+h)*y;i[u++]=(a+h+1)*y;i[u++]=a*y;i[u++]=(a+h+1)*y;i[u++]=(a+1)*y;if(this._doubleSided){i[u++]=(a+h+1)*y+1;i[u++]=(a+h)*y+1;i[u++]=a*y+1;i[u++]=(a+1)*y+1;i[u++]=(a+h+1)*y+1;i[u++]=a*y+1}}}}}else if(e==X.ElementsType.LINE){var b=t;var x=this._segmentsH+1+h;var w=this._width/2;var E=this._height/2;var d=new Float32Array(x*6);var S=new Float32Array(x);u=0;l=0;for(_=0;_<=this._segmentsH;++_){d[l++]=-w;d[l++]=0;d[l++]=_*this._height-E;d[l++]=w;d[l++]=0;d[l++]=_*this._height-E;S[u++]=1}for(c=0;c<=this._segmentsW;++c){d[l++]=c*this._width-w;d[l++]=0;d[l++]=-E;d[l++]=c*this._width-w;d[l++]=0;d[l++]=E;S[u++]=1}b.setPositions(d);b.setThickness(S)}};t.prototype._pBuildUVs=function(t,e){var i;var r;var s;if(e==X.ElementsType.TRIANGLE){s=(this._segmentsH+1)*(this._segmentsW+1);if(this._doubleSided)s*=2;var n=t;if(n.uvs&&s==n.numVertices){n.invalidateVertices(n.uvs)}else{n.setUVs(new Float32Array(s*2))}i=n.uvs.get(s);r=n.uvs.stride;var o=0;for(var a=0;a<=this._segmentsH;++a){for(var h=0;h<=this._segmentsW;++h){i[o]=h/this._segmentsW*this._scaleU;i[o+1]=(1-a/this._segmentsH)*this._scaleV;o+=r;if(this._doubleSided){i[o]=h/this._segmentsW*this._scaleU;i[o+1]=(1-a/this._segmentsH)*this._scaleV;o+=r}}}}else if(e==X.ElementsType.LINE){}};return t}(s);var Bt=function(n){g(t,n);function t(t,e,i,r,s){if(t===void 0){t=null}if(e===void 0){e="triangle"}if(i===void 0){i=100}if(r===void 0){r=16}if(s===void 0){s=true}return n.call(this,t,e,i,0,0,r,1,true,false,false,s)||this}Object.defineProperty(t.prototype,"radius",{get:function(){return this._pBottomRadius},set:function(t){this._pBottomRadius=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"sides",{get:function(){return this._pSegmentsW},set:function(t){this.setSegmentsW(t)},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"subdivisions",{get:function(){return this._pSegmentsH},set:function(t){this.setSegmentsH(t)},enumerable:true,configurable:true});return t}(Lt);var Ut=function(h){g(t,h);function t(t,e,i,r,s,n,o){if(t===void 0){t=null}if(e===void 0){e="triangle"}if(i===void 0){i=50}if(r===void 0){r=50}if(s===void 0){s=16}if(n===void 0){n=8}if(o===void 0){o=true}var a=h.call(this,t,e)||this;a._numVertices=0;a._radius=i;a._tubeRadius=r;a._segmentsR=s;a._segmentsT=n;a._yUp=o;return a}Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(t){this._radius=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"tubeRadius",{get:function(){return this._tubeRadius},set:function(t){this._tubeRadius=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"segmentsR",{get:function(){return this._segmentsR},set:function(t){this._segmentsR=t;this._pInvalidatePrimitive();this._pInvalidateUVs()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"segmentsT",{get:function(){return this._segmentsT},set:function(t){this._segmentsT=t;this._pInvalidatePrimitive();this._pInvalidateUVs()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"yUp",{get:function(){return this._yUp},set:function(t){this._yUp=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});t.prototype._pBuildGraphics=function(t,e){var i;var r;var s;var n;var o;var a,h;var l,u,c,_,f,p,d,g;var m;var v;var y=0;if(e==X.ElementsType.TRIANGLE){var b=t;this._numVertices=(this._segmentsT+1)*(this._segmentsR+1);y=this._segmentsT*this._segmentsR*6;if(this._numVertices==b.numVertices){b.invalidateIndices();b.invalidateVertices(b.positions);b.invalidateVertices(b.normals);b.invalidateVertices(b.tangents)}else{b.setIndices(new Uint16Array(y));b.setPositions(new Float32Array(this._numVertices*3));b.setNormals(new Float32Array(this._numVertices*3));b.setTangents(new Float32Array(this._numVertices*3));this._pInvalidateUVs()}i=b.indices.get(b.numElements);r=b.positions.get(this._numVertices);s=b.normals.get(this._numVertices);n=b.tangents.get(this._numVertices);o=b.concatenatedBuffer.stride/4;m=0;v=0;var x=2*Math.PI/this._segmentsR;var w=2*Math.PI/this._segmentsT;var E=void 0,S=void 0;var A=void 0,T=void 0,P=void 0,D=void 0;var I=0;var C=0;var M=void 0,O=void 0,F=void 0,R=void 0,N;for(h=0;h<=this._segmentsT;++h){I=m;for(a=0;a<=this._segmentsR;++a){d=a*x;g=h*w;N=Math.cos(g);_=N*Math.cos(d);f=N*Math.sin(d);p=Math.sin(g);l=this._radius*Math.cos(d)+this._tubeRadius*_;u=this._radius*Math.sin(d)+this._tubeRadius*f;c=h==this._segmentsT?0:this._tubeRadius*p;if(this._yUp){P=-p;D=f;A=0;T=N?_/N:l/this._radius;E=-c;S=u}else{P=f;D=p;A=N?_/N:l/this._radius;T=0;E=u;S=c}if(a==this._segmentsR){r[m]=l;r[m+1]=r[I+1];r[m+2]=r[I+2]}else{r[m]=l;r[m+1]=E;r[m+2]=S}s[m]=_;s[m+1]=P;s[m+2]=D;n[m]=-(N?f/N:u/this._radius);n[m+1]=A;n[m+2]=T;m+=o;if(a>0&&h>0){M=C;O=C-1;F=O-this._segmentsR-1;R=M-this._segmentsR-1;i[v++]=M;i[v++]=O;i[v++]=F;i[v++]=M;i[v++]=F;i[v++]=R}C++}}}else if(e==X.ElementsType.LINE){}};t.prototype._pBuildUVs=function(t,e){var i,r;var s;var n;if(e==X.ElementsType.TRIANGLE){var o=t;if(o.uvs&&this._numVertices==o.numVertices){o.invalidateVertices(o.uvs)}else{o.setUVs(new Float32Array(this._numVertices*2))}s=o.uvs.get(this._numVertices);n=o.uvs.stride;var a=0;for(r=0;r<=this._segmentsT;++r){for(i=0;i<=this._segmentsR;++i){s[a]=i/this._segmentsR*this._scaleU;s[a+1]=r/this._segmentsT*this._scaleV;a+=n}}}else if(e==X.ElementsType.LINE){}};return t}(s);var Vt=function(){function t(){}t.ADVANCED="advanced";t.NORMAL="normal";return t}();var Ht=function(r){g(t,r);function t(t){var e=r.call(this,t)||this;var i=new G.PerspectiveProjection;i.coordinateSystem=G.CoordinateSystem.RIGHT_HANDED;i.originX=-1;i.originY=1;i.transform=new G.Transform;i.transform.moveTo(0,0,-1e3);i.transform.lookAt(new G.Vector3D);e._view=new o.View(i,e._stage);e._root=new c;e._renderer=X.RenderGroup.getInstance(X.DefaultRenderer).getRenderer(e._view.getNode(e._root).partition);e._renderer.view.projection=i;e._renderer.renderableSorter=null;return e}t.prototype.generate=function(t,e,i,r){var s;var n=[];var o;for(var a in t.font_styles){var h=t.font_styles[a].generateFNTTextures(r,i,e);for(var l=0;l<h.length;l++){o=e;var u=new f;u.graphics.addShape(h[l]);this._root.removeChildren(0,this._root.numChildren);this._root.addChild(u);this._renderer.view.projection.scale=1e3/e;var c=0;var _=this._stage.glVersion==1?e*2:e;s=new q.BitmapImage2D(_,_,true,0,true);n.push(s);t.font_styles[a].addFNTChannel(s);while(o>=1){this._view.backgroundAlpha=0;this._view.backgroundColor=0;this._view.target=s;this._renderer.render(true,0,c);if(this._stage.glVersion==1)break;o*=.5;c++}}}return n};return t}(nt);var Wt=function(){function t(){}t.NONE="none";t.PIXEL="pixel";t.SUBPIXEL="subpixel";return t}();var zt=function(){function t(){}t.NORMAL="normal";t.SELECTION="selection";return t}();var Gt=function(){function t(t,e,i){if(t===void 0){t=false}if(e===void 0){e=false}if(i===void 0){i=false}this._keepMaterial=t;this._disposeSources=e;this._objectSpace=i}Object.defineProperty(t.prototype,"disposeSources",{get:function(){return this._disposeSources},set:function(t){this._disposeSources=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"keepMaterial",{get:function(){return this._keepMaterial},set:function(t){this._keepMaterial=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"objectSpace",{get:function(){return this._objectSpace},set:function(t){this._objectSpace=t},enumerable:true,configurable:true});t.prototype.applyToContainer=function(t,e){this.reset();this.parseContainer(t,e);this.collect(t,false);this.merge(t,this._disposeSources)};t.prototype.applyToSprites=function(t,e){this.reset();if(!e.length)return;for(var i=0;i<e.length;i++)if(e[i]!=t)this.collect(e[i],this._disposeSources);this.collect(t,false);this.merge(t,this._disposeSources)};t.prototype.apply=function(t,e){this.reset();this.collect(e,this._disposeSources);this.collect(t,false);this.merge(t,this._disposeSources)};t.prototype.reset=function(){this._toDispose=new Array;this._shapeVOs=new Array};t.prototype.merge=function(t,e){var i;var r=t.graphics;var s=this._shapeVOs.length>1;for(i=0;i<this._shapeVOs.length;i++){var n=new X.TriangleElements(new q.AttributesBuffer);n.autoDeriveNormals=false;n.autoDeriveTangents=false;var o=this._shapeVOs[i];n.setIndices(o.indices);n.setPositions(o.vertices);n.setNormals(o.normals);n.setTangents(o.tangents);n.setUVs(o.uvs);if(this._keepMaterial&&s)r.addShape(Y.Shape.getShape(n,o.material));else r.addShape(Y.Shape.getShape(n))}if(this._keepMaterial&&!s&&this._shapeVOs.length)t.material=this._shapeVOs[0].material;if(e){var a=this._toDispose.length;for(i;i<a;i++)this._toDispose[i].dispose()}this._toDispose=null};t.prototype.collect=function(t,e){var i;var r;for(i=0;i<t.graphics.count;i++){var s=void 0;var n=void 0;var o=void 0,a=void 0,h=void 0,l=void 0;var u=t.graphics.getShapeAt(i).elements;var c=this.getShapeData(t.graphics.getShapeAt(i).material);var _=this._objectSpace?c.vertices:[];var f=this._objectSpace?c.normals:[];var p=this._objectSpace?c.tangents:[];a=_.length;h=f.length;l=p.length;var d=c.uvs.length;this.copyAttributes(u.positions,_,u.numVertices,a);this.copyAttributes(u.normals,f,u.numVertices,h);this.copyAttributes(u.tangents,p,u.numVertices,l);this.copyAttributes(u.uvs,c.uvs,u.numVertices,d);var g=!this._objectSpace?c.vertices.length/3:0;o=c.indices.length;n=u.numElements;var m=u.indices.get(n);for(s=0;s<n;s++){r=s*3;c.indices[o++]=m[r]+g;c.indices[o++]=m[r+1]+g;c.indices[o++]=m[r+2]+g}if(!this._objectSpace){t.transform.matrix3D.transformVectors(_,_);t.transform.matrix3D.deltaTransformVectors(f,f);t.transform.matrix3D.deltaTransformVectors(p,p);a=c.vertices.length;h=c.normals.length;l=c.tangents.length;n=_.length;for(s=0;s<n;s++){c.vertices[a++]=_[s];c.normals[h++]=f[s];c.tangents[l++]=p[s]}}}if(e)this._toDispose.push(t)};t.prototype.copyAttributes=function(t,e,i,r){var s=t.get(i);var n=t.dimensions;var o=t.stride;var a=i*o;for(var h=0;h<a;h+=o)for(var l=0;l<n;l++)e[r++]=s[h+l]};t.prototype.getShapeData=function(t){var e;if(this._keepMaterial){var i=void 0;var r=this._shapeVOs.length;for(i=0;i<r;i++){if(this._shapeVOs[i].material==t){e=this._shapeVOs[i];break}}}else if(this._shapeVOs.length){e=this._shapeVOs[0]}if(!e){e=new qt;e.vertices=new Array;e.normals=new Array;e.tangents=new Array;e.uvs=new Array;e.indices=new Array;e.material=t;this._shapeVOs.push(e)}return e};t.prototype.parseContainer=function(t,e){var i;var r;if(e instanceof f&&e!=t)this.collect(e,this._disposeSources);for(r=0;r<e.numChildren;++r){i=e.getChildAt(r);this.parseContainer(t,i)}};return t}();var qt=function(){function t(){}return t}();var Yt=function(){function i(){}i.string=function(t){if(typeof t=="function")t=new t;if(typeof t=="string")return t;return t};i.byteArray=function(t){if(typeof t=="function")t=new t;if(t instanceof G.ByteArray)return t;return t};i.isHex=function(t){var e=t.length;for(var i=0;i<e;++i){if(this._hexChars.indexOf(t.charAt(i))==-1)return false}return true};i.tryColor=function(t){if(typeof t=="number")return Math.floor(t);if(typeof t=="string"){if(t=="random")return Math.floor(Math.random()*16777216);if(this._colorNames==null){this._colorNames=new Object;this._colorNames["steelblue"]=4620980;this._colorNames["royalblue"]=267920;this._colorNames["cornflowerblue"]=6591981;this._colorNames["lightsteelblue"]=11584734;this._colorNames["mediumslateblue"]=8087790;this._colorNames["slateblue"]=6970061;this._colorNames["darkslateblue"]=4734347;this._colorNames["midnightblue"]=1644912;this._colorNames["navy"]=128;this._colorNames["darkblue"]=139;this._colorNames["mediumblue"]=205;this._colorNames["blue"]=255;this._colorNames["dodgerblue"]=2003199;this._colorNames["deepskyblue"]=49151;this._colorNames["lightskyblue"]=8900346;this._colorNames["skyblue"]=8900331;this._colorNames["lightblue"]=11393254;this._colorNames["powderblue"]=11591910;this._colorNames["azure"]=15794175;this._colorNames["lightcyan"]=14745599;this._colorNames["paleturquoise"]=11529966;this._colorNames["mediumturquoise"]=4772300;this._colorNames["lightseagreen"]=2142890;this._colorNames["darkcyan"]=35723;this._colorNames["teal"]=32896;this._colorNames["cadetblue"]=6266528;this._colorNames["darkturquoise"]=52945;this._colorNames["aqua"]=65535;this._colorNames["cyan"]=65535;this._colorNames["turquoise"]=4251856;this._colorNames["aquamarine"]=8388564;this._colorNames["mediumaquamarine"]=6737322;this._colorNames["darkseagreen"]=9419919;this._colorNames["mediumseagreen"]=3978097;this._colorNames["seagreen"]=3050327;this._colorNames["darkgreen"]=25600;this._colorNames["green"]=32768;this._colorNames["forestgreen"]=2263842;this._colorNames["limegreen"]=3329330;this._colorNames["lime"]=65280;this._colorNames["chartreuse"]=8388352;this._colorNames["lawngreen"]=8190976;this._colorNames["greenyellow"]=11403055;this._colorNames["yellowgreen"]=10145074;this._colorNames["palegreen"]=10025880;this._colorNames["lightgreen"]=9498256;this._colorNames["springgreen"]=65407;this._colorNames["mediumspringgreen"]=64154;this._colorNames["darkolivegreen"]=5597999;this._colorNames["olivedrab"]=7048739;this._colorNames["olive"]=8421376;this._colorNames["darkkhaki"]=12433259;this._colorNames["darkgoldenrod"]=12092939;this._colorNames["goldenrod"]=14329120;this._colorNames["gold"]=16766720;this._colorNames["yellow"]=16776960;this._colorNames["khaki"]=15787660;this._colorNames["palegoldenrod"]=15657130;this._colorNames["blanchedalmond"]=16772045;this._colorNames["moccasin"]=16770229;this._colorNames["wheat"]=16113331;this._colorNames["navajowhite"]=16768685;this._colorNames["burlywood"]=14596231;this._colorNames["tan"]=13808780;this._colorNames["rosybrown"]=12357519;this._colorNames["sienna"]=10506797;this._colorNames["saddlebrown"]=9127187;this._colorNames["chocolate"]=13789470;this._colorNames["peru"]=13468991;this._colorNames["sandybrown"]=16032864;this._colorNames["darkred"]=9109504;this._colorNames["maroon"]=8388608;this._colorNames["brown"]=10824234;this._colorNames["firebrick"]=11674146;this._colorNames["indianred"]=13458524;this._colorNames["lightcoral"]=15761536;this._colorNames["salmon"]=16416882;this._colorNames["darksalmon"]=15308410;this._colorNames["lightsalmon"]=16752762;this._colorNames["coral"]=16744272;this._colorNames["tomato"]=16737095;this._colorNames["darkorange"]=16747520;this._colorNames["orange"]=16753920;this._colorNames["orangered"]=16729344;this._colorNames["crimson"]=14423100;this._colorNames["red"]=16711680;this._colorNames["deeppink"]=16716947;this._colorNames["fuchsia"]=16711935;this._colorNames["magenta"]=16711935;this._colorNames["hotpink"]=16738740;this._colorNames["lightpink"]=16758465;this._colorNames["pink"]=16761035;this._colorNames["palevioletred"]=14381203;this._colorNames["mediumvioletred"]=13047173;this._colorNames["purple"]=8388736;this._colorNames["darkmagenta"]=9109643;this._colorNames["mediumpurple"]=9662683;this._colorNames["blueviolet"]=9055202;this._colorNames["indigo"]=4915330;this._colorNames["darkviolet"]=9699539;this._colorNames["darkorchid"]=10040012;this._colorNames["mediumorchid"]=12211667;this._colorNames["orchid"]=14315734;this._colorNames["violet"]=15631086;this._colorNames["plum"]=14524637;this._colorNames["thistle"]=14204888;this._colorNames["lavender"]=15132410;this._colorNames["ghostwhite"]=16316671;this._colorNames["aliceblue"]=15792383;this._colorNames["mintcream"]=16121850;this._colorNames["honeydew"]=15794160;this._colorNames["lightgoldenrodyellow"]=16448210;this._colorNames["lemonchiffon"]=16775885;this._colorNames["cornsilk"]=16775388;this._colorNames["lightyellow"]=16777184;this._colorNames["ivory"]=16777200;this._colorNames["floralwhite"]=16775920;this._colorNames["linen"]=16445670;this._colorNames["oldlace"]=16643558;this._colorNames["antiquewhite"]=16444375;this._colorNames["bisque"]=16770244;this._colorNames["peachpuff"]=16767673;this._colorNames["papayawhip"]=16773077;this._colorNames["beige"]=16119260;this._colorNames["seashell"]=16774638;this._colorNames["lavenderblush"]=16773365;this._colorNames["mistyrose"]=16770273;this._colorNames["snow"]=16775930;this._colorNames["white"]=16777215;this._colorNames["whitesmoke"]=16119285;this._colorNames["gainsboro"]=14474460;this._colorNames["lightgrey"]=13882323;this._colorNames["silver"]=12632256;this._colorNames["darkgrey"]=11119017;this._colorNames["grey"]=8421504;this._colorNames["lightslategrey"]=7833753;this._colorNames["slategrey"]=7372944;this._colorNames["dimgrey"]=6908265;this._colorNames["darkslategrey"]=3100495;this._colorNames["black"]=0;this._colorNames["transparent"]=4278190080}if(this._colorNames[t]!=null)return this._colorNames[t];if(t.length==6&&this.isHex(t))return parseInt("0x"+t)}return null};i.color=function(t){var e=this.tryColor(t);if(e==null)throw new Dt("Can't cast to color: "+t);return e};i.tryClass=function(t){if(this._notClasses[t])return t;var e=this._classes[t];if(e!=null)return e;try{e=window[t];this._classes[t]=e;return e}catch(t){}this._notClasses[t]=true;return t};i.image2D=function(e){if(e==null)return null;if(typeof e=="string")e=this.tryClass(e);if(typeof e=="function"){try{e=new e}catch(t){e=new e(0,0)}}if(e instanceof q.Image2D)return e;if(e instanceof X.ImageTexture2D)e=e.image;throw new Dt("Can't cast to BitmapImage2D: "+e)};i.bitmapTexture=function(e){if(e==null)return null;if(typeof e=="string")e=this.tryClass(e);if(typeof e=="function"){try{e=new e}catch(t){e=new e(0,0)}}if(e instanceof X.ImageTexture2D)return e;try{var t=i.image2D(e);return new X.ImageTexture2D(t)}catch(t){}throw new Dt("Can't cast to ImageTexture2D: "+e)};i._hexChars="0123456789abcdefABCDEF";i._notClasses=new Object;i._classes=new Object;return i}();var Xt=function(){function t(t,e,i,r){var s=this;if(t===void 0){t=null}if(e===void 0){e=null}if(i===void 0){i=null}if(r===void 0){r=null}this._time=0;this._deltaTime=0;this._onProjectionChangedDelegate=function(t){return s._onProjectionChanged(t)};this._rendererClass=r||X.DefaultRenderer;this._pickGroup=o.PickGroup.getInstance();this.view=i||new o.View;this.partition=t||this._view.getNode(new c).partition;this.camera=e||new R}Object.defineProperty(t.prototype,"partition",{get:function(){return this._partition},set:function(t){if(this._partition==t)return;if(this._mousePicker)this._mouseManager.unregisterPicker(this._mousePicker);this._partition=t;this._mousePicker=this._pickGroup.getRaycastPicker(this._partition);this._tabPicker=this._pickGroup.getTabPicker(this._partition);this._mousePicker.findClosestCollision=true;this._mouseManager.registerPicker(this._mousePicker);if(this._camera){this._camera.clear();this._partition.invalidateEntity(this._camera.getAbstraction(this._partition))}},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"view",{get:function(){return this._view},set:function(t){if(this._view==t)return;if(this._view){if(this._renderer){this._renderer.clear();this._renderer=null}if(this._mousePicker)this._mouseManager.unregisterPicker(this._mousePicker)}this._view=t;this._mouseManager=Rt.getInstance(this._view.stage);if(this._mousePicker)this._mouseManager.registerPicker(this._mousePicker);if(this._camera)this._view.projection=this._camera.projection},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"renderer",{get:function(){if(!this._renderer)this._renderer=X.RenderGroup.getInstance(this._rendererClass).getRenderer(this._partition);return this._renderer},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"mouseX",{get:function(){return this._mouseX},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"mouseY",{get:function(){return this._mouseY},enumerable:true,configurable:true});t.prototype.getLocalMouseX=function(t){return t.getInverseMatrix3D().transformVector(this._view.unproject(this._view.stage.screenX,this._view.stage.screenY,1e3)).x};t.prototype.getLocalMouseY=function(t){return t.getInverseMatrix3D().transformVector(this._view.unproject(this._view.stage.screenX,this._view.stage.screenY,1e3)).y};t.prototype.getLocalTouchPoints=function(t){var e;var i=new Array;var r=this._view.stage.touchPoints.length;for(var s=0;s<r;s++){e=t.getInverseMatrix3D().transformVector(this._view.unproject(this._view.stage.touchPoints[s].x,this._view.stage.touchPoints[s].y,1e3));i.push(new q.TouchPoint(e.x,e.y,this._view.stage.touchPoints[s].id))}return i};Object.defineProperty(t.prototype,"rendererClass",{get:function(){return this._rendererClass},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"rendererType",{set:function(t){if(this._rendererClass==t)return;if(this._renderer){this._renderer.clear();this._renderer=null}this._rendererClass=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"camera",{get:function(){return this._camera},set:function(t){if(this._camera==t)return;if(this._camera){this._camera.clear();this._camera.removeEventListener(F.PROJECTION_CHANGED,this._onProjectionChangedDelegate)}this._camera=t;this._camera.addEventListener(F.PROJECTION_CHANGED,this._onProjectionChangedDelegate);if(this._view)this._view.projection=this._camera.projection;this._partition.invalidateEntity(this._camera.getAbstraction(this._partition))},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"deltaTime",{get:function(){return this._deltaTime},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"mouseManager",{get:function(){return this._mouseManager},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"mousePicker",{get:function(){return this._mousePicker},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"tabPicker",{get:function(){return this._tabPicker},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"renderedFacesCount",{get:function(){return 0},enumerable:true,configurable:true});t.prototype.fireMouseEvents=function(){if(!this.disableMouseEvents)this._mouseManager.fireMouseEvents(this._mousePicker)};t.prototype.render=function(t){if(t===void 0){t=true}this._updateTime();if(t&&!this.disableMouseEvents)this._mouseManager.fireMouseEvents(this._mousePicker);if(this.beforeRenderCallback)this.beforeRenderCallback();this.renderer.render()};t.prototype._updateTime=function(){var t=G.getTimer();if(this._time==0)this._time=t;this._deltaTime=t-this._time;this._time=t};t.prototype.dispose=function(){if(this._renderer){this._renderer.clear();this._renderer=null}this._mouseManager.dispose();this._mouseManager=null};t.prototype._onProjectionChanged=function(t){this._view.projection=this._camera.projection};return t}();Y.MaterialManager.materialClass=h.MethodMaterial;Y.MaterialManager.textureClass=X.ImageTexture2D;console.debug("AwayJS - Scene - 0.13.250");d.Timeline=E;d.ControllerBase=S;d.FirstPersonController=A;d.FollowController=D;d.HoverController=P;d.LookAtController=T;d.SpringController=I;d.Billboard=C;d._Render_Billboard=M;d.Camera=R;d.DisplayObject=u;d.DisplayObjectContainer=c;d.LineSegment=L;d._Render_LineSegment=k;d.LoaderContainer=B;d.MorphSprite=p;d.MovieClip=H;d.SimpleButton=W;d.Skybox=Q;d._Render_Skybox=$;d._Render_SkyboxMaterial=J;d.Sprite=f;d.TextField=Pt;d.TextSprite=xt;d.CastError=Dt;d.CameraEvent=F;d.FocusEvent=It;d.KeyboardEvent=yt;d.MouseEvent=V;d.ResizeEvent=Ct;d.TextfieldEvent=bt;d.SkyboxElements=z;d._Render_SkyboxElements=K;d._Stage_SkyboxElements=Z;d.DefaultSceneGraphFactory=Mt;d.SceneImage2D=Ft;d.FrameScriptManager=U;d.DefaultFontManager=dt;d.DeviceFontManager=pt;d.MouseManager=Rt;d.PrefabBase=i;d.PrimitiveCapsulePrefab=Nt;d.PrimitiveConePrefab=kt;d.PrimitiveCubePrefab=n;d.PrimitiveCylinderPrefab=Lt;d.PrimitivePlanePrefab=jt;d.PrimitivePolygonPrefab=Bt;d.PrimitivePrefabBase=s;d.PrimitiveSpherePrefab=a;d.PrimitiveTorusPrefab=Ut;d.AntiAliasType=Vt;d.BitmapFontChar=ct;d.BitmapFontTable=_t;d.FNTGenerator=Ht;d.Font=ft;d.GridFitType=Wt;d.HTMLTextProcessor=St;d.TesselatedFontTable=ut;d.TesselatedFontChar=st;d.TextFieldAutoSize=et;d.TextFieldType=it;d.TextFormat=mt;d.TextFormatAlign=rt;d.TextInteractionMode=zt;d.TextLineMetrics=vt;d.Merge=Gt;d.Cast=Yt;d.Scene=Xt;d.Settings=b;Object.defineProperty(d,"__esModule",{value:true})});
1
+ (function(t,e){typeof exports==="object"&&typeof module!=="undefined"?e(exports,require("@awayjs/core"),require("@awayjs/stage"),require("@awayjs/view"),require("@awayjs/graphics"),require("@awayjs/renderer"),require("@awayjs/materials"),require("node-html-parser")):typeof define==="function"&&define.amd?define(["exports","@awayjs/core","@awayjs/stage","@awayjs/view","@awayjs/graphics","@awayjs/renderer","@awayjs/materials","node-html-parser"],e):e(t.AwayjsScene=t.AwayjsScene||{},t.AwayjsCore,t.AwayjsStage,t.AwayjsView,t.AwayjsGraphics,t.AwayjsRenderer,t.AwayjsMaterials,t.nodeHtmlParser)})(this,function(d,G,q,o,Y,X,h,y){"use strict";var r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)if(e.hasOwnProperty(i))t[i]=e[i]};function g(t,e){r(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}function t(t,e){var i=typeof Symbol==="function"&&t[Symbol.iterator];if(!i)return t;var r=i.call(t),s,n=[],o;try{while((e===void 0||e-- >0)&&!(s=r.next()).done)n.push(s.value)}catch(t){o={error:t}}finally{try{if(s&&!s.done&&(i=r["return"]))i.call(r)}finally{if(o)throw o.error}}return n}function e(t){return this instanceof e?(this.v=t,this):new e(t)}var i=function(e){g(t,e);function t(){var t=e.call(this)||this;t._pObjects=new Array;return t}t.prototype.getNewObject=function(){var t=this._pCreateObject();this._pObjects.push(t);return t};t.prototype._pCreateObject=function(){throw new G.AbstractMethodError};t.prototype._iValidate=function(){};return t}(G.AssetBase);var s=function(s){g(t,s);function t(t,e){if(t===void 0){t=null}if(e===void 0){e="triangle"}var i=s.call(this)||this;i._primitiveDirty=true;i._uvDirty=true;i._scaleU=1;i._scaleV=1;i._material=t;i._elementsType=e;if(i._elementsType==X.ElementsType.TRIANGLE){var r=new X.TriangleElements(new q.AttributesBuffer);r.autoDeriveNormals=false;r.autoDeriveTangents=false;i._elements=r}else if(i._elementsType==X.ElementsType.LINE){i._elements=new X.LineElements(new q.AttributesBuffer)}return i}Object.defineProperty(t.prototype,"assetType",{get:function(){return t.assetType},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"elementsType",{get:function(){return this._elementsType},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"material",{get:function(){return this._material},set:function(t){if(t==this._material)return;this._material=t;var e=this._pObjects.length;for(var i=0;i<e;i++)this._pObjects[i].material=this._material},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"scaleU",{get:function(){return this._scaleU},set:function(t){if(this._scaleU==t)return;this._scaleU=t;this._pInvalidateUVs()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"scaleV",{get:function(){return this._scaleV},set:function(t){if(this._scaleV==t)return;this._scaleV=t;this._pInvalidateUVs()},enumerable:true,configurable:true});t.prototype._pBuildGraphics=function(t,e){throw new G.AbstractMethodError};t.prototype._pBuildUVs=function(t,e){throw new G.AbstractMethodError};t.prototype._pInvalidatePrimitive=function(){this._primitiveDirty=true};t.prototype._pInvalidateUVs=function(){this._uvDirty=true};t.prototype.updateGraphics=function(){this._pBuildGraphics(this._elements,this._elementsType);this._primitiveDirty=false};t.prototype.updateUVs=function(){this._pBuildUVs(this._elements,this._elementsType);this._uvDirty=false};t.prototype._iValidate=function(){if(this._primitiveDirty)this.updateGraphics();if(this._uvDirty)this.updateUVs()};t.prototype._pCreateObject=function(){var t=new f(null,this._material);t.graphics.addShape(Y.Shape.getShape(this._elements));t._iSourcePrefab=this;return t};t.assetType="[asset PrimitivePrefab]";return t}(i);var n=function(u){g(t,u);function t(t,e,i,r,s,n,o,a,h){if(t===void 0){t=null}if(e===void 0){e="triangle"}if(i===void 0){i=100}if(r===void 0){r=100}if(s===void 0){s=100}if(n===void 0){n=1}if(o===void 0){o=1}if(a===void 0){a=1}if(h===void 0){h=true}var l=u.call(this,t,e)||this;l._width=i;l._height=r;l._depth=s;l._segmentsW=n;l._segmentsH=o;l._segmentsD=a;l._tile6=h;return l}Object.defineProperty(t.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"depth",{get:function(){return this._depth},set:function(t){this._depth=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"tile6",{get:function(){return this._tile6},set:function(t){this._tile6=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"segmentsW",{get:function(){return this._segmentsW},set:function(t){this._segmentsW=t;this._pInvalidatePrimitive();this._pInvalidateUVs()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"segmentsH",{get:function(){return this._segmentsH},set:function(t){this._segmentsH=t;this._pInvalidatePrimitive();this._pInvalidateUVs()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"segmentsD",{get:function(){return this._segmentsD},set:function(t){this._segmentsD=t;this._pInvalidatePrimitive();this._pInvalidateUVs()},enumerable:true,configurable:true});t.prototype._pBuildGraphics=function(t,e){var i;var r;var s;var n;var o;var a,h,l,u;var c,_,f=0;var p,d;var g,m,v;var y;var b=this._width/2;var x=this._height/2;var w=this._depth/2;if(e==X.ElementsType.TRIANGLE){var E=t;var S=((this._segmentsW+1)*(this._segmentsH+1)+(this._segmentsW+1)*(this._segmentsD+1)+(this._segmentsH+1)*(this._segmentsD+1))*2;var A=(this._segmentsW*this._segmentsH+this._segmentsW*this._segmentsD+this._segmentsH*this._segmentsD)*12;if(S==E.numVertices&&E.indices!=null){E.invalidateIndices();E.invalidateVertices(E.positions);E.invalidateVertices(E.normals);E.invalidateVertices(E.tangents)}else{E.setIndices(new Uint16Array(A));E.setPositions(new Float32Array(S*3));E.setNormals(new Float32Array(S*3));E.setTangents(new Float32Array(S*3));this._pInvalidateUVs()}i=E.indices.get(E.numElements);r=E.positions.get(S);s=E.normals.get(S);n=E.tangents.get(S);o=E.concatenatedBuffer.stride/4;p=0;d=0;g=this._width/this._segmentsW;m=this._height/this._segmentsH;v=this._depth/this._segmentsD;for(c=0;c<=this._segmentsW;c++){y=-b+c*g;for(_=0;_<=this._segmentsH;_++){r[p]=y;r[p+1]=-x+_*m;r[p+2]=-w;s[p]=0;s[p+1]=0;s[p+2]=-1;n[p]=1;n[p+1]=0;n[p+2]=0;p+=o;r[p]=y;r[p+1]=-x+_*m;r[p+2]=w;s[p]=0;s[p+1]=0;s[p+2]=1;n[p]=-1;n[p+1]=0;n[p+2]=0;p+=o;if(c&&_){a=2*((c-1)*(this._segmentsH+1)+(_-1));h=2*(c*(this._segmentsH+1)+(_-1));l=a+2;u=h+2;i[d++]=a;i[d++]=l;i[d++]=u;i[d++]=a;i[d++]=u;i[d++]=h;i[d++]=h+1;i[d++]=u+1;i[d++]=l+1;i[d++]=h+1;i[d++]=l+1;i[d++]=a+1}}}f+=2*(this._segmentsW+1)*(this._segmentsH+1);for(c=0;c<=this._segmentsW;c++){y=-b+c*g;for(_=0;_<=this._segmentsD;_++){r[p]=y;r[p+1]=x;r[p+2]=-w+_*v;s[p]=0;s[p+1]=1;s[p+2]=0;n[p]=1;n[p+1]=0;n[p+2]=0;p+=o;r[p]=y;r[p+1]=-x;r[p+2]=-w+_*v;s[p]=0;s[p+1]=-1;s[p+2]=0;n[p]=1;n[p+1]=0;n[p+2]=0;p+=o;if(c&&_){a=f+2*((c-1)*(this._segmentsD+1)+(_-1));h=f+2*(c*(this._segmentsD+1)+(_-1));l=a+2;u=h+2;i[d++]=a;i[d++]=l;i[d++]=u;i[d++]=a;i[d++]=u;i[d++]=h;i[d++]=h+1;i[d++]=u+1;i[d++]=l+1;i[d++]=h+1;i[d++]=l+1;i[d++]=a+1}}}f+=2*(this._segmentsW+1)*(this._segmentsD+1);for(c=0;c<=this._segmentsD;c++){y=w-c*v;for(_=0;_<=this._segmentsH;_++){r[p]=-b;r[p+1]=-x+_*m;r[p+2]=y;s[p]=-1;s[p+1]=0;s[p+2]=0;n[p]=0;n[p+1]=0;n[p+2]=-1;p+=o;r[p]=b;r[p+1]=-x+_*m;r[p+2]=y;s[p]=1;s[p+1]=0;s[p+2]=0;n[p]=0;n[p+1]=0;n[p+2]=1;p+=o;if(c&&_){a=f+2*((c-1)*(this._segmentsH+1)+(_-1));h=f+2*(c*(this._segmentsH+1)+(_-1));l=a+2;u=h+2;i[d++]=a;i[d++]=l;i[d++]=u;i[d++]=a;i[d++]=u;i[d++]=h;i[d++]=h+1;i[d++]=u+1;i[d++]=l+1;i[d++]=h+1;i[d++]=l+1;i[d++]=a+1}}}}else if(e==X.ElementsType.LINE){var T=t;var P=this._segmentsH*4+this._segmentsW*4+this._segmentsD*4;r=new Float32Array(P*6);var D=new Float32Array(P);p=0;d=0;for(c=0;c<this._segmentsH;++c){r[p++]=-b;r[p++]=c*this._height/this._segmentsH-x;r[p++]=-w;r[p++]=b;r[p++]=c*this._height/this._segmentsH-x;r[p++]=-w;D[d++]=1;r[p++]=-b;r[p++]=x-c*this._height/this._segmentsH;r[p++]=w;r[p++]=b;r[p++]=x-c*this._height/this._segmentsH;r[p++]=w;D[d++]=1}for(c=0;c<this._segmentsW;++c){r[p++]=c*this._width/this._segmentsW-b;r[p++]=-x;r[p++]=-w;r[p++]=c*this._width/this._segmentsW-b;r[p++]=x;r[p++]=-w;D[d++]=1;r[p++]=b-c*this._width/this._segmentsW;r[p++]=-x;r[p++]=w;r[p++]=b-c*this._width/this._segmentsW;r[p++]=x;r[p++]=w;D[d++]=1}for(c=0;c<this._segmentsH;++c){r[p++]=-b;r[p++]=c*this._height/this._segmentsH-x;r[p++]=-w;r[p++]=-b;r[p++]=c*this._height/this._segmentsH-x;r[p++]=w;D[d++]=1;r[p++]=b;r[p++]=x-c*this._height/this._segmentsH;r[p++]=-w;r[p++]=b;r[p++]=x-c*this._height/this._segmentsH;r[p++]=w;D[d++]=1}for(c=0;c<this._segmentsD;++c){r[p++]=b;r[p++]=-x;r[p++]=c*this._depth/this._segmentsD-w;r[p++]=b;r[p++]=x;r[p++]=c*this._depth/this._segmentsD-w;D[d++]=1;r[p++]=-b;r[p++]=-x;r[p++]=w-c*this._depth/this._segmentsD;r[p++]=-b;r[p++]=x;r[p++]=w-c*this._depth/this._segmentsD;D[d++]=1}for(c=0;c<this._segmentsD;++c){r[p++]=-b;r[p++]=-x;r[p++]=w-c*this._depth/this._segmentsD;r[p++]=b;r[p++]=-x;r[p++]=w-c*this._depth/this._segmentsD;D[d++]=1;r[p++]=-b;r[p++]=x;r[p++]=c*this._depth/this._segmentsD-w;r[p++]=b;r[p++]=x;r[p++]=c*this._depth/this._segmentsD-w;D[d++]=1}for(c=0;c<this._segmentsW;++c){r[p++]=b-c*this._width/this._segmentsW;r[p++]=-x;r[p++]=-w;r[p++]=b-c*this._width/this._segmentsW;r[p++]=-x;r[p++]=w;D[d++]=1;r[p++]=c*this._width/this._segmentsW-b;r[p++]=x;r[p++]=-w;r[p++]=c*this._width/this._segmentsW-b;r[p++]=x;r[p++]=w;D[d++]=1}T.setPositions(r);T.setThickness(D)}};t.prototype._pBuildUVs=function(t,e){var i,r,s;var n;var o;var a,h;var l,u;var c,_;var f,p;var d,g;var m;if(e==X.ElementsType.TRIANGLE){m=((this._segmentsW+1)*(this._segmentsH+1)+(this._segmentsW+1)*(this._segmentsD+1)+(this._segmentsH+1)*(this._segmentsD+1))*2;var v=t;if(v.uvs&&m==v.numVertices){v.invalidateVertices(v.uvs)}else{v.setUVs(new Float32Array(m*2))}n=v.uvs.get(m);o=v.uvs.stride;if(this._tile6){a=l=1/3;h=u=1/2}else{a=h=1;l=u=0}s=0;c=1*l;_=1*u;f=2*l;p=0*u;d=a/this._segmentsW;g=h/this._segmentsH;for(i=0;i<=this._segmentsW;i++){for(r=0;r<=this._segmentsH;r++){n[s]=(c+i*d)*this._scaleU;n[s+1]=(_+(h-r*g))*this._scaleV;s+=o;n[s]=(f+(a-i*d))*this._scaleU;n[s+1]=(p+(h-r*g))*this._scaleV;s+=o}}c=1*l;_=0*u;f=0*l;p=0*u;d=a/this._segmentsW;g=h/this._segmentsD;for(i=0;i<=this._segmentsW;i++){for(r=0;r<=this._segmentsD;r++){n[s]=(c+i*d)*this._scaleU;n[s+1]=(_+(h-r*g))*this._scaleV;s+=o;n[s]=(f+i*d)*this._scaleU;n[s+1]=(p+r*g)*this._scaleV;s+=o}}c=0*l;_=1*u;f=2*l;p=1*u;d=a/this._segmentsD;g=h/this._segmentsH;for(i=0;i<=this._segmentsD;i++){for(r=0;r<=this._segmentsH;r++){n[s]=(c+i*d)*this._scaleU;n[s+1]=(_+(h-r*g))*this._scaleV;s+=o;n[s]=(f+(a-i*d))*this._scaleU;n[s+1]=(p+(h-r*g))*this._scaleV;s+=o}}}else if(e==X.ElementsType.LINE){}};return t}(s);var a=function(a){g(t,a);function t(t,e,i,r,s,n){if(t===void 0){t=null}if(e===void 0){e="triangle"}if(i===void 0){i=50}if(r===void 0){r=16}if(s===void 0){s=12}if(n===void 0){n=true}var o=a.call(this,t,e)||this;o._radius=i;o._segmentsW=r;o._segmentsH=s;o._yUp=n;return o}Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(t){this._radius=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"segmentsW",{get:function(){return this._segmentsW},set:function(t){this._segmentsW=t;this._pInvalidatePrimitive();this._pInvalidateUVs()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"segmentsH",{get:function(){return this._segmentsH},set:function(t){this._segmentsH=t;this._pInvalidatePrimitive();this._pInvalidateUVs()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"yUp",{get:function(){return this._yUp},set:function(t){this._yUp=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});t.prototype._pBuildGraphics=function(t,e){var i;var r;var s;var n;var o;var a;var h;var l,u;var c;var _;var f;if(e==X.ElementsType.TRIANGLE){var p=t;f=(this._segmentsH+1)*(this._segmentsW+1);if(f==p.numVertices&&p.indices!=null){p.invalidateIndices();p.invalidateVertices(p.positions);p.invalidateVertices(p.normals);p.invalidateVertices(p.tangents)}else{p.setIndices(new Uint16Array((this._segmentsH-1)*this._segmentsW*6));p.setPositions(new Float32Array(f*3));p.setNormals(new Float32Array(f*3));p.setTangents(new Float32Array(f*3));this._pInvalidateUVs()}i=p.indices.get(p.numElements);r=p.positions.get(f);s=p.normals.get(f);n=p.tangents.get(f);o=p.concatenatedBuffer.stride/4;l=0;u=0;var d=void 0;var g=void 0;var m=void 0;for(h=0;h<=this._segmentsH;++h){d=l;var v=Math.PI*h/this._segmentsH;var y=-this._radius*Math.cos(v);var b=this._radius*Math.sin(v);for(a=0;a<=this._segmentsW;++a){var x=2*Math.PI*a/this._segmentsW;var w=b*Math.cos(x);var E=b*Math.sin(x);var S=1/Math.sqrt(w*w+E*E+y*y);var A=Math.sqrt(E*E+w*w);if(this._yUp){g=0;m=A>.007?w/A:0;c=-y;_=E}else{g=A>.007?w/A:0;m=0;c=E;_=y}if(a==this._segmentsW){r[l]=r[d];r[l+1]=r[d+1];r[l+2]=r[d+2];s[l]=s[d]+w*S*.5;s[l+1]=s[d+1]+c*S*.5;s[l+2]=s[d+2]+_*S*.5;n[l]=A>.007?-E/A:1;n[l+1]=g;n[l+2]=m}else{r[l]=w;r[l+1]=c;r[l+2]=_;s[l]=w*S;s[l+1]=c*S;s[l+2]=_*S;n[l]=A>.007?-E/A:1;n[l+1]=g;n[l+2]=m}if(a>0&&h>0){var T=(this._segmentsW+1)*h+a;var P=(this._segmentsW+1)*h+a-1;var D=(this._segmentsW+1)*(h-1)+a-1;var I=(this._segmentsW+1)*(h-1)+a;if(h==this._segmentsH){r[l]=r[d];r[l+1]=r[d+1];r[l+2]=r[d+2];i[u++]=T;i[u++]=D;i[u++]=I}else if(h==1){i[u++]=T;i[u++]=P;i[u++]=D}else{i[u++]=T;i[u++]=P;i[u++]=D;i[u++]=T;i[u++]=D;i[u++]=I}}l+=o}}}else if(e==X.ElementsType.LINE){var C=t;var M=this._segmentsH*this._segmentsW*2+this._segmentsW;var O=new Float32Array(M*6);var F=new Float32Array(M);l=0;u=0;for(h=0;h<=this._segmentsH;++h){var v=Math.PI*h/this._segmentsH;var y=-this._radius*Math.cos(v);var b=this._radius*Math.sin(v);for(a=0;a<=this._segmentsW;++a){var x=2*Math.PI*a/this._segmentsW;var w=b*Math.cos(x);var E=b*Math.sin(x);if(this._yUp){c=-y;_=E}else{c=E;_=y}if(a>0){O[l++]=w;O[l++]=c;O[l++]=_;F[u++]=1;if(h>0){var R=h==1?3-(6*(this._segmentsW-a)+12*a):3-this._segmentsW*12;O[l]=O[l+++R];O[l]=O[l+++R];O[l]=O[l+++R];O[l++]=w;O[l++]=c;O[l++]=_;F[u++]=1}}if(a<this._segmentsW){O[l++]=w;O[l++]=c;O[l++]=_}}}C.setPositions(O);C.setThickness(F)}};t.prototype._pBuildUVs=function(t,e){var i,r;var s=(this._segmentsH+1)*(this._segmentsW+1);var n;var o;if(e==X.ElementsType.TRIANGLE){s=(this._segmentsH+1)*(this._segmentsW+1);var a=t;if(a.uvs&&s==a.numVertices){a.invalidateVertices(a.uvs)}else{a.setUVs(new Float32Array(s*2))}n=a.uvs.get(s);o=a.uvs.stride;var h=0;for(r=0;r<=this._segmentsH;++r){for(i=0;i<=this._segmentsW;++i){n[h]=i/this._segmentsW*this._scaleU;n[h+1]=r/this._segmentsH*this._scaleV;h+=o}}}else if(e==X.ElementsType.LINE){}};return t}(s);var l;var b=G.ConfigManager.instance.addStore("scene",{ALLOW_FORCE_MSAA:8,MSAA_MINIMAL_IMAGE_SIZE:300,ALLOW_APPROXIMATION:0,USE_UNSAFE_CACHE_AS_BITMAP:false,USE_UNSAFE_SCALE_9_SLICE:false,USE_UNSAFE_FILTERS:false,USE_UNSAFE_BLENDS:false,REMAP_BLEND_MODE:true,BLEND_MODE_REMAP_TABLE:(l={},l[q.BlendMode.DARKEN]=q.BlendMode.MULTIPLY,l),CPU_COPY_PIXELS_COUNT:64*64,FONT_TESSELATION_QUALITY:1/10,USE_UNSAFE_FNT:false,TEXT_SHAPE_ROUND_PRECISION:.1});var u=function(t){g(e,t);function e(){var e=t.call(this)||this;e._mouseChildren=true;e._sessionID=-1;e._avmDepthID=-1;e._alignmentMode=o.AlignmentMode.REGISTRATION_POINT;e._visible=true;e._maskId=-1;e._mouseEnabled=true;e._maskMode=false;e.isSlice9ScaledMC=false;e.isSlice9ScaledSprite=false;e.isAVMScene=false;e.placeObjectTag=null;e._blendMode="";e.castsShadows=true;e._filters=null;e.orientationMode=o.OrientationMode.DEFAULT;e.zOffset=0;e.hasDispatchedAddedToStage=false;e.cursorType="";e._isInFocus=false;e._tabEnabled=false;e._tabIndex=-1;e._avmDepthID=-1;e._onInvalidatePropertiesDelegate=function(t){return e._onInvalidateProperties(t)};e._onInvalidateImagesDelegate=function(t){return e._onInvalidateImages(t)};e._transform=new G.Transform(null);e._transform.addEventListener(G.TransformEvent.INVALIDATE_MATRIX3D,function(t){return e._invalidateHierarchicalProperty(o.HierarchicalProperty.SCENE_TRANSFORM)});e._transform.addEventListener(G.TransformEvent.INVALIDATE_COLOR_TRANSFORM,function(t){return e._invalidateHierarchicalProperty(o.HierarchicalProperty.COLOR_TRANSFORM)});e._defaultBoundingVolume=e._getDefaultBoundingVolume();return e}e.prototype.getScriptPrecedence=function(){if(!this._parent){return[]}var t=this._parent.getScriptPrecedence();if(this.placeObjectTag){t.push(this.placeObjectTag.actionBlocksPrecedence)}return t};e.prototype.getMouseCursor=function(){return"initial"};Object.defineProperty(e.prototype,"tabEnabled",{get:function(){return this._tabEnabled},set:function(t){this._tabEnabled=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"tabIndex",{get:function(){return this._tabIndex},set:function(t){this._tabIndex=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"isInFocus",{get:function(){return this._isInFocus},set:function(t){this._isInFocus=t},enumerable:true,configurable:true});e.prototype.setFocus=function(t,e,i){if(e===void 0){e=false}if(i===void 0){i=true}if(this._isInFocus==t)return;this._isInFocus=t};Object.defineProperty(e.prototype,"alignmentMode",{get:function(){return this._alignmentMode},set:function(t){if(this._alignmentMode==t)return;this._alignmentMode=t;this._invalidateHierarchicalProperty(o.HierarchicalProperty.SCENE_TRANSFORM)},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"alpha",{get:function(){return this._transform.colorTransform.alphaMultiplier},set:function(t){this._transform.colorTransform.alphaMultiplier=t;this._transform.invalidateColorTransform()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"blendMode",{get:function(){if(!b.USE_UNSAFE_BLENDS){return""}if(b.REMAP_BLEND_MODE){return b.BLEND_MODE_REMAP_TABLE[this._blendMode]||this._blendMode}return this._blendMode},set:function(t){if(this._blendMode===t){return}this._blendMode=t;if(t===q.BlendMode.OVERLAY){this._transform.invalidateColorTransform()}},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"defaultBoundingVolume",{get:function(){return this._defaultBoundingVolume},set:function(t){if(this._defaultBoundingVolume==t)return;this._defaultBoundingVolume=t;if(this._boundsPrimitive){this._boundsPrimitive.dispose();this._boundsPrimitive=null}this.invalidate()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"cacheAsBitmap",{get:function(){return this._bitmapCache},set:function(t){if(t===this._bitmapCache){return}if(!b.USE_UNSAFE_CACHE_AS_BITMAP){return}t&&console.warn("[@scene/DisplayObject] Unsafe cacheAsBitmap is enabled!"+"You can disable it by `Settings.USE_UNSAFE_CACHE_AS_BITMAP = false`",this.id);this._bitmapCache=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"eulers",{get:function(){if(!this._eulers)this._eulers=new G.Vector3D;this._eulers.x=this.rotationX;this._eulers.y=this.rotationY;this._eulers.z=this.rotationZ;return this._eulers},set:function(t){this._transform.rotation.x=t.x;this._transform.rotation.y=t.y;this._transform.rotation.z=t.z;this._transform.invalidateMatrix3D()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"filters",{get:function(){return this._filters},set:function(t){if(!b.USE_UNSAFE_FILTERS){return}this._filters=t;this._invalidateStyle()},enumerable:true,configurable:true});e.prototype.updateFilters=function(t){console.warn("[scene/DisplayObject] - updateFilters is just a stub")};Object.defineProperty(e.prototype,"index",{get:function(){if(this._parent)return this._parent.getChildIndex(this);return 0},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"loader",{get:function(){return this._loader},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"mask",{set:function(t){this.scriptMask=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"maskMode",{get:function(){return this._maskMode},set:function(t){if(this._maskMode==t)return;this._maskMode=t;this._maskId=t?this.id:-1;this._updateMaskMode()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"pickObject",{get:function(){return this._pickObject},set:function(t){if(this._pickObject==t)return;this._pickObject=t.pickObjectFromTimeline?t.clone():t;if(this._pickObject){this._pickObject.mouseChildren=false;this._pickObject.mouseEnabled=false}},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"mouseEnabled",{get:function(){return this._mouseEnabled},set:function(t){if(this._mouseEnabled==t)return;this._mouseEnabled=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"mouseX",{get:function(){return this._mouseX},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"mouseY",{get:function(){return this._mouseY},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"name",{get:function(){return this._pName?this._pName:""},set:function(t){this._pName=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"registrationPoint",{get:function(){if(this._registrationMatrix3D)return new G.Vector3D(-this._registrationMatrix3D._rawData[12]*this.scaleX,-this._registrationMatrix3D._rawData[13]*this.scaleY,-this._registrationMatrix3D._rawData[14]*this.scaleZ);return null},set:function(t){if(!t){if(!this._registrationMatrix3D)return;this._registrationMatrix3D._rawData[12]=0;this._registrationMatrix3D._rawData[13]=0;this._registrationMatrix3D._rawData[14]=0;if(this._registrationMatrix3D.isIdentity())this._registrationMatrix3D=null}else{if(!this._registrationMatrix3D)this._registrationMatrix3D=new G.Matrix3D;this._registrationMatrix3D._rawData[12]=-t.x/this._transform.scale.x;this._registrationMatrix3D._rawData[13]=-t.y/this._transform.scale.y;this._registrationMatrix3D._rawData[14]=-t.z/this._transform.scale.z}this._registrationMatrix3D.invalidatePosition();this._invalidateHierarchicalProperty(o.HierarchicalProperty.SCENE_TRANSFORM)},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"registrationScale",{get:function(){if(this._registrationMatrix3D)return new G.Vector3D(this._registrationMatrix3D._rawData[0],this._registrationMatrix3D._rawData[5],this._registrationMatrix3D._rawData[10]);return null},set:function(t){if(!t){if(!this._registrationMatrix3D)return;this._registrationMatrix3D._rawData[0]=1;this._registrationMatrix3D._rawData[5]=1;this._registrationMatrix3D._rawData[10]=1;if(this._registrationMatrix3D.isIdentity())this._registrationMatrix3D=null}else{if(!this._registrationMatrix3D)this._registrationMatrix3D=new G.Matrix3D;this._registrationMatrix3D._rawData[0]=t.x;this._registrationMatrix3D._rawData[5]=t.y;this._registrationMatrix3D._rawData[10]=t.z}this._invalidateHierarchicalProperty(o.HierarchicalProperty.SCENE_TRANSFORM)},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"rotationX",{get:function(){return this._transform.rotation.x*G.MathConsts.RADIANS_TO_DEGREES},set:function(t){if(this.rotationX==t)return;this._transform.rotation.x=t*G.MathConsts.DEGREES_TO_RADIANS;this._transform.invalidateMatrix3D()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"rotationY",{get:function(){return this._transform.rotation.y*G.MathConsts.RADIANS_TO_DEGREES},set:function(t){if(this.rotationY==t)return;this._transform.rotation.y=t*G.MathConsts.DEGREES_TO_RADIANS;this._transform.invalidateMatrix3D()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"rotationZ",{get:function(){return this._transform.rotation.z*G.MathConsts.RADIANS_TO_DEGREES},set:function(t){if(this.rotationZ==t)return;this._transform.rotation.z=t*G.MathConsts.DEGREES_TO_RADIANS;this._transform.invalidateMatrix3D()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"scale9Grid",{get:function(){return this._scale9Grid},set:function(t){this._scale9Grid=t;this._invalidateHierarchicalProperty(o.HierarchicalProperty.SCALE9)},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"scaleX",{get:function(){return this._transform.scale.x},set:function(t){this._setScaleX(t)},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"scaleY",{get:function(){return this._transform.scale.y},set:function(t){this._setScaleY(t)},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"scaleZ",{get:function(){return this._transform.scale.z},set:function(t){this._setScaleZ(t)},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"skewX",{get:function(){return this._transform.skew.x},set:function(t){if(this.skewX==t)return;this._transform.skew.x=t;this._transform.invalidateMatrix3D()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"skewY",{get:function(){return this._transform.skew.y},set:function(t){if(this.skewY==t)return;this._transform.skew.y=t;this._transform.invalidateMatrix3D()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"skewZ",{get:function(){return this._transform.skew.z},set:function(t){if(this.skewZ==t)return;this._transform.skew.z=t;this._transform.invalidateMatrix3D()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"scrollRect",{get:function(){return this._scrollRect},set:function(t){this._scrollRect=t;if(!t&&this._scrollRectPrimitive){var e=this.masks.indexOf(this._scrollRectPrimitive);this.masks.splice(e,1);this._scrollRectPrimitive=null}this._transform.invalidatePosition();this._scrollRectPrimitiveDirty=true},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"material",{get:function(){return this._material},set:function(t){if(this._material==t)return;this._material=t;this._invalidateMaterial()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"style",{get:function(){return this._style},set:function(t){if(this._style==t)return;if(this._style){this._style.removeEventListener(X.StyleEvent.INVALIDATE_PROPERTIES,this._onInvalidatePropertiesDelegate);this._style.removeEventListener(X.StyleEvent.INVALIDATE_IMAGES,this._onInvalidateImagesDelegate)}this._style=t;if(this._style){this._style.addEventListener(X.StyleEvent.INVALIDATE_PROPERTIES,this._onInvalidatePropertiesDelegate);this._style.addEventListener(X.StyleEvent.INVALIDATE_IMAGES,this._onInvalidateImagesDelegate)}this._invalidateStyle()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"boundsVisible",{get:function(){return this._boundsVisible},set:function(t){if(t==this._boundsVisible)return;this._boundsVisible=t;this.invalidate()},enumerable:true,configurable:true});e.prototype.getScrollRectPrimitive=function(){if(this._scrollRectPrimitiveDirty){this._scrollRectPrimitiveDirty=false;if(!this._scrollRectPrimitive){this._scrollRectPrimitive=new f;this._scrollRectPrimitive.maskMode=true;if(!this.masks)this.masks=[];this.masks.push(this._scrollRectPrimitive)}this._scrollRectPrimitive.graphics.clear();this._scrollRectPrimitive.graphics.beginFill(255,1);this._scrollRectPrimitive.graphics.drawRect(0,0,this._scrollRect.width,this._scrollRect.height);this._scrollRectPrimitive.graphics.endFill()}return this._scrollRectPrimitive};e.prototype.getBoundsPrimitive=function(t){if(this._boundsPrimitive==null){switch(this._defaultBoundingVolume){case o.BoundingVolumeType.BOX:case o.BoundingVolumeType.BOX_BOUNDS:case o.BoundingVolumeType.BOX_BOUNDS_FAST:case o.BoundingVolumeType.BOX_FAST:this._boundsPrefab=new n(null,X.ElementsType.LINE);this._boundsPrimitive=this._boundsPrefab.getNewObject();break;case o.BoundingVolumeType.SPHERE:case o.BoundingVolumeType.SPHERE_BOUNDS:case o.BoundingVolumeType.SPHERE_BOUNDS_FAST:case o.BoundingVolumeType.SPHERE_FAST:this._boundsPrefab=new a(null,X.ElementsType.LINE);this._boundsPrimitive=this._boundsPrefab.getNewObject();break;default:}this._boundsPrefabDirty=true}if(this._boundsPrefabDirty)this._updateBoundsPrefab(t);return this._boundsPrimitive};Object.defineProperty(e.prototype,"transform",{get:function(){return this._transform},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},set:function(t){if(this._visible==t)return;this._visible=t;this._invalidateHierarchicalProperty(o.HierarchicalProperty.VISIBLE)},enumerable:true,configurable:true});e.prototype._mergeMasks=function(t,e){if(!t&&!e)return;if(!t&&e)return[e];if(e&&!t.includes(e))t.push(e);return t};e.prototype._setMasks=function(t){var e=this._masks?this._masks:[];if(t){for(var i=t.length-1;i>=0;i--){var r=t[i];if(!r){console.warn("[DisplayObject] Timeline mask has null value, skipping it");t.splice(i,1)}else{var s=e.indexOf(r);if(s!=-1){e.splice(s,1)}else{r.maskMode=true}}}}for(var i=e.length-1;i>=0;i--)e[i].maskMode=false;this._masks=t};Object.defineProperty(e.prototype,"scriptMask",{get:function(){return this._scriptMask},set:function(t){if(t===this._scriptMask)return;if(this._scriptMask){var e=this._masks.indexOf(this._scriptMask);if(e!==-1){this._masks.splice(e,1);this._scriptMask.maskMode=false}}this._scriptMask=t;this._masks=this._mergeMasks(this._masks,t);if(t)t.maskMode=true;this._invalidateHierarchicalProperty(o.HierarchicalProperty.MASKS)},enumerable:true,configurable:true});e.prototype.updateTimelineMask=function(t){this._setMasks(this._mergeMasks(t,this._scriptMask));this._invalidateHierarchicalProperty(o.HierarchicalProperty.MASKS)};Object.defineProperty(e.prototype,"masks",{get:function(){return this._masks},set:function(t){if(this._masks==t)return;if(!t||!t.length){this._scriptMask=null}else{var e=t.length;var i=false;for(var r=0;r<e;r++)i=i||t[r]===this._scriptMask;if(this._scriptMask&&!i)this._scriptMask=null}this._setMasks(t);this._invalidateHierarchicalProperty(o.HierarchicalProperty.MASKS)},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"mouseChildren",{get:function(){return this._mouseChildren},set:function(t){if(this._mouseChildren==t)return;this._mouseChildren=t;this._invalidateHierarchicalProperty(o.HierarchicalProperty.MOUSE_ENABLED)},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"x",{get:function(){return this._transform.position.x},set:function(t){if(this._transform.position.x==t)return;this._transform.matrix3D._rawData[12]=t;this._transform.invalidatePosition()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"y",{get:function(){return this._transform.position.y},set:function(t){if(this._transform.position.y==t)return;this._transform.matrix3D._rawData[13]=t;this._transform.invalidatePosition()},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"z",{get:function(){return this._transform.position.z},set:function(t){if(this._transform.position.z==t)return;this._transform.matrix3D._rawData[14]=t;this._transform.invalidatePosition()},enumerable:true,configurable:true});e.prototype.advanceFrame=function(){};e.prototype.getEntity=function(){return};e.prototype._initNode=function(t){};e.prototype.clone=function(){var t=new e;this.copyTo(t);return t};e.prototype.copyTo=function(t){var e;t.defaultBoundingVolume=this._defaultBoundingVolume;if(this._registrationMatrix3D)t._registrationMatrix3D=this._registrationMatrix3D.clone();t.mouseChildren=this._mouseChildren;t.material=this._material;t.style=this._style;t.pickObject=this._pickObject;t.pickObjectFromTimeline=this.pickObjectFromTimeline;t.boundsVisible=this._boundsVisible;t.name=this._pName;t.mouseEnabled=this._mouseEnabled;t.extra=this.extra;t.maskMode=this._maskMode;t.castsShadows=this.castsShadows;t.assetNamespace=this.assetNamespace;t._symbol=this._symbol;t.avm1Symbol=this.avm1Symbol;t.isAVMScene=this.isAVMScene;t.isSlice9ScaledMC=this.isSlice9ScaledMC;t.scale9Grid=(e=this.scale9Grid)===null||e===void 0?void 0:e.clone();if(this._masks){t._masks=this._masks.slice();t._scriptMask=this._scriptMask;t._invalidateHierarchicalProperty(o.HierarchicalProperty.MASKS)}this._transform.copyRawDataTo(t._transform)};e.prototype.dispose=function(){this.disposeValues()};e.prototype.disposeValues=function(){if(this._parent)this._parent.removeChild(this);this.material=null;if(this._adapter){this._adapter.dispose();this._adapter=null}this._pickObject=null;this._masks=null;this._scriptMask=null};e.prototype.lookAt=function(t,e){if(e===void 0){e=null}this.transform.lookAt(t,e)};e.prototype.movePivot=function(t,e,i){if(t==0&&e==0&&i==0)return;if(!this._registrationMatrix3D)this._registrationMatrix3D=new G.Matrix3D;this._registrationMatrix3D._rawData[12]-=t/this._transform.scale.x;this._registrationMatrix3D._rawData[13]-=e/this._transform.scale.y;this._registrationMatrix3D._rawData[14]-=i/this._transform.scale.z;this._invalidateHierarchicalProperty(o.HierarchicalProperty.SCENE_TRANSFORM)};e.prototype.reset=function(){this.visible=true;if(!this.noTimelineUpdate)this._transform.clearMatrix3D();this._transform.clearColorTransform();this.masks=null;this.maskMode=false};e.prototype.isOnDisplayList=function(){var t=this;while(t){if(t.isAVMScene)return true;t=t.parent}return false};e.prototype._setParent=function(t){this._parent=t};e.prototype._invalidateHierarchicalProperty=function(t){this.dispatchEvent(new o.HeirarchicalEvent(o.HeirarchicalEvent.INVALIDATE_PROPERTY,t))};e.prototype._iInternalUpdate=function(){if(this._iController)this._iController.update()};Object.defineProperty(e.prototype,"maskId",{get:function(){return this._maskId},enumerable:true,configurable:true});e.prototype._setScaleX=function(t){if(this.scaleX==t)return;this._transform.scale.x=t;this._transform.invalidateMatrix3D()};e.prototype._setScaleY=function(t){if(this.scaleY==t)return;this._transform.scale.y=t;this._transform.invalidateMatrix3D()};e.prototype._setScaleZ=function(t){if(this.scaleZ==t)return;this._transform.scale.z=t;this._transform.invalidateMatrix3D()};e.prototype._updateBoundsPrefab=function(t){if(this._boundsPrefab instanceof n){var e=t.getBoundingVolume(null,this._defaultBoundingVolume).getBox();if(e==null)return;this._boundsPrefab.width=e.width;this._boundsPrefab.height=e.height;this._boundsPrefab.depth=e.depth;this._boundsPrimitive.registrationPoint=new G.Vector3D(-(e.x+e.width/2)*this._boundsPrimitive.transform.scale.x,-(e.y+e.height/2)*this._boundsPrimitive.transform.scale.y,-(e.z+e.depth/2)*this._boundsPrimitive.transform.scale.z)}else if(this._boundsPrefab instanceof a){var i=t.getBoundingVolume(null,this._defaultBoundingVolume).getSphere();if(i==null)return;this._boundsPrefab.radius=i.radius;this._boundsPrimitive.registrationPoint=new G.Vector3D(-i.x*this._boundsPrimitive.transform.scale.x,-i.y*this._boundsPrimitive.transform.scale.y,-i.z*this._boundsPrimitive.transform.scale.z)}};e.prototype._updateMaskMode=function(){if(this._maskMode){this._mouseEnabled=false;this.partitionClass=o.BasicPartition}this._invalidateHierarchicalProperty(o.HierarchicalProperty.MASK_ID)};e.prototype._invalidateMaterial=function(){this.dispatchEvent(new X.RenderableEvent(X.RenderableEvent.INVALIDATE_MATERIAL,this))};e.prototype._invalidateStyle=function(){this.dispatchEvent(new X.RenderableEvent(X.RenderableEvent.INVALIDATE_STYLE,this))};e.prototype.invalidateElements=function(){this.dispatchEvent(new X.RenderableEvent(X.RenderableEvent.INVALIDATE_ELEMENTS,this))};e.prototype._onInvalidateProperties=function(t){if(t===void 0){t=null}this._invalidateStyle()};e.prototype._onInvalidateImages=function(t){if(t===void 0){t=null}this.invalidate()};e.prototype._getDefaultBoundingVolume=function(){return o.BoundingVolumeType.BOX_BOUNDS_FAST};return e}(G.AssetBase);var c=function(s){g(i,s);function i(){var t=s.call(this)||this;t._children=new Array;t.doingSwap=false;t.tabChildren=false;return t}Object.defineProperty(i.prototype,"assetType",{get:function(){return i.assetType},enumerable:true,configurable:true});Object.defineProperty(i.prototype,"animator",{get:function(){return this._animator},set:function(t){if(this._animator)this._animator.removeOwner(this);this._animator=t;if(this._animator)this._animator.addOwner(this)},enumerable:true,configurable:true});Object.defineProperty(i.prototype,"numChildren",{get:function(){return this._children.length},enumerable:true,configurable:true});i.prototype.advanceFrame=function(){for(var t=0;t<this._children.length;t++)this._children[t].advanceFrame()};i.prototype.addChild=function(t){return this.addChildAt(t,this._children.length)};i.prototype.addChildAt=function(t,e){if(t.parent)t.parent.removeChild(t);this._children.splice(e,0,t);t._setParent(this);this.dispatchEvent(new o.ContainerEvent(o.ContainerEvent.ADD_CHILD_AT,t,e));return t};i.prototype.addChildren=function(){var t=[];for(var e=0;e<arguments.length;e++){t[e]=arguments[e]}var i=t.length;for(var r=0;r<i;r++)this.addChild(t[r])};i.prototype.clone=function(){var t=new i;this.copyTo(t);return t};i.prototype.copyTo=function(t){s.prototype.copyTo.call(this,t);if(this._animator)t.animator=this._animator.clone();var e=this._children.length;for(var i=0;i<e;++i){var r=this._children[i].adapter.clone().adaptee;t.addChild(r)}};i.prototype.contains=function(t){return this._children.indexOf(t)>=0};i.prototype.disposeValues=function(){if(this._animator)this._animator.dispose();for(var t=this._children.length-1;t>=0;t--)this.removeChild(this._children[t]);s.prototype.disposeValues.call(this)};i.prototype.getChildAt=function(t){var e=this._children[t];if(e==null)throw new G.RangeError("Index does not exist in the child list of the caller");return e};i.prototype.getChildByName=function(t){var e=this._children.length;for(var i=0;i<e;++i)if(this._children[i].name==t)return this._children[i];return null};i.prototype.getChildIndex=function(t){var e=this._children.indexOf(t);if(e==-1){throw i.NO_CHILD_ERROR}return e};i.prototype.getObjectsUnderPoint=function(t){return new Array};i.prototype.removeChild=function(t){if(t==null)throw new G.ArgumentError("Parameter child cannot be null");this.removeChildAt(this.getChildIndex(t));return t};i.prototype.removeChildAt=function(t){return this.removeChildAtInternal(t)};i.prototype.removeChildren=function(t,e){if(t===void 0){t=0}if(e===void 0){e=2147483647}if(t<0)throw new G.RangeError("beginIndex is out of range of the child list");if(e>this._children.length)throw new G.RangeError("endIndex is out of range of the child list");for(var i=e-1;i>=t;i--)this.removeChildAtInternal(i)};i.prototype.setChildIndex=function(t,e){var i=this.getChildIndex(t);if(i<0)throw new G.ArgumentError("Parameter child must be child of this object");if(e>this._children.length-1)throw new G.RangeError("Parameter index is out of range of the child list");if(i==e)return;this.removeChildAt(i);this.addChildAt(t,e);if(t._sessionID>=0&&this._sessionID_childs){delete this._sessionID_childs[t._sessionID];t._sessionID=-1}};i.prototype.swapChildren=function(t,e){if(t.parent!=this||e.parent!=this)return;this.swapChildrenAt(this.getChildIndex(t),this.getChildIndex(e))};i.prototype.swapChildrenAt=function(t,e){if(t==e)return;if(t>=this._children.length||e>=this._children.length)throw"[scene/DisplayobjectContainer] - swapChildrenAt - Range Error";var i;var r;if(t<e){r=this.removeChildAt(e);i=this.removeChildAt(t);this.addChildAt(r,t);this.addChildAt(i,e)}else{i=this.removeChildAt(t);r=this.removeChildAt(e);this.addChildAt(i,e);this.addChildAt(r,t)}if(this._sessionID_childs){if(this._children[t]._sessionID>=0){delete this._sessionID_childs[this._children[t]._sessionID];this._children[t]._sessionID==-1;this._children[t]._avmDepthID==-1}if(this._children[e]._sessionID>=0){delete this._sessionID_childs[this._children[e]._sessionID];this._children[e]._sessionID==-1;this._children[t]._avmDepthID==-1}}};i.prototype._initNode=function(t){for(var e=0;e<this._children.length;++e)t.addChildAt(this._children[e],e)};i.prototype.removeChildAtInternal=function(t){var e=this._children.splice(t,1)[0];e._setParent(null);this.dispatchEvent(new o.ContainerEvent(o.ContainerEvent.REMOVE_CHILD_AT,e,t));return e};i.prototype._updateMaskMode=function(){if(this.maskMode)this.mouseChildren=false;s.prototype._updateMaskMode.call(this)};i.assetType="[asset DisplayObjectContainer]";i.NO_CHILD_ERROR=new G.ArgumentError("Child parameter is not a child of the caller");return i}(u);o.PartitionBase.registerAbstraction(o.EntityNode,c);var f=function(r){g(s,r);function s(t,e){if(t===void 0){t=null}if(e===void 0){e=null}var i=r.call(this)||this;i.graphics=t;i.material=e;return i}s.getNewSprite=function(t,e){if(t===void 0){t=null}if(e===void 0){e=null}if(s._sprites.length){var i=s._sprites.pop();i.graphics=t;i.material=e;return i}return new s(t,e)};s.clearPool=function(){s._sprites=[]};Object.defineProperty(s.prototype,"assetType",{get:function(){return s.assetType},enumerable:true,configurable:true});Object.defineProperty(s.prototype,"graphics",{get:function(){if(!this._graphics){this.graphics=Y.Graphics.getGraphics();this.invalidate()}return this._graphics},set:function(t){if(this._graphics==t)return;if(this._graphics){this._graphics.usages--}this._graphics=t;if(this._graphics)this._graphics.usages++;this.invalidate()},enumerable:true,configurable:true});s.prototype.getEntity=function(){return this._graphics};s.prototype.dispose=function(){this.disposeValues();s._sprites.push(this)};s.prototype.disposeValues=function(){r.prototype.disposeValues.call(this)};s.prototype.clone=function(){var t=s.getNewSprite();this.copyTo(t);return t};s.prototype.copyTo=function(t,e){if(e===void 0){e=false}r.prototype.copyTo.call(this,t);t._iSourcePrefab=this._iSourcePrefab;if(this._graphics)this._graphics.copyTo(t.graphics,e)};s.prototype._iInternalUpdate=function(){r.prototype._iInternalUpdate.call(this);if(this._iSourcePrefab)this._iSourcePrefab._iValidate()};s.prototype.bakeTransformations=function(){this._graphics.applyTransformation(this.transform.matrix3D);this.transform.clearMatrix3D()};s._sprites=new Array;s.assetType="[asset Sprite]";return s}(c);var _=Object.create(null);function w(t,e){if(e===void 0){e=""}var i=_[t._id+e];_[t._id+e]=true;if(!i){console.warn("[MorphSprite] - id",t.id,e,t)}return!i}var p=function(e){g(r,e);function r(){var t=e!==null&&e.apply(this,arguments)||this;t._frameCaches={};return t}r.getNewMorphSprite=function(t,e){if(t===void 0){t=null}if(e===void 0){e=null}if(r._morphSprites.length){var i=r._morphSprites.pop();i.graphics=t||Y.Graphics.getGraphics();i.material=e;return i}return new r(t,e)};Object.defineProperty(r.prototype,"assetType",{get:function(){return r.assetType},enumerable:true,configurable:true});r.prototype.reset=function(){e.prototype.reset.call(this);this.setRatio(0)};r.prototype._blendStyle=function(t,e,i,r){var s=1-r;var n=r;var o;var a;var h=t.style.fillStyle;var l=e.style.fillStyle;var u;if(t.style.data_type!=e.style.data_type){throw"Error in morph data - different styles of pathes"}switch(h.data_type){case Y.SolidFillStyle.data_type:{var c=h;var _=l;a=s*c.alpha+n*_.alpha;o=G.ColorUtils.interpolateFloat32Color(c.color,_.color,r);u=new Y.SolidFillStyle(o,a);break}case Y.GradientFillStyle.data_type:{var f=[];var p=[];var d=[];var c=h;var _=l;var g=c.colors.length;for(var m=0;m<g;m++){f[f.length]=G.ColorUtils.interpolateFloat32Color(c.colors[m],_.colors[m],r);d[d.length]=s*c.alphas[m]+n*_.alphas[m];p[p.length]=s*c.ratios[m]+n*_.ratios[m]}var v=c.matrix;var y=_.matrix;var b=new G.Matrix;b.a=v.a*s+y.a*n;b.b=v.b*s+y.b*n;b.c=v.c*s+y.c*n;b.d=v.d*s+y.d*n;b.tx=v.tx*s+y.tx*n;b.ty=v.ty*s+y.ty*n;u=new Y.GradientFillStyle(c.type,f,d,p,b,c.spreadMethod,c.interpolationMethod,c.focalPointRatio);break}case Y.BitmapFillStyle.data_type:{var c=h;var _=l;var v=c.matrix;var y=_.matrix;var b=new G.Matrix;b.a=v.a*s+y.a*n;b.b=v.b*s+y.b*n;b.c=v.c*s+y.c*n;b.d=v.d*s+y.d*n;b.tx=v.tx*s+y.tx*n;b.ty=v.ty*s+y.ty*n;u=new Y.BitmapFillStyle(c.material,b,c.repeat,c.smooth);break}}if(t.style.data_type===Y.GraphicsStrokeStyle.data_type){var c=t.style;var _=e.style;var x=s*c.thickness+n*_.thickness;i.style=new Y.GraphicsStrokeStyle(u,x,c.jointstyle,c.capstyle,c.miterLimit,c.scaleMode)}else{i.style=new Y.GraphicsFillStyle(u)}};r.prototype._blendContours=function(t,e,i,r){var s=1-r;var n=r;var o=t._commands.length;if(e._commands.length!==o){throw"Error in morph data - different number of contour"}for(var a=0;a<o;a++){var h=t._commands[a];var l=t._data[a];var u=e._commands[a];var c=e._data[a];var _=0;var f=0;var p=0;var d=0;var g=0;var m=0;var v=h.length;if(u.length!=v){v=Math.min(u.length,v);w(this,"different number of commands in contour");return}for(var y=0;y<v;y++){switch(h[y]){case Y.GraphicsPathCommand.MOVE_TO:if(u[y]!=Y.GraphicsPathCommand.MOVE_TO){throw"Error in morph data - both shapes must start with Move too command"}p=l[_++];d=l[_++];g=c[f++];m=c[f++];i.moveTo(s*p+n*g,s*d+n*m);break;case Y.GraphicsPathCommand.LINE_TO:if(u[y]==Y.GraphicsPathCommand.LINE_TO){p=l[_++];d=l[_++];g=c[f++];m=c[f++];i.lineTo(s*p+n*g,s*d+n*m)}else if(u[y]==Y.GraphicsPathCommand.CURVE_TO){var b=p+(l[_++]-p)/2;var x=d+(l[_++]-d)/2;i.curveTo(s*b+n*c[f++],s*x+n*c[f++],s*l[_-2]+n*c[f++],s*l[_-1]+n*c[f++]);p=l[_-2];d=l[_-1];g=c[f-2];m=c[f-1]}break;case Y.GraphicsPathCommand.CURVE_TO:if(u[y]==Y.GraphicsPathCommand.LINE_TO){var b=g+(c[f++]-g)/2;var x=m+(c[f++]-m)/2;i.curveTo(s*l[_++]+n*b,s*l[_++]+n*x,s*l[_++]+n*c[f-2],s*l[_++]+n*c[f-1]);p=l[_-2];d=l[_-1];g=c[f-2];m=c[f-1]}else if(u[y]==Y.GraphicsPathCommand.CURVE_TO){i.curveTo(s*l[_++]+n*c[f++],s*l[_++]+n*c[f++],s*l[_++]+n*c[f++],s*l[_++]+n*c[f++]);p=l[_-2];d=l[_-1];g=c[f-2];m=c[f-1]}break}}}};r.prototype.setRatio=function(t){var e=t*65535|0;var i=this._graphics;if(this._ratio===e){return}this._ratio=e;if(i.buildQueueTags){i.buildQueueTags(true)}else{i.endFill();i.clear()}if(i.start.length!==i.end.length){throw"Error in morph data - different number of pathes"}var r=i.start.length;for(var s=0;s<r;s++){var n=new Y.GraphicsPath;var o=i.start[s];var a=i.end[s];this._blendStyle(o,a,n,t);this._blendContours(o,a,n,t);i.add_queued_path(n)}i._endFillInternal(true)};r.prototype.dispose=function(){this.disposeValues();this._frameCaches={};r._morphSprites.push(this)};r.prototype.clone=function(){var t=r.getNewMorphSprite();this.copyTo(t);return t};r.assetType="[asset MorphSprite]";r._morphSprites=new Array;return r}(f);var m;var v=["",q.BlendMode.NORMAL,q.BlendMode.LAYER,q.BlendMode.MULTIPLY,q.BlendMode.SCREEN,q.BlendMode.LIGHTEN,q.BlendMode.DARKEN,q.BlendMode.DIFFERENCE,q.BlendMode.ADD,q.BlendMode.SUBTRACT,q.BlendMode.INVERT,q.BlendMode.ALPHA,q.BlendMode.ERASE,q.BlendMode.OVERLAY,q.BlendMode.HARDLIGHT];function x(t){if(t===void 0){t=1}return v[t]||v[1]}var E=function(){function u(t){this.factory=t;this._update_indices=[];this._update_frames=[];this.isButton=false;this._initalMcID=-1;this.numKeyFrames=0;this.keyframe_indices=[];this.avm1Exports={};this.avm1InitActions={};this.avm1ButtonActions=[];this.graphicsPool={};this.audioPool={};this.placeObjectTagsForSessionIDs={};this._labels={};this._framescripts={};this._framescripts_translated={};this.keyframe_to_frameidx={}}u.prototype.resetScripts=function(){this._framescripts={};this._framescripts_translated={}};u.prototype.init=function(){if(this.frame_command_indices==null||this.frame_recipe==null||this.keyframe_durations==null){return}var t=0;var e=0;var i=0;var r=0;var s=0;var n=0;this.keyframe_firstframes=[];this.keyframe_constructframes=[];this.keyframe_indices=[];this.keyframe_to_frameidx={};this.keyframe_to_frameidx[0]=0;var o=0;for(e=0;e<this.numKeyFrames;e++){this.keyframe_to_frameidx[e]=o;r=this.keyframe_durations[e];o+=r;if(this.frame_recipe[e]&1)n=s;this.keyframe_firstframes[s]=t;this.keyframe_constructframes[s++]=n;for(i=0;i<r;i++)this.keyframe_indices[t++]=e}};u.prototype.get_framescript=function(t){if(this._framescripts[t]==null)return"";if(typeof this._framescripts[t]=="string")return this._framescripts[t];else{throw new Error("Framescript is already translated to Function!!!")}};u.prototype.add_framescript=function(t,e,i,r){if(r===void 0){r=false}if(this._initalMcID>=0&&i.id!=this._initalMcID)return;this._initalMcID=i.id;if(!this._framescripts[e]){this._framescripts[e]=[]}if(Array.isArray(t)){for(var s=0;s<t.length;s++){this._framescripts[e][this._framescripts[e].length]=t[s]}}else{this._framescripts[e].push(t)}this._framescripts_translated[e]=!r};u.prototype.get_script_for_frame=function(t,e,i){if(i===void 0){i=false}if(e>=0&&this._framescripts[e]){if(i&&!this._framescripts_translated[e]){var r=t.className?t.className:t.name;this._framescripts[e]=this.factory.createFrameScripts(this._framescripts[e],e,r,t.id);this._framescripts_translated[e]=true}return this._framescripts[e]}return null};Object.defineProperty(u.prototype,"numFrames",{get:function(){return this.keyframe_indices.length},enumerable:true,configurable:true});u.prototype.getKeyframeIndexForFrameIndex=function(t){return this.keyframe_indices[t]};u.prototype.getChildInstance=function(t,e){return this.factory.createChildInstanceForTimeline(this,t,e)};u.prototype.extractHitArea=function(t){t.reset(false);this.gotoFrame(t,this.numFrames-1,false);var e=t.numChildren;var i=new c;var r;var s;while(e>0){e--;s=t.getChildAt(e);r=s.clone();r.x=s.x;r.scaleX=s.scaleX;r.y=s.y;r.scaleY=s.scaleY;r.rotationZ=s.rotationZ;i.addChild(r)}i.pickObjectFromTimeline=true;t.pickObject=i;t.reset(false);return i};u.prototype.getCurrentFrameLabel=function(t){var e=this.keyframe_to_frameidx[t.constructedKeyFrameIndex];for(var i in this._labels){if(this._labels[i].keyFrameIndex==t.constructedKeyFrameIndex&&e==t.currentFrameIndex){return this._labels[i].name}}return null};u.prototype.getCurrentLabel=function(t){var e=null;var i=-1;for(var r in this._labels){var s=this._labels[r].keyFrameIndex;if(s>i&&s<=t.constructedKeyFrameIndex){i=s;e=this._labels[r].name}}return e};u.prototype.jumpToLabel=function(t,e,i){if(i===void 0){i=0}if(!this._labels[e]){console.warn("[TIMELINE] - jumpToLabel with invalid label",t,e,i);return}var r=this._labels[e].keyFrameIndex;if(r>=0)t.currentFrameIndex=this.keyframe_firstframes[r]+i};u.prototype.getScriptForLabel=function(t,e,i){if(i===void 0){i=false}var r=this._labels[e.toLowerCase()].keyFrameIndex;if(r<0)return null;var s=this.keyframe_firstframes[r];if(s>=0&&this._framescripts[s]){return this.get_script_for_frame(t,s,i)}return null};u.prototype.gotoFrame=function(t,e,i,r,s){if(i===void 0){i=true}if(r===void 0){r=false}if(s===void 0){s=false}var n=t.constructedKeyFrameIndex;var o=this.keyframe_indices[e];if(n==o&&!s){t.adapter.queueFrameScripts(this,e,i);return}else if(n+1==o){this.constructNextFrame(t,i,true);return}var a=this.keyframe_constructframes[o];var h=a;var l=o>n;if(l&&n>a)h=n+1;t.adapter.constructFrame(this,h,o,l,e,r,i);this.applyCollectedUpdateCommands(t);t.constructedKeyFrameIndex=o};u.prototype.applyCollectedUpdateCommands=function(t){var e;var i=this._update_indices.length;for(e=0;e<i;e++)this.update_childs(t,this._update_indices[e],this._update_frames[e])};u.prototype.constructNextFrame=function(t,e,i){if(e===void 0){e=true}if(i===void 0){i=false}var r=t.currentFrameIndex;var s=this.keyframe_indices[r];if(e)t.adapter.queueFrameScripts(this,r,i);if(t.constructedKeyFrameIndex!=s){t.constructedKeyFrameIndex=s;var n=this.frame_command_indices[s];var o=this.frame_recipe[s];if(o&1){t.adapter.removeAllTimelineChilds()}else if(o&2){this.remove_childs_continous(t,n++)}if(o&4)this.add_childs_continous(t,n++);if(o&8)this.update_childs(t,n++);if(o&16)this.start_sounds(t,n++)}};u.prototype.remove_childs_continous=function(t,e){var i=this.command_index_stream[e];var r=i+this.command_length_stream[e];for(var s=i;s<r;s++){t.adapter.removeTimelineChildAt(this.remove_child_stream[s])}};u.prototype.add_childs_continous=function(t,e){var i;var r=this.command_index_stream[e];var s=r+this.command_length_stream[e];for(var n=r;n<s;n++){i=n*3;if(typeof this.add_child_stream[i]==="undefined"){console.warn("[Timeline] - add_childs_continous - could not find child-id in child_stream for idx",i,this.add_child_stream);continue}var o=this.factory.createChildInstanceForTimeline(this,this.add_child_stream[i+2],this.add_child_stream[i]);t.adapter.addTimelineChildAtDepth(o,this.add_child_stream[i+1])}};u.prototype.start_sounds=function(t,e){var i=this.command_index_stream[e];var r=i+this.command_length_stream[e];for(var s=i;s<r;s++){var n=this.audioPool[this.add_sounds_stream[s]];if(n){if(n.cmd==15){var o=n.sound;if(!o){console.warn("[Timeline] Missed sound to start!",n);return}t.startSound(n.id,o,n.props.loopCount||0)}else if(n.cmd==16){t.stopSound(n.id)}}}};u.prototype.update_childs=function(t,e,i){if(i===void 0){i=-1}var r=this.command_index_stream[e];var s=r+this.command_length_stream[e];for(var n=r;n<s;n++){var o=t.getTimelineChildAtSessionID(this.update_child_stream[n]);if(!o){continue}this._blocked=!!(o._adapter&&o.adapter.isBlockedByScript());var a=this.update_child_props_indices_stream[n];var h=a+this.update_child_props_length_stream[n];for(var l=a;l<h;l++){u.applyFunctionMap[this.property_type_stream[l]](this,o,t,this.property_index_stream[l])}}};u.update_mtx_all=function(t,e,i,r){if(t._blocked||e.noTimelineUpdate)return;r*=6;var s=e.transform.matrix3D;var n=t.properties_stream_f32_mtx_all;s._rawData[0]=n[r++];s._rawData[1]=n[r++];s._rawData[4]=n[r++];s._rawData[5]=n[r++];s._rawData[12]=n[r++];s._rawData[13]=n[r];e.transform.invalidateComponents()};u.update_colortransform=function(t,e,i,r){if(e._adapter&&e.adapter.isColorTransformByScript())return;r*=8;var s=t.properties_stream_f32_ct;var n=e.transform.colorTransform||(e.transform.colorTransform=new G.ColorTransform);n._rawData[0]=s[r++];n._rawData[1]=s[r++];n._rawData[2]=s[r++];n._rawData[3]=s[r++];n._rawData[4]=s[r++];n._rawData[5]=s[r++];n._rawData[6]=s[r++];n._rawData[7]=s[r];e.transform.invalidateColorTransform()};u.update_masks=function(t,e,i,r){var s=[];var n=t.properties_stream_int[r++];if(n===0){e.updateTimelineMask(null);return}for(var o=0;o<n;o++){s.push(i.getTimelineChildAtSessionID(t.properties_stream_int[r+o]))}e.updateTimelineMask(s)};u.update_name=function(t,e,i,r){if(t.properties_stream_strings[r].indexOf("instance")==0){return}i.adapter.unregisterScriptObject(e);e.name=t.properties_stream_strings[r];i.adapter.registerScriptObject(e)};u.update_button_name=function(t,e,i,r){e.name=t.properties_stream_strings[r];e.addButtonListeners();i.adapter.registerScriptObject(e)};u.update_visibility=function(t,e,i,r){if(!e._adapter||!e.adapter.isVisibilityByScript()){e.visible=!!r}};u.update_mtx_scale_rot=function(t,e,i,r){if(t._blocked||e.noTimelineUpdate){return}r*=4;var s=e.transform.matrix3D;var n=t.properties_stream_f32_mtx_scale_rot;s._rawData[0]=n[r++];s._rawData[1]=n[r++];s._rawData[4]=n[r++];s._rawData[5]=n[r];e.transform.invalidateComponents();e._invalidateHierarchicalProperty(o.HierarchicalProperty.SCENE_TRANSFORM)};u.update_mtx_pos=function(t,e,i,r){if(t._blocked||e.noTimelineUpdate)return;r*=2;var s=e.transform.matrix3D;s._rawData[12]=t.properties_stream_f32_mtx_pos[r++];s._rawData[13]=t.properties_stream_f32_mtx_pos[r];e.transform.invalidatePosition()};u.enable_maskmode=function(t,e,i,r){e.maskMode=true};u.remove_masks=function(t,e,i,r){e.updateTimelineMask(null)};u.update_filters=function(t,e,i,r){var s=t.properties_stream_int[r++];var n=t.properties_stream_int[r++];var o=e.adapter;if(n===0){o.updateFilters(null);return}o.updateFilters(t.properties_stream_filters.slice(s,s+n))};u.swap_graphics=function(t,e,i,r){if(!e.isAsset(f)){console.warn("[Timeline] - swap_graphics - child is not a Sprite");return}var s=e;var n=t.graphicsPool[t.properties_stream_int[r]];if(n.id===s.graphics.id){return}s.graphics=n};u.start_audio=function(t,e,i,r){};u.set_ratio=function(t,e,i,r){if(!e.isAsset(p)){console.warn("[Timeline] - set_ratio - child is not a MorphSprite");return}e.setRatio(t.properties_stream_int[r]/65535)};u.update_blendmode=function(t,e,i,r){e.blendMode=x(r)};u.update_rendermode=function(t,e,i,r){console.log("update rendermode "+r)};u.prototype.dispose=function(){this.keyframe_indices=[];this.avm1Exports={};this.avm1InitActions={};this.avm1ButtonActions=[];this.graphicsPool={};this.audioPool={};this.placeObjectTagsForSessionIDs={};this._labels={};this._framescripts={};this._framescripts_translated={}};u.applyFunctionMap=(m={},m[1]=u.update_mtx_all,m[2]=u.update_colortransform,m[3]=u.update_masks,m[4]=u.update_name,m[5]=u.update_button_name,m[6]=u.update_visibility,m[7]=u.update_blendmode,m[8]=u.update_rendermode,m[9]=u.update_filters,m[11]=u.update_mtx_scale_rot,m[12]=u.update_mtx_pos,m[200]=u.enable_maskmode,m[201]=u.remove_masks,m[202]=u.swap_graphics,m[203]=u.set_ratio,m[204]=u.start_audio,m);return u}();var S=function(){function t(t){if(t===void 0){t=null}this._pAutoUpdate=true;this.targetObject=t}t.prototype.pNotifyUpdate=function(){if(this._pTargetObject)this._pTargetObject._invalidateHierarchicalProperty(o.HierarchicalProperty.SCENE_TRANSFORM)};Object.defineProperty(t.prototype,"targetObject",{get:function(){return this._pTargetObject},set:function(t){if(this._pTargetObject==t)return;if(this._pTargetObject&&this._pAutoUpdate)this._pTargetObject._iController=null;this._pTargetObject=t;if(this._pTargetObject&&this._pAutoUpdate)this._pTargetObject._iController=this;this.pNotifyUpdate()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"autoUpdate",{get:function(){return this._pAutoUpdate},set:function(t){if(this._pAutoUpdate==t)return;this._pAutoUpdate=t;if(this._pTargetObject){if(this._pAutoUpdate)this._pTargetObject._iController=this;else this._pTargetObject._iController=null}},enumerable:true,configurable:true});t.prototype.update=function(t){if(t===void 0){t=true}throw new G.AbstractMethodError};t.prototype.updateController=function(){if(this._pControllerDirty&&this._pAutoUpdate){this._pControllerDirty=false;this.pNotifyUpdate()}};return t}();var A=function(h){g(t,h);function t(t,e,i,r,s,n,o){if(t===void 0){t=null}if(e===void 0){e=0}if(i===void 0){i=90}if(r===void 0){r=-90}if(s===void 0){s=90}if(n===void 0){n=8}if(o===void 0){o=false}var a=h.call(this,t)||this;a._iCurrentPanAngle=0;a._iCurrentTiltAngle=90;a._panAngle=0;a._tiltAngle=90;a._minTiltAngle=-90;a._maxTiltAngle=90;a._steps=8;a._walkIncrement=0;a._strafeIncrement=0;a._wrapPanAngle=false;a.fly=false;a.panAngle=e;a.tiltAngle=i;a.minTiltAngle=r;a.maxTiltAngle=s;a.steps=n;a.wrapPanAngle=o;a._iCurrentPanAngle=a._panAngle;a._iCurrentTiltAngle=a._tiltAngle;return a}Object.defineProperty(t.prototype,"steps",{get:function(){return this._steps},set:function(t){t=t<1?1:t;if(this._steps==t)return;this._steps=t;this.pNotifyUpdate()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"panAngle",{get:function(){return this._panAngle},set:function(t){if(this._panAngle==t)return;this._panAngle=t;this.pNotifyUpdate()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"tiltAngle",{get:function(){return this._tiltAngle},set:function(t){t=Math.max(this._minTiltAngle,Math.min(this._maxTiltAngle,t));if(this._tiltAngle==t)return;this._tiltAngle=t;this.pNotifyUpdate()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"minTiltAngle",{get:function(){return this._minTiltAngle},set:function(t){if(this._minTiltAngle==t)return;this._minTiltAngle=t;this.tiltAngle=Math.max(this._minTiltAngle,Math.min(this._maxTiltAngle,this._tiltAngle))},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"maxTiltAngle",{get:function(){return this._maxTiltAngle},set:function(t){if(this._maxTiltAngle==t)return;this._maxTiltAngle=t;this.tiltAngle=Math.max(this._minTiltAngle,Math.min(this._maxTiltAngle,this._tiltAngle))},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"wrapPanAngle",{get:function(){return this._wrapPanAngle},set:function(t){if(this._wrapPanAngle==t)return;this._wrapPanAngle=t;this.pNotifyUpdate()},enumerable:true,configurable:true});t.prototype.update=function(t){if(t===void 0){t=true}if(this._tiltAngle!=this._iCurrentTiltAngle||this._panAngle!=this._iCurrentPanAngle){this._pControllerDirty=true;if(this._wrapPanAngle){if(this._panAngle<0){this._iCurrentPanAngle+=this._panAngle%360+360-this._panAngle;this._panAngle=this._panAngle%360+360}else{this._iCurrentPanAngle+=this._panAngle%360-this._panAngle;this._panAngle=this._panAngle%360}while(this._panAngle-this._iCurrentPanAngle<-180)this._iCurrentPanAngle-=360;while(this._panAngle-this._iCurrentPanAngle>180)this._iCurrentPanAngle+=360}if(t){this._iCurrentTiltAngle+=(this._tiltAngle-this._iCurrentTiltAngle)/(this.steps+1);this._iCurrentPanAngle+=(this._panAngle-this._iCurrentPanAngle)/(this.steps+1)}else{this._iCurrentTiltAngle=this._tiltAngle;this._iCurrentPanAngle=this._panAngle}if(Math.abs(this.tiltAngle-this._iCurrentTiltAngle)<.01&&Math.abs(this._panAngle-this._iCurrentPanAngle)<.01){this._iCurrentTiltAngle=this._tiltAngle;this._iCurrentPanAngle=this._panAngle}}this.targetObject.rotationX=this._iCurrentTiltAngle;this.targetObject.rotationY=this._iCurrentPanAngle;if(this._walkIncrement){if(this.fly){this.targetObject.transform.moveForward(this._walkIncrement)}else{this.targetObject.x+=this._walkIncrement*Math.sin(this._panAngle*G.MathConsts.DEGREES_TO_RADIANS);this.targetObject.z+=this._walkIncrement*Math.cos(this._panAngle*G.MathConsts.DEGREES_TO_RADIANS)}this._walkIncrement=0}if(this._strafeIncrement){this.targetObject.transform.moveRight(this._strafeIncrement);this._strafeIncrement=0}};t.prototype.incrementWalk=function(t){if(t==0)return;this._walkIncrement+=t;this.pNotifyUpdate()};t.prototype.incrementStrafe=function(t){if(t==0)return;this._strafeIncrement+=t;this.pNotifyUpdate()};return t}(S);var T=function(r){g(t,r);function t(t,e){if(t===void 0){t=null}if(e===void 0){e=null}var i=r.call(this,t)||this;i._pOrigin=new G.Vector3D(0,0,0);if(e)i.lookAtObject=e;else i.lookAtPosition=new G.Vector3D;return i}Object.defineProperty(t.prototype,"lookAtPosition",{get:function(){return this._pLookAtPosition},set:function(t){if(this._pLookAtObject){this._pLookAtObject=null}this._pLookAtPosition=t;this.pNotifyUpdate()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"lookAtObject",{get:function(){return this._pLookAtObject},set:function(t){if(this._pLookAtPosition)this._pLookAtPosition=null;if(this._pLookAtObject==t)return;this._pLookAtObject=t;this.pNotifyUpdate()},enumerable:true,configurable:true});t.prototype.update=function(t){if(t===void 0){t=true}if(this._pTargetObject){if(this._pLookAtPosition)this._pTargetObject.lookAt(this._pLookAtPosition);else if(this._pLookAtObject)this._pTargetObject.lookAt(this._pLookAtObject.transform.matrix3D.position)}};return t}(S);var P=function(f){g(t,f);function t(t,e,i,r,s,n,o,a,h,l,u,c){if(t===void 0){t=null}if(e===void 0){e=null}if(i===void 0){i=0}if(r===void 0){r=90}if(s===void 0){s=1e3}if(n===void 0){n=-90}if(o===void 0){o=90}if(a===void 0){a=null}if(h===void 0){h=null}if(l===void 0){l=8}if(u===void 0){u=2}if(c===void 0){c=false}var _=f.call(this,t,e)||this;_._iCurrentPanAngle=0;_._iCurrentTiltAngle=90;_._panAngle=0;_._tiltAngle=90;_._distance=1e3;_._minPanAngle=-Infinity;_._maxPanAngle=Infinity;_._minTiltAngle=-90;_._maxTiltAngle=90;_._steps=8;_._yFactor=2;_._wrapPanAngle=false;_._upAxis=new G.Vector3D;_.distance=s;_.panAngle=i;_.tiltAngle=r;_.minPanAngle=a!=null?a:-Infinity;_.maxPanAngle=h!=null?h:Infinity;_.minTiltAngle=n;_.maxTiltAngle=o;_.steps=l;_.yFactor=u;_.wrapPanAngle=c;_._iCurrentPanAngle=_._panAngle;_._iCurrentTiltAngle=_._tiltAngle;return _}Object.defineProperty(t.prototype,"steps",{get:function(){return this._steps},set:function(t){t=t<1?1:t;if(this._steps==t)return;this._steps=t;this.pNotifyUpdate()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"panAngle",{get:function(){return this._panAngle},set:function(t){t=Math.max(this._minPanAngle,Math.min(this._maxPanAngle,t));if(this._panAngle==t)return;this._panAngle=t;this.pNotifyUpdate()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"tiltAngle",{get:function(){return this._tiltAngle},set:function(t){t=Math.max(this._minTiltAngle,Math.min(this._maxTiltAngle,t));if(this._tiltAngle==t)return;this._tiltAngle=t;this.pNotifyUpdate()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"distance",{get:function(){return this._distance},set:function(t){if(this._distance==t)return;this._distance=t;this.pNotifyUpdate()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"minPanAngle",{get:function(){return this._minPanAngle},set:function(t){if(this._minPanAngle==t)return;this._minPanAngle=t;this.panAngle=Math.max(this._minPanAngle,Math.min(this._maxPanAngle,this._panAngle))},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"maxPanAngle",{get:function(){return this._maxPanAngle},set:function(t){if(this._maxPanAngle==t)return;this._maxPanAngle=t;this.panAngle=Math.max(this._minPanAngle,Math.min(this._maxPanAngle,this._panAngle))},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"minTiltAngle",{get:function(){return this._minTiltAngle},set:function(t){if(this._minTiltAngle==t)return;this._minTiltAngle=t;this.tiltAngle=Math.max(this._minTiltAngle,Math.min(this._maxTiltAngle,this._tiltAngle))},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"maxTiltAngle",{get:function(){return this._maxTiltAngle},set:function(t){if(this._maxTiltAngle==t)return;this._maxTiltAngle=t;this.tiltAngle=Math.max(this._minTiltAngle,Math.min(this._maxTiltAngle,this._tiltAngle))},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"yFactor",{get:function(){return this._yFactor},set:function(t){if(this._yFactor==t)return;this._yFactor=t;this.pNotifyUpdate()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"wrapPanAngle",{get:function(){return this._wrapPanAngle},set:function(t){if(this._wrapPanAngle==t)return;this._wrapPanAngle=t;this.pNotifyUpdate()},enumerable:true,configurable:true});t.prototype.update=function(t){if(t===void 0){t=true}if(this._tiltAngle!=this._iCurrentTiltAngle||this._panAngle!=this._iCurrentPanAngle){this._pControllerDirty=true;if(this._wrapPanAngle){if(this._panAngle<0){this._iCurrentPanAngle+=this._panAngle%360+360-this._panAngle;this._panAngle=this._panAngle%360+360}else{this._iCurrentPanAngle+=this._panAngle%360-this._panAngle;this._panAngle=this._panAngle%360}while(this._panAngle-this._iCurrentPanAngle<-180)this._iCurrentPanAngle-=360;while(this._panAngle-this._iCurrentPanAngle>180)this._iCurrentPanAngle+=360}if(t){this._iCurrentTiltAngle+=(this._tiltAngle-this._iCurrentTiltAngle)/(this.steps+1);this._iCurrentPanAngle+=(this._panAngle-this._iCurrentPanAngle)/(this.steps+1)}else{this._iCurrentPanAngle=this._panAngle;this._iCurrentTiltAngle=this._tiltAngle}if(Math.abs(this.tiltAngle-this._iCurrentTiltAngle)<.01&&Math.abs(this._panAngle-this._iCurrentPanAngle)<.01){this._iCurrentTiltAngle=this._tiltAngle;this._iCurrentPanAngle=this._panAngle}}var e=this.lookAtObject?this.lookAtObject.transform.position:this.lookAtPosition?this.lookAtPosition:this._pOrigin;this.targetObject.x=e.x+this.distance*Math.sin(this._iCurrentPanAngle*G.MathConsts.DEGREES_TO_RADIANS)*Math.cos(this._iCurrentTiltAngle*G.MathConsts.DEGREES_TO_RADIANS);this.targetObject.y=e.y+this.distance*Math.sin(this._iCurrentTiltAngle*G.MathConsts.DEGREES_TO_RADIANS)*this.yFactor;this.targetObject.z=e.z+this.distance*Math.cos(this._iCurrentPanAngle*G.MathConsts.DEGREES_TO_RADIANS)*Math.cos(this._iCurrentTiltAngle*G.MathConsts.DEGREES_TO_RADIANS);this._upAxis.x=-Math.sin(this._iCurrentPanAngle*G.MathConsts.DEGREES_TO_RADIANS)*Math.sin(this._iCurrentTiltAngle*G.MathConsts.DEGREES_TO_RADIANS);this._upAxis.y=Math.cos(this._iCurrentTiltAngle*G.MathConsts.DEGREES_TO_RADIANS);this._upAxis.z=-Math.cos(this._iCurrentPanAngle*G.MathConsts.DEGREES_TO_RADIANS)*Math.sin(this._iCurrentTiltAngle*G.MathConsts.DEGREES_TO_RADIANS);if(this._pTargetObject){if(this._pLookAtPosition)this._pTargetObject.lookAt(this._pLookAtPosition,this._upAxis);else if(this._pLookAtObject)this._pTargetObject.lookAt(this._pLookAtObject.transform.matrix3D.position,this._upAxis)}};return t}(T);var D=function(s){g(t,s);function t(t,e,i,r){if(t===void 0){t=null}if(e===void 0){e=null}if(i===void 0){i=45}if(r===void 0){r=700}return s.call(this,t,e,0,i,r)||this}t.prototype.update=function(t){if(t===void 0){t=true}if(!this.lookAtObject)return;this.panAngle=this._pLookAtObject.rotationY-180;s.prototype.update.call(this)};return t}(P);var I=function(o){g(t,o);function t(t,e,i,r,s){if(t===void 0){t=null}if(e===void 0){e=null}if(i===void 0){i=1}if(r===void 0){r=40}if(s===void 0){s=4}var n=o.call(this,t,e)||this;n.positionOffset=new G.Vector3D(0,500,-1e3);n.stiffness=i;n.damping=s;n.mass=r;n._velocity=new G.Vector3D;n._dv=new G.Vector3D;n._stretch=new G.Vector3D;n._force=new G.Vector3D;n._acceleration=new G.Vector3D;n._desiredPosition=new G.Vector3D;return n}t.prototype.update=function(t){if(t===void 0){t=true}if(!this._pLookAtObject||!this._pTargetObject)return;this._pControllerDirty=true;var e=this._pLookAtObject.transform.matrix3D.deltaTransformVector(this.positionOffset);this._desiredPosition.x=this._pLookAtObject.x+e.x;this._desiredPosition.y=this._pLookAtObject.y+e.y;this._desiredPosition.z=this._pLookAtObject.z+e.z;this._stretch=this._pTargetObject.transform.position.add(this._desiredPosition);this._stretch.scaleBy(-this.stiffness);this._dv.copyFrom(this._velocity);this._dv.scaleBy(this.damping);this._force.x=this._stretch.x-this._dv.x;this._force.y=this._stretch.y-this._dv.y;this._force.z=this._stretch.z-this._dv.z;this._acceleration.copyFrom(this._force);this._acceleration.scaleBy(1/this.mass);this._velocity.incrementBy(this._acceleration);var i=this._pTargetObject.transform.position.add(this._velocity);this._pTargetObject.transform.moveTo(i.x,i.y,i.z);o.prototype.update.call(this)};return t}(T);var C=function(s){g(n,s);function n(t,e,i){if(e===void 0){e="auto"}if(i===void 0){i=false}var r=s.call(this)||this;r.preserveDimensions=false;r._onInvalidateTextureDelegate=function(t){return r._onInvalidateTexture(t)};r.material=t;r._updateDimensions();if(r._sampler)r._sampler.smooth=i;return r}n.getNewBillboard=function(t,e,i){if(e===void 0){e="auto"}if(i===void 0){i=false}if(n._billboards.length){var r=n._billboards.pop();r.material=t;return r}return new n(t,e,i)};Object.defineProperty(n.prototype,"assetType",{get:function(){return n.assetType},enumerable:true,configurable:true});Object.defineProperty(n.prototype,"billboardRect",{get:function(){return this._billboardRect},enumerable:true,configurable:true});Object.defineProperty(n.prototype,"billboardHeight",{get:function(){return this._billboardHeight},enumerable:true,configurable:true});Object.defineProperty(n.prototype,"billboardWidth",{get:function(){return this._billboardWidth},enumerable:true,configurable:true});Object.defineProperty(n.prototype,"material",{get:function(){return this._material},set:function(t){if(t==this._material)return;if(this._material)this._material.removeEventListener(X.MaterialEvent.INVALIDATE_TEXTURES,this._onInvalidateTextureDelegate);this._material=t;if(this._material)this._material.addEventListener(X.MaterialEvent.INVALIDATE_TEXTURES,this._onInvalidateTextureDelegate);this._updateDimensions();this._invalidateMaterial()},enumerable:true,configurable:true});Object.defineProperty(n.prototype,"sampler",{get:function(){return this._sampler},enumerable:true,configurable:true});Object.defineProperty(n.prototype,"width",{get:function(){return this._width},set:function(t){if(this._width==t)return;this._width=t;this.scaleX=this._width/this._billboardRect.width},enumerable:true,configurable:true});Object.defineProperty(n.prototype,"height",{get:function(){return this._height},set:function(t){if(this._height==t)return;this._height=t;this.scaleY=this._height/this._billboardRect.height},enumerable:true,configurable:true});n.prototype.advanceFrame=function(){};n.prototype.getEntity=function(){return this};n.prototype.dispose=function(){this.disposeValues();n._billboards.push(this)};n.prototype.clone=function(){var t=n.getNewBillboard(this._material);this.copyTo(t);return t};n.prototype._acceptTraverser=function(t){if(!this.material){return}var e=this.material.getTextureAt(0);if(!e){return}var i=this.image;if(!i||i.isDisposed){return}t.applyTraversable(this)};Object.defineProperty(n.prototype,"image",{get:function(){var t,e;if(!this.material){return null}var i=this.material.getTextureAt(0);if(!i){return null}var r=(t=this._style)===null||t===void 0?void 0:t.getImageAt(i);if(r){return r}r=(e=this.material.style)===null||e===void 0?void 0:e.getImageAt(i);if(r){return r}return i.getImageAt(0)},enumerable:true,configurable:true});n.prototype._updateDimensions=function(){var t,e;var i=this.image;if(i&&!i.isDisposed){var r=this.material.getTextureAt(0);this._sampler=((t=this._style)===null||t===void 0?void 0:t.getSamplerAt(r))||((e=this.material.style)===null||e===void 0?void 0:e.getSamplerAt(r))||r.getSamplerAt(0)||q.ImageUtils.getDefaultSampler();if(this._sampler.imageRect){this._billboardWidth=this._sampler.imageRect.width*i.width;this._billboardHeight=this._sampler.imageRect.height*i.height}else{this._billboardWidth=i.rect.width;this._billboardHeight=i.rect.height}this._billboardRect=this._sampler.frameRect||new G.Rectangle(0,0,this._billboardWidth,this._billboardHeight)}else{this._billboardWidth=1;this._billboardHeight=1;this._billboardRect=new G.Rectangle(0,0,1,1)}this.invalidate();this.invalidateElements();if(!this.preserveDimensions){this._width=this._billboardRect.width*this.scaleX;this._height=this._billboardRect.height*this.scaleY}else{this.scaleX=this._width/this._billboardRect.width;this.scaleY=this._height/this._billboardRect.height}};n.prototype._onInvalidateProperties=function(t){if(t===void 0){t=null}s.prototype._onInvalidateProperties.call(this,t);this._updateDimensions()};n.prototype._onInvalidateTexture=function(t){this._updateDimensions()};n._billboards=new Array;n.assetType="[asset Billboard]";return n}(c);var M=function(s){g(u,s);function u(){return s!==null&&s.apply(this,arguments)||this}u.prototype._getStageElements=function(){var t=this._asset;var e=t.billboardWidth;var i=t.billboardHeight;var r=t.billboardRect;var s=e.toString()+i.toString()+r.toString();this._id=s;var n=u._samplerElements[s];if(!n){var o=-r.x;var a=-r.y;var h=e-r.x;var l=i-r.y;n=u._samplerElements[s]=new X.TriangleElements(new q.AttributesBuffer(11,4));n.autoDeriveNormals=false;n.autoDeriveTangents=false;n.setPositions([o,a,0,h,l,0,h,a,0,o,a,0,o,l,0,h,l,0]);n.setUVs([0,0,1,1,1,0,0,0,0,1,1,1])}return n.getAbstraction(this._stage)};u.prototype.executeRender=function(t,e,i,r){if(t===void 0){t=true}if(e===void 0){e=0}if(i===void 0){i=0}if(r===void 0){r=0}this._stage.context.setCulling(q.ContextGLTriangleFace.NONE);s.prototype.executeRender.call(this,t,e,i,r)};u.prototype._getRenderMaterial=function(){var t=this._asset.material||X.MaterialUtils.getDefaultColorMaterial();return t.getAbstraction(this.renderer.getRenderElements(this.stageElements.elements))};u.prototype._getStyle=function(){return this._asset.style};u._samplerElements=new Object;return u}(X._Render_RenderableBase);var O=function(r){g(t,r);function t(t,e){var i=r.call(this,t,e)||this;i._billboardBoxDirty=true;i._onInvalidateElementsDelegate=function(t){return i._onInvalidateElements(t)};i._asset.addEventListener(X.RenderableEvent.INVALIDATE_ELEMENTS,i._onInvalidateElementsDelegate);return i}t.prototype._onInvalidateElements=function(t){this._billboardBoxDirty=true};t.prototype.onClear=function(t){this._asset.removeEventListener(X.RenderableEvent.INVALIDATE_ELEMENTS,this._onInvalidateElementsDelegate);r.prototype.onClear.call(this,t)};t.prototype.hitTestPoint=function(t,e,i){return true};t.prototype.getBoxBounds=function(t,e,i,r){if(t===void 0){t=null}if(e===void 0){e=true}if(i===void 0){i=null}if(r===void 0){r=null}if(this._billboardBoxDirty){this._billboardBoxDirty=false;var s=this._asset.billboardRect;this._billboardBox=new G.Box(s.x,s.y,0,s.width,s.height,0)}return(t?t.transformBox(this._billboardBox):this._billboardBox).union(r,r||i)};t.prototype.getSphereBounds=function(t,e,i,r,s){if(e===void 0){e=null}if(i===void 0){i=true}if(r===void 0){r=null}if(s===void 0){s=null}return s};t.prototype.testCollision=function(t,e){var i=-t.rayPosition.z/t.rayDirection.z;var r=new G.Vector3D(t.rayPosition.x+i*t.rayDirection.x,t.rayPosition.y+i*t.rayDirection.y);t.traversable=this._asset;t.rayEntryDistance=i;t.position=r;t.normal=new G.Vector3D(0,0,1);return true};return t}(o._Pick_PickableBase);X.RenderEntity.registerRenderable(M,C);o.PickEntity.registerPickable(O,C);o.PartitionBase.registerAbstraction(o.EntityNode,C);var F=function(r){g(t,r);function t(t,e){var i=r.call(this,t)||this;i._camera=e;return i}Object.defineProperty(t.prototype,"camera",{get:function(){return this._camera},enumerable:true,configurable:true});t.prototype.clone=function(){return new t(this.type,this._camera)};t.PROJECTION_CHANGED="projectionChanged";return t}(G.EventBase);var R=function(i){g(t,i);function t(t){if(t===void 0){t=null}var e=i.call(this)||this;e._projection=t||new G.PerspectiveProjection;e._projection.transform=e._transform;e.z=-1e3;return e}Object.defineProperty(t.prototype,"assetType",{get:function(){return t.assetType},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"projection",{get:function(){return this._projection},set:function(t){if(this._projection==t)return;if(!t)throw new Error("Projection cannot be null!");this._projection.transform=null;this._projection=t;this._projection.transform=this._transform;this.dispatchEvent(new F(F.PROJECTION_CHANGED,this))},enumerable:true,configurable:true});t.prototype.project=function(t,e){if(e===void 0){e=null}return this._projection.project(this._transform.inverseMatrix3D.transformVector(t,e),e)};t.prototype.unproject=function(t,e,i,r){if(r===void 0){r=null}return this._transform.matrix3D.transformVector(this._projection.unproject(t,e,i,r))};t.prototype._getDefaultBoundingVolume=function(){return o.BoundingVolumeType.NULL};t.assetType="[asset Camera]";return t}(c);var N=function(t){g(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e.prototype.acceptTraverser=function(t){};return e}(o.EntityNode);o.PartitionBase.registerAbstraction(N,R);var L=function(n){g(t,n);function t(t,e,i,r){if(r===void 0){r=1}var s=n.call(this)||this;s.material=t;s._startPosition=e;s._endPosition=i;s._halfThickness=r*.5;return s}Object.defineProperty(t.prototype,"assetType",{get:function(){return t.assetType},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"startPosition",{get:function(){return this._startPosition},set:function(t){if(this._startPosition==t)return;this._startPosition=t;this.invalidateElements()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"endPosition",{get:function(){return this._endPosition},set:function(t){if(this._endPosition==t)return;this._endPosition=t;this.invalidateElements()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"thickness",{get:function(){return this._halfThickness*2},set:function(t){if(this._halfThickness==t)return;this._halfThickness=t*.5;this.invalidateElements()},enumerable:true,configurable:true});t.prototype.getEntity=function(){return this};t.prototype._acceptTraverser=function(t){t.applyTraversable(this)};t.assetType="[asset LineSegment]";return t}(u);var k=function(t){g(n,t);function n(){return t!==null&&t.apply(this,arguments)||this}n.prototype._getStageElements=function(){var t=n._lineGraphics[this._asset.id]||(n._lineGraphics[this._asset.id]=new X.LineElements);var e=this._asset.startPosition;var i=this._asset.endPosition;var r=new Float32Array(6);var s=new Float32Array(1);r[0]=e.x;r[1]=e.y;r[2]=e.z;r[3]=i.x;r[4]=i.y;r[5]=i.z;s[0]=this._asset.thickness;t.setPositions(r);t.setThickness(s);return t.getAbstraction(this._stage)};n.prototype._getRenderMaterial=function(){var t=this._asset.material||X.MaterialUtils.getDefaultColorMaterial();return t.getAbstraction(this.renderer.getRenderElements(this.stageElements.elements))};n.prototype._getStyle=function(){return this._asset.style};n._lineGraphics=new Object;return n}(X._Render_RenderableBase);var j=function(r){g(t,r);function t(t,e){var i=r.call(this,t,e)||this;i._lineSegmentBoxDirty=true;i._lineSegmentSphereDirty=true;i._onInvalidateElementsDelegate=function(t){return i._onInvalidateElements(t)};i._asset.addEventListener(X.RenderableEvent.INVALIDATE_ELEMENTS,i._onInvalidateElementsDelegate);return i}t.prototype._onInvalidateElements=function(t){this._lineSegmentBoxDirty=true;this._lineSegmentSphereDirty=true};t.prototype.onClear=function(t){this._asset.removeEventListener(X.RenderableEvent.INVALIDATE_ELEMENTS,this._onInvalidateElementsDelegate);r.prototype.onClear.call(this,t)};t.prototype.hitTestPoint=function(t,e,i){return true};t.prototype.getBoxBounds=function(t,e,i,r){if(t===void 0){t=null}if(e===void 0){e=true}if(i===void 0){i=null}if(r===void 0){r=null}if(this._lineSegmentBoxDirty){this._lineSegmentBoxDirty=false;var s=this._asset.startPosition;var n=this._asset.endPosition;this._lineSegmentBox=new G.Box(Math.min(s.x,n.x),Math.min(s.y,n.y),Math.min(s.z,n.z),Math.abs(s.x-n.x),Math.abs(s.y-n.y),Math.abs(s.z-n.z))}return(t?t.transformBox(this._lineSegmentBox):this._lineSegmentBox).union(r,r||i)};t.prototype.getSphereBounds=function(t,e,i,r,s){if(e===void 0){e=null}if(i===void 0){i=true}if(r===void 0){r=null}if(s===void 0){s=null}if(this._lineSegmentSphereDirty){this._lineSegmentSphereDirty=false;var n=this._asset.startPosition;var o=this._asset.endPosition;var a=(o.x-n.x)/2;var h=(o.y-n.y)/2;var l=(o.z-n.z)/2;this._lineSegmentSphere=new G.Sphere(n.x+a,n.y+h,n.z+l,Math.sqrt(a*a+h*h+l*l))}return(e?e.transformSphere(this._lineSegmentSphere):this._lineSegmentSphere).union(s,s||r)};t.prototype.testCollision=function(t,e){t.traversable=null;return false};return t}(o._Pick_PickableBase);X.RenderEntity.registerRenderable(k,L);o.PickEntity.registerPickable(j,L);o.PartitionBase.registerAbstraction(o.EntityNode,L);var B=function(s){g(t,s);function t(t,e){var i;if(t===void 0){t=true}if(e===void 0){e=null}var r=s.call(this)||this;r._useAssetLib=t;r._assetLibId=e;r._onLoaderStartDelegate=function(t){return r._onLoaderStart(t)};r._onLoadProgressDelegate=function(t){return r._onLoadProgress(t)};r._onLoadCompleteDelegate=function(t){return r._onLoadComplete(t)};r._onAssetCompleteDelegate=function(t){return r._onAssetComplete(t)};r._onLoaderCompleteDelegate=function(t){return r._onLoaderComplete(t)};r._onLoadErrorDelegate=function(t){return r._onLoadError(t)};r._onParseErrorDelegate=function(t){return r._onParseError(t)};r._errorDelegateSelector=(i={},i[G.URLLoaderEvent.LOAD_ERROR]=r._onLoadErrorDelegate,i[G.ParserEvent.PARSE_ERROR]=r._onParseErrorDelegate,i);return r}Object.defineProperty(t.prototype,"content",{get:function(){return this._content},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"contentLoader",{get:function(){return this._contentLoader},enumerable:true,configurable:true});t.prototype.addEventListener=function(t,e){if(this._contentLoader&&t==G.URLLoaderEvent.LOAD_ERROR||t==G.ParserEvent.PARSE_ERROR)this._contentLoader.addEventListener(t,this._errorDelegateSelector[t]);s.prototype.addEventListener.call(this,t,e)};t.prototype.removeEventListener=function(t,e){if(this._contentLoader&&t==G.URLLoaderEvent.LOAD_ERROR||t==G.ParserEvent.PARSE_ERROR)this._contentLoader.removeEventListener(t,this._errorDelegateSelector[t]);s.prototype.removeEventListener.call(this,t,e)};t.prototype.close=function(){if(!this._contentLoader)return;if(this._useAssetLib)G.AssetLibraryBundle.getInstance(this._assetLibId).stopLoader(this._contentLoader);this._disposeLoader()};t.prototype.load=function(t,e,i,r){if(e===void 0){e=null}if(i===void 0){i=null}if(r===void 0){r=null}this._getLoader().load(t,e,i,r)};t.prototype.loadData=function(t,e,i,r){if(e===void 0){e=null}if(i===void 0){i=null}if(r===void 0){r=null}this._getLoader().loadData(t,"",e,i,r)};t.prototype._getLoader=function(){if(this._contentLoader)this.close();this._contentLoader=this._useAssetLib?G.AssetLibraryBundle.getInstance(this._assetLibId).getLoader():new G.Loader;this._contentLoader.addEventListener(G.LoaderEvent.LOADER_START,this._onLoaderStartDelegate);this._contentLoader.addEventListener(G.URLLoaderEvent.LOAD_PROGRESS,this._onLoadProgressDelegate);this._contentLoader.addEventListener(G.URLLoaderEvent.LOAD_COMPLETE,this._onLoadCompleteDelegate);this._contentLoader.addEventListener(G.AssetEvent.ASSET_COMPLETE,this._onAssetCompleteDelegate);this._contentLoader.addEventListener(G.LoaderEvent.LOADER_COMPLETE,this._onLoaderCompleteDelegate);if(this.hasEventListener(G.URLLoaderEvent.LOAD_ERROR))this._contentLoader.addEventListener(G.URLLoaderEvent.LOAD_ERROR,this._onLoadErrorDelegate);if(this.hasEventListener(G.ParserEvent.PARSE_ERROR))this._contentLoader.addEventListener(G.ParserEvent.PARSE_ERROR,this._onParseErrorDelegate);return this._contentLoader};t.prototype._disposeLoader=function(){this._contentLoader.removeEventListener(G.LoaderEvent.LOADER_START,this._onLoaderStartDelegate);this._contentLoader.removeEventListener(G.URLLoaderEvent.LOAD_PROGRESS,this._onLoadProgressDelegate);this._contentLoader.removeEventListener(G.URLLoaderEvent.LOAD_COMPLETE,this._onLoadCompleteDelegate);this._contentLoader.removeEventListener(G.AssetEvent.ASSET_COMPLETE,this._onAssetCompleteDelegate);this._contentLoader.removeEventListener(G.LoaderEvent.LOADER_COMPLETE,this._onLoaderCompleteDelegate);if(this.hasEventListener(G.URLLoaderEvent.LOAD_ERROR))this._contentLoader.removeEventListener(G.URLLoaderEvent.LOAD_ERROR,this._onLoadErrorDelegate);if(this.hasEventListener(G.ParserEvent.PARSE_ERROR))this._contentLoader.removeEventListener(G.ParserEvent.PARSE_ERROR,this._onParseErrorDelegate);if(!this._useAssetLib)this._contentLoader.stop();this._contentLoader=null};t.prototype.unload=function(){};t.enableParser=function(t){G.Loader.enableParser(t)};t.enableParsers=function(t){G.Loader.enableParsers(t)};t.prototype._onLoaderStart=function(t){this.dispatchEvent(t)};t.prototype._onLoadProgress=function(t){this.dispatchEvent(t)};t.prototype._onLoadComplete=function(t){this.dispatchEvent(t)};t.prototype._onAssetComplete=function(t){this.dispatchEvent(t)};t.prototype._onLoadError=function(t){if(this.hasEventListener(G.URLLoaderEvent.LOAD_ERROR)){this.dispatchEvent(t);return true}else{return false}};t.prototype._onParseError=function(t){if(this.hasEventListener(G.ParserEvent.PARSE_ERROR)){this.dispatchEvent(t);return true}else{return false}};t.prototype._onLoaderComplete=function(t){this._content=t.content;if(this._content)this.addChild(this._content);this.dispatchEvent(t);this._disposeLoader()};return t}(c);var U=function(){function l(){}l.setInterval=function(t,e){this._intervalID++;if(e<4){e=4}this._active_intervals[this._intervalID]={f:t,t:e,dt:0,isTimeout:false};return this._intervalID};l.setTimeOut=function(t,e){this._intervalID++;if(e<4){e=4}this._active_intervals[this._intervalID]={f:t,t:e,dt:0,isTimeout:true};return this._intervalID};l.clearInterval=function(t){delete this._active_intervals[t]};l.clearTimeout=function(t){delete this._active_intervals[t]};l.execute_intervals=function(t){if(t===void 0){t=0}var e;for(var i in this._active_intervals){e=this._active_intervals[i];e.dt+=t;while(this._active_intervals[i]&&e.dt>=e.t){e.dt-=e.t;e.f();if(e.isTimeout){delete this._active_intervals[i]}}}};l.add_child_to_dispose=function(t){this._queued_dispose.push(t)};l.get_queue=function(){if(!l._queue){l._queue={queued_mcs:[],queued_scripts:[],queued_mcs_pass2:[],queued_scripts_pass2:[],constructors:[]}}return l._queue};l.add_script_to_queue=function(t,e){var i=l.get_queue();var r=i.queued_mcs_pass2.length;var s=0;for(s=0;s<r;s++){i.queued_mcs.push(i.queued_mcs_pass2[s]);i.queued_scripts.push(i.queued_scripts_pass2[s])}i.queued_mcs_pass2.length=0;i.queued_scripts_pass2.length=0;t.adapter.allowScript=true;i.queued_mcs.push(t);i.queued_scripts.push(e)};l.add_loaded_action_to_queue=function(t){var e=l.get_queue();e.queued_mcs.push(t);e.queued_scripts.push(null)};l.add_script_to_queue_pass2=function(t,e){var i=l.get_queue();t.adapter.allowScript=true;i.queued_mcs_pass2.push(t);i.queued_scripts_pass2.push(e)};l.execute_as3_constructors_finish_scene=function(t){for(var e=0,i=t.numChildren;e<i;e++){var r=t.getChildAt(e);if(r.parent&&r.adapter.executeConstructor)l.execute_as3_constructors_recursiv(r)}};l.execute_as3_constructors_enterFrame=function(t){if(!l.invalidAS3Constructors)return;l.execute_as3_constructors_recursiv(t);l.invalidAS3Constructors=false};l.execute_as3_constructors_recursiv=function(t){var e=t.adapter;var i=e.executeConstructor;if(i){e.executeConstructor=null;i()}else{for(var r=0,s=t.numChildren;r<s;r++){var n=t.getChildAt(r);l.execute_as3_constructors_recursiv(n)}}if(t.just_added_to_timeline&&t._sessionID>=0&&e&&e.dispatchStaticEvent){e.dispatchStaticEvent("added",e);t.just_added_to_timeline=false;t.hasDispatchedAddedToStage=t.isOnDisplayList();if(t.hasDispatchedAddedToStage)e.dispatchStaticEvent("addedToStage",e)}};l.isOnStage=function(t){var e=t;while(e&&!e.isAVMScene){e=e.parent}if(e&&e.isAVMScene)return true;return false};l.execute_avm1_constructors=function(){var t=l.get_queue();if(t.queued_mcs.length==0&&t.queued_mcs_pass2.length==0)return;var e=t.queued_mcs_pass2.length;while(e>0){e--;t.queued_mcs.push(t.queued_mcs_pass2[e]);t.queued_scripts.push(t.queued_scripts_pass2[e])}t.queued_mcs_pass2.length=0;t.queued_scripts_pass2.length=0;var i=t.queued_mcs;var r;if(l.useAVM1){e=i.length;while(e>0){e--;r=i[e];if(!l.isOnStage(r))continue;if(r.onInitialize){var s=r.onInitialize;r.onInitialize=null;s()}}for(e=0;e<i.length;e++){r=i[e];if(!l.isOnStage(r))continue;if(r.onConstruct){var s=r.onConstruct;r.onConstruct=null;s()}var n=r.adapter.executeConstructor;if(n){r.adapter.executeConstructor=null;n()}}}};l.execute_queue=function(){var t=l.get_queue();if(t.queued_mcs.length==0&&t.queued_mcs_pass2.length==0)return;var e=t.queued_mcs.concat();var i=t.queued_scripts.concat();t.queued_mcs.length=0;t.queued_scripts.length=0;var r=t.queued_mcs_pass2.length;var s=0;for(s=0;s<r;s++){e.push(t.queued_mcs_pass2[s]);i.push(t.queued_scripts_pass2[s])}t.queued_mcs_pass2.length=0;t.queued_scripts_pass2.length=0;var n;if(l.useAVM1){for(s=0;s<e.length;s++){n=e[s];if(!l.isOnStage(n))continue;if(n.onInitialize){var o=n.onInitialize;n.onInitialize=null;o()}}for(s=0;s<e.length;s++){n=e[s];if(!l.isOnStage(n))continue;if(n.onConstruct){var o=n.onConstruct;n.onConstruct=null;o()}var a=n.adapter.executeConstructor;if(a){n.adapter.executeConstructor=null;a()}}}for(s=0;s<e.length;s++){n=e[s];if(l.useAVM1){if(!l.isOnStage(n))continue;if(n.onLoaded){var o=n.onLoaded;n.onLoaded=null;o()}if(!n.adapter.hasOnLoadExecuted){n.adapter.hasOnLoadExecuted=true;var h=n.adapter.alGet("onLoad");if(h){h.alCall(n.adapter)}}}if(i[s]!=null){n=e[s];if(n&&n.adapter&&!n.adapter.constructorHasRun){t.queued_mcs.push(n);t.queued_scripts.push(i[s])}else if(n&&n.adapter&&n.adapter.executeScript){n.adapter.executeScript(i[s])}else{}}else{}}};l.execute_dispose=function(){var t=this._queued_dispose.length;for(var e=0;e<t;e++)this._queued_dispose[e].dispose();this._queued_dispose.length=0};l.invalidAS3Constructors=false;l.frameScriptDebug=undefined;l.useAVM1=false;l._queued_dispose=[];l._active_intervals=new Object;l._intervalID=0;return l}();var V=function(i){g(r,i);function r(t){var e=i.call(this,t)||this;e.buttons=0;return e}Object.defineProperty(r.prototype,"bubbles",{get:function(){var t=this._iAllowedToPropagate&&this._iAllowedToImmediatlyPropagate;this._iAllowedToPropagate=true;this._iAllowedToImmediatlyPropagate=true;return t},enumerable:true,configurable:true});r.prototype.stopPropagation=function(){this._iAllowedToPropagate=false;if(this._iParentEvent)this._iParentEvent.stopPropagation()};r.prototype.stopImmediatePropagation=function(){this._iAllowedToPropagate=false;this._iAllowedToImmediatlyPropagate=false;if(this._iParentEvent)this._iParentEvent.stopImmediatePropagation()};r.prototype.clone=function(){var t=new r(this.type);t.screenX=this.screenX;t.screenY=this.screenY;t.view=this.view;t.containerNode=this.containerNode;t.rootNode=this.rootNode;t.traversable=this.traversable;t.material=this.material;t.uv=this.uv;t.position=this.position;t.normal=this.normal;t.elementIndex=this.elementIndex;t.delta=this.delta;t.ctrlKey=this.ctrlKey;t.shiftKey=this.shiftKey;t._iParentEvent=this;t._iAllowedToPropagate=this._iAllowedToPropagate;t.buttons=this.buttons;return t};Object.defineProperty(r.prototype,"scenePosition",{get:function(){return this.containerNode.getMatrix3D().transformVector(this.position)},enumerable:true,configurable:true});Object.defineProperty(r.prototype,"sceneNormal",{get:function(){var t=this.containerNode.getMatrix3D().deltaTransformVector(this.normal);t.normalize();return t},enumerable:true,configurable:true});r.prototype._dispatchEvent=function(t,e){if(!t.isMouseDisabled()||this.type==r.MOUSE_OUT||this.type==r.ROLL_OUT){t.container.dispatchEvent(this,e);U.execute_queue()}};r.MOUSE_OVER="mouseOver3d";r.MOUSE_OUT="mouseOut3d";r.ROLL_OVER="rollOver3d";r.ROLL_OUT="rollOut3d";r.MOUSE_UP="mouseUp3d";r.MOUSE_UP_OUTSIDE="mouseUpOutside3d";r.MOUSE_DOWN="mouseDown3d";r.MOUSE_MOVE="mouseMove3d";r.DRAG_MOVE="dragMove3d";r.DRAG_OUT="dragOut3d";r.DRAG_OVER="dragOver3d";r.DRAG_START="dragStart3d";r.DRAG_STOP="dragStop3d";r.FOCUS_IN="focusIn3d";r.FOCUS_OUT="focusOut3d";r.CLICK="click3d";r.DOUBLE_CLICK="doubleClick3d";r.MOUSE_WHEEL="mouseWheel3d";return r}(G.EventBase);var H=function(s){g(c,s);function c(t,e){if(e===void 0){e=false}var i=s.call(this)||this;i.symbolID=0;i.preventScript=false;i._scenes=[];i._buttonMode=false;i._isButton=false;i._time=0;i._currentFrameIndex=-1;i._isPlaying=true;i._currentSceneIndex=0;i._sceneDirty=false;i._isInit=true;i._sessionID_childs={};i._sounds={};i._skipFramesForStream=0;i._isTimelinePass=false;i._isSprite=false;i.buttonEnabled=true;i.loop=true;i.constructedKeyFrameIndex=-1;i._soundVolume=1;i._parentSoundVolume=1;i._isButton=false;i._buttonMode=false;i._useHandCursor=true;i.doingSwap=false;i.cursorType="pointer";i._onMouseOver=function(t){if(i.buttonEnabled)i.currentFrameIndex=t.buttons&1?i.currentFrameIndex==0?0:2:1;else i.currentFrameIndex=0};i._onMouseOut=function(t){i.currentFrameIndex=t.buttons&1&&i.currentFrameIndex!=0?1:0};i._onMouseDown=function(t){if(i.buttonEnabled)i.currentFrameIndex=2;else i.currentFrameIndex=0};i._onMouseUp=function(t){i.currentFrameIndex=1};i._onMouseUpOutside=function(t){i.currentFrameIndex=0};i._timeline=t;if(e){i.transformToSprite()}return i}c.stopAllSounds=function(){c._activeSoundsOwners.forEach(function(t){return t&&t.stopAllSounds()});c._activeSoundsOwners.clear()};c.getNewMovieClip=function(t){if(c._movieClips.length){var e=c._movieClips.pop();e.timeline=t;return e}return new c(t)};c.clearPool=function(){c._movieClips=[]};Object.defineProperty(c.prototype,"isSprite",{get:function(){return this._isSprite},enumerable:true,configurable:true});c.prototype.initSoundStream=function(t,e){if(!this._soundStreams){this._soundStreams=new c.movieClipSoundsManagerClass(this)}this._soundStreams.initSoundStream(t,e)};c.prototype.addSoundStreamBlock=function(t,e){if(!this._soundStreams){this._soundStreams=new c.movieClipSoundsManagerClass(this)}this._soundStreams.addSoundStreamBlock(t,e)};c.prototype.stopCurrentStream=function(t){if(this._soundStreams){return this._soundStreams.stopStream(t)}};c.prototype.resetStreamStopped=function(){if(this._soundStreams){this._soundStreams.resetStreamStopped()}};c.prototype._syncSounds=function(t){if(this._soundStreams){return this._soundStreams.syncSounds(t,this._isPlaying,this.parent)}return 0};c.prototype.transformToSprite=function(){if(this._isSprite){return}this._isSprite=true;var t=this._timeline;if(t.numFrames<=1){return}t.frame_command_indices=[t.frame_command_indices[0]];t.frame_recipe=[t.frame_recipe[0]];t.keyframe_constructframes=[t.keyframe_constructframes[0]];t.keyframe_durations=[t.keyframe_durations[0]];t.keyframe_firstframes=[t.keyframe_firstframes[0]];t.keyframe_indices=[t.keyframe_indices[0]]};c.prototype.startSound=function(t,e,i,r){var s=e.play(0,i);s.onSoundComplete=r;this._sounds[t]=e;if(!c._activeSounds[t]){c._activeSounds[t]=[]}c._activeSounds[t].push(s);c._activeSoundsOwners.add(this)};c.prototype.stopSounds=function(t){if(t===void 0){t=null}if(t){if(this._sounds[t]){this._sounds[t].stop();delete this._sounds[t];var e=c._activeSounds[t];if(e){for(var i=0,r=e;i<r.length;i++){var s=r[i];s.stop()}}delete c._activeSounds[t]}}else{for(var n in this._sounds){this._sounds[n].stop();var e=c._activeSounds[t];if(e){for(var o=0,a=e;o<a.length;o++){var s=a[o];s.stop()}}delete c._activeSounds[n]}this._sounds={}}if(Object.getOwnPropertyNames(this._sounds).length===0){c._activeSoundsOwners.delete(this)}var h=this._children.length;var l;for(var u=0;u<h;++u){l=this._children[u];if(l.isAsset(c))l.stopSounds(t)}this.stopCurrentStream(this._currentFrameIndex);c._activeSounds={};if(this._soundStreams){this._soundStreams.syncSounds(0,false,this.parent)}};c.prototype.getSceneIndexByFrame=function(t){var e=this.scenes;if(e.length<=1){return 0}for(var i=0;i<e.length;i++){if(e[i].offset>t){return i-1}}return e.length-1};c.prototype.getSceneIndex=function(t){var e=this.scenes;for(var i=0;i<e.length&&t;i++){if(e[i].name===t){return i}}return 0};Object.defineProperty(c.prototype,"currentSceneName",{get:function(){return this.scenes[this._currentSceneIndex].name},set:function(t){var e=this.getSceneIndex(t);this._sceneDirty=this._currentSceneIndex!==e;this._currentSceneIndex=e;this._currentFrameIndex=this._scenes[e].offset},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"currentScene",{get:function(){var t=this.scenes[this._currentSceneIndex];if(t.numFrames===-1){t.numFrames=this.timeline.numFrames-t.offset}return t},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"scenes",{get:function(){if(this._scenes.length===0){this._scenes[0]={name:"Scene1",offset:0,labels:[],numFrames:this.timeline.numFrames}}return this._scenes},set:function(t){this._scenes=t},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"isPlaying",{get:function(){return this._isPlaying},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"soundVolume",{get:function(){return this._soundVolume},set:function(t){if(this._soundVolume==t){return}this._soundVolume=t;for(var e in this._sounds){this._sounds[e].volume=t}var i=this._children.length;var r;for(var s=0;s<i;++s){r=this._children[s];if(r.isAsset(c))r.soundVolume=t}},enumerable:true,configurable:true});c.prototype.stopSound=function(t){if(this._sounds[t]){this._sounds[t].stop();delete this._sounds[t]}if(Object.getOwnPropertyNames(this._sounds).length===0){c._activeSoundsOwners.delete(this)}if(c._activeSounds[t]){for(var e=0;e<c._activeSounds[t].length;e++){c._activeSounds[t][e].stop()}delete c._activeSounds[t]}};c.prototype.stopAllSounds=function(){var t=Object.keys(this._sounds);for(var e=0,i=t;e<i.length;e++){var r=i[e];this.stopSounds(r)}};c.prototype.buttonReset=function(){if(this._isButton&&!this.buttonEnabled){this.currentFrameIndex=0}};c.prototype.getMouseCursor=function(){if(this.name=="scene")return"initial";if(this._useHandCursor&&this.buttonMode){return this.cursorType}return"initial"};c.prototype.queueFrameScripts=function(t,e,i){console.warn("[MovieClip] - queueFrameScripts should only be called on AVM-Adapters")};c.prototype.registerScriptObject=function(t){this[t.name]=t;if(t.isAsset(c))t.removeButtonListeners()};c.prototype.unregisterScriptObject=function(t){delete this[t.name];if(t.isAsset(c))t.removeButtonListeners()};c.prototype.dispose=function(){this.disposeValues();c._movieClips.push(this)};c.prototype.disposeValues=function(){s.prototype.disposeValues.call(this);this._sessionID_childs={};this._timeline=null};Object.defineProperty(c.prototype,"useHandCursor",{get:function(){return this._useHandCursor},set:function(t){this._useHandCursor=t},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"buttonMode",{get:function(){return this._buttonMode},set:function(t){this._buttonMode=t},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"isButton",{get:function(){return this._isButton},set:function(t){this._isButton=t},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"isInit",{get:function(){return this._isInit},set:function(t){this._isInit=t},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"timeline",{get:function(){return this._timeline},set:function(t){if(this._timeline==t)return;this._timeline=t;this.reset(false,false)},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"numFrames",{get:function(){return this._timeline.numFrames},enumerable:true,configurable:true});c.prototype.jumpToLabel=function(t,e){if(e===void 0){e=0}var i=this._currentFrameIndex;this._timeline.jumpToLabel(this,t,e);return i!==this._currentFrameIndex};c.prototype.reset=function(t,e){if(t===void 0){t=true}if(e===void 0){e=true}this._isTimelinePass=true;if(e)s.prototype.reset.call(this);if(this.id==4115)console.warn("reset",this.id);this.resetStreamStopped();this._time=0;if(e&&this._adapter)this.adapter.freeFromScript();this.constructedKeyFrameIndex=-1;for(var i=this.numChildren-1;i>=0;i--)this.removeChildAt(i);if(this._graphics)this._graphics.clear();if(t){var r=this._timeline.keyframe_indices.length;this._isPlaying=Boolean(r>1);this._currentSceneIndex=0;if(r){this._currentFrameIndex=0;this._timeline.constructNextFrame(this,t&&!this.doingSwap&&!this.preventScript,true)}else{this._currentFrameIndex=-1}}this._skipAdvance=true;this._isTimelinePass=false};Object.defineProperty(c.prototype,"currentFrameIndex",{get:function(){return this._currentFrameIndex},set:function(t){this.jumpToIndex(t)},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"currentFrameIndexRelative",{get:function(){return this._currentFrameIndex-this.currentScene.offset},set:function(t){this.jumpToIndex(t,this._currentSceneIndex)},enumerable:true,configurable:true});c.prototype.jumpToIndex=function(t,e){var i=true;var r=0;var s=this._timeline.keyframe_indices.length;this.resetStreamStopped();if(!s)return false;var n=this.scenes;if(typeof e==="undefined"){e=this.getSceneIndexByFrame(t)}else{e=typeof e==="string"?this.getSceneIndex(e):e;var o=n[e];if(o.numFrames===-1){o.numFrames=s-o.offset}r=o.offset;s=o.numFrames}this._currentSceneIndex=e;if(t<0){t=0}else if(t>=s){t=s-1;i=false}t+=r;this._skipAdvance=false;if(this._currentFrameIndex===t&&!this._sceneDirty)return false;this._sceneDirty=false;this._currentFrameIndex=t;this._timeline.gotoFrame(this,t,i,false,false);return true};c.prototype.addButtonListeners=function(){this._isButton=true;this.stop();this.addEventListener(V.MOUSE_OVER,this._onMouseOver);this.addEventListener(V.MOUSE_OUT,this._onMouseOut);this.addEventListener(V.MOUSE_DOWN,this._onMouseDown);this.addEventListener(V.MOUSE_UP,this._onMouseUp);this.addEventListener(V.MOUSE_UP_OUTSIDE,this._onMouseUpOutside);this.mouseChildren=false};c.prototype.removeButtonListeners=function(){this.removeEventListener(V.MOUSE_OVER,this._onMouseOver);this.removeEventListener(V.MOUSE_OUT,this._onMouseOut);this.removeEventListener(V.MOUSE_DOWN,this._onMouseDown);this.removeEventListener(V.MOUSE_UP,this._onMouseUp);this.removeEventListener(V.MOUSE_UP_OUTSIDE,this._onMouseUpOutside)};c.prototype.getTimelineChildAtSessionID=function(t){return this._sessionID_childs[t]};c.prototype.constructFrame=function(t,e,i,r,s,n,o){console.warn("[scene/MovieClip] - constructFrame not implemented")};c.prototype.addTimelineChildAtDepth=function(t,e,i){console.warn("[scene/MovieClip] - addTimelineChildAtDepth not implemented");return null};c.prototype.removeTimelineChildAtDepth=function(t){console.warn("[scene/MovieClip] - removeTimelineChildAtDepth not implemented")};c.prototype.removeChildAtInternal=function(t){var e=this._children[t];if(e._adapter)e.adapter.freeFromScript();if(this._isTimelinePass){this.adapter.unregisterScriptObject(e)}delete this._sessionID_childs[e._sessionID];e._sessionID=-1;if(e.adapter&&e.adapter.dispatchStaticEvent){e.adapter.dispatchStaticEvent("removed",e.adapter)}if(this.isOnDisplayList()&&e.adapter.dispatch_REMOVED_FROM_STAGE){e.adapter.dispatch_REMOVED_FROM_STAGE(e)}return s.prototype.removeChildAtInternal.call(this,t)};Object.defineProperty(c.prototype,"assetType",{get:function(){return c.assetType},enumerable:true,configurable:true});c.prototype.play=function(){if(this._timeline.keyframe_indices.length>1)this._isPlaying=true};c.prototype.stop=function(){this.resetStreamStopped();this._isPlaying=false};c.prototype.clone=function(){var t=c.getNewMovieClip(this._timeline);this.copyTo(t);return t};c.prototype.copyTo=function(t){s.prototype.copyTo.call(this,t);t.buttonMode=this.buttonMode;t.symbolID=this.symbolID;t.loop=this.loop;t._soundStreams=this._soundStreams;t._scenes=this._scenes;if(this._isSprite){t.transformToSprite()}};c.prototype.advanceFrameInternal=function(){if(this._timeline&&this._timeline.numFrames>0&&this._isPlaying&&!this._skipAdvance){if(this._currentFrameIndex===this._timeline.numFrames-1){if(this.loop){if(this._currentFrameIndex!==0){this._currentFrameIndex=0;this._currentSceneIndex=0;this.resetStreamStopped();this._timeline.gotoFrame(this,0,true,true,true)}}else this._isPlaying=false}else{this._currentFrameIndex++;this._currentSceneIndex=this.getSceneIndexByFrame(this._currentFrameIndex);this._timeline.constructNextFrame(this)}}s.prototype.advanceFrame.call(this);this._skipAdvance=false};c.prototype.advanceFrame=function(){this._isTimelinePass=true;if(this._skipFramesForStream==0){this.advanceFrameInternal()}this._skipFramesForStream=this._syncSounds(this._currentFrameIndex);while(this._skipFramesForStream>0){U.execute_queue();this.advanceFrameInternal();this._skipFramesForStream=this._syncSounds(this._currentFrameIndex)}this._isTimelinePass=false};c.prototype.logHierarchy=function(t){if(t===void 0){t=0}this.printHierarchyName(t,this);var e=this._children.length;var i;for(var r=0;r<e;r++){i=this._children[r];if(i.isAsset(c))i.logHierarchy(t+1);else this.printHierarchyName(t+1,i)}};c.prototype.printHierarchyName=function(t,e){var i="";for(var r=0;r<t;++r)i+="--";i+=" "+e.name+" = "+e.id;console.log(i)};c.prototype.clear=function(){this.resetStreamStopped();s.prototype.clear.call(this)};c.avm1ScriptQueue=[];c.avm1ScriptQueueScripts=[];c.avm1LoadedActions=[];c.movieClipSoundsManagerClass=null;c._movieClips=new Array;c._activeSounds={};c._activeSoundsOwners=new Set;c.assetType="[asset MovieClip]";return c}(f);o.PartitionBase.registerAbstraction(o.EntityNode,H);var W=function(s){g(t,s);function t(t,e,i,r){if(t===void 0){t=null}if(e===void 0){e=null}if(i===void 0){i=null}if(r===void 0){r=null}return s.call(this)||this}Object.defineProperty(t.prototype,"downState",{get:function(){return this._downState},set:function(t){this._downState=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this.enabled=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"hitTestState",{get:function(){return this._hitTestState},set:function(t){this._hitTestState=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"overState",{get:function(){return this._overState},set:function(t){this._overState=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"soundTransform",{get:function(){console.log("soundTransform not implemented yet in flash/SimpleButton");return null},set:function(t){console.log("soundTransform not implemented yet in flash/SimpleButton")},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"trackAsMenu",{get:function(){console.log("trackAsMenu not implemented yet in flash/SimpleButton");return false},set:function(t){console.log("trackAsMenu not implemented yet in flash/SimpleButton")},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"upState",{get:function(){return this._upState},set:function(t){this._upState=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"useHandCursor",{get:function(){console.log("useHandCursor not implemented yet in flash/SimpleButton");return false},set:function(t){console.log("useHandCursor not implemented yet in flash/SimpleButton")},enumerable:true,configurable:true});return t}(f);var z=function(t){g(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}Object.defineProperty(e.prototype,"assetType",{get:function(){return e.assetType},enumerable:true,configurable:true});e.assetType="[asset SkyboxElements]";return e}(X.TriangleElements);var K=function(t){g(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e.prototype._includeDependencies=function(t){};e.prototype._getVertexCode=function(t,e,i){var r="";var s=t.globalPosDependencies>0?i.globalPositionVertex:i.animatedPosition;var n=e.getFreeVertexConstant();e.getFreeVertexConstant();e.getFreeVertexConstant();e.getFreeVertexConstant();t.viewMatrixIndex=n.index*4;var o=e.getFreeVertexConstant();t.scenePositionIndex=o.index*4;var a=e.getFreeVertexConstant();var h=e.getFreeVertexVectorTemp();r+="mul "+h+", "+s+", "+a+"\n"+"add "+h+", "+h+", "+o+"\n";if(t.projectionDependencies>0){i.projectionFragment=e.getFreeVarying();r+="m44 "+h+", "+h+", "+n+"\n"+"mov "+i.projectionFragment+", "+h+"\n"+"mov op, "+h+"\n"}else{r+="m44 op, "+h+", "+n+"\n"}return r};e.prototype._getFragmentCode=function(t,e,i){return""};return e}(X._Render_ElementsBase);var Z=function(e){g(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;t._skyboxProjection=new G.Matrix3D;return t}t.prototype.draw=function(t,e,i,r){var s=e.scenePositionIndex;var n=e.view.projection.transform.matrix3D.position;e.vertexConstantData[s++]=2*n.x;e.vertexConstantData[s++]=2*n.y;e.vertexConstantData[s++]=2*n.z;e.vertexConstantData[s++]=1;e.vertexConstantData[s++]=e.vertexConstantData[s++]=e.vertexConstantData[s++]=e.view.projection.far/Math.sqrt(3);e.vertexConstantData[s]=1;var o=new G.Vector3D;this._skyboxProjection.copyFrom(e.view.viewMatrix3D);this._skyboxProjection.copyRowTo(2,o);var a=o.x;var h=o.y;var l=o.z;var u=-(o.x*n.x+o.y*n.y+o.z*n.z+Math.sqrt(a*a+h*h+l*l));var c=a>=0?1:-1;var _=h>=0?1:-1;var f=new G.Vector3D(c,_,1,1);var p=this._skyboxProjection.clone();p.invert();var d=p.transformVector(f);this._skyboxProjection.copyRowTo(3,f);var g=(d.x*f.x+d.y*f.y+d.z*f.z+d.w*f.w)/(a*d.x+h*d.y+l*d.z+u*d.w);this._skyboxProjection.copyRowFrom(2,new G.Vector3D(a*g,h*g,l*g,u*g));if(e.sceneMatrixIndex>=0)e.sceneMatrix.copyFrom(t.renderSceneTransform,true);e.viewMatrix.copyFrom(this._skyboxProjection,true);var m=this._stage.context;m.setProgramConstantsFromArray(q.ContextGLProgramType.VERTEX,e.vertexConstantData);m.setProgramConstantsFromArray(q.ContextGLProgramType.FRAGMENT,e.fragmentConstantData);if(this._indices)this.getIndexBufferGL().draw(q.ContextGLDrawMode.TRIANGLES,0,this.numIndices);else this._stage.context.drawVertices(q.ContextGLDrawMode.TRIANGLES,r,i||this.numVertices)};return t}(X._Stage_TriangleElements);X.RenderGroup.registerElements(K,z);q.Stage.registerAbstraction(Z,z);var Q=function(r){g(t,r);function t(t,e){if(t===void 0){t=16777215}if(e===void 0){e=1}var i=r.call(this)||this;i._textures=new Array;i._blendMode=q.BlendMode.NORMAL;i.animateUVs=false;i.bothSides=false;i.curves=false;i.imageRect=false;i.useColorTransform=false;i.alphaThreshold=0;i.alphaBlending=true;i._onTextureInvalidateDelegate=function(t){return i.onTextureInvalidate(t)};i._owners=[i];i.style=new X.Style;if(t instanceof q.ImageCube){i._style.image=t;i.texture=new X.ImageTextureCube}else{i._style.color=Number(t)}return i}Object.defineProperty(t.prototype,"animationSet",{get:function(){return this._animationSet},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"blendMode",{get:function(){return this._blendMode},set:function(t){if(this._blendMode==t)return;this._blendMode=t;this.invalidate()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"iOwners",{get:function(){return this._owners},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"texture",{get:function(){return this._texture},set:function(t){if(this._texture==t)return;if(this._texture)this.removeTexture(this._texture);this._texture=t;if(this._texture)this.addTexture(this._texture);this.invalidatePasses()},enumerable:true,configurable:true});t.prototype.getNumTextures=function(){return this._textures.length};t.prototype.getTextureAt=function(t){return this._textures[t]};t.prototype.getEntity=function(){return this};Object.defineProperty(t.prototype,"assetType",{get:function(){return t.assetType},enumerable:true,configurable:true});t.prototype.invalidatePasses=function(){this.dispatchEvent(new X.MaterialEvent(X.MaterialEvent.INVALIDATE_PASSES,this))};t.prototype.invalidateElements=function(){this.dispatchEvent(new X.RenderableEvent(X.RenderableEvent.INVALIDATE_ELEMENTS,this))};t.prototype.invalidateMaterial=function(){this.dispatchEvent(new X.RenderableEvent(X.RenderableEvent.INVALIDATE_MATERIAL,this))};t.prototype.invalidateStyle=function(){this.dispatchEvent(new X.RenderableEvent(X.RenderableEvent.INVALIDATE_STYLE,this))};t.prototype.addTexture=function(t){this._textures.push(t);t.addEventListener(G.AssetEvent.INVALIDATE,this._onTextureInvalidateDelegate);this.onTextureInvalidate()};t.prototype.removeTexture=function(t){this._textures.splice(this._textures.indexOf(t),1);t.removeEventListener(G.AssetEvent.INVALIDATE,this._onTextureInvalidateDelegate);this.onTextureInvalidate()};t.prototype.onTextureInvalidate=function(t){if(t===void 0){t=null}this.invalidate()};t.prototype._onInvalidateProperties=function(t){this.invalidateMaterial();this.invalidatePasses()};t.prototype._acceptTraverser=function(t){t.applyTraversable(this)};t.prototype.iAddOwner=function(t){};t.prototype.iRemoveOwner=function(t){};t.prototype._getDefaultBoundingVolume=function(){return o.BoundingVolumeType.NULL};t.prototype.testCollision=function(t,e){t.traversable=null;return false};t.assetType="[asset Skybox]";return t}(c);var J=function(r){g(t,r);function t(t,e){var i=r.call(this,t,e)||this;i._skybox=t;i._shader=new X.ShaderBase(e,i,i,i._stage);i._texture=i._skybox.texture.getAbstraction(i._shader);i._pAddPass(i);return i}t.prototype.onClear=function(t){r.prototype.onClear.call(this,t);this._texture.onClear(new G.AssetEvent(G.AssetEvent.CLEAR,this._skybox.texture));this._texture=null;this._skybox=null};t.prototype._pUpdateRender=function(){r.prototype._pUpdateRender.call(this);this.requiresBlending=this._material.blendMode!=q.BlendMode.NORMAL;this.shader.setBlendMode(this._material.blendMode==q.BlendMode.NORMAL&&this.requiresBlending?q.BlendMode.LAYER:this._material.blendMode)};t.prototype._includeDependencies=function(t){r.prototype._includeDependencies.call(this,t);t.usesPositionFragment=true};t.prototype._getFragmentCode=function(t,e){return this._texture._getFragmentCode(e.shadedTarget,t,e,e.positionVarying)};t.prototype._setRenderState=function(t){r.prototype._setRenderState.call(this,t);this._texture._setRenderState(t)};t.prototype._activate=function(){r.prototype._activate.call(this);this._stage.context.setDepthTest(false,q.ContextGLCompareMode.LESS);this._texture.activate()};return t}(X._Render_MaterialPassBase);var $=function(t){g(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e.prototype._getStageElements=function(){var t=e._elements;if(!t){t=new z(new q.AttributesBuffer(11,4));t.autoDeriveNormals=false;t.autoDeriveTangents=false;t.setIndices(Array(0,1,2,2,3,0,6,5,4,4,7,6,2,6,7,7,3,2,4,5,1,1,0,4,4,0,3,3,7,4,2,1,5,5,6,2));t.setPositions(Array(-1,1,-1,1,1,-1,1,1,1,-1,1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1))}return t.getAbstraction(this._stage)};e.prototype._getRenderMaterial=function(){return this._asset.getAbstraction(this.renderer.getRenderElements(this.stageElements.elements))};e.prototype._getStyle=function(){return this._asset.style};return e}(X._Render_RenderableBase);var tt=function(t){g(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e.prototype.isInFrustum=function(t,e,i,r){if(this.isInvisible())return false;return true};e.prototype.isCastingShadow=function(){return false};return e}(o.EntityNode);X.DefaultRenderer.registerMaterial(J,Q);X.RenderEntity.registerRenderable($,Q);o.PartitionBase.registerAbstraction(tt,Q);var et=function(){function t(){}t.CENTER="center";t.LEFT="left";t.NONE="none";t.RIGHT="right";return t}();var it=function(){function t(){}t.DYNAMIC="dynamic";t.INPUT="input";t.STATIC="input";return t}();(function(t){t["STANDART"]="standart";t["BOLD"]="bold";t["ITALIC"]="italic";t["BOLDITALIC"]="boldItalic"})(d.FontStyleName||(d.FontStyleName={}));var rt=function(){function t(){}t.CENTER="center";t.JUSTIFY="justify";t.LEFT="left";t.RIGHT="right";return t}();var st=function(){function t(t,e,i){if(t===void 0){t=null}if(e===void 0){e=null}if(i===void 0){i=null}this.fill_data=t;this.stroke_data=e;this.fill_data_path=i;this.fnt_channel=0;this.lastTesselatedScale=0;this.kerningCharCodes=[];this.kerningValues=[]}t.prototype.dispose=function(){if(this.stroke_data){this.stroke_data=null}if(this.fill_data){this.fill_data=null}if(this.fill_data_path){this.fill_data_path=null}};return t}();var nt=function(){function t(t){this._stage=t}return t}();var ot=function(){function t(){this.left=Number.MAX_VALUE;this.right=Number.MIN_VALUE;this.top=Number.MAX_VALUE;this.bottom=Number.MIN_VALUE}t.prototype.grown=function(t,e){if(t<this.left)this.left=t;if(t>this.right)this.right=t;if(e<this.top)this.top=e;if(e>this.bottom)this.bottom=e};t.prototype.toRect=function(){return new G.Rectangle(this.left,this.top,this.right-this.left,this.bottom-this.top)};return t}();var at=function(r){g(y,r);function y(t,e){if(e===void 0){e=false}var i=r.call(this,t)||this;i.debug=false;i.debug=e;return i}y.getCanvasContext=function(t,e,i){if(t===void 0){t=100}if(e===void 0){e=100}if(i===void 0){i=false}var r="OffscreenCanvas"in self&&!i?new self.OffscreenCanvas(t,e):document.createElement("canvas");r.width=t;r.height=e;return r.getContext("2d",{desynchronized:true,alpha:true})};y.freeCanvasContext=function(t){if(t.canvas instanceof self.OffscreenCanvas){return}t.canvas.width=0;t.canvas.height=0};y.transformChar=function(t){var e=t.fill_data_path;if(e.commands[0].length===0&&e.commands.length===1){return null}var i=new Path2D;var r=new ot;for(var s=0;s<e.commands.length;s++){var n=e.data[s];var o=e.commands[s];var a=0;for(var h=0,l=o;h<l.length;h++){var u=l[h];switch(u){case Y.GraphicsPathCommand.MOVE_TO:{var c=n[a++]/20;var _=n[a++]/20;r.grown(c,_);i.moveTo(c,_);break}case Y.GraphicsPathCommand.LINE_TO:{var c=n[a++]/20;var _=n[a++]/20;r.grown(c,_);i.lineTo(c,_);break}case Y.GraphicsPathCommand.CURVE_TO:{var f=n[a++]/20;var p=n[a++]/20;var d=n[a++]/20;var g=n[a++]/20;r.grown(f,p);r.grown(d,g);i.quadraticCurveTo(f,p,d,g)}}}}return{path:i,char:t,rect:r.toRect()}};y.sortPatches=function(t,e){return t.rect.height-e.rect.height};y.render=function(t,e,i,r,s){if(r===void 0){r=0}if(s===void 0){s=0}var n=t.get_font_chars();var o=[];var a=s*2;var h=0;var l=1;for(var u=0,c=n;u<c.length;u++){var _=c[u];var f=y.transformChar(_);if(!f){continue}h+=(a+f.rect.width)*(a+f.rect.height);o.push(f)}o.sort(y.sortPatches);if(r){t.initFontSize(r);l=i/t.get_font_em_size()}e.save();e.clearRect(0,0,i,i);e.fillStyle="#fff";var p=s;var d=s;var g=0;for(var m=0,v=o;m<v.length;m++){var f=v[m];if(!f.path){continue}if(p+f.rect.width+a>=i/l){p=s;d+=g+a;g=0}if(d+f.rect.height>i/l){console.warn("[FNTGeneratorCanvas] Font image overflow, font will corrupted!")}g=Math.max(f.rect.height,g);e.setTransform(l,0,0,l,(p-f.rect.x)*l,(d-f.rect.y)*l);e.fill(f.path);f.char.fnt_rect=new G.Rectangle(f.rect.x/f.char.char_width,f.rect.y/t.get_font_em_size(),f.rect.width/f.char.char_width,f.rect.height/t.get_font_em_size());f.char.fnt_uv=new G.Rectangle(p*l/i,d*l/i,f.rect.width*l/i,f.rect.height*l/i);f.char.fnt_channel=0;p+=f.rect.width+a}e.restore()};y.prototype.generate=function(t,e,i,r){var s=y.getCanvasContext(e,e,this.debug);var n=[];for(var o in t.font_styles){var a=t.font_styles[o];y.render(a,s,e,i,r);var h=s.getImageData(0,0,e,e);var l=new q.BitmapImage2D(e,e,true,0,true,this._stage);l.setPixels(new G.Rectangle(0,0,e,e),h.data);n.push(l);a.addFNTChannel(l)}if(!this.debug){y.freeCanvasContext(s)}else{this.canvas=s.canvas}return n};return y}(nt);var ht=Object.create(null);function lt(t,e){if(e===void 0){e=""}var i=ht[t._id+e];ht[t._id+e]=true;return!i}var ut=function(r){g(s,r);function s(t){if(t===void 0){t=null}var e=r.call(this)||this;e._fntSizeLimit=-1;e._font_chars=[];e._font_chars_dic=Object.create(null);e._current_size=0;e._size_multiply=0;e._ascent=0;e._descent=0;e._usesCurves=false;e._glyphIdxToChar={};e._fnt_channels=[];e._font_em_size=32;if(t){e._opentype_font=t;e._font_em_size=72;e._ascent=t.tables.hhea.ascender/(e._opentype_font.unitsPerEm/72);e._descent=-2+t.tables.hhea.descender/(e._opentype_font.unitsPerEm/72);e._current_size=0;e._size_multiply=0;var i=e._opentype_font.charToGlyph(String.fromCharCode(32));if(i){}return e}return e}s.prototype.addFNTChannel=function(t){this._fnt_channels.push(t)};s.prototype.getGlyphCount=function(){return this._font_chars.length};s.prototype.generateFNTData=function(t){if(this._fntSizeLimit>0){return}var e=new at(t,false);var i=e.generate(this.font,this._font_em_size,this._current_size,4);if(i&&i.length>0){this._fntSizeLimit=this._current_size*4}};s.prototype.generateFNTTextures=function(t,e,i){console.log("generateFNTTextures");if(e){this._fntSizeLimit=e*.5;this.initFontSize(e)}if(this._opentype_font){for(var r=0;r<this._opentype_font.glyphs.length;r++){var s=this._opentype_font.charToGlyph(String.fromCharCode(this._opentype_font.glyphs.glyphs[r].unicode));if(s){var n=s.getPath();var o=new Y.GraphicsPath;var a=0;var h=n.commands.length;var l=0;var u=0;var c=this._ascent;for(a=0;a<h;a++){var _=n.commands[a];if(_.type==="M"){o.moveTo(_.x,_.y+c);l=_.x;u=_.y+c}else if(_.type==="L"){o.lineTo(_.x,_.y+c)}else if(_.type==="Q"){o.curveTo(_.x1,_.y1+c,_.x,_.y+c)}else if(_.type==="C"){o.cubicCurveTo(_.x1,_.y1+c,_.x2,_.y2+c,_.x,_.y+c)}else if(_.type==="Z"){o.lineTo(l,u)}}var f=new st(null,null,o);f.char_width=s.advanceWidth*(1/s.path.unitsPerEm*72);f.fill_data=Y.GraphicsFactoryFills.pathToAttributesBuffer(o,true);if(!f.fill_data){console.log("error tesselating opentype glyph",this._opentype_font.glyphs.glyphs[r])}else{this._font_chars.push(f);this._font_chars_dic[this._opentype_font.glyphs.glyphs[r].unicode]=f}}else{console.log("no char found for",this._opentype_font.glyphs.glyphs[r])}}}var p;var d=0;var g=0;var m;var v;var y=[[]];var b=0;var x=0;var w=[];var E=Number.MIN_VALUE;var S=Number.MIN_VALUE;var A=Number.MAX_VALUE;var T=Number.MAX_VALUE;var P=0;var D=0;var I=0;for(var a=0;a<this._font_chars.length;a++){p=this._font_chars[a].fill_data;m=new Float32Array(p.buffer);E=Number.MIN_VALUE;S=Number.MIN_VALUE;A=Number.MAX_VALUE;T=Number.MAX_VALUE;P=0;D=0;for(v=0;v<p.count;v++){P=m[v*2];D=m[v*2+1];if(P<T)T=P;if(P>S)S=P;if(D<A)A=D;if(D>E)E=D}this._font_chars[a].fnt_rect=new G.Rectangle(T/this._font_chars[a].char_width,A/this._font_em_size,(S-T)/this._font_chars[a].char_width,(E-A)/this._font_em_size);I+=(S-T+t+t)*(E-A+t+t);w[w.length]={idx:a,minx:T,miny:A,width:S-T,height:E-A}}w.sort(function(t,e){return t.height>e.height?-1:1});var C=0;x=i;var M=1;if(e){this.initFontSize(e);M=this._size_multiply}else{M=x/Math.sqrt(I)*1.2;var O=true;var F=0;while(O){O=false;d=0;g=t;for(var a=0;a<w.length;a++){F=w[a].height*M;P=0;D=0;d+=t;if(d+w[a].width*M+t>=x){d=t;g+=C+t*2;C=0}if(F>C){C=F}if(g+F+t*2>=x){O=true;M=M*.995;break}d+=w[a].width*M+t}}}this._fntSizeLimit=M*this._font_em_size*.5;var R;d=0;g=t;for(var a=0;a<w.length;a++){R=this._font_chars[w[a].idx];p=R.fill_data;m=new Float32Array(p.buffer);T=w[a].minx;S=Number.MIN_VALUE;A=w[a].miny;E=Number.MIN_VALUE;P=0;D=0;d+=t;if(d+w[a].width*M+t>=x){d=t;g+=C+t*2;C=0}w[a].height*=M;if(w[a].height>C){C=w[a].height}if(g+C+t*2>=x){d=t;g=t;C=0;b++;y[b]=[]}R.fnt_channel=b;for(v=0;v<p.count;v++){P=(m[v*2]-T)*M+d;D=(m[v*2+1]-A)*M+g;y[b][y[b].length]=P;y[b][y[b].length]=D;if(P>S){S=P}if(D>E){E=D}}R.fnt_uv=new G.Rectangle(d/x,1-g/x,(S-d)/x,(E-g)/x);d+=w[a].width*M+t}var N=[];for(var a=0;a<y.length;a++){var L=2;var k=new q.AttributesView(Float32Array,L);k.set(y[a]);var j=k.attributesBuffer.cloneBufferView();k.dispose();var B=new X.TriangleElements(j);B.setPositions(new q.Float2Attributes(j));var U=Y.Shape.getShape(B);var V=new q.ImageSampler;U.style=new X.Style;var H=16777215;var W=1;var z=Y.MaterialManager.get_material_for_color(H,W);U.material=z.material;if(z.colorPos){U.style.addSamplerAt(V,U.material.getTextureAt(0));U.material.animateUVs=true;U.style.uvMatrix=new G.Matrix(0,0,0,0,z.colorPos.x,z.colorPos.y)}N[a]=U}return N};s.prototype.getRatio=function(t){return this._size_multiply};s.prototype.hasChar=function(t){var e=!!this._font_chars_dic[t];if(!e&&this._opentype_font){e=!!this._opentype_font.charToGlyph(String.fromCharCode(parseInt(t)))}return e};s.prototype.changeOpenTypeFont=function(t,e){if(e===void 0){e=true}if(e&&this._opentype_font){}this._opentype_font=t;this._ascent=t.ascender;this._descent=t.descender;this._font_em_size=t.unitsPerEm;var i=this.getChar("32");if(i){this._whitespace_width=i.char_width}};s.prototype.initFontSize=function(t){if(this._current_size===t){return}this._current_size=t;this._size_multiply=t/this._font_em_size;if(!this._size_multiply){debugger}};s.prototype.getCharVertCnt=function(t){var e=this._font_chars_dic[t];if(e){return e.fill_data.length}return 0};s.prototype.getCharWidth=function(t){var e=this._whitespace_width*this._size_multiply||s.DEFAULT_SPACE;if(t=="32"){return(e*20|0)/20}if(t=="9"){return e*2*20/20}var i=this.getChar(t,false);if(i){return(i.char_width*this._size_multiply*20|0)/20}else if(t=="9679"){i=this.createPointGlyph_9679();return(i.char_width*this._size_multiply*20|0)/20}return 0};Object.defineProperty(s.prototype,"usesCurves",{get:function(){return this._usesCurves},enumerable:true,configurable:true});s.prototype.getLineHeight=function(){return this._size_multiply*(this._ascent-this.descent)};s.prototype.getUnderLineHeight=function(){return this._size_multiply*(this._ascent-this.descent/2)};Object.defineProperty(s.prototype,"assetType",{get:function(){return s.assetType},enumerable:true,configurable:true});s.prototype.dispose=function(){for(var t=0;t<this._font_chars.length;t++){this._font_chars[t].dispose()}this._font_chars.length=0;this._font_chars_dic=null};Object.defineProperty(s.prototype,"fntSizeLimit",{get:function(){return this._fntSizeLimit},set:function(t){this._fntSizeLimit=t},enumerable:true,configurable:true});Object.defineProperty(s.prototype,"ascent",{get:function(){return this._ascent},set:function(t){this._ascent=t},enumerable:true,configurable:true});Object.defineProperty(s.prototype,"descent",{get:function(){return this._descent},set:function(t){this._descent=t},enumerable:true,configurable:true});Object.defineProperty(s.prototype,"offset_x",{get:function(){return this._offset_x},set:function(t){this._offset_x=t},enumerable:true,configurable:true});Object.defineProperty(s.prototype,"offset_y",{get:function(){return this._offset_y},set:function(t){this._offset_y=t},enumerable:true,configurable:true});s.prototype.get_font_chars=function(){return this._font_chars};s.prototype.get_font_em_size=function(){return this._font_em_size};s.prototype.set_whitespace_width=function(t){this._whitespace_width=t};s.prototype.get_whitespace_width=function(){return this._whitespace_width};s.prototype.set_font_em_size=function(t){this._font_em_size=t};s.prototype.buildTextLineFromIndices=function(t,e,i,r,s,n){var o=t.getTextShapeForIdentifierAndFormat(e.color.toString(),e);var a=i;var h=s.length;var l=[];var u=0;r-=this._ascent*this._size_multiply;for(var c=0;c<h;c++){var _=s[c];var f=this._glyphIdxToChar[_];if(!f){i+=n[c];continue}if(f.fill_data===null){if(f.fill_data_path.commands[0][0]==1&&f.fill_data_path.data[0][0]==0&&f.fill_data_path.data[0][1]==0){f.fill_data_path.data[0].shift();f.fill_data_path.data[0].shift();f.fill_data_path.commands[0].shift();f.fill_data_path.commands[0][0]=2}f.fill_data=Y.GraphicsFactoryFills.pathToAttributesBuffer(f.fill_data_path,true)}var p=f.fill_data;if(p){l.push({char:f,x:i,y:r,selected:false});u+=p.buffer.byteLength/4}i+=n[c]}var d=new Float32Array(u);this._fillBuffer(d,l,false);o.addChunk(d);return new G.Point(i-a,this.getLineHeight())};s.prototype.fillTextRun=function(t,e,i,r){var s=this._fntSizeLimit>=0&&this._fntSizeLimit>=e.size;if(s){return this.fillTextRunFNT(t,e,i,r)}var n=this._queryShape(t,e);var o;var a;var h=i+r;var l=this._size_multiply;var u=t.selectionBeginIndex;var c=t.selectionEndIndex;var _=0;if(t.selectable){a=e.clone();a.color=16777215;o=this._queryShape(t,a);if(a.underline&&i+1<t.words.length){_=t.words.get(i).x}if(t.selectionEndIndex<t.selectionBeginIndex){u=t.selectionEndIndex;c=t.selectionBeginIndex}}var f=0;var p=0;var d=[];var g=[];var m=[];for(var v=i;v<h;v+=1){var y=t.words.get(v);var b=y.x;var x=y.y;var w=y.start;var E=w+y.len;for(var S=w;S<E;S++){var A=t.isInFocus&&S>=u&&S<c?o:n;var T=t.chars_codes[S];if(T===32||T===9){continue}var P=this.getChar(T,true);if(!P){if(lt(this,"miss"+t.chars_codes[S])){console.debug("[TesselatedFontTable] Error: char not found in fontTable",t.chars_codes[S],String.fromCharCode(t.chars_codes[S]))}continue}if(A===o){g.push({char:P,x:b,y:x,selected:true});f+=P.fill_data.buffer.byteLength/4}else{d.push({char:P,x:b,y:x,selected:false});p+=P.fill_data.buffer.byteLength/4}b+=P.char_width*l}var D=.25*t.internalScale.y;var I=x+this.getUnderLineHeight()+D;var C=x+this.getUnderLineHeight()-D;if(t.selectable&&a.underline&&i+1<t.words.length){var M=new Float32Array(12);M[0]=_;M[1]=C;M[2]=_;M[3]=I;M[4]=b;M[5]=I;M[6]=b;M[7]=I;M[8]=b;M[9]=C;M[10]=_;M[11]=C;m.push(M)}}if(p>0){p+=m.length*12;var O=new Float32Array(p);var F=this._fillBuffer(O,d,false);for(var R=0,N=m;R<N.length;R++){var L=N[R];O.set(L,F);F+=L.length}n.addChunk(O)}if(f>0){var O=new Float32Array(f);this._fillBuffer(O,g,true);o.addChunk(O)}};s.prototype._cacheKey=function(t,e){if(t===void 0){t=16777215}if(e===void 0){e=-1}var i=e>=0;return""+t+i+(i?e:0)};s.prototype._queryShape=function(t,e,i){if(i===void 0){i=-1}var r=t.getTextShapeForIdentifierAndFormat(this._cacheKey(e.color,i),e);if(i>=0&&!r.fntMaterial){var s=G.ColorUtils.float32ColorToARGB(e.color);var n=new h.MethodMaterial(this._fnt_channels[i]);n.colorTransform=new G.ColorTransform(s[1]/255,s[2]/255,s[3]/255);n.bothSides=true;n.alphaBlending=true;n.useColorTransform=true;n.style.sampler=new q.ImageSampler(false,true,true);r.fntMaterial=n}return r};s.prototype.fillTextRunFNT=function(t,e,i,r){var s=this._queryShape(t,e,0);var n={};var o={};var a=i+r;var h=this._size_multiply;var l;var u=t.selectionBeginIndex;var c=t.selectionEndIndex;var _=0;if(t.selectable){var f=e.clone();f.color=16777215;l=this._queryShape(t,f,0);o[l.cacheId]=l;if(f.underline&&i+1<t.words.length){_=t.words.get(i).x}if(t.selectionEndIndex<t.selectionBeginIndex){u=t.selectionEndIndex;c=t.selectionBeginIndex}}n[s.cacheId]=s;var p=new Map;var d=[];for(var g=i;g<a;g+=1){var m=t.words.get(g);var v=m.x;var y=m.y;var b=m.start;var x=b+m.len;var w=null;var E=null;var S=0;var A=-1;for(var T=b;T<x;T++){if(t.chars_codes[T]===32||t.chars_codes[T]===9){continue}var P=this.getChar(t.chars_codes[T],false);if(!P){if(lt(this,"miss"+t.chars_codes[T])){console.debug("[TesselatedFontTable] Error: char not found in fontTable",t.chars_codes[T],String.fromCharCode(t.chars_codes[T]))}continue}var D=t.isInFocus&&T>=u&&T<c;var I=s;var C=n;if(D){I=l;C=o}var M=I.format;var O=w?w.cacheId:"";if(!O||S!==M.color||P.fnt_channel!==A){O=this._cacheKey(M.color,P.fnt_channel);S=M.color;A=P.fnt_channel}var F=w&&w.cacheId!==O?C[O]:w;if(!F){F=this._queryShape(t,M,P.fnt_channel);C[F.cacheId]=F}if(w!==F||!E){E=p.get(F)||{uv:[],pos:[]};p.set(F,E);w=F}this._emitCharFNT(E,P,v,y);v+=P.char_width*h}}var R=Array.from(p.keys());for(var N=0,L=R;N<L.length;N++){var k=L[N];var j=p.get(k);k.addChunk(new Float32Array(j.pos),new Float32Array(j.uv))}};s.prototype._emitCharFNT=function(t,e,i,r){var s=this._size_multiply;var n=this._font_em_size*s;var o=e.fnt_rect;var a=e.fnt_uv;var h=e.char_width*s;if(!o){return}var l=i+h*o.x*20;var u=l+h*o.width*20;var c=r+n*o.y*20;var _=c+n*o.height*20;t.pos.push(l,c,l,_,u,c,u,c,l,_,u,_);t.uv.push(a.x,a.y,a.x,a.bottom,a.right,a.y,a.right,a.y,a.x,a.bottom,a.right,a.bottom)};s.prototype.createPointGlyph_9679=function(){var t=[];Y.GraphicsFactoryHelper.drawElipse(this._font_em_size/2,this._font_em_size/2,this._font_em_size/8,this._font_em_size/8,t,0,360,5,false);var e=new q.AttributesView(Float32Array,2);e.set(t);var i=e.attributesBuffer.cloneBufferView();e.dispose();var r=new st(i,null,null);r.char_width=this._font_em_size;this._font_chars.push(r);this._font_chars_dic["9679"]=r;return r};s.prototype.getCharOpenType=function(t){if(!this._opentype_font){return null}var e=this._opentype_font.charToGlyph(String.fromCharCode(parseInt(t)));if(!e){return null}var i=e.getPath();var r=new Y.GraphicsPath;var s=0;var n=i.commands.length;var o=0;var a=0;var h=this._ascent;var l=this._opentype_font.unitsPerEm/72;for(s=0;s<n;s++){var u=i.commands[s];if(u.type==="M"){r.moveTo(l*u.x,l*u.y+h);o=l*u.x;a=l*u.y+h}else if(u.type==="L"){r.lineTo(l*u.x,l*u.y+h)}else if(u.type==="Q"){r.curveTo(l*u.x1,l*u.y1+h,l*u.x,l*u.y+h)}else if(u.type==="C"){var c=u.x1+(u.x2-u.x1)/2;var _=u.y1+(u.y2-u.y1)/2;r.curveTo(l*u.x1,l*u.y1+h,l*c,l*_+h);r.curveTo(l*u.x2,l*u.y2+h,l*u.x,l*u.y+h)}else if(u.type==="Z"){r.lineTo(o,a)}}var f=new st(null,null,r);f.char_width=e.advanceWidth;f.fill_data=Y.GraphicsFactoryFills.pathToAttributesBuffer(r,true,null,l*b.FONT_TESSELATION_QUALITY);f.lastTesselatedScale=l;if(!f.fill_data){if(lt(this,"tess"+t)){console.debug("[TesselatedFontTable] Error:tesselating opentype glyph:",t.charCodeAt(0))}return null}this._font_chars.push(f);this._font_chars_dic[t]=f};s.prototype.getChar=function(t,e){if(e===void 0){e=true}t=""+t;var i=this._font_chars_dic[t];if(!e&&i){return i}if(!i){if(this._opentype_font){return this.getCharOpenType(t)}if(t=="9679"){return this.createPointGlyph_9679()}return null}var r=this._size_multiply;var s=Math.max(.01,Math.round(r*100)/100);if(i.fill_data_path===null){return null}if(!(i.fill_data==null&&i.stroke_data==null)&&i.lastTesselatedScale>=s){return i}var n=i.fill_data_path;if(n.commands[0][0]==1&&n.data[0][0]==0&&n.data[0][1]==0){n.data[0].shift();n.data[0].shift();n.commands[0].shift();n.commands[0][0]=2}if(i.fill_data){i.fill_data.clear()}i.fill_data=Y.GraphicsFactoryFills.pathToAttributesBuffer(i.fill_data_path,true,null,s*b.FONT_TESSELATION_QUALITY);if(i.lastTesselatedScale>0){console.debug("[TesselatedFontTable] Retesselate char from scale:",i.lastTesselatedScale,s,String.fromCharCode(+t))}i.lastTesselatedScale=s;if(!i.fill_data){if(lt(this,"tess"+t)){console.debug("[TesselatedFontTable] Error:tesselating glyph:",t.charCodeAt(0))}return null}return i};s.prototype.setChar=function(t,e,i,r,s,n,o){if(i===void 0){i=null}if(r===void 0){r=null}if(s===void 0){s=false}if(n===void 0){n=0}if(o===void 0){o=null}e=Math.floor(e*20)/20;if(i==null&&r==null&&o==null)throw"TesselatedFontTable: trying to create a TesselatedFontChar with no data \n\t\t\t\t(fills_data, stroke_data and fill_data_path is null)";if(this._font_chars.length>0){if(s!=this._usesCurves){throw"TesselatedFontTable: Can not set different types of graphic-glyphs\n\t\t\t\t\t(curves vs non-cuves) on the same FontTable!"}}else{this._usesCurves=s}var a=new st(i,r,o);a.char_width=e;a.glyph_idx=n;a.name=t;this._glyphIdxToChar[n]=a;this._font_chars.push(a);this._font_chars_dic[t]=a};s.prototype.roundTo=function(t){var e=b.TEXT_SHAPE_ROUND_PRECISION;var i=1/(e||1);return Math.floor(t*i)*e};s.prototype._fillBuffer=function(t,e,i){if(i===void 0){i=false}var r=this._size_multiply;var s=0;for(var n=0,o=e;n<o.length;n++){var a=o[n];if(a.selected!==i){continue}var h=a.x,l=a.y,u=a.char;var c=new Float32Array(u.fill_data.buffer);var _=c.length;for(var f=0;f<_;f+=2){t[s+f+0]=this.roundTo(c[f+0]*r+h);t[s+f+1]=this.roundTo(c[f+1]*r+l)}s+=c.length}return s};s.assetType="[asset TesselatedFontTable]";s.DEFAULT_SPACE=14;return s}(G.AssetBase);var ct=function(){function t(t,e,i,r,s,n,o,a,h,l){this.id=t;this.x=e;this.y=i;this.width=r;this.height=s;this.x_offset=n;this.y_offset=o;this.x_advance=a;this.page=h;this.channel=l}return t}();var _t=function(e){g(t,e);function t(){var t=e.call(this)||this;t._font_chars=[];t._materials=[];t._font_chars_dic=new Object;t._ascent=0;t._descent=0;t._current_size=0;t._size_multiply=0;t._init_size=0;t._texture_width=0;t._texture_height=0;t._adjust_size=0;return t}t.prototype.getGlyphCount=function(){return this._font_chars.length};Object.defineProperty(t.prototype,"assetType",{get:function(){return t.assetType},enumerable:true,configurable:true});t.prototype.initFontSize=function(t){if(this._adjust_size)t*=this._adjust_size;if(this._current_size==t)return;this._current_size=t;this._size_multiply=t/this._init_size};t.prototype.getCharDataCanvas=function(t){var e=this._font_chars_dic[t];if(e){return[e.x,e.y,e.width,e.height,e.x_offset*this._size_multiply,e.y_offset*this._size_multiply]}return[]};t.prototype.getCharData=function(t){var e=this._font_chars_dic[t];if(e){var i=e.height/this._init_size*this._current_size;var r=e.width/this._init_size*this._current_size;return[e.x/this._texture_width,e.y/this._texture_height,e.width/this._texture_width,e.height/this._texture_height,e.x_offset*this._size_multiply,e.y_offset*this._size_multiply,i,r]}return[]};t.prototype.getCharVertCnt=function(t){return 6*4};Object.defineProperty(t.prototype,"texture_width",{get:function(){return this._texture_width},set:function(t){this._texture_width=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"texture_height",{get:function(){return this._texture_height},set:function(t){this._texture_height=t},enumerable:true,configurable:true});t.prototype.hasChar=function(t){return this._font_chars_dic[t]!=null};t.prototype.getCharWidth=function(t){var e=this._font_chars_dic[t];if(e)return this._size_multiply*e.x_advance;return 0};t.prototype.fillTextRun=function(t,e,i,r){};t.prototype.getLineHeight=function(){return this._current_size};t.prototype.dispose=function(){var t=this._materials.length;for(var e=0;e<t;++e){this._materials[e].dispose()}this._materials.length=0;this._font_chars.length=0;this._font_chars_dic=null};t.prototype.addMaterial=function(t){this._materials.push(t)};t.prototype.getMaterial=function(t){if(t===void 0){t=0}return this._materials[t]};Object.defineProperty(t.prototype,"ascent",{get:function(){return this._ascent},set:function(t){this._ascent=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"descent",{get:function(){return this._descent},set:function(t){this._descent=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"offset_x",{get:function(){return this._offset_x},set:function(t){this._offset_x=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"offset_y",{get:function(){return this._offset_y},set:function(t){this._offset_y=t},enumerable:true,configurable:true});t.prototype.get_font_chars=function(){return this._font_chars};t.prototype.get_font_em_size=function(){return this._font_em_size};t.prototype.set_whitespace_width=function(t){this._whitespace_width=t};t.prototype.get_whitespace_width=function(){return this._whitespace_width};t.prototype.set_font_em_size=function(t){this._font_em_size=t};t.prototype.getChar=function(t){return this._font_chars_dic[t]};t.prototype.setChar=function(t,e,i,r,s,n,o,a,h,l){var u=new ct(t,e,i,r,s,n,o,a,h,l);this._font_chars.push(u);this._font_chars_dic[t]=u};t.assetType="[asset BitmapFontTable]";return t}(G.AssetBase);var ft=function(e){g(t,e);function t(){var t=e.call(this)||this;t._font_styles={};t.fontName=null;t.regularFontStyle=null;return t}Object.defineProperty(t,"emptyFontTable",{get:function(){if(!this._emptyFontTable){this._emptyFontTable=new ut}return this._emptyFontTable},enumerable:true,configurable:true});t.registerFont=function(t){};Object.defineProperty(t.prototype,"font_styles",{get:function(){return this._font_styles},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"assetType",{get:function(){return t.assetType},enumerable:true,configurable:true});t.prototype.dispose=function(){for(var t in this._font_styles){this._font_styles[t].dispose()}this._font_styles=null};t.prototype.replace_font_table=function(t,e){this._font_styles[t]=e};t.prototype.create_font_table=function(t,e,i){if(e===void 0){e=ut.assetType}if(i===void 0){i=null}var r=this.get_font_table(t,e,i);if(r){console.warn("[Font] - create_font_table - "+t+" - already exists")}var s=null;if(e==ut.assetType){s=new ut(i)}else if(e==_t.assetType){s=new _t}s.name=t;s.font=this;this._font_styles[t]=s;return s};t.prototype.get_font_table=function(t,e,i,r){if(e===void 0){e=ut.assetType}if(i===void 0){i=null}if(r===void 0){r=false}var s=this._font_styles[t];if(s){if(s.assetType!=e){throw"[Font] - get_font_table - existing table has wrong assetType"}return s}if(r&&Object.keys(this._font_styles).length>0){for(var n in this._font_styles){console.log("font style not found return different",n);return this._font_styles[n]}}return null};t.assetType="[asset Font]";return t}(G.AssetBase);var pt=function(){function t(){}t.getDeviceFont=function(t){t=this.getDeviceFontName(t);if(this._deviceFonts[t])return this._deviceFonts[t];var e=new ft;e.name=t;this._deviceFonts[t]=e;return this._deviceFonts[t]};t.getDeviceFontName=function(t){if(!t){return"sans"}for(var e in this.deviceFontMap){var i=this.deviceFontMap[e].indexOf(t);if(i>=0){return e}}console.warn("[DeviceFontManager] - no mapping exists for "+t+"\n\t\t - falling back to "+"sans");return"sans"};t.deviceFontMap={};t._deviceFonts={};return t}();pt.deviceFontMap["sans"]=["_sans","Arial"];pt.deviceFontMap["Arial Narrow"]=["Arial Narrow"];pt.deviceFontMap["Arial Black"]=["Arial Black"];pt.deviceFontMap["serif"]=[];pt.deviceFontMap["typewriter"]=[];var dt=function(){function t(){}t.defineFont_CFF=function(t,e){if(e===void 0){e=G.AssetBase.DEFAULT_NAMESPACE}this._embbedCFF_fonts||(this._embbedCFF_fonts={});this._embbedCFF_fonts[e]||(this._embbedCFF_fonts[e]={});var i=this._embbedCFF_fonts[e][t];if(i){return i}i=new ft;i.name=t;this._embbedCFF_fonts[e][t]=i;return i};t.getFont_CFF=function(t,e){if(e===void 0){e=G.AssetBase.DEFAULT_NAMESPACE}if(!t){return pt.getDeviceFont(t)}var i=e||G.AssetBase.DEFAULT_NAMESPACE;this._embbedCFF_fonts||(this._embbedCFF_fonts={});this._embbedCFF_fonts[i]||(this._embbedCFF_fonts[i]={});var r=this._embbedCFF_fonts[i][t];if(r){return r}for(var s in this._embbedCFF_fonts){if(this._embbedCFF_fonts[s][t]){return this._embbedCFF_fonts[s][t]}}return pt.getDeviceFont(t)};t.defineFont=function(t,e){if(e===void 0){e=G.AssetBase.DEFAULT_NAMESPACE}this._registered_fonts||(this._registered_fonts={});this._registered_fonts[e]||(this._registered_fonts[e]={});if(this.deviceFontsLoading){return pt.getDeviceFont(t)}var i=this._registered_fonts[e][t];if(i){return i}i=new ft;i.name=t;if(this._namespaces.indexOf(e)===-1){this._namespaces.push(e)}this._registered_fonts[e][t]=i;return i};t.registerFontForClassName=function(t,e){this._registered_fonts_by_className[e]=t};t.getFont=function(t,e){if(e===void 0){e=undefined}if(!t)return null;if(this._registered_fonts_by_className[t]){return this._registered_fonts_by_className[t]}var i=e||G.AssetBase.DEFAULT_NAMESPACE;this._registered_fonts||(this._registered_fonts={});this._registered_fonts[i]||(this._registered_fonts[i]={});var r=this._registered_fonts[i][t];if(r){return r}else if(this._namespaces.length>0&&!e){for(var s=0,n=this._namespaces;s<n.length;s++){var o=n[s];if(this._registered_fonts[o][t]){return this._registered_fonts[o][t]}}}return pt.getDeviceFont(t)};t.clearAll=function(){this.deviceFontsLoading=false;this._registered_fonts={}};t.deviceFontsLoading=false;t._registered_fonts={};t._registered_fonts_by_className={};t._namespaces=[];t._embbedCFF_fonts={};return t}();(function(t){t["DEFAULT"]="DEFAULT";t["DEVICE"]="device";t["EMBED_CFF"]="embeddedCFF"})(d.FontLookUpMode||(d.FontLookUpMode={}));var gt=["font","align","leftMargin","rightMargin","indent","size","color","bold","italic","underline","leading","letterSpacing"];var mt=function(p){g(e,p);function e(t,e,i,r,s,n,o,a,h,l,u,c,_){if(t===void 0){t=null}if(e===void 0){e=null}if(i===void 0){i=null}if(r===void 0){r=null}if(s===void 0){s=null}if(n===void 0){n=null}if(o===void 0){o=null}if(a===void 0){a=null}if(h===void 0){h=null}if(l===void 0){l=null}if(u===void 0){u=null}if(c===void 0){c=null}if(_===void 0){_=null}var f=p.call(this)||this;f.fontLookUpMode=d.FontLookUpMode.DEFAULT;f._updateID=0;f._fontTableDirty=true;f.tabStops=[];f._size=e;f._color=i;f._bold=r;f._italic=s;f._underline=n;f.url=o;f.link_target=a;f._align=h;f._leftMargin=l;f._rightMargin=u;f._indent=c;f._leading=_;if(typeof t==="string"){f.font_name=t}else{f.font=t}return f}Object.defineProperty(e.prototype,"updateID",{get:function(){return this._updateID},enumerable:true,configurable:true});e.prototype.hasPropertySet=function(t){return this["_"+t]!==null};Object.defineProperty(e.prototype,"align",{get:function(){return this._align?this._align:rt.LEFT},set:function(t){if(this._align!==t){this._updateID++}this._align=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"blockIndent",{get:function(){return this._blockIndent?this._blockIndent:0},set:function(t){if(this._blockIndent!==t){this._updateID++}this._blockIndent=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"leftMargin",{get:function(){return this._leftMargin?this._leftMargin:0},set:function(t){if(t!==this._leftMargin){this._updateID++}this._leftMargin=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"rightMargin",{get:function(){return this._rightMargin?this._rightMargin:0},set:function(t){if(t!==this._rightMargin){this._updateID++}this._rightMargin=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"indent",{get:function(){return this._indent?this._indent:0},set:function(t){if(t!==this._indent){this._updateID++}this._indent=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"color",{get:function(){return this._color!==null?this._color:0},set:function(t){if(t!==this._color){this._updateID++}this._color=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"kerning",{get:function(){return this._kerning?this._kerning:false},set:function(t){if(t!==this._kerning){this._updateID++}this._kerning=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"leading",{get:function(){return this._leading?this._leading:0},set:function(t){if(t!==this._leading){this._updateID++}this._leading=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"letterSpacing",{get:function(){return this._letterSpacing?this._letterSpacing:0},set:function(t){if(t!==this._letterSpacing){this._updateID++}this._letterSpacing=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"size",{get:function(){return this._size?this._size:12},set:function(t){if(t!==this._size){this._updateID++}this._size=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"bold",{get:function(){return this._bold?this._bold:false},set:function(t){if(t!==this._bold){this._updateID++}this._bold=t;this._fontTableDirty=true},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"italic",{get:function(){return this._italic?this._italic:false},set:function(t){if(t!==this._italic){this._updateID++}this._italic=t;this._fontTableDirty=true},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"underline",{get:function(){return this._underline?this._underline:false},set:function(t){if(t!==this._underline){this._updateID++}this._underline=t},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"font_table",{get:function(){if(!this._font_table||this._fontTableDirty)this.update_font_table();return this._font_table},set:function(t){this._font_table=t;this._fontTableDirty=false},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"font_name",{get:function(){var t;return(t=this.font)===null||t===void 0?void 0:t.name},set:function(t){var e;if(((e=this.font)===null||e===void 0?void 0:e.name)==t)return;if(this.fontLookUpMode==d.FontLookUpMode.DEFAULT){this._font=dt.getFont(t)}else if(this.fontLookUpMode==d.FontLookUpMode.DEVICE){this._font=pt.getDeviceFont(t)}else if(this.fontLookUpMode==d.FontLookUpMode.EMBED_CFF){this._font=dt.getFont_CFF(t)}this._fontTableDirty=true;this._updateID++},enumerable:true,configurable:true});e.prototype.update_font_table=function(){this._fontTableDirty=false;var t=d.FontStyleName.STANDART;if(this._italic&&!this._bold)t=d.FontStyleName.ITALIC;else if(!this._italic&&this._bold)t=d.FontStyleName.BOLD;else if(this._italic&&this._bold)t=d.FontStyleName.BOLDITALIC;if(this._font){var e=this._font.get_font_table(t,ut.assetType,null,true);if(this._font_table&&!e)return;this._font_table=e?e:ft.emptyFontTable}};Object.defineProperty(e.prototype,"font",{get:function(){return this._font},set:function(t){if(this._font==t)return;this._font=t;this._fontTableDirty=true;this._updateID++},enumerable:true,configurable:true});e.prototype.clone=function(){var t=new e(this._font,this._size,this._color,this._bold,this._italic,this._underline,this.url,this.link_target,this._align,this._leftMargin,this._rightMargin,this._indent,this._leading);t.font_table=this._font_table;return t};e.prototype.equal=function(t){for(var e=0,i=gt;e<i.length;e++){var r=i[e];if(this[r]!==t[r]){return false}}return true};e.prototype.applyToFormat=function(t){for(var e=0,i=gt;e<i.length;e++){var r=i[e];if(this["_"+r]!==null){t[r]=this["_"+r]}}return t};e.prototype.mergeFormat=function(t){for(var e=0,i=gt;e<i.length;e++){var r=i[e];if(this["_"+r]!==t[r]){this["_"+r]=null}}};Object.defineProperty(e.prototype,"assetType",{get:function(){return e.assetType},enumerable:true,configurable:true});e.assetType="[asset TextFormat]";return e}(G.AssetBase);var vt=function(){function t(t,e,i,r,s,n){if(t===void 0){t=0}if(e===void 0){e=0}if(i===void 0){i=0}if(r===void 0){r=0}if(s===void 0){s=0}if(n===void 0){n=0}this.x=t;this.width=e;this.height=i;this.ascent=r;this.descent=s;this.leading=n}return t}();var yt=function(s){g(t,s);function t(t,e,i){if(i===void 0){i=0}var r=s.call(this,t)||this;r._char=e;r._charCode=i;r.isShift=false;r.isCTRL=false;r.isAlt=false;return r}Object.defineProperty(t.prototype,"char",{get:function(){return this._char},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"charCode",{get:function(){return this._charCode},enumerable:true,configurable:true});t.prototype.clone=function(){return new t(this.type,this._char,this._charCode)};t.KEYDOWN="keydown";t.KEYUP="keyup";return t}(G.EventBase);var bt=function(e){g(i,e);function i(t){return e.call(this,t)||this}i.prototype.clone=function(){var t=new i(this.type);return t};i.CHANGED="onChanged";return i}(G.EventBase);var xt=function(e){g(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype._iInternalUpdate=function(){e.prototype._iInternalUpdate.call(this);var t=this.parentTextField;if(t._textFormat&&!t._textFormat.font_table.isAsset(ut)&&!t._textFormat.material){this.transform.colorTransform.color=t.textColor!=null?t.textColor:t._textFormat.color;this._invalidateHierarchicalProperty(o.HierarchicalProperty.COLOR_TRANSFORM)}};return t}(f);var wt=function(){function t(t,e){this.format=t;this.cacheId=e;this.verts=[];this.uvs=[];this._length=0;this.verts=[];this.uvs=[]}Object.defineProperty(t.prototype,"length",{get:function(){return this._length},set:function(t){if(t>this._length){return}var e=this.verts;var i=this.uvs;if(t===0){this._length=0;e.length=0;i.length=0;return}var r=0;var s=t;while(r<e.length&&s>0){s-=e[r].length;r++}if(s<0){e[r-1]=e[r-1].subarray(0,s+e[r-1].length);if(i[r-1]){i[r-1]=i[r-1].subarray(0,s+i[r-1].length)}}e.length=r;this._length=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"hasUV",{get:function(){return this.uvs.length>0},enumerable:true,configurable:true});t.prototype.addChunk=function(t,e){if(this.verts.length!==this.uvs.length&&e){throw"You can't mix TextShape with UV and without in same place"}if(e&&t.length!==e.length){throw"Position buffer and UV buffer should has equal size"}this._length+=t.length;this.verts.push(t);if(e){this.uvs.push(e)}};Object.defineProperty(t.prototype,"tall",{get:function(){return this.verts[this.verts.length-1]},enumerable:true,configurable:true});return t}();var Et=[{test:/\&gt;/g,replace:">"}];var St=function(){function t(){}t.get=function(){if(!t.instance)t.instance=new t;return t.instance};t.prototype.processHTML=function(t,e){e=e.replace(/&apos;/g,"'");e=e.replace(new RegExp("&nbsp;","g")," ");e=e.replace(new RegExp("√","g"),String.fromCharCode(8730));e=e.replace(new RegExp("×","g"),String.fromCharCode(215));e=e.replace(new RegExp("<\\\\","g"),"</");e=e.replace(new RegExp("<br>","g"),"<br/>");e=e.replace(new RegExp("<BR>","g"),"<br/>");e=e.replace(new RegExp("<BR/>","g"),"<br/>");e=e.replace(new RegExp("<B","g"),"<b");e=e.replace(new RegExp("</B>","g"),"</b>");e=e.replace(new RegExp("<I","g"),"<i");e=e.replace(new RegExp("</I>","g"),"</i>");e=e.replace(new RegExp("<P","g"),"<p");e=e.replace(new RegExp("</P>","g"),"</p>");e=e.replace(new RegExp("<U","g"),"<u");e=e.replace(new RegExp("</U>","g"),"</u>");e=e.replace(new RegExp("<LI","g"),"<li");e=e.replace(new RegExp("</LI>","g"),"</li>");e=e.replace(new RegExp("<FONT","g"),"<font");e=e.replace(new RegExp("</FONT>","g"),"</font>");e=e.replace(new RegExp("& ","g"),"&amp; ");var i=0;var r=[];var s=[];var n=[];while(i<e.length){if(e[i]=="<"){if(e[i+1]=="p"){r[r.length]="p"}else if(e[i+1]=="b"&&e[i+2]!="r"){r[r.length]="b"}else if(e[i+1]=="i"){r[r.length]="i"}else if(e[i+1]=="u"){r[r.length]="u"}else if(e[i+1]=="f"&&e[i+2]=="o"&&e[i+3]=="n"&&e[i+4]=="t"){r[r.length]="font";i+=2}else if(e[i+1]=="l"&&e[i+2]=="i"){r[r.length]="li";i++}else if(e[i+1]=="/"&&e[i+2]=="p"){var o=r.length;var a=-1;while(o>0){o--;if(r[o]=="p"){a=o;break}}if(a<0){s[s.length]=i;n[n.length]=4}else{o=r.length-1;while(o>a){s[s.length]=i;n[n.length]="</"+r[o]+">";r.pop();o--}r.pop()}}else if(e[i+1]=="/"&&e[i+2]=="b"){var h=r.length;var a=-1;while(h>0){h--;if(r[h]=="b"){a=h;break}}if(a<0){s[s.length]=i;n[n.length]=4}else{h=r.length-1;while(h>a){s[s.length]=i;n[n.length]="</"+r[h]+">";r.pop();h--}r.pop()}}else if(e[i+1]=="/"&&e[i+2]=="i"){var l=r.length;var a=-1;while(l>0){l--;if(r[l]=="i"){a=l;break}}if(a<0){s[s.length]=i;n[n.length]=4}else{l=r.length-1;while(l>a){s[s.length]=i;n[n.length]="</"+r[l]+">";r.pop();l--}r.pop()}}else if(e[i+1]=="/"&&e[i+2]=="u"){var u=r.length;var a=-1;while(u>0){u--;if(r[u]=="u"){a=u;break}}if(a<0){s[s.length]=i;n[n.length]=4}else{u=r.length-1;while(u>a){s[s.length]=i;n[n.length]="</"+r[u]+">";r.pop();u--}r.pop()}}else if(e[i+1]=="/"&&e[i+2]=="l"&&e[i+3]=="i"){var c=r.length;var a=-1;while(c>0){c--;if(r[c]=="li"){a=c;break}}if(a<0){s[s.length]=i;n[n.length]=7}else{c=r.length-1;while(c>a){s[s.length]=i;n[n.length]="</"+r[c]+">";r.pop();c--}r.pop()}}else if(e[i+1]=="/"&&e[i+2]=="f"&&e[i+3]=="o"&&e[i+4]=="n"&&e[i+5]=="t"){var _=r.length;var a=-1;while(_>0){_--;if(r[_]=="font"){a=_;break}}if(a<0){s[s.length]=i;n[n.length]=7}else{_=r.length-1;while(_>a){s[s.length]=i;n[n.length]="</"+r[_]+">";r.pop();_--}r.pop()}}i++}else{i++}}var f=r.length;while(f>0){f--;s[s.length]=i;n[n.length]="</"+r[f]+">"}var p=0;var d=n.length;for(var g=0;g<d;g++){if(typeof n[g]==="number"){e=e.slice(0,s[g]+p)+e.slice(s[g]+p+n[g]);p-=n[g]}else{e=e.slice(0,s[g]+p)+n[g]+e.slice(s[g]+p);p+=n[g].length}}var m={text:""};t._textFormats=[t._textFormat];t._textFormatsIdx=[0];var v=y.parse(e);if(v&&v.firstChild){m.multiline=v.firstChild.childNodes.length>0;this.readHTMLTextPropertiesRecursive(t,v,m,t._textFormat)}if(m.text!=""&&(m.text.charCodeAt(m.text.length-1)==13||m.text.charCodeAt(m.text.length-1)==10)){m.text=m.text.slice(0,m.text.length-1)}if(m.text!=""&&(m.text.length>=2&&m.text[m.text.length-1]=="n"&&m.text[m.text.length-2]=="\\")){m.text=m.text.slice(0,m.text.length-2)}if(m.text!=""&&(m.text.length>=2&&m.text[m.text.length-1]=="n"&&m.text[m.text.length-2]=="\\")){m.text=m.text.slice(0,m.text.length-2)}t._textFormatsIdx[t._textFormatsIdx.length-1]=m.text.length;return m.text};t.prototype.readHTMLTextPropertiesRecursive=function(t,e,i,r){var s=[];var n=[];if(e.attributes){if(e.attributes.size||e.attributes.SIZE){var o=e.attributes.size?e.attributes.size:e.attributes.SIZE;o=o.replace(/[^0-9.]/g,"");s[s.length]=parseInt(o);n[n.length]="size"}if(e.attributes.color||e.attributes.COLOR){var o=e.attributes.color?e.attributes.color:e.attributes.COLOR;o=o.replace("#","0x");s[s.length]=parseInt(o);n[n.length]="color"}if(e.attributes.indent||e.attributes.INDENT){var o=e.attributes.indent?e.attributes.indent:e.attributes.INDENT;o=o.replace(/[^0-9.]/g,"");s[s.length]=parseInt(o);n[n.length]="indent"}if(e.attributes.leftMargin||e.attributes.LEFTMARGIN){var o=e.attributes.leftMargin?e.attributes.leftMargin:e.attributes.LEFTMARGIN;o=o.replace(/[^0-9.]/g,"");s[s.length]=parseInt(o);n[n.length]="leftMargin"}if(e.attributes.rightMargin||e.attributes.RIGHTMARGIN){var o=e.attributes.rightMargin?e.attributes.rightMargin:e.attributes.RIGHTMARGIN;o=o.replace(/[^0-9.]/g,"");s[s.length]=parseInt(o);n[n.length]="rightMargin"}if(e.attributes.align||e.attributes.ALIGN){var o=e.attributes.align?e.attributes.align:e.attributes.ALIGN;s[s.length]=o;n[n.length]="align"}if(e.attributes.face||e.attributes.FACE){var o=e.attributes.face?e.attributes.face:e.attributes.FACE;s[s.length]=o;n[n.length]="font_name"}}if(e.tagName=="b"||e.rawTagName=="b"){if(!r.bold){s[s.length]=true;n[n.length]="bold"}}else if(e.tagName=="i"||e.rawTagName=="i"){if(!r.italic){s[s.length]=true;n[n.length]="italic"}}else if(e.tagName=="u"||e.rawTagName=="u"){if(!r.underline){s[s.length]=true;n[n.length]="underline"}}else if(e.tagName=="font"||e.rawTagName=="font"){}else if(e.tagName=="li"||e.rawTagName=="li"){i.text+="\n ● "}else if((e.tagName=="br"||e.rawTagName=="br")&&t.multiline){i.text+="\n"}else if((e.tagName=="sbr"||e.rawTagName=="sbr")&&t.multiline){i.text+="\n"}var a=false;var h=s.length;while(h>0){h--;if(r[n[h]]!=s[h]){a=true;break}}var l=r;if(a){l=r.clone();h=s.length;while(h>0){h--;l[n[h]]=s[h]}t._textFormats.push(l);t._textFormatsIdx[t._textFormatsIdx.length-1]=i.text.length;t._textFormatsIdx.push(i.text.length)}if(e.childNodes&&e.childNodes.length>0){for(var u=0;u<e.childNodes.length;u++){if(t._textFormats[t._textFormats.length-1]!=l){t._textFormats.push(l);t._textFormatsIdx[t._textFormatsIdx.length-1]=i.text.length;t._textFormatsIdx.push(i.text.length)}this.readHTMLTextPropertiesRecursive(t,e.childNodes[u],i,l)}}else{var c=e.text.replace(/[\s\r\n]/gi,"");if(c!=""){var _=e.text;for(var f=0,p=Et;f<p.length;f++){var d=p[f];_=_.replace(d.test,d.replace)}i.text+=_}}if(e.tagName=="ul"||e.rawTagName=="ul"||e.tagName=="li"||e.rawTagName=="li"){}else if(e.tagName=="p"||e.rawTagName=="p"){i.text+="\n"}};return t}();var At=function(){function t(t){if(t===void 0){t=40}this.index=-1;this.store=Array.from({length:t},function(t){return{x:Infinity,y:Infinity,start:0,width:0,len:0}})}t.prototype.put=function(t,e,i,r,s){this.index++;var n=this.store[this.index]||(this.store[this.index]={});n.start=t;n.x=e;n.y=i;n.width=r;n.len=s;return n};Object.defineProperty(t.prototype,"last",{get:function(){return this.store[this.index]},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"length",{get:function(){return this.index+1},set:function(t){this.index=t-1},enumerable:true,configurable:true});t.prototype.get=function(t){return this.store[t]};t.prototype.free=function(){this.index=-1};t.prototype.dispose=function(){this.store=null;this.index=0};return t}();var Tt=[{test:/&apos;/g,replace:"'"},{test:/&gt;/g,replace:">"}];var Pt=function(r){g(d,r);function d(){var e=r.call(this)||this;e.textOffsetX=0;e.textOffsetY=0;e._selectionBeginIndex=0;e._selectionEndIndex=0;e._biggestLine=0;e._iText="";e._iTextDiffStart=0;e._text="";e._iTextWoLineBreaks="";e.inMaskMode=false;e.cursorIntervalID=-1;e.cursorBlinking=false;e.showSelection=false;e._textDirty=false;e._positionsDirty=false;e._glyphsDirty=false;e._shapesDirty=false;e._textShapesDirty=false;e.chars_codes=[];e.chars_width=[];e.tf_per_char=[];e.words=new At(10);e._textRuns_formats=[];e._textRuns_words=[];e._paragraph_textRuns_indices=[];e._maxWidthLine=0;e._labelData=null;e.lines_wordStartIndices=[];e.lines_wordEndIndices=[];e.lines_start_y=[];e.lines_start_x=[];e.lines_charIdx_start=[];e.lines_charIdx_end=[];e.lines_width=[];e.lines_height=[];e.lines_numSpacesPerline=[];e.char_positions_x=[];e.char_positions_y=[];e.sourceTextField=null;e._maskWidth=0;e._maskHeight=0;e._maskTextOffsetX=0;e._maskTextOffsetY=0;e.isStatic=false;e._internalScale=new G.Vector3D(1,1,1);e.onKeyDelegate=function(t){return e.onKey(t)};e.startSelectionByMouseDelegate=function(t){return e.startSelectionByMouse(t)};e.stopSelectionByMouseDelegate=function(t){return e.stopSelectionByMouse(t)};e.updateSelectionByMouseDelegate=function(t){return e.updateSelectionByMouse(t)};e._onClipboardPasteDelegate=function(t){return e.onClipboardPaste(t)};e.cursorIntervalID=-1;e._tabEnabled=true;e.cursorType="";e.textOffsetX=0;e.textOffsetY=0;e.textShapes={};e._textColor=0;e._width=100;e._height=100;e._textWidth=0;e._textHeight=0;e._type=it.DYNAMIC;e._selectable=false;e._numLines=0;e.multiline=false;e._autoSize=et.NONE;e._wordWrap=false;e._background=false;e._backgroundColor=16777215;e._border=false;e._borderColor=0;e.html=false;e.maxChars=0;e._selectionBeginIndex=0;e._selectionEndIndex=0;e._scrollH=0;e._scrollV=0;e._textFormats=[];e._graphics=Y.Graphics.getGraphics();e.mouseEnabled=e._selectable;return e}d.getNewTextField=function(){return d._textFields.length?d._textFields.pop():new d};d.clearPool=function(){d._textFields=[]};d.prototype.updateMaskMode=function(){if(this.inMaskMode){if(this._maskWidth!=this._width||this._maskHeight!=this._height||this._maskTextOffsetX!=this.textOffsetX||this._maskTextOffsetY!=this.textOffsetY){this._maskWidth=this._width;this._maskHeight=this._height;this._maskTextOffsetX=this.textOffsetX;this._maskTextOffsetY=this.textOffsetY;this.maskChild.graphics.clear();this.maskChild.graphics.beginFill(16777215);this.maskChild.graphics.drawRect(this.textOffsetX,this.textOffsetY,this._width,this._height);this.maskChild.graphics.endFill()}this._graphics.clear()}if(!this.inMaskMode){this.inMaskMode=true;if(!this.maskChild)this.maskChild=new f;if(!this.textChild)this.textChild=new xt;this.textChild.mouseEnabled=false;this.textChild.parentTextField=this;this.maskChild.mouseEnabled=false;this.maskChild.graphics.beginFill(16777215);this.maskChild.graphics.drawRect(this.textOffsetX,this.textOffsetY,this._width,this._height);this.maskChild.graphics.endFill();this.addChild(this.maskChild);this.addChild(this.textChild);this.maskChild.visible=false;this._graphics.clear();this.targetGraphics=this.textChild.graphics;return}if(this._textWidth>this._width||this._textHeight>this._height){this.textChild.scriptMask=this.maskChild}else{this.textChild.scriptMask=null}return};d.prototype.getMouseCursor=function(){return this.cursorType};Object.defineProperty(d.prototype,"isInFocus",{get:function(){return this._isInFocus},set:function(t){},enumerable:true,configurable:true});d.prototype.setFocus=function(t,e,i){if(e===void 0){e=false}if(i===void 0){i=true}if(this._isInFocus==t){return}r.prototype.setFocus.call(this,t,e,i);this.enableInput(t);if(!this._selectable){return}this.setSelection(0,0);this._glyphsDirty=true;this.invalidate()};d.prototype.enableInput=function(t){if(t===void 0){t=true}if(this.cursorIntervalID>=0){window.clearInterval(this.cursorIntervalID);this.cursorIntervalID=-1}if(t&&this._isInFocus&&this.selectable){this.drawSelectionGraphics();var e=this;this.cursorIntervalID=window.setInterval(function(){e.cursorBlinking=!e.cursorBlinking;if(!e.selectable){e.cursorBlinking=true}e._shapesDirty=true;e.invalidate()},500)}};d.prototype.findCharIdxForMouse=function(t){var e=new G.Point(t.position.x,t.position.y);var i=this.getLineIndexAtPoint(e.x,e.y);var r=this.getCharIndexAtPoint(e.x,e.y,i);if(i>=this.lines_start_x.length){i=this.lines_start_x.length-1}if(i<0){i=0}if(i>=0&&r<0&&this.lines_start_x[i]!==undefined){if(e.x<=this.lines_start_x[i]){r=this.lines_charIdx_start[i]}else{r=this.lines_charIdx_end[i]}}if(i<0||r<0){r=0}return r};d.prototype.startSelectionByMouse=function(t){this._selectionBeginIndex=this.findCharIdxForMouse(t);this._selectionEndIndex=this._selectionBeginIndex;if(this.cursorShape)this.cursorShape.invalidate();this.cursorShape=undefined;if(this.bgShapeSelect)this.bgShapeSelect.invalidate();this.bgShapeSelect=undefined;this._glyphsDirty=true;this._shapesDirty=true;this._textShapesDirty=true;this.cursorBlinking=false;this.drawSelectionGraphics()};d.prototype.stopSelectionByMouse=function(t){this._selectionEndIndex=this.findCharIdxForMouse(t);this._glyphsDirty=true;this.reConstruct();this.drawSelectionGraphics()};d.prototype.updateSelectionByMouse=function(t){this._selectionEndIndex=this.findCharIdxForMouse(t);if(this.bgShapeSelect)this.bgShapeSelect.invalidate();this.bgShapeSelect=undefined;this._glyphsDirty=true;this.reConstruct();this.drawSelectionGraphics()};d.prototype.drawSelectionGraphics=function(){if(this._selectionBeginIndex<0){this._selectionBeginIndex=0}if(this._selectionBeginIndex>this.char_positions_x.length){this._selectionBeginIndex=this.char_positions_x.length}if(this._selectionEndIndex<0){this._selectionEndIndex=0}if(this._selectionEndIndex>this.char_positions_x.length){this._selectionEndIndex=this.char_positions_x.length}if(this._selectionBeginIndex===this._selectionEndIndex){this.showSelection=false;this.drawCursor()}else{this.showSelection=true;this.cursorBlinking=true;this.drawSelectedBG()}};d.prototype.scrollToCursor=function(t,e){};d.prototype.drawCursor=function(){this._shapesDirty=true;if(this.cursorBlinking||!this.selectable||this.selectionBeginIndex!==this.selectionEndIndex){return}var t=0;var e=0;var i=this.newTextFormat;if(this.char_positions_x.length==0){t=this.textOffsetX+this._width/2+this._textWidth/2;if(i.align=="justify"){}else if(i.align=="center"){}else if(i.align=="right"){t=this.textOffsetX+this._width-2}else if(i.align=="left"){t=this.textOffsetX+4+this._textWidth}}else if(this._selectionBeginIndex==this.char_positions_x.length){t=this.char_positions_x[this._selectionBeginIndex-1]+this.chars_width[this._selectionBeginIndex-1];e=this.char_positions_y[this._selectionBeginIndex-1];i=this.tf_per_char[this._selectionBeginIndex-1]}else{t=this.char_positions_x[this._selectionBeginIndex];e=this.char_positions_y[this._selectionBeginIndex];i=this.tf_per_char[this._selectionBeginIndex]}i.font_table.initFontSize(i.size);var r=i.font_table.getLineHeight();var s=this.getTextColorForTextFormat(i);var n=this.internalScale.x;if(n<=0){n=1}var o=[t-.5*n,e,n,r];if(!this.cursorShape){this.cursorShape=Y.GraphicsFactoryHelper.drawRectangles(o,s,1);this.cursorShape.usages++}else{Y.GraphicsFactoryHelper.updateRectanglesShape(this.cursorShape,o)}if(this.cursorShape.style.color!==s){var a=G.ColorUtils.float32ColorToARGB(s)[0];var h=Y.MaterialManager.get_material_for_color(s,a/255||1);if(h.colorPos){this.cursorShape.style=new X.Style;var l=new q.ImageSampler;h.material.animateUVs=true;this.cursorShape.style.color=s;this.cursorShape.style.addSamplerAt(l,h.material.getTextureAt(0));this.cursorShape.style.uvMatrix=new G.Matrix(0,0,0,0,h.colorPos.x,h.colorPos.y)}}this.scrollToCursor(t,e)};d.prototype.drawSelectedBG=function(){this._shapesDirty=true;this._textShapesDirty=true;if(this._selectionBeginIndex<0){this._selectionBeginIndex=0}if(this._selectionBeginIndex>this.char_positions_x.length){this._selectionBeginIndex=this.char_positions_x.length}var t=this._selectionBeginIndex;var e=this._selectionEndIndex;if(this._selectionEndIndex<this._selectionBeginIndex){t=this._selectionEndIndex;e=this._selectionBeginIndex}var i=0;var r=0;var s=-1;var n=null;var o=-1;var a=0;var h=0;var l=[];if(this.char_positions_x.length!=0&&this._selectionEndIndex!=this._selectionBeginIndex){var u=e>this.char_positions_x.length?this.char_positions_x.length:e;for(var c=t;c<u;c++){if(c==this.char_positions_x.length){i=this.char_positions_x[c-1]+this.chars_width[c-1];r=this.char_positions_y[c-1];n=this.tf_per_char[c-1]}else{i=this.char_positions_x[c];r=this.char_positions_y[c];n=this.tf_per_char[c]}if(o<0){o=i}if(s>=0&&s!=r){l.push(o,s,a,h);a=0;o=i}a+=this.chars_width[c];s=r;n.font_table.initFontSize(n.size);h=Math.max(h,n.font_table.getLineHeight())}}if(a>0){l.push(o,s,a,h);if(!this.bgShapeSelect){this.bgShapeSelect=Y.GraphicsFactoryHelper.drawRectangles(l,0,1);this.bgShapeSelect.usages++}else{Y.GraphicsFactoryHelper.updateRectanglesShape(this.bgShapeSelect,l)}return}this.scrollToCursor(o+a,s+h)};d.prototype.drawBG=function(){this._graphics.beginFill(this.backgroundColor,!this._background?0:1);this._graphics.drawRect(this.textOffsetX,this.textOffsetY,this.width,this.height);this._graphics.endFill()};d.prototype.drawBorder=function(){var t=this.border?.25*this.internalScale.x:0;var e=this.border?.25*this.internalScale.y:0;this._graphics.beginFill(this._borderColor,1);this._graphics.drawRect(this.textOffsetX,this.textOffsetY,this._width,e*2);this._graphics.drawRect(this.textOffsetX,this.textOffsetY+this._height-e*2,this._width,e*2);this._graphics.drawRect(this.textOffsetX,this.textOffsetY+e*2,t*2,this._height-e*2);this._graphics.drawRect(this.textOffsetX+this._width-t*2,this.textOffsetY+e*2,t*2,this._height-e*2);this._graphics.endFill()};d.prototype.getTextShapeForIdentifierAndFormat=function(t,e){if(this.textShapes[t]){return this.textShapes[t]}return this.textShapes[t]=new wt(e,t)};Object.defineProperty(d.prototype,"autoSize",{get:function(){return this._autoSize},set:function(t){if(this._autoSize==t)return;if(typeof t==="string"){if(t!=et.CENTER&&t!=et.NONE&&t!=et.LEFT&&t!=et.RIGHT){return}}else{if(typeof t==="boolean"){if(t)t=et.LEFT;else t=et.NONE}if(typeof t==="number"){if(t>0)t=et.LEFT;else t=et.NONE}}this._autoSize=t;this._positionsDirty=true;if(this._autoSize!=et.NONE)this.invalidate()},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"internalScale",{get:function(){return this._internalScale},enumerable:true,configurable:true});d.prototype._iInternalUpdate=function(){r.prototype._iInternalUpdate.call(this);this.reConstruct(true)};Object.defineProperty(d.prototype,"assetType",{get:function(){return d.assetType},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"background",{get:function(){return this._background},set:function(t){if(this._background==t)return;this._background=t;this._shapesDirty=true},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(t){this._backgroundColor=t;this._shapesDirty=true},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"border",{get:function(){return this._border},set:function(t){if(t==this._border)return;this._border=t;this._shapesDirty=true},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"borderColor",{get:function(){return this._borderColor},set:function(t){if(t==this.borderColor)return;this._borderColor=t;this._shapesDirty=true},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"bottomScrollV",{get:function(){return this._bottomScrollV},set:function(t){if(t==this._bottomScrollV)return;this._bottomScrollV=t},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"caretIndex",{get:function(){return this._caretIndex},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"height",{get:function(){if(this._autoSize!=et.NONE)this.reConstruct();return this._height},set:function(t){if(this._height==t)return;if(this._autoSize!=et.NONE)return;this._height=t;this._positionsDirty=true;this.invalidate()},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"htmlText",{get:function(){return this._htmlText},set:function(t){if(t==this._htmlText)return;this._htmlText=t;var e=St.get().processHTML(this,t);this._labelData=null;this._text=e;this._iText=e;this._iTextWoLineBreaks=e.replace(/(\r\n|\n|\\n|\r)/gm,"");this._textDirty=true;this.newTextFormat=this._textFormats[this._textFormats.length-1];this.invalidate()},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"length",{get:function(){return this._iText.length},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"maxScrollH",{get:function(){this.reConstruct();return this._maxScrollH},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"maxScrollV",{get:function(){this.reConstruct();return this._maxScrollV},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"numLines",{get:function(){this.reConstruct();return this._numLines},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"restrict",{get:function(){return this._restrict},set:function(t){if(t==this._restrict)return;this._restrict=t;this._restrictRegex=null;if(typeof t=="undefined")return;t=t.toString();if(t.length>=2&&t[0]=="-"&&!isNaN(parseInt(t[1])))t="0"+t;t=t.replace(/\\/g,"");t=t.replace(/\^/g,"");t=t.replace(/([^a-zA-Z0-9])\-/g,"$1\\-");t=t.replace(/\./g,"\\.");t=t.replace(/\</g,"\\<");t=t.replace(/\>/g,"\\>");t=t.replace(/\+/g,"\\+");t=t.replace(/\*/g,"\\*");t=t.replace(/\?/g,"\\?");t=t.replace(/\[/g,"\\[");t=t.replace(/\]/g,"\\]");t=t.replace(/\$/g,"\\$");t=t.replace(/\(/g,"\\(");t=t.replace(/\)/g,"\\)");t=t.replace(/\{/g,"\\{");t=t.replace(/\}/g,"\\}");t=t.replace(/\=/g,"\\=");t=t.replace(/\!/g,"\\!");t=t.replace(/\:/g,"\\:");t=t.replace(/\|/g,"\\|");t=t.replace(/\//g,"\\/");t=t.replace(/\%/g,"\\%");this._restrictRegex=new RegExp("[^"+t+"]","g")},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"scrollH",{get:function(){return this._scrollH},set:function(t){if(t==this._scrollH)return;this._scrollH=t},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"scrollV",{get:function(){return this._scrollV},set:function(t){var e=Math.round(t);if(e===this._scrollV)return;this._scrollV=e;if(this._scrollV>this._maxScrollV)this._scrollV=this._maxScrollV;if(this._scrollV<=0){this._scrollV=0}if(!this.textChild){return}this.textChild.y=-this.lines_start_y[this._scrollV]},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"selectable",{get:function(){return this._selectable},set:function(t){if(this.selectable==t){return}this._selectable=t;this.mouseEnabled=t;this.cursorType=t?"text":"";if(t){this.addEventListener(V.DRAG_START,this.startSelectionByMouseDelegate);this.addEventListener(V.DRAG_STOP,this.stopSelectionByMouseDelegate);this.addEventListener(V.DRAG_MOVE,this.updateSelectionByMouseDelegate)}else{this.removeEventListener(V.DRAG_START,this.startSelectionByMouseDelegate);this.removeEventListener(V.DRAG_STOP,this.stopSelectionByMouseDelegate);this.removeEventListener(V.DRAG_MOVE,this.updateSelectionByMouseDelegate)}},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"selectionBeginIndex",{get:function(){return this._selectionBeginIndex},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"selectionEndIndex",{get:function(){return this._selectionEndIndex},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"text",{get:function(){return this._text},set:function(t){t=typeof t==="undefined"?"":t.toString();t=t.replace(String.fromCharCode(160)," ");if(this._text==t)return;this._labelData=null;this._text=t;if(t!=""&&(t.charCodeAt(t.length-1)==13||t.charCodeAt(t.length-1)==10)){t=t.slice(0,t.length-1)}if(t!=""&&(t.length>=3&&t[t.length-1]=="n"&&t[t.length-2]=="\\"&&t[t.length-3]=="\\")){t=t.slice(0,t.length-3)}if(t!=""&&(t.length>=3&&t[t.length-1]=="n"&&t[t.length-2]=="\\")){t=t.slice(0,t.length-2)}for(var e=0,i=Tt;e<i.length;e++){var r=i[e];t=t.replace(r.test,r.replace)}this._iText=t;this._iTextWoLineBreaks=t.replace(/(\r\n|\n|\\n|\r)/gm,"");this._textFormats=[this.newTextFormat];this._textFormatsIdx=[this._iText.length];this._textDirty=true;this.invalidate()},enumerable:true,configurable:true});d.prototype.setLabelData=function(t){this._labelData=t;this.isStatic=true;this._iText="";this._iTextWoLineBreaks="";this._textDirty=false;this._positionsDirty=false;this._glyphsDirty=true;this.invalidate()};Object.defineProperty(d.prototype,"newTextFormat",{get:function(){return this._newTextFormat?this._newTextFormat:this._textFormat?this._textFormat:new mt},set:function(t){if(t){this._newTextFormat=t.applyToFormat(this._textFormat.clone());return}this._newTextFormat=null},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"textFormat",{get:function(){if(this._textFormat==null){this._textFormat=new mt}return this._textFormat},set:function(t){if(!t)throw new Error("TextField::: set textFormat - no value!");if(this._textFormat==t){return}this._textDirty=true;this._textFormat=t;this._textShapesDirty=true;this._textDirty=true;this.invalidate()},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"scaleX",{get:function(){return this._transform.scale.x},set:function(t){if(this._transform.scale.x==t){return}this._setScaleX(t)},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"scaleY",{get:function(){return this._transform.scale.y},set:function(t){if(this._transform.scale.y==t){return}this._setScaleY(t)},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"textColor",{get:function(){return this._textColor},set:function(t){if(this._textColor==t){return}this._textColor=t;if(this._textFormats){var e=this._textFormats.length;while(e>0){e--;if(this._textFormats[e])this._textFormats[e].color=t}this._textDirty=true}this._glyphsDirty=true;this.invalidate()},enumerable:true,configurable:true});d.prototype.getTextColorForTextFormat=function(t){if(t.hasPropertySet("color")){return t.color}return this._textColor};Object.defineProperty(d.prototype,"textInteractionMode",{get:function(){return this._textInteractionMode},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"textWidth",{get:function(){this.reConstruct();return this._textWidth},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"textHeight",{get:function(){this.reConstruct();if(this.type==it.INPUT&&this._iText==""){this.textFormat.font_table.initFontSize(this.textFormat.size);return this.textFormat.font_table.getLineHeight()}return this._textHeight},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"type",{get:function(){return this._type},set:function(t){if(this._type==t)return;this._type=t;this._textDirty=true;if(t==it.INPUT){this.enableInput(true);this.addEventListener(yt.KEYDOWN,this.onKeyDelegate)}else{this.enableInput(false);this.removeEventListener(yt.KEYDOWN,this.onKeyDelegate)}this.invalidate()},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"x",{get:function(){if(this._autoSize!=et.NONE&&!this._wordWrap){this.reConstruct()}return this._transform.position.x},set:function(t){if(this._autoSize!=et.NONE&&!this._wordWrap)this.reConstruct();if(this._transform.position.x==t)return;this._transform.matrix3D._rawData[12]=t;this._transform.invalidatePosition()},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"width",{get:function(){if(this._autoSize!=et.NONE&&!this._wordWrap){this.reConstruct()}return this._width},set:function(t){if(this._width==t)return;this._width=t;this._positionsDirty=true;this.invalidate()},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"wordWrap",{get:function(){return this._wordWrap},set:function(t){if(this._wordWrap==t)return;this._wordWrap=t;this._positionsDirty=true;if(!t)this.invalidate()},enumerable:true,configurable:true});d.prototype.advanceFrame=function(){};d.prototype.getEntity=function(){return this._graphics};d.prototype.clear=function(){r.prototype.clear.call(this)};d.prototype.dispose=function(){this.disposeValues();d._textFields.push(this)};d.prototype.disposeValues=function(){r.prototype.disposeValues.call(this);if(this.maskChild){this.maskChild.dispose();this.maskChild=null}if(this.textChild){this.textChild.dispose();this.textChild=null}if(this.cursorShape){this.cursorShape.dispose();this.cursorShape=null}if(this.bgShapeSelect){this.bgShapeSelect.dispose();this.bgShapeSelect=null}if(this._labelData){this._labelData=null}this._resetParagraph();this._clearTextShapes();this._textFormat=null};d.prototype.reConstruct=function(t){if(t===void 0){t=false}if(!this._textDirty&&!this._positionsDirty&&!this._glyphsDirty&&!this._shapesDirty)return;if(this._textDirty){this._positionsDirty=true;this._lastWordsCount=this.words.length;this.char_positions_x.length=0;this.char_positions_y.length=0;this.words.length=0;this.lines_wordStartIndices.length=0;this.lines_wordEndIndices.length=0;this.lines_start_y.length=0;this.lines_start_x.length=0;this.lines_charIdx_start.length=0;this.lines_charIdx_end.length=0;this.lines_width.length=0;this.lines_height.length=0;this.lines_numSpacesPerline.length=0;this._maxScrollH=0;this._maxScrollV=0;this._maxWidthLine=0;if(!this._textFormat&&this._textFormats.length>0)this._textFormat=this._textFormats[0];this.buildParagraphs()}if(this._positionsDirty){this._glyphsDirty=true;if(this._iText!=""&&this._textFormat!=null){this.getWordPositions()}else{this._textWidth=0;this._textHeight=0;if(this._autoSize!=et.NONE){if(!this.wordWrap)this.adjustPositionForAutoSize(0);this._height=4;if(this._type==it.INPUT){this.newTextFormat.font_table.initFontSize(this.newTextFormat.size);this._height=this.newTextFormat.font_table.getLineHeight()+4}}if(this._type==it.INPUT)this.drawSelectionGraphics()}this.updateMaskMode()}this._textDirty=false;this._positionsDirty=false;if(!t)return;if(this._glyphsDirty){if(this._labelData){this.buildGlyphsForLabelData()}else{this.buildGlyphs()}}this._glyphsDirty=false;if(this._labelData){return}this.buildShapes();this._shapesDirty=false};d.prototype.reset=function(){r.prototype.reset.call(this);if(this.sourceTextField){this.sourceTextField.copyTo(this)}};d.prototype.onClipboardPaste=function(t){var e=(t.clipboardData||self.clipboardData).getData("text");if(!e){return}t.preventDefault();if(this._selectionBeginIndex>0||this._selectionEndIndex>this.length){this._insertNewText(e);return}this.text=e};d.prototype._resetParagraph=function(){this._textShapesDirty=this._textShapesDirty||this.chars_codes.length>0;this.tf_per_char.length=0;this.chars_width.length=0;this.chars_codes.length=0;this._paragraph_textRuns_indices.length=0;this._textRuns_formats.length=0;this._textRuns_words.length=0};d.prototype.buildParagraphs=function(){if(!this._textDirty){return}if(this._iText===""||!this._textFormat){this._resetParagraph();return}var e=0;var i=0;var r=0;var s=0;var n=0;var t=0;var o=0;var a=this._iText;var h=this._textFormatsIdx.length;var l=this._paragraph_textRuns_indices;var u=this._textRuns_formats;var c=this._textRuns_words;var _=this.chars_codes;var f=this.tf_per_char;var p=this.chars_width;var d=function(t){l[e]=t;e++};var g=function(t,e){if(e===void 0){e=false}e&&d(i);u[i++]=t;return t};var m=function(t){c[r++]=t;return t};var v=function(t,e,i){n+=+(t!==_[s]);n+=+(e!==f[s]);n+=+(i!==p[s]);_[s]=t;f[s]=e;p[s]=i;s++};d(i);for(var y=0;y<h;y++){var b=0;var x=0;var w=true;var E=this._textFormats[y];var S=this._width-(E.indent+E.leftMargin+E.rightMargin);E.font_table.initFontSize(E.size);var A=y===h-1?a.length:this._textFormatsIdx[y];if(A>o){g(E);var T=m({start:this.words.length,count:0,width:0,space:0});for(var P=o;P<A;P++){var D=a.charCodeAt(P);var I=a.charCodeAt(P+1);if(D===13){D=10}if(D===92&&I===114){P+=1;continue}if(D===92&&I===110){P+=1;D=10;I=a.charCodeAt(P+1)}var C=D===10;if(C){T.count=b;T.width=t;T.space=x;g(E,true);T=m({start:this.words.length,count:0,width:0,space:0});w=true;x=0;b=0;if(this._maxWidthLine<t){this._maxWidthLine=t}t=0;continue}var M=E.font_table.getCharWidth(D.toString());var O=D==9||D==32;if(!O&&P<A-1){if(I!=9&&I!=32){M+=E.letterSpacing}}t+=M;v(D,E,M);if(O){x++;this.words.put(s-1,0,0,M,1);b++;w=true}else{if(b>0&&this._autoSize==et.NONE&&this._wordWrap){if(this.words.last.width+M>=S){w=true}}if(w){this.words.put(s-1,0,0,M,1);b++}else{this.words.last.width+=M;this.words.last.len+=1}w=false}}T.count=b;T.width=t;T.space=x;if(this._maxWidthLine<t){this._maxWidthLine=t}}o=A}this._textShapesDirty=this._textShapesDirty||n>0||_.length!==s;l.length=e;c.length=r;u.length=i;_.length=s;f.length=s;p.length=s};d.prototype.adjustPositionForAutoSize=function(t){var e=this._width;this._width=4+t;if(this._autoSize==et.RIGHT){this._transform.matrix3D._rawData[12]-=this._width-e;this._transform.invalidatePosition()}else if(this._autoSize==et.CENTER){this._transform.matrix3D._rawData[12]-=(this._width-e)/2;this._transform.invalidatePosition()}};d.prototype.getWordPositions=function(){var t=0;var e=this._textRuns_formats.length;var i=0;var r=0;var s=0;var n;var o=0;var a=0;this._numLines=0;var h=0;var l=0;var u=0;var c=this.textOffsetY+2;if(this._autoSize!=et.NONE&&!this._wordWrap&&this._textDirty){var _=this._maxWidthLine+this._textFormat.indent+this._textFormat.leftMargin+this._textFormat.rightMargin;this.adjustPositionForAutoSize(_)}var f=this._width-(this._textFormat.indent+this._textFormat.leftMargin+this._textFormat.rightMargin);var p=0;var d=this._paragraph_textRuns_indices.length;h=0;this.lines_wordStartIndices.length=0;this.lines_wordEndIndices.length=0;this.lines_start_y.length=0;this.lines_start_x.length=0;this.lines_width.length=0;this.lines_height.length=0;this.lines_numSpacesPerline.length=0;this.lines_charIdx_start.length=0;this.lines_charIdx_end.length=0;var g=[];var m=[];for(p=0;p<d;p++){e=p==d-1?this._textRuns_formats.length:this._paragraph_textRuns_indices[p+1];s=0;g[g.length]=0;for(t=this._paragraph_textRuns_indices[p];t<e;t++){n=this._textRuns_formats[t];n.font_table.initFontSize(n.size);if(g[g.length-1]<n.font_table.getLineHeight()+n.leading){g[g.length-1]=n.font_table.getLineHeight()+n.leading}r=this._textRuns_words[t].start+this._textRuns_words[t].count;s+=this._textRuns_words[t].width}this.lines_wordStartIndices[this.lines_wordStartIndices.length]=this._textRuns_words[this._paragraph_textRuns_indices[p]].start;this.lines_wordEndIndices[this.lines_wordEndIndices.length]=r;this.lines_width[this.lines_width.length]=0;this.lines_numSpacesPerline[this.lines_numSpacesPerline.length]=0;var v=0;this.lines_height[this.lines_height.length]=g[v];m[h]=n;for(t=this._paragraph_textRuns_indices[p];t<e;t++){n=this._textRuns_formats[t];n.font_table.initFontSize(n.size);a=n.indent;r=this._textRuns_words[t].start+this._textRuns_words[t].count;if(s<=f||!this.wordWrap){for(i=this._textRuns_words[t].start;i<r;i+=1){var y=this.words.get(i);u=y.width;l+=u;this.lines_wordEndIndices[h]=i+1;this.lines_width[h]+=u;m[h]=n;if(this.chars_codes[y.start]==32||this.chars_codes[y.start]==9){this.lines_numSpacesPerline[h]+=1}}}else{u=0;a=0;for(i=this._textRuns_words[t].start;i<r;i+=1){var y=this.words.get(i);u=y.width;var b=false;if(this.chars_codes[y.start]==32||this.chars_codes[y.start]==9){this.lines_numSpacesPerline[h]+=1;b=true}if(b||this.lines_width[h]+u<=f-a-1*n.font_table.getCharWidth("32")||this.lines_width[h]==0){this.lines_wordEndIndices[h]=i+1;this.lines_width[h]+=u;m[h]=n}else{h++;this.lines_wordStartIndices[h]=i;this.lines_wordEndIndices[h]=i+1;this.lines_width[h]=u;this.lines_numSpacesPerline[h]=0;this.lines_height[this.lines_height.length]=g[v];m[h]=n;a=n.indent}}}}v++;h++}var x=this.textOffsetX;var w;var E;var S;var A;var T;var P;var D=0;var I=this.lines_wordStartIndices.length;var C=0;this._biggestLine=0;this._numLines=I;for(P=0;P<I;P++){l=this.lines_width[P];S=this.lines_height[P];w=this.lines_wordStartIndices[P];A=this.lines_wordEndIndices[P];E=this.lines_numSpacesPerline[P];n=m[P];T=f-l;x=this.textOffsetX+n.leftMargin+n.indent;if(n.align==rt.JUSTIFY){if(P!=I-1&&T>0&&E>0){}if(P!=0){x-=n.indent}}else if(n.align==rt.CENTER){if(T>0)x+=T/2;else{x+=2}}else if(n.align==rt.RIGHT){if(T>0)x+=T-2;else{x+=2}}else if(n.align==rt.LEFT){x+=2}var M=0;var O=x;this.lines_start_x[P]=x;this.lines_start_y[P]=c;this.lines_charIdx_start[P]=C;var F=0;for(i=w;i<A;i+=1){var y=this.words.get(i);y.x=x;O=0;w=y.start;M=w+y.len;var R=this.tf_per_char[w];R.font_table.initFontSize(R.size);var N=S-(R.font_table.getLineHeight()+R.leading);N=N>0?N-2:0;y.y=c+N;for(D=w;D<M;D++){this.char_positions_x[this.char_positions_x.length]=x+O;this.char_positions_y[this.char_positions_y.length]=c+N;O+=this.chars_width[D];C++}x+=O;F+=O}this.lines_charIdx_end[P]=C;c+=S;if(F>o){this._biggestLine=P;o=F}}this._textWidth=o;this._textHeight=c;if(this.autoSize!=et.NONE)this._height=this._textHeight+4;if(this._textWidth>this._width){w=this.lines_charIdx_start[this._biggestLine];D=this.lines_charIdx_end[this._biggestLine];var L=0;while(D>w){D--;L+=this.chars_width[D];if(L>this._width){this._maxScrollH=D;break}}}if(this._textHeight>this._height){var k=this.lines_height.length;var L=4;while(k>0){k--;L+=this.lines_height[k];if(L>this._height){this._maxScrollV=k+1;break}}}};d.prototype.buildGlyphsForLabelData=function(){this._clearTextShapes();var t=[];var e=[];var i=[];var r=[];var s=this.staticMatrix.tx/20;var n=this.staticMatrix.ty/20;var o;var a=0;for(var h=0;h<this._labelData.records.length;h++){t[h]=new mt;e[h]=[];i[h]=[];o=this._labelData.records[h];if(o.font_table){t[h].font_table=o.font_table}else if(h>0){t[h].font_table=t[h-1].font_table}else{console.log("error - no font for label")}if(o.fontHeight){t[h].size=o.fontHeight/20}else if(h>0){t[h].size=t[h-1].size}if(o.color){t[h].color=G.ColorUtils.f32_RGBA_To_f32_ARGB(o.color)}else if(h>0){t[h].color=t[h-1].color}if(o.moveY!=null){n+=o.moveY/20-a;a=n}else{}if(o.moveX!=null){s=this.staticMatrix.tx/20+o.moveX/20}r.push(s);r.push(n);for(var l=0;l<o.entries.length;l++){e[h][l]=o.entries[l].glyphIndex;i[h][l]=o.entries[l].advance/20;s+=i[h][l]}}var u;var c=0;var _=t.length;var f;var p=0;var d=0;for(c=0;c<_;c++){t[c].font_table.initFontSize(t[c].size);f=t[c].font_table.buildTextLineFromIndices(this,t[c],r[c*2],r[c*2+1],e[c],i[c]);d+=f.y;p=f.x>p?f.x:p}this._textWidth=p;this._textHeight=d;this.targetGraphics=this._graphics;this.targetGraphics.clear();this.drawBG();if(this.border||!this._background&&this._type!=it.INPUT)this.drawBorder();for(var g in this.textShapes){u=this.textShapes[g];var m=new q.Float2Attributes(u.length/2);var v=new Float32Array(m.attributesBuffer.buffer);var y=0;for(var b=0,x=u.verts;b<x.length;b++){var w=x[b];v.set(w,y);y+=w.length}u.elements=new X.TriangleElements;u.elements.setPositions(m);u.elements.invalidate();u.shape=this.targetGraphics.addShape(Y.Shape.getShape(u.elements));u.shape.deepHitCheck=true;u.shape.usages++;var E=new q.ImageSampler;u.shape.style=new X.Style;if(u.format.material&&this._textColor==0){u.shape.material=this._textFormat.material;u.shape.style.addSamplerAt(E,u.shape.material.getTextureAt(0));u.shape.material.animateUVs=true;u.shape.style.uvMatrix=new G.Matrix(0,0,0,0,u.format.uv_values[0],u.format.uv_values[1])}else{var S=this.getTextColorForTextFormat(u.format);var A=G.ColorUtils.float32ColorToARGB(S)[0];if(A==0){A=255}var T=Y.MaterialManager.get_material_for_color(S,A/255);u.shape.material=T.material;if(T.colorPos){u.shape.style.addSamplerAt(E,u.shape.material.getTextureAt(0));u.shape.material.animateUVs=true;u.shape.style.uvMatrix=new G.Matrix(0,0,0,0,T.colorPos.x,T.colorPos.y)}}}};d.prototype.buildGlyphs=function(){var t=this._textRuns_formats;var e=this._textRuns_words;var i=t.length;if(this._textShapesDirty)this._clearTextShapes();for(var r=0;r<i;r++){var s=e[r];if(s.count==0){continue}t[r].font_table.initFontSize(t[r].size);if(b.USE_UNSAFE_FNT){t[r].font_table.generateFNTData(null)}t[r].font_table.fillTextRun(this,t[r],s.start,s.count)}var n;for(var o in this.textShapes){n=this.textShapes[o];if(n.length===0){continue}var a=new q.Float2Attributes(n.length/2);var h=new Float32Array(a.attributesBuffer.buffer);var l=n.hasUV?new q.Float2Attributes(n.length/2):null;var u=l?new Float32Array(l.attributesBuffer.buffer):null;var c=0;for(var _=0;_<n.verts.length;_++){var f=n.verts[_];h.set(f,c);if(u){u.set(n.uvs[_],c)}c+=f.length}n.length=0;n.addChunk(h,u);if(n.shape){var p=n.shape.elements;p.setPositions(h);if(u){p.setUVs(u)}p.invalidate();a.dispose();if(l){l.dispose()}continue}var d=this.getTextColorForTextFormat(n.format);var g=G.ColorUtils.float32ColorToARGB(d)[0]||255;n.elements=new X.TriangleElements;n.elements.setPositions(a);if(l){n.elements.setUVs(l)}n.elements.invalidate();n.shape=Y.Shape.getShape(n.elements);n.shape.deepHitCheck=true;n.shape.usages++;var m=new q.ImageSampler(false,true,true);n.shape.style=new X.Style;if(n.fntMaterial){n.shape.material=n.fntMaterial;n.shape.style.addSamplerAt(m,n.shape.material.getTextureAt(0))}else if(n.format.material&&this._textColor==0){n.shape.material=this._textFormat.material;n.shape.style.addSamplerAt(m,n.shape.material.getTextureAt(0));n.shape.material.animateUVs=true;n.shape.style.uvMatrix=new G.Matrix(0,0,0,0,n.format.uv_values[0],n.format.uv_values[1])}else{var v=Y.MaterialManager.get_material_for_color(d,g/255);n.shape.material=v.material;if(v.colorPos){n.shape.style.addSamplerAt(m,n.shape.material.getTextureAt(0));n.shape.material.animateUVs=true;n.shape.style.uvMatrix=new G.Matrix(0,0,0,0,v.colorPos.x,v.colorPos.y)}}}};d.prototype.buildShapes=function(){if(!this.targetGraphics){this.targetGraphics=this._graphics}else{this._graphics.clear()}this.targetGraphics.clear();this.drawBG();if(this._border||!this._background){this.drawBorder()}this.drawSelectionGraphics();if(this.bgShapeSelect&&this.isInFocus&&this.showSelection){this.targetGraphics.addShape(this.bgShapeSelect)}var t;for(var e in this.textShapes){t=this.textShapes[e];if(!t.shape){continue}this.targetGraphics.addShape(t.shape)}if(this.type===it.INPUT&&this.isInFocus&&this.cursorShape&&!this.cursorBlinking){this.targetGraphics.addShape(this.cursorShape)}};d.prototype.appendText=function(t){if(!t.length){return}this._iText+=t;this._textDirty=true;this.invalidate()};d.prototype.closeParagraph=function(){this._iText+="\n";this._textDirty=true;this.invalidate()};d.prototype.getCharBoundaries=function(t){var e=new G.Rectangle;if(t>=this.char_positions_x.length){return e}e.x=this.char_positions_x[t];e.width=this.chars_width[t];e.y=this.char_positions_y[t];e.height=10;return e};d.prototype.getCharIndexAtPoint=function(t,e,i){if(i===void 0){i=-1}if(i<0){i=this.getLineIndexAtPoint(t,e)}var r=this.lines_charIdx_start[i];var s=this.lines_charIdx_end[i];for(var n=r;n<s;n++){if(t>=this.char_positions_x[n]){if(t<=this.char_positions_x[n]+this.chars_width[n]/2){return n}else if(t<=this.char_positions_x[n]+this.chars_width[n]){return n+1}}}return-1};d.prototype.getFirstCharInParagraph=function(t){console.log("Textfield.getFirstCharInParagraph() not implemented");return this._firstCharInParagraph};d.prototype.getImageReference=function(t){console.log("TextField.getImageReference() not implemented");return this._imageReference};d.prototype.getLineIndexAtPoint=function(t,e){var i=this.lines_start_y.length;for(var r=0;r<i-1;r++){if(e>=this.lines_start_y[r]&&e<=this.lines_start_y[r+1])return r}if(e>=this.lines_start_y[i-1])return i-1;return 0};d.prototype.getLineIndexOfChar=function(t){this.buildParagraphs();var e=this.lines_charIdx_start.length-1;for(var i=void 0;i<e;i++){if(t>=this.lines_charIdx_start[i]&&t<=this.lines_charIdx_end[i+1])return i}return e};d.prototype.getLineLength=function(t){if(this.lines_width.length==0){return 0}if(t>=this.lines_width.length)return this.lines_width[this.lines_width.length-1];return this.lines_width[t]};d.prototype.getLineMetrics=function(t){var e=new vt;if(!this.lines_width.length){return e}if(t>=this.lines_width.length){t=this.lines_width.length-1}e.x=this.lines_start_x[t];e.width=this.lines_width[t];e.height=this.lines_height[t];return e};d.prototype.getLineOffset=function(t){if(this.lines_charIdx_start.length==0){return 0}if(t>=this.lines_charIdx_start.length)return this.lines_charIdx_start[this.lines_charIdx_start.length-1];return this.lines_charIdx_start[t]};d.prototype.getLineText=function(t){if(this.lines_charIdx_start.length==0){return""}if(t>=this.lines_width.length)t=this.lines_width.length-1;return this._iText.slice(this.lines_charIdx_start[t],this.lines_charIdx_end[t])};d.prototype.getParagraphLength=function(t){return this._paragraphLength};d.prototype.getTextFormat=function(t,e){if(t===void 0){t=-1}if(e===void 0){e=-1}if(!this.tf_per_char||!this.tf_per_char.length){if(this._textFormat)return this._textFormat.clone();return new mt}if(t<0)t=0;if(e>this.tf_per_char.length){e=this.tf_per_char.length}var i=this.tf_per_char[t].clone();var r=this.tf_per_char[t];for(var s=t+1;s<e;s++){if(this.tf_per_char[s]==r){continue}i.mergeFormat(this.tf_per_char[s]);r=this.tf_per_char[s]}return i};d.prototype.replaceSelectedText=function(t){return this._insertNewText(t)};d.prototype.replaceText=function(t,e,i){var r=this._iTextWoLineBreaks.slice(0,t-1);var s=this._iTextWoLineBreaks.slice(e,this._iTextWoLineBreaks.length);this.text=r+i+s;this._selectionEndIndex=this._selectionBeginIndex+i.length};d.prototype.setSelection=function(t,e){if(this._selectionBeginIndex==t&&this._selectionBeginIndex==e)return;this._selectionBeginIndex=t;this._selectionEndIndex=e;this._glyphsDirty=true;this.reConstruct();this.drawSelectionGraphics()};d.prototype.setTextFormat=function(t,e,i){if(e===void 0){e=-1}if(i===void 0){i=-1}if(!t||this._iTextWoLineBreaks.length==0)return;if(e==-1&&i==-1||e==0&&i==-1||(e==-1||e==0)&&i>=this._iTextWoLineBreaks.length){var r=this._textFormats.length;if(this._textFormats.length===1&&this._textFormats[0].equal(t)){return}for(var s=0;s<r;s++){this._textFormats[s]=this._textFormats[s].clone();t.applyToFormat(this._textFormats[s])}this._textDirty=true;this._textShapesDirty=true;return}var n=0;var o=[];var a=[];var h=0;var l=-1;var u;var c=this._textFormats.length;var _=this._iTextWoLineBreaks.length;if(e==-1)e=0;if(i==-1)i=_;if(i<e){var f=i;i=e;e=f}if(i==e)i++;for(var p=0;p<c;p++){if(p>0)h=l;l=this._textFormatsIdx[p];u=this._textFormats[p];if(h<=e&&l>e){if(h<e){o.push(u);a.push(e)}while(l<i){var d=this._textFormats[p].clone();t.applyToFormat(d);o.push(d);a.push(l);p++;if(p<c){l=this._textFormatsIdx[p];u=this._textFormats[p]}else{l=i+1}}if(l==i){var d=u.clone();t.applyToFormat(d);o.push(d);a.push(i)}if(l>i){var d=u.clone();t.applyToFormat(d);o.push(d);a.push(i);o.push(u);a.push(l)}}else{o.push(this._textFormats[p]);a.push(this._textFormatsIdx[p])}}this._textFormats.length=0;this._textFormatsIdx.length=0;for(n=0;n<o.length;n++){this._textFormats[n]=o[n];this._textFormatsIdx[n]=a[n]}this._textDirty=true;this._textShapesDirty=true};d.isFontCompatible=function(t,e){return false};d.prototype.onKey=function(t){var e=t;this.addChar(e.char,e.isShift,e.isCTRL,e.isAlt)};d.prototype.addCharCode=function(t){this.addChar(String.fromCharCode(t))};d.prototype.deleteSelectedText=function(t){if(t===void 0){t="Backspace"}if(this.text.length==0)return;if(this._selectionBeginIndex!=this._selectionEndIndex){var e=this._selectionBeginIndex!=0?this._iText.slice(0,this._selectionBeginIndex):"";var i=this._selectionEndIndex<this._iText.length?this._iText.slice(this._selectionEndIndex,this._iText.length):"";this.text=e+i;this._selectionEndIndex=this._selectionBeginIndex;return}if(t=="Backspace"){if(this._selectionBeginIndex==0){return}var e=this._iText.slice(0,this._selectionBeginIndex-1);var i=this._iText.slice(this._selectionEndIndex,this._iText.length);this.text=e+i;this._selectionBeginIndex-=1;this._selectionEndIndex=this._selectionBeginIndex}else if(t=="Delete"){var e=this._iText.slice(0,this._selectionBeginIndex);var i=this._iText.slice(this._selectionEndIndex+1,this._iText.length);this.text=e+i;this._selectionEndIndex=this._selectionBeginIndex}};d.prototype.addChar=function(t,e,i,r){var s=this;if(e===void 0){e=false}if(i===void 0){i=false}if(r===void 0){r=false}var n=false;var o=this._iText;if(!this._selectionBeginIndex){this._selectionBeginIndex=0}if(!this._selectionEndIndex){this._selectionEndIndex=0}if(this._selectionEndIndex<this._selectionBeginIndex){var a=this._selectionEndIndex;this._selectionEndIndex=this._selectionBeginIndex;this._selectionBeginIndex=a}if(!r&&!i){if(t=="Backspace"||t=="Delete"){this.deleteSelectedText(t);n=true}else if(t=="ArrowRight"){if(!e&&this._selectionEndIndex!=this._selectionBeginIndex){if(this._selectionEndIndex>this._selectionBeginIndex){this._selectionBeginIndex=this._selectionEndIndex}else{this._selectionEndIndex=this._selectionBeginIndex}}else{if(this._selectionEndIndex>this._selectionBeginIndex){this._selectionEndIndex+=1;if(!e)this._selectionBeginIndex=this._selectionEndIndex}else{this._selectionBeginIndex+=1;if(!e)this._selectionEndIndex=this._selectionBeginIndex}}n=true}else if(t=="ArrowLeft"){if(!e&&this._selectionEndIndex!=this._selectionBeginIndex){if(this._selectionEndIndex>this._selectionBeginIndex)this._selectionEndIndex=this._selectionBeginIndex;else this._selectionBeginIndex=this._selectionEndIndex}else{if(this._selectionEndIndex>this._selectionBeginIndex){this._selectionBeginIndex-=1;if(!e)this._selectionEndIndex=this._selectionBeginIndex}else{this._selectionEndIndex-=1;if(!e)this._selectionBeginIndex=this._selectionEndIndex}}n=true}else if(t=="Enter"&&this.multiline){this._insertNewText("\n");n=true}else if(t.length==1){if(this._restrictRegex){var h=t.replace(this._restrictRegex,"");if(h.length<t.length){var l=t.toUpperCase().replace(this._restrictRegex,"");var u=t.toLowerCase().replace(this._restrictRegex,"");t=l;if(l.length<u.length){t=u}if(h.length>t.length){t=h}}if(t=="")return}if(this.newTextFormat.font_table){var c=this.newTextFormat.font_table;var _=t.charCodeAt(0).toString();var f=false;f=f||c.hasChar(_);f=f||c.hasChar(_.toLowerCase());f=f||c.hasChar(_.toUpperCase());if(!f){console.log("Char not found",_);return}}this._insertNewText(t);n=true}else if(t.length>1){console.log("invalid keyboard input: ",t)}if(n){this._glyphsDirty=true;this.invalidate();if(o!==this._iText){this.dispatchEvent(d._onChangedEvent)}}}else{if(i&&!e&&t==="v"){if(navigator.clipboard.readText){navigator.clipboard.readText().then(function(t){s._insertNewText(t)}).catch(function(t){console.warn("[TextField] Can't paste text:",t.message)})}}}if(t&&t.length>0&&this.adapter!=this){var p=void 0;switch(t){case"Backspace":p=8;break;case"Delete":p=46;break;case"ArrowRight":p=39;break;case"ArrowLeft":p=37;break;case".":p=189;break;default:p=t.charCodeAt(0);break}this.adapter.dispatchKeyEvent(p,e,i,r)}};d.prototype._insertNewText=function(t){if(this._selectionBeginIndex!=this._selectionEndIndex){var e=this._iText.slice(0,this._selectionBeginIndex);var i=this._iText.slice(this._selectionEndIndex,this._iText.length);if(this.maxChars>0&&e.length+i.length+t.length>this.maxChars){var r=this.maxChars-e.length+i.length;if(r>0){t=t.slice(0,r)}}this.text=e+t+i;this._textShapesDirty=true;this._selectionBeginIndex+=1;this._selectionEndIndex=this._selectionBeginIndex}else{if(this.maxChars>0&&this._iText.length>=this.maxChars){}else{var e=this._iText.slice(0,this._selectionBeginIndex);var i=this._iText.slice(this._selectionEndIndex,this._iText.length);this.text=e+t+i;this._textShapesDirty=true;this._selectionBeginIndex+=1;this._selectionEndIndex=this._selectionBeginIndex}}};d.prototype.clone=function(){var t=d.getNewTextField();this.copyTo(t);return t};d.prototype.copyTo=function(t){r.prototype.copyTo.call(this,t);t.autoSize=this.autoSize;t.type=this._type;t.html=this.html;t.width=this._width;t.height=this._height;if(this._textFormat)t.textFormat=this._textFormat.clone();t.textColor=this._textColor;t.border=this._border;t.borderColor=this._borderColor;t.background=this._background;t.backgroundColor=this._backgroundColor;t.textOffsetX=this.textOffsetX;t.textOffsetY=this.textOffsetY;t.staticMatrix=this.staticMatrix;t.selectable=this._selectable;t.multiline=this.multiline;t.wordWrap=this.wordWrap;t.maxChars=this.maxChars;t.sourceTextField=this;if(t.html){t.htmlText=this.htmlText}else{t.text=this.text}if(this._labelData){t.setLabelData(this._labelData)}};d.prototype._clearTextShapes=function(){this._textShapesDirty=false;this._lastWordsCount=0;if(this.targetGraphics)this.targetGraphics.clear();var t;for(var e in this.textShapes){t=this.textShapes[e];if(t.shape){t.shape.dispose()}t.shape=null;t.elements=null;t.length=0;delete this.textShapes[e]}};d._textFields=[];d.assetType="[asset TextField]";d._onChangedEvent=new bt(bt.CHANGED);return d}(c);var Dt=function(e){g(t,e);function t(t){return e.call(this,t)||this}return t}(G.ErrorBase);var It=function(e){g(i,e);function i(t){return e.call(this,t)||this}i.prototype.clone=function(){var t=new i(this.type);t.view=this.view;t.entity=this.entity;return t};i.prototype._dispatchEvent=function(t){t.container.dispatchEvent(this);U.execute_queue()};i.FOCUS_IN="focusIn3d";i.FOCUS_OUT="focusOut3d";return i}(G.EventBase);var Ct=function(s){g(t,s);function t(t,e,i){if(e===void 0){e=NaN}if(i===void 0){i=NaN}var r=s.call(this,t)||this;r._oldHeight=e;r._oldWidth=i;return r}Object.defineProperty(t.prototype,"oldHeight",{get:function(){return this._oldHeight},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"oldWidth",{get:function(){return this._oldWidth},enumerable:true,configurable:true});t.prototype.clone=function(){return new t(this.type,this._oldHeight,this._oldWidth)};t.RESIZE="resize";return t}(G.EventBase);var Mt=function(e){g(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;t.awaySymbols={};return t}t.prototype.createMovieClip=function(t,e){if(t===void 0){t=null}if(e===void 0){e=null}return new H(t||new E(this))};t.prototype.createSprite=function(t,e,i){if(t===void 0){t=null}if(e===void 0){e=null}if(i===void 0){i=null}if(t)return t.getNewObject();return new f};t.prototype.createDisplayObjectContainer=function(t){if(t===void 0){t=null}return new c};t.prototype.createTextField=function(t){if(t===void 0){t=null}return new Pt};t.prototype.createBillboard=function(t,e){if(e===void 0){e=null}return new C(t)};t.prototype.createMaterial=function(t,e,i){if(i===void 0){i=null}return new h.MethodMaterial(t,e)};t.prototype.createFrameScripts=function(t,e,i,r){throw"[DefaultSceneGraphFactory] - createFrameScripts should be overwritten by AVM"};t.prototype.createChildInstanceForTimeline=function(t,e,i){throw"[DefaultSceneGraphFactory] - createChildInstanceForTimeline should be overwritten by AVM"};return t}(q.DefaultStageFactory);var Ot=new G.Point(0,0);var Ft=function(a){g(v,a);function v(t,e,i,r,s,n){if(i===void 0){i=true}if(r===void 0){r=4294967295}if(s===void 0){s=true}if(n===void 0){n=null}var o=a.call(this,t,e,i,null,s,n)||this;o._initalFillColor=null;o._lastUsedFill=null;o._internalSync=false;o._msaaNeedDrop=false;o._enforceMSAASupport=false;o._antialiasQuality=b.ALLOW_FORCE_MSAA;o._clearFromDispose=false;o._initalFillColor=r;o._lastUsedFill=r;return o}v.getImage=function(t,e,i,r,s,n,o){if(i===void 0){i=true}if(r===void 0){r=4294967295}if(s===void 0){s=true}if(n===void 0){n=null}if(o===void 0){o=false}var a=new v(t,e,i,r,s,n);if(!o){a._msaaNeedDrop=true;a._antialiasQuality=0}else{a._enforceMSAASupport=true}return a};v.tryStoreImage=function(t,e){e.filterManager.pushTemp(t)};v.getTemp=function(t,e,i,r){if(r===void 0){r=false}var s=i.filterManager.popTemp(t,e,r&&b.ALLOW_FORCE_MSAA>1);s.antialiasQuality=r?b.ALLOW_FORCE_MSAA:0;return s};v.prototype._dropMSAA=function(){if(this._msaaNeedDrop||!this.canUseMSAAInternaly){return}this._enforceMSAASupport=false;this._msaaNeedDrop=true;if(this.wasUpload){a.prototype.unload.call(this)}console.debug("[SceneImage2D Experemental] Drop MSAA support because a setPixel* operation called after upload.",this.id)};Object.defineProperty(v.prototype,"canUseMSAAInternaly",{get:function(){if(this._enforceMSAASupport){return true}var t=b.MSAA_MINIMAL_IMAGE_SIZE;var e=b.MSAA_MINIMAL_IMAGE_SIZE;if(this._stage){e=Math.min(this._stage.height,e);t=Math.min(this._stage.width,t)}return this.width>=t&&this.height>=e&&!this._msaaNeedDrop},enumerable:true,configurable:true});Object.defineProperty(v.prototype,"antialiasQuality",{get:function(){return this.canUseMSAAInternaly?this._antialiasQuality:0},enumerable:true,configurable:true});v.prototype.syncData=function(t){var e=this;if(t===void 0){t=false}if(t&&this._asyncRead){return this._asyncRead}if(!t&&this._asyncRead){throw"[SceneImage2D] Synced read not allowed while async read is requested!"}this.applySymbol();if(!this._imageDataDirty){return t?Promise.resolve(false):false}var i=this._stage.context;this._stage.setRenderTarget(this,false);if(!this._data){this._data=new Uint8ClampedArray(this.width*this.height*4)}this._internalSync=true;this._asyncRead=i.drawToBitmapImage2D(this,false,t);this._internalSync=false;this._stage.setRenderTarget(null);if(!t){this._imageDataDirty=false;this._unpackPMA=false;return true}return this._asyncRead.then(function(t){e._imageDataDirty=false;e._unpackPMA=false;e._asyncRead=null;return true})};v.prototype.getDataInternal=function(t,e){if(t===void 0){t=true}if(e===void 0){e=false}if(!e&&this._imageDataDirty&&!this._internalSync){this.syncData(false);return this._data}if(this._initalFillColor===null){return a.prototype.getDataInternal.call(this,t,true)}var i=a.prototype.getDataInternal.call(this,false,true);if(!i){a.prototype.fillRect.call(this,this.rect,this._initalFillColor);this._initalFillColor=null;return this._data}return i};Object.defineProperty(v.prototype,"assetType",{get:function(){return v.assetType},enumerable:true,configurable:true});v.prototype.createRenderer=function(){var t=new G.PerspectiveProjection;t.coordinateSystem=G.CoordinateSystem.RIGHT_HANDED;t.originX=-1;t.originY=1;t.transform=new G.Transform;t.transform.scaleTo(1,-1,1);t.transform.moveTo(0,0,-1e3);v._view=new o.View(t,this._stage);v._root=new c;v._rootNode=v._view.getNode(v._root);v._renderer=X.RenderGroup.getInstance(X.DefaultRenderer).getRenderer(v._rootNode.partition);v._view.backgroundAlpha=0;v._view.backgroundColor=0;v._renderer.disableClear=true;v._renderer.renderableSorter=null};v.prototype.createBillboardRenderer=function(){var t=new G.PerspectiveProjection;t.coordinateSystem=G.CoordinateSystem.RIGHT_HANDED;t.originX=-1;t.originY=1;t.transform=new G.Transform;t.transform.moveTo(0,0,-1e3);t.transform.lookAt(new G.Vector3D);v._billboardView=new o.View(t,this._stage);v._billboardRoot=new c;v._billboardRenderer=X.RenderGroup.getInstance(X.DefaultRenderer).getRenderer(v._billboardView.getNode(v._billboardRoot).partition);v._billboardView.backgroundAlpha=0;v._billboardView.backgroundColor=0;v._billboardRenderer.disableClear=true;v._billboardRenderer.renderableSorter=null;var e=new h.MethodMaterial(new q.BitmapImage2D(128,128,true,0));e.bothSides=true;e.alphaBlending=true;v._billboard=new C(e);v._billboard.style=new X.Style;v._billboardRoot.addChild(v._billboard)};v.prototype.dispose=function(){this._clearFromDispose=true;this.dropAllReferences();this.unmarkToUnload();this.unuseWeakRef();this._data=null;this._locked=false;a.prototype.dispose.call(this);this._clearFromDispose=false};v.prototype.unload=function(){var t=this;var e=this.syncData(true);if(typeof e!=="boolean"){e.then(function(){return a.prototype.unload.call(t)});return}a.prototype.unload.call(this)};v.prototype.deepClone=function(t){this.copyPixels(t,this._rect,new G.Point(0,0))};v.prototype.fillRect=function(t,e){this.dropAllReferences();var i=G.ColorUtils.float32ColorToARGB(e);var r=this._transparent?i[0]/255:1;var s=t!==this._rect&&!this._rect.equals(t);this._stage.setRenderTarget(this,true,0,0,true);this._stage.setScissor(t);this._lastUsedFill=s?null:e;this._stage.clear(i[1]/255*r,i[2]/255*r,i[3]/255*r,r);this._stage.setScissor(null);this._imageDataDirty=true};v.prototype.copyPixels=function(t,e,i,r,s,n){this._lastUsedFill=null;this.dropAllReferences();this.unmarkToUnload();n=this.transparent!==t.transparent||n;if(!t._imageDataDirty&&e.equals(this._rect)&&this._rect.equals(t.rect)&&!n&&(!this.wasUpload||!t.wasUpload)){var o=t.getDataInternal(true);if(this._data){this._data.set(o)}else{this._data=o.slice()}this._unpackPMA=t._unpackPMA;this._initalFillColor=null;this._imageDataDirty=false;this.invalidateGPU();return}if(t.width*t.height<=b.CPU_COPY_PIXELS_COUNT&&!n){}if(this._initalFillColor!==null){this.fillRect(this._rect,this._initalFillColor);this._initalFillColor=null}var a=t;if(r){a=this._stage.filterManager.popTemp(t.width,t.height);this._stage.filterManager.copyPixels(r,a,new G.Rectangle(s.x,s.y,e.width,e.height),new G.Point(0,0));this._stage.filterManager.copyPixels(t,a,t.rect,new G.Point(0,0),true,"alpha_back")}this._stage.filterManager.copyPixels(a,this,e,i,n);if(r){this._stage.filterManager.pushTemp(a)}this._imageDataDirty=true};v.prototype.threshold=function(t,e,i,r,s,n,o,a){this._lastUsedFill=null;this.dropAllReferences();this.unmarkToUnload();this._stage.threshold(t,this,e,i,r,s,n,o,a);this._imageDataDirty=true};v.prototype.applyFilter=function(t,e,i,r){if(!b.USE_UNSAFE_FILTERS||!r||!r.filterName){return false}this.dropAllReferences(false);var s=this._stage.filterManager.applyFilter(t,this,e,i,r.filterName,r);this._imageDataDirty=s;return s};v.prototype.colorTransform=function(t,e){this.dropAllReferences();this.unmarkToUnload();this._lastUsedFill=null;this._stage.colorTransform(this,this,t,e);this._imageDataDirty=true};v.prototype.setPixel=function(t,e,i){if(this.canUseMSAAInternaly){this._dropMSAA()}a.prototype.setPixel.call(this,t,e,i)};v.prototype.setPixel32=function(t,e,i){if(this.canUseMSAAInternaly){this._dropMSAA()}a.prototype.setPixel32.call(this,t,e,i)};v.prototype.setPixels=function(t,e){if(this.wasUpload&&this.canUseMSAAInternaly){this._dropMSAA()}a.prototype.setPixels.call(this,t,e)};v.prototype.clear=function(){var t=this;if(this._clearFromDispose){a.prototype.clear.call(this);return}var e=this.syncData(true);this.unmarkToUnload();this.lastUsedTime=-1;if(typeof e==="boolean"){this.wasUpload=false;a.prototype.clear.call(this);return}e.then(function(){t.wasUpload=false;a.prototype.clear.call(t)})};v.prototype.getPixel32=function(t,e){this.syncData();return a.prototype.getPixel32.call(this,t,e)};v.prototype.getPixel=function(t,e){var i=this.getPixel32(t,e);return i&16777215};v.prototype.draw=function(t,e,i,r,s,n){this.dropAllReferences();this.unmarkToUnload();if(t instanceof u){this._drawAsDisplay(t,e,i,r,s,n)}else{this._drawAsBitmap(t,e,i,r,s,n)}this._lastUsedFill=null;this._imageDataDirty=true;this.invalidate()};v._mapSupportedBlendMode=function(t){if(t===void 0){t=""}switch(t){case null:case"":case q.BlendMode.NORMAL:case q.BlendMode.LAYER:return q.BlendMode.LAYER;case q.BlendMode.MULTIPLY:case q.BlendMode.ADD:case q.BlendMode.ALPHA:return t}return q.BlendMode.LAYER};v.prototype._drawAsBitmap=function(t,e,i,r,s,n){if(!v._billboardRenderer){this.createBillboardRenderer()}if(this._initalFillColor!==null){this.fillRect(this._rect,this._initalFillColor);this._initalFillColor=null}var o=this._stage;var a=v._mapSupportedBlendMode(r);var h=!r||a!==q.BlendMode.LAYER||r==q.BlendMode.LAYER;var l=!h||this===t;var u=l?o.filterManager.popTemp(this.width,this.height,false):this;var c=v._billboardRenderer;var _=v._billboardRoot;var f=v._billboard;f.sampler.smooth=n;c.disableClear=!l;c.view.target=u;c.view.projection.scale=1e3/u.height;f.material.style.image=t;f.material.blendMode=!l?v._mapSupportedBlendMode(r):q.BlendMode.LAYER;f.material.useColorTransform=!!i;if(e){var p=_.transform.matrix3D;p.identity();p._rawData[0]=e.a;p._rawData[1]=-e.b;p._rawData[4]=e.c;p._rawData[5]=-e.d;p._rawData[12]=e.tx;p._rawData[13]=u.height-e.ty;_.transform.invalidateComponents()}else{_.transform.rotateTo(0,0,0);_.transform.scaleTo(1,-1,1);_.transform.moveTo(0,u.height,0)}_.transform.colorTransform=i;c.render();if(l){o.filterManager.copyPixels(u,this,this.rect,Ot,true,r);o.filterManager.pushTemp(u)}};v.prototype._drawAsDisplay=function(t,e,i,r,s,n){if(r===void 0){r=""}r=r||q.BlendMode.LAYER;if(!v._renderer){this.createRenderer()}var o=v._root;var a=v._rootNode;var h=v._renderer;var l=this.canUseMSAAInternaly;var u=!t.isAsset(C)&&this._stage.context.glVersion===2&&b.ALLOW_FORCE_MSAA>1&&!l;var c=this;var _=r!==q.BlendMode.LAYER||this._lastUsedFill===null;var f=_||u;if((!u||_)&&this._initalFillColor!==null){this.fillRect(this._rect,this._initalFillColor);this._initalFillColor=null}if(f){c=v.getTemp(this.width,this.height,this._stage,u);if(!_&&this._lastUsedFill!==null){h.disableClear=false;h.view.backgroundColor=this._lastUsedFill&16777215;h.view.backgroundAlpha=this._transparent?(this._lastUsedFill>>>24&255)/255:1}else{h.disableClear=false;h.view.backgroundColor=0;h.view.backgroundAlpha=0}}var p=h.view.projection.transform;var d=p.matrix3D;d.identity();if(e){var g=d._rawData;g[0]=e.a;g[1]=e.b;g[4]=e.c;g[5]=e.d;g[10]=1;g[12]=e.tx;g[13]=e.ty}d.appendScale(1,-1,1);d.appendTranslation(0,this._rect.height,1e3);d.invert();p.matrix3D=d;h.antiAlias=(l?this.antialiasQuality:c.antialiasQuality)||0;h.view.target=c;h.view.projection.scale=1e3/this._rect.height;h.view.projection.ratio=this._rect.width/this._rect.height;h.view.x=-(c.width-this.width);h.view.y=-(c.height-this.height);h.view.width=this.width;h.view.height=this.height;var m=a.addChildAt(t,0);m.transformDisabled=true;m.colorTransformDisabled=false;o.transform.colorTransform=i;o.blendMode=v._mapSupportedBlendMode(r);h.render();h.antiAlias=0;h.disableClear=true;a.removeChildAt(0);if(f){this._stage.filterManager.copyPixels(c,this,this._rect,Ot,_,r);v.tryStoreImage(c,this._stage)}};v.prototype.reset=function(){};v.prototype.clone=function(){var t=v.getImage(this.width,this.height,this.transparent,null,false,this._stage,false);t.deepClone(this);return t};v.assetType="[image SceneImage2D]";return v}(q.BitmapImage2D);q.Stage.registerAbstraction(q._Stage_BitmapImage2D,Ft);var Rt=function(){function i(t){this._pickerLookup=new Array;this.allowKeyInput=true;this._collisionIsEnabledButton=false;this._eventBubbling=true;this._allowFocusOnUnfocusable=true;this._cursorType="auto";this._nullVector=new G.Vector3D;this._queuedEvents=new Array;this._mouseUp=new V(V.MOUSE_UP);this._mouseUpOutside=new V(V.MOUSE_UP_OUTSIDE);this._mouseClick=new V(V.CLICK);this._mouseOut=new V(V.MOUSE_OUT);this._dragOut=new V(V.DRAG_OUT);this._dragOver=new V(V.DRAG_OVER);this._mouseDown=new V(V.MOUSE_DOWN);this._mouseMove=new V(V.MOUSE_MOVE);this._mouseOver=new V(V.MOUSE_OVER);this._mouseWheel=new V(V.MOUSE_WHEEL);this._mouseDoubleClick=new V(V.DOUBLE_CLICK);this._rollOver=new V(V.ROLL_OVER);this._rollOut=new V(V.ROLL_OUT);this._dragMove=new V(V.DRAG_MOVE);this._dragStart=new V(V.DRAG_START);this._dragStop=new V(V.DRAG_STOP);this._focusIn=new It(It.FOCUS_IN);this._focusOut=new It(It.FOCUS_OUT);this._useSoftkeyboard=false;this._isAVM1Dragging=false;this._isDown=false;this._stage=t;this.onDoubleClick=this.onDoubleClick.bind(this);this.onMouseDown=this.onMouseDown.bind(this);this.onMouseMove=this.onMouseMove.bind(this);this.onMouseUp=this.onMouseUp.bind(this);this.onMouseWheel=this.onMouseWheel.bind(this);this.onMouseOver=this.onMouseOver.bind(this);this.onMouseOut=this.onMouseOut.bind(this);this.onKeyDown=this.onKeyDown.bind(this);this.onKeyUp=this.onKeyUp.bind(this);this.buttonEnabledDirty=false;this._isTouch="ontouchstart"in self||navigator["msMaxTouchPoints"]>0;this._showCursor=true;this._mouseDragging=false;var e=this._stage.container;e.addEventListener("touchstart",this.onMouseDown);e.addEventListener("mousedown",this.onMouseDown);window.addEventListener("touchmove",this.onMouseMove);window.addEventListener("mousemove",this.onMouseMove);window.addEventListener("mouseup",this.onMouseUp);e.addEventListener("touchend",this.onMouseUp);e.addEventListener("mousewheel",this.onMouseWheel);e.addEventListener("mouseover",this.onMouseOver);e.addEventListener("mouseout",this.onMouseOut);window.addEventListener("keydown",this.onKeyDown);window.addEventListener("keyup",this.onKeyUp);window.addEventListener("contextmenu",function(t){return t.preventDefault()})}i.prototype.startDragObject=function(t){this._isAVM1Dragging=true;if(t)this._mouseDragCollision=t};i.prototype.stopDragObject=function(){this._isAVM1Dragging=false};Object.defineProperty(i.prototype,"showCursor",{get:function(){return this._showCursor},set:function(t){this._showCursor=t;this.cursorType=this._cursorType},enumerable:true,configurable:true});Object.defineProperty(i.prototype,"cursorType",{get:function(){return this._cursorType},set:function(t){this._cursorType=t;this._stage.container.style.cursor=this._showCursor?t:"none"},enumerable:true,configurable:true});Object.defineProperty(i.prototype,"eventBubbling",{get:function(){return this._eventBubbling},set:function(t){this._eventBubbling=t},enumerable:true,configurable:true});Object.defineProperty(i.prototype,"useSoftkeyboard",{get:function(){return this._useSoftkeyboard},set:function(t){this._useSoftkeyboard=t;if(!t){window.addEventListener("keydown",this.onKeyDown);window.addEventListener("keyup",this.onKeyUp)}else if(t){window.removeEventListener("keydown",this.onKeyDown);window.removeEventListener("keyup",this.onKeyUp)}},enumerable:true,configurable:true});i.prototype.dispose=function(){var t=this._stage.container;t.removeEventListener("dblclick",this.onDoubleClick);t.removeEventListener("touchstart",this.onMouseDown);t.removeEventListener("mousedown",this.onMouseDown);window.removeEventListener("touchmove",this.onMouseMove);window.removeEventListener("mousemove",this.onMouseMove);window.removeEventListener("mouseup",this.onMouseUp);t.removeEventListener("touchend",this.onMouseUp);t.removeEventListener("wheel",this.onMouseWheel);t.removeEventListener("mouseover",this.onMouseOver);t.removeEventListener("mouseout",this.onMouseOut);window.removeEventListener("keydown",this.onKeyDown);window.removeEventListener("keyup",this.onKeyUp);this._stage=null;this._mouseMoveEvent=null;this._mouseUp=null;this._mouseUpOutside=null;this._mouseClick=null;this._mouseOut=null;this._dragOut=null;this._dragOver=null;this._mouseDown=null;this._mouseMove=null;this._mouseOver=null;this._mouseWheel=null;this._mouseDoubleClick=null;this._dragMove=null;this._dragStart=null;this._dragStop=null};i.clearInstance=function(t){if(this._instancePool[t.id]){this._instancePool[t.id].dispose();delete this._instancePool[t.id]}};i.getInstance=function(t){return this._instancePool[t.id]||(this._instancePool[t.id]=new i(t))};i.prototype.setFocus=function(t){if(this._focusNode==t)return;if(this._allowFocusOnUnfocusable||this._focusNode.container.tabEnabled){if(this._focusNode){this.dispatchEvent(this._focusOut,this._focusNode);this._focusNode.container.setFocus(false,true)}this._focusNode=t;if(this._focusNode){this.dispatchEvent(this._focusIn,this._focusNode);this._focusNode.container.setFocus(true,true)}}};i.prototype.getFocus=function(){return this._focusNode};i.prototype.dispatchEvent=function(t,e){var i;if(!this._eventBubbling){if(e){t._dispatchEvent(e,e.container)}return}var r=(i=e)===null||i===void 0?void 0:i.container;while(e){if(t.commonAncestor&&e==t.commonAncestor){return}t._dispatchEvent(e,r);if(!t._iAllowedToPropagate){e=null}else{e=e.parent}}};i.prototype.setupAndDispatchEvent=function(t,e,i,r){if(r===void 0){r=null}if(e){t.delta=e.wheelDelta;t.ctrlKey=e.ctrlKey;t.altKey=e.altKey;t.shiftKey=e.shiftKey;t.buttons=e.buttons}t=this.setUpEvent(t,i,r);this.dispatchEvent(t,t.rootNode)};i.prototype.fireMouseEvents=function(t){if(t===void 0){t=null}var e,i,r,s;var n;if(t){n=t.getViewCollision(this._stage.screenX,this._stage.screenY)}else if(this._updateDirty){for(var o=0;o<this._pickerLookup.length;o++)if(!n||this._pickerLookup[o].layeredView)n=this._pickerLookup[o].getViewCollision(this._stage.screenX,this._stage.screenY,false,n)}if(!t&&!this._updateDirty)return;var a;var h;var l=this._queuedEvents.length;for(var o=0;o<l;++o){a=this._queuedEvents[o];h=(e=n)===null||e===void 0?void 0:e.rootNode;this.setUpEvent(a,n);if(a.type==V.MOUSE_DOWN){this._mouseDragging=true;if(!this._eventBubbling)this._stage.dispatchEvent(a);if(this._isTouch)this.setupAndDispatchEvent(this._mouseOver,this._mouseMoveEvent,n);this._mouseDragCollision=n;if(h){this.dispatchEvent(a,h)}else if(this._eventBubbling)this._stage.dispatchEvent(a);if(this._mouseDragCollision){this.setFocus((i=this._mouseDragCollision)===null||i===void 0?void 0:i.rootNode);this.setupAndDispatchEvent(this._dragStart,a,this._mouseDragCollision)}}else if(a.type==V.MOUSE_UP){if(!this._eventBubbling)this._stage.dispatchEvent(a);var u=null;var c=null;if(this._isAVM1Dragging&&this._mouseDragCollision){c=this._mouseDragCollision.rootNode;u=this._mouseDragCollision.containerNode}else if(this._mouseDragging&&this._mouseDragCollision&&this._mouseDragCollision.rootNode!=h){}else if(this._mouseDragging&&this._mouseDragCollision&&this._mouseDragCollision.rootNode==h){c=this._mouseDragCollision.rootNode;u=this._mouseDragCollision.containerNode}if(c){this.dispatchEvent(a,c)}else if(this._eventBubbling&&h)this.dispatchEvent(a,h);else if(this._eventBubbling)this._stage.dispatchEvent(a);if(u){if(!this._isAVM1Dragging)this.setupAndDispatchEvent(this._mouseClick,this._isTouch?this._mouseMoveEvent:a,this._mouseDragCollision);this.setupAndDispatchEvent(this._dragStop,a,this._mouseDragCollision)}else if(this._mouseDragging&&this._mouseDragCollision){this.setupAndDispatchEvent(this._mouseUpOutside,a,this._mouseDragCollision)}this._mouseDragCollision=null;this._mouseDragging=false;this._isAVM1Dragging=false}else if(a.type==V.MOUSE_MOVE){if(!this._eventBubbling){this._stage.dispatchEvent(a)}if(a.rootNode){this.dispatchEvent(a,a.rootNode)}if(this._mouseDragCollision){this.setupAndDispatchEvent(this._dragMove,a,this._mouseDragCollision)}if(this._eventBubbling){this._stage.dispatchEvent(a)}}else{this.dispatchEvent(a,h)}}this._queuedEvents.length=0;this._rollOut.commonAncestor=null;this._rollOver.commonAncestor=null;var _=(r=n)===null||r===void 0?void 0:r.rootNode;var f=(s=this._prevCollision)===null||s===void 0?void 0:s.rootNode;if(_!=f){if(f){this.setupAndDispatchEvent(this._mouseOut,this._mouseMoveEvent,this._prevCollision);if(this._mouseDragging&&this._mouseDragCollision&&this._mouseDragCollision.rootNode==f)this.setupAndDispatchEvent(this._dragOut,this._mouseMoveEvent,this._prevCollision)}if(!f&&_){this.setupAndDispatchEvent(this._rollOut,this._mouseMoveEvent,this._prevCollision);this.setupAndDispatchEvent(this._rollOver,this._mouseMoveEvent,n)}if(f&&!_){this.setupAndDispatchEvent(this._rollOut,this._mouseMoveEvent,this._prevCollision);this.setupAndDispatchEvent(this._rollOver,this._mouseMoveEvent,n)}if(f&&_){var p=[];var d=f;while(d&&!d.container.isAVMScene){p.push(d);d=d.parent}var g=null;d=_;while(d&&!d.container.isAVMScene){var m=p.indexOf(d);if(m==-1){d=d.parent}else{g=d;d=null}}if(g!=f)this.setupAndDispatchEvent(this._rollOut,this._mouseMoveEvent,this._prevCollision,g);if(g!=_)this.setupAndDispatchEvent(this._rollOver,this._mouseMoveEvent,n,g)}this._collisionIsEnabledButton=_?_.buttonEnabled:false;if(_){this.setupAndDispatchEvent(this._mouseOver,this._mouseMoveEvent,n);if(this._mouseDragging)this.setupAndDispatchEvent(this._dragOver,this._mouseMoveEvent,n)}this._prevCollision=n}else{var v=_?_.buttonEnabled:false;if(this._collisionIsEnabledButton!=v&&v){if(!this._isTouch)this.setupAndDispatchEvent(this._mouseOver,this._mouseMoveEvent,n);else if(this._mouseDragCollision&&this._mouseDragCollision.rootNode==_)this.setupAndDispatchEvent(this._dragOver,this._mouseMoveEvent,n)}this._collisionIsEnabledButton=v}if(!this._mouseDragging){this.cursorType=_?_.container.getMouseCursor():"auto"}this._updateDirty=false};i.prototype.registerPicker=function(t){this._pickerLookup.push(t)};i.prototype.unregisterPicker=function(t){this._pickerLookup.splice(this._pickerLookup.indexOf(t),1)};i.prototype.addEventsForSceneBinary=function(t,e){if(e===void 0){e=0}var i={};i.clientX=null;i.clientY=null;i.touches=[];i.changedTouches=[];i.preventDefault=function(){};var r=new Float32Array(t);var s=0;var n=0;var o=0;n++;var a=r[n++];var h=r[n++];var l=r[n++];if(h!=1&&h!=6&&h!=12&&h!=262&&h!=518){for(s=0;s<a;s++){var u={};u.identifier=r[n++];u.clientX=r[n++];u.clientY=r[n++];i.touches[s]=u}i.changedTouches[0]=i.touches[l]}else{if(a==1){var u={};u.identifier=r[n++];u.clientX=r[n++];u.clientY=r[n++];i.clientX=u.clientX;i.clientY=u.clientY}else{for(s=0;s<a;s++){var u={};u.identifier=r[n++];u.clientX=r[n++];u.clientY=r[n++];if(s!=l){i.touches[o]=u}else{i.clientX=u.clientX;i.clientY=u.clientY}}}}if(h==0||h==5||h==11||h==261||h==517){this.onMouseDown(i)}else if(h==1||h==6||h==12||h==262||h==518){this.onMouseUp(i)}else if(h==2){this.onMouseMove(i)}else{console.log("recieved unknown touch event-type: "+h)}};i.prototype.fireEventsForSceneFromString=function(t,e){if(e===void 0){e=0}var i={};i.clientX=null;i.clientY=null;i.preventDefault=function(){};var r=t.split(",");var s=0;var n=0;var o=parseInt(r[n++]);var a=parseInt(r[n++]);var h=parseInt(r[n++]);i.touches=[];i.changedTouches=[];if(a!=1&&a!=6){for(s=0;s<o;s++){var l={};l.identifier=r[n++];l.clientX=r[n++];l.clientY=r[n++];i.touches[s]=l;i.changedTouches[s]=l}i.changedTouches[s]=i.touches[h]}else{for(s=0;s<o;s++){if(s!=h){var l={};l.identifier=r[n++];l.clientX=r[n++];l.clientY=r[n++];i.touches[s]=l;i.changedTouches[s]=l}else{i.clientX=r[n++];i.clientY=r[n++];n++}}}if(a==0){this.onMouseDown(i)}else if(a==1){this.onMouseUp(i)}else if(a==2){this.onMouseMove(i)}else if(a==261){this.onMouseDown(i)}else if(a==6){this.onMouseUp(i)}};i.prototype.setUpEvent=function(t,e,i){if(i===void 0){i=null}var r,s;t._iAllowedToImmediatlyPropagate=true;t._iAllowedToPropagate=true;t.screenX=this._stage.screenX;t.screenY=this._stage.screenY;if(e){t.containerNode=e.containerNode;t.rootNode=e.rootNode;t.traversable=e.traversable;t.uv=e.uv;t.position=(r=e.position)===null||r===void 0?void 0:r.clone();t.normal=(s=e.normal)===null||s===void 0?void 0:s.clone();t.elementIndex=e.elementIndex}else{t.containerNode=null;t.rootNode=null;t.traversable=null;t.uv=null;t.position=this._nullVector;t.normal=this._nullVector;t.elementIndex=0}t.commonAncestor=i;return t};i.prototype.queueDispatch=function(t,e){t.delta=e instanceof WheelEvent?-3*e.deltaY/100:0;t.ctrlKey=e.ctrlKey;t.altKey=e.altKey;t.shiftKey=e.shiftKey;t.buttons=e instanceof MouseEvent?e.buttons:0;this._queuedEvents.push(t)};i.prototype.onKeyDown=function(t){!i.inputRecorder||i.inputRecorder.recordEvent(t);if(this.allowKeyInput){switch(t.keyCode){case 37:case 39:case 38:case 40:t.preventDefault();break;default:break}if(this._focusNode||this._stage){var e=new yt(yt.KEYDOWN,t.key,t.code);e.isShift=t.shiftKey;e.isCTRL=t.ctrlKey;e.isAlt=t.altKey;e.keyCode=t.keyCode;if(this._focusNode)this._focusNode.container.dispatchEvent(e);if(this._stage)this._stage.dispatchEvent(e)}}};i.prototype.onKeyUp=function(t){!i.inputRecorder||i.inputRecorder.recordEvent(t);if(this.allowKeyInput){switch(t.keyCode){case 37:case 39:case 38:case 40:t.preventDefault();break;default:break}if(this._focusNode||this._stage){var e=new yt(yt.KEYUP,t.key,t.code);e.isShift=t.shiftKey;e.isCTRL=t.ctrlKey;e.isAlt=t.altKey;e.keyCode=t.keyCode;if(this._focusNode)this._focusNode.container.dispatchEvent(e);if(this._stage)this._stage.dispatchEvent(e)}}};i.prototype.onMouseMove=function(t){!i.inputRecorder||i.inputRecorder.recordEvent(t);this._isTouch=t.type!="mousemove";this.updateColliders(t);this.queueDispatch(this._mouseMove,this._mouseMoveEvent=t)};i.prototype.onMouseOut=function(t){!i.inputRecorder||i.inputRecorder.recordEvent(t);this.updateColliders(t);this.queueDispatch(this._mouseOut,t)};i.prototype.onMouseOver=function(t){!i.inputRecorder||i.inputRecorder.recordEvent(t);this.updateColliders(t);this.queueDispatch(this._mouseOver,t)};i.prototype.onDoubleClick=function(t){!i.inputRecorder||i.inputRecorder.recordEvent(t);this.updateColliders(t);if(t instanceof MouseEvent&&t.buttons&6){t.preventDefault()}this.queueDispatch(this._mouseDoubleClick,t)};i.prototype.onMouseDown=function(t){this._isTouch=t.type!=="mousedown";if(this._isDown){return}!i.inputRecorder||i.inputRecorder.recordEvent(t);this._isDown=true;this.updateColliders(t);var e=this._isTouch;if(t instanceof MouseEvent&&t.buttons&6){e=true}if(e){t.preventDefault();this._stage.container.focus()}this.queueDispatch(this._mouseDown,t)};i.prototype.onMouseUp=function(t){if(!this._isDown){return}!i.inputRecorder||i.inputRecorder.recordEvent(t);this._isDown=false;this.updateColliders(t);var e=this._isTouch;if(t instanceof MouseEvent&&t.button===1){e=true}if(e){t.preventDefault();this._stage.container.focus()}this.queueDispatch(this._mouseUp,t)};i.prototype.onMouseWheel=function(t){!i.inputRecorder||i.inputRecorder.recordEvent(t);this.updateColliders(t);this.queueDispatch(this._mouseWheel,t)};i.prototype.updateColliders=function(t){this._stage.interactionHandler(t);this._updateDirty=true};i._instancePool={};return i}();var Nt=function(h){g(t,h);function t(t,e,i,r,s,n,o){if(t===void 0){t=null}if(e===void 0){e="triangle"}if(i===void 0){i=50}if(r===void 0){r=100}if(s===void 0){s=16}if(n===void 0){n=15}if(o===void 0){o=true}var a=h.call(this,t,e)||this;a._numVertices=0;a._radius=i;a._height=r;a._segmentsW=s;a._segmentsH=n%2==0?n+1:n;a._yUp=o;return a}Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(t){this._radius=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"segmentsW",{get:function(){return this._segmentsW},set:function(t){this._segmentsW=t;this._pInvalidatePrimitive();this._pInvalidateUVs()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"segmentsH",{get:function(){return this._segmentsH},set:function(t){this._segmentsH=t%2==0?t+1:t;this._pInvalidatePrimitive();this._pInvalidateUVs()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"yUp",{get:function(){return this._yUp},set:function(t){this._yUp=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});t.prototype._pBuildGraphics=function(t,e){var i;var r;var s;var n;var o;var a;var h;var l=0;var u=0;var c;var _,f,p,d;var g=0;if(e==X.ElementsType.TRIANGLE){var m=t;this._numVertices=(this._segmentsH+1)*(this._segmentsW+1);g=(this._segmentsH-1)*this._segmentsW*6;if(this._numVertices==m.numVertices){m.invalidateIndices();m.invalidateVertices(m.positions);m.invalidateVertices(m.normals);m.invalidateVertices(m.tangents)}else{m.setIndices(new Uint16Array(g));m.setPositions(new Float32Array(this._numVertices*3));m.setNormals(new Float32Array(this._numVertices*3));m.setTangents(new Float32Array(this._numVertices*3));this._pInvalidateUVs()}i=m.indices.get(m.numElements);r=m.positions.get(this._numVertices);s=m.normals.get(this._numVertices);n=m.tangents.get(this._numVertices);o=m.concatenatedBuffer.stride/4;for(h=0;h<=this._segmentsH;++h){var v=Math.PI*h/this._segmentsH;var y=-this._radius*Math.cos(v);var b=this._radius*Math.sin(v);c=u;for(a=0;a<=this._segmentsW;++a){var x=2*Math.PI*a/this._segmentsW;var w=b*Math.cos(x);var E=h>this._segmentsH/2?this._height/2:-this._height/2;var S=b*Math.sin(x);var A=1/Math.sqrt(w*w+S*S+y*y);var T=Math.sqrt(S*S+w*w);if(this._yUp){p=0;d=T>.007?w/T:0;_=-y;f=S}else{p=T>.007?w/T:0;d=0;_=S;f=y}if(a==this._segmentsW){r[u]=r[c];r[u+1]=r[c+1];r[u+2]=r[c+2];s[u]=(s[c]+w*A)*.5;s[u+1]=(s[c+1]+_*A)*.5;s[u+2]=(s[c+2]+f*A)*.5;n[u]=(n[c]+(T>.007?-S/T:1))*.5;n[u+1]=(n[c+1]+p)*.5;n[u+2]=(n[c+2]+d)*.5}else{r[u]=w;r[u+1]=this._yUp?_-E:_;r[u+2]=this._yUp?f:f+E;s[u]=w*A;s[u+1]=_*A;s[u+2]=f*A;n[u]=T>.007?-S/T:1;n[u+1]=p;n[u+2]=d}if(a>0&&h>0){var P=(this._segmentsW+1)*h+a;var D=(this._segmentsW+1)*h+a-1;var I=(this._segmentsW+1)*(h-1)+a-1;var C=(this._segmentsW+1)*(h-1)+a;if(h==this._segmentsH){r[u]=r[c];r[u+1]=r[c+1];r[u+2]=r[c+2];i[l++]=P;i[l++]=I;i[l++]=C}else if(h==1){i[l++]=P;i[l++]=D;i[l++]=I}else{i[l++]=P;i[l++]=D;i[l++]=I;i[l++]=P;i[l++]=I;i[l++]=C}}u+=o}}}else if(e==X.ElementsType.LINE){}};t.prototype._pBuildUVs=function(t,e){var i,r;var s;var n;if(e==X.ElementsType.TRIANGLE){var o=t;if(o.uvs&&this._numVertices==o.numVertices){o.invalidateVertices(o.uvs)}else{o.setUVs(new Float32Array(this._numVertices*2))}s=o.uvs.get(this._numVertices);n=o.uvs.stride;var a=0;for(r=0;r<=this._segmentsH;++r){for(i=0;i<=this._segmentsW;++i){s[a]=i/this._segmentsW*this._scaleU;s[a+1]=r/this._segmentsH*this._scaleV;a+=n}}}else if(e==X.ElementsType.LINE){}};return t}(s);var Lt=function(_){g(t,_);function t(t,e,i,r,s,n,o,a,h,l,u){if(t===void 0){t=null}if(e===void 0){e="triangle"}if(i===void 0){i=50}if(r===void 0){r=50}if(s===void 0){s=100}if(n===void 0){n=16}if(o===void 0){o=1}if(a===void 0){a=true}if(h===void 0){h=true}if(l===void 0){l=true}if(u===void 0){u=true}var c=_.call(this,t,e)||this;c._numVertices=0;c._topRadius=i;c._pBottomRadius=r;c._height=s;c._pSegmentsW=n;c._pSegmentsH=o;c._topClosed=a;c._bottomClosed=h;c._surfaceClosed=l;c._yUp=u;return c}Object.defineProperty(t.prototype,"topRadius",{get:function(){return this._topRadius},set:function(t){this._topRadius=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"bottomRadius",{get:function(){return this._pBottomRadius},set:function(t){this._pBottomRadius=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"segmentsW",{get:function(){return this._pSegmentsW},set:function(t){this.setSegmentsW(t)},enumerable:true,configurable:true});t.prototype.setSegmentsW=function(t){this._pSegmentsW=t;this._pInvalidatePrimitive();this._pInvalidateUVs()};Object.defineProperty(t.prototype,"segmentsH",{get:function(){return this._pSegmentsH},set:function(t){this.setSegmentsH(t)},enumerable:true,configurable:true});t.prototype.setSegmentsH=function(t){this._pSegmentsH=t;this._pInvalidatePrimitive();this._pInvalidateUVs()};Object.defineProperty(t.prototype,"topClosed",{get:function(){return this._topClosed},set:function(t){this._topClosed=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"bottomClosed",{get:function(){return this._bottomClosed},set:function(t){this._bottomClosed=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"yUp",{get:function(){return this._yUp},set:function(t){this._yUp=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});t.prototype._pBuildGraphics=function(t,e){var i;var r;var s;var n;var o;var a;var h;var l;var u;var c;var _;var f;var p;var d;var g;var m;var v;var y=0;var b;var x;var w=0;var E=0;var S=0;var A;var T;this._numVertices=0;var P=2*Math.PI/this._pSegmentsW;if(e==X.ElementsType.TRIANGLE){var D=t;if(this._surfaceClosed){this._numVertices+=(this._pSegmentsH+1)*(this._pSegmentsW+1);y+=this._pSegmentsH*this._pSegmentsW*6}if(this._topClosed){this._numVertices+=2*(this._pSegmentsW+1);y+=this._pSegmentsW*3}if(this._bottomClosed){this._numVertices+=2*(this._pSegmentsW+1);y+=this._pSegmentsW*3}if(this._numVertices==D.numVertices){D.positions.invalidate();D.normals.invalidate();D.tangents.invalidate();D.indices.invalidate()}else{D.setIndices(new Uint16Array(y));D.setPositions(new Float32Array(this._numVertices*3));D.setNormals(new Float32Array(this._numVertices*3));D.setTangents(new Float32Array(this._numVertices*3));this._pInvalidateUVs()}i=D.indices.get(D.numElements);r=D.positions.get(this._numVertices);s=D.normals.get(this._numVertices);n=D.tangents.get(this._numVertices);o=D.concatenatedBuffer.stride/4;_=0;f=0;if(this._topClosed&&this._topRadius>0){c=-.5*this._height;if(this._yUp){A=1;T=0;b=-c;x=0}else{A=0;T=-1;b=0;x=c}r[_]=0;r[_+1]=b;r[_+2]=x;s[_]=0;s[_+1]=A;s[_+2]=T;n[_]=1;n[_+1]=0;n[_+2]=0;_+=o;E++;for(a=0;a<=this._pSegmentsW;++a){d=a*P;l=this._topRadius*Math.cos(d);u=this._topRadius*Math.sin(d);if(this._yUp){b=-c;x=u}else{b=u;x=c}if(a==this._pSegmentsW){r[_]=r[w+o];r[_+1]=r[w+o+1];r[_+2]=r[w+o+2]}else{r[_]=l;r[_+1]=b;r[_+2]=x}s[_]=0;s[_+1]=A;s[_+2]=T;n[_]=1;n[_+1]=0;n[_+2]=0;_+=o;if(a>0){i[f++]=E-1;i[f++]=S;i[f++]=E}E++}}if(this._bottomClosed&&this._pBottomRadius>0){c=.5*this._height;w=E*o;S=E;if(this._yUp){A=-1;T=0;b=-c;x=0}else{A=0;T=1;b=0;x=c}if(a>0){r[_]=0;r[_+1]=b;r[_+2]=x;s[_]=0;s[_+1]=A;s[_+2]=T;n[_]=1;n[_+1]=0;n[_+2]=0;_+=o}E++;for(a=0;a<=this._pSegmentsW;++a){d=a*P;l=this._pBottomRadius*Math.cos(d);u=this._pBottomRadius*Math.sin(d);if(this._yUp){b=-c;x=u}else{b=u;x=c}if(a==this._pSegmentsW){r[_]=r[w+o];r[_+1]=r[w+o+1];r[_+2]=r[w+o+2]}else{r[_]=l;r[_+1]=b;r[_+2]=x}s[_]=0;s[_+1]=A;s[_+2]=T;n[_]=1;n[_+1]=0;n[_+2]=0;_+=o;if(a>0){i[f++]=E-1;i[f++]=E;i[f++]=S}E++}}g=this._pBottomRadius-this._topRadius;m=g/this._height;v=m==0?1:this._height/g;if(this._surfaceClosed){var I=void 0;var C=void 0;var M=void 0;var O=void 0;var F=void 0,R=void 0,N=void 0,L=void 0;for(h=0;h<=this._pSegmentsH;++h){p=this._topRadius-h/this._pSegmentsH*(this._topRadius-this._pBottomRadius);c=-(this._height/2)+h/this._pSegmentsH*this._height;w=E*o;for(a=0;a<=this._pSegmentsW;++a){d=a*P;l=p*Math.cos(d);u=p*Math.sin(d);F=v*Math.cos(d);R=v*Math.sin(d);if(this._yUp){A=0;T=-F;b=-c;x=u;N=m;L=R}else{A=-F;T=0;b=u;x=c;N=R;L=m}if(a==this._pSegmentsW){r[_]=r[w];r[_+1]=r[w+1];r[_+2]=r[w+2];s[_]=F;s[_+1]=m;s[_+2]=R;n[_]=R;n[_+1]=A;n[_+2]=T}else{r[_]=l;r[_+1]=b;r[_+2]=x;s[_]=F;s[_+1]=N;s[_+2]=L;n[_]=-R;n[_+1]=A;n[_+2]=T}_+=o;if(a>0&&h>0){I=E;C=E-1;M=C-this._pSegmentsW-1;O=I-this._pSegmentsW-1;i[f++]=I;i[f++]=C;i[f++]=M;i[f++]=I;i[f++]=M;i[f++]=O}E++}}}}else if(e==X.ElementsType.LINE){var k=t;var j=this._pSegmentsH*this._pSegmentsW*2+this._pSegmentsW;r=new Float32Array(j*6);var B=new Float32Array(j);_=0;f=0;for(h=0;h<=this._pSegmentsH;++h){p=this._topRadius-h/this._pSegmentsH*(this._topRadius-this._pBottomRadius);c=-(this._height/2)+h/this._pSegmentsH*this._height;for(a=0;a<=this._pSegmentsW;++a){d=a*P;l=p*Math.cos(d);u=p*Math.sin(d);if(this._yUp){b=-c;x=u}else{b=u;x=c}if(a>0){r[_++]=l;r[_++]=b;r[_++]=x;B[f++]=1;if(h>0){var U=h==1?3-(6*(this._pSegmentsW-a)+12*a):3-this._pSegmentsW*12;r[_]=r[_+++U];r[_]=r[_+++U];r[_]=r[_+++U];r[_++]=l;r[_++]=b;r[_++]=x;B[f++]=1}}if(a<this._pSegmentsW){r[_++]=l;r[_++]=b;r[_++]=x}}}k.setPositions(r);k.setThickness(B)}};t.prototype._pBuildUVs=function(t,e){var i;var r;var s;var n;var o;var a;var h;if(e==X.ElementsType.TRIANGLE){var l=t;if(l.uvs&&this._numVertices==l.numVertices){l.invalidateVertices(l.uvs)}else{l.setUVs(new Float32Array(this._numVertices*2))}a=l.uvs.get(this._numVertices);h=l.uvs.stride;var u=2*Math.PI/this._pSegmentsW;var c=0;if(this._topClosed){a[c]=.5*this._scaleU;a[c+1]=.5*this._scaleV;c+=h;for(i=0;i<=this._pSegmentsW;++i){o=i*u;s=.5+.5*-Math.cos(o);n=.5+.5*Math.sin(o);a[c]=s*this._scaleU;a[c+1]=n*this._scaleV;c+=h}}if(this._bottomClosed){a[c]=.5*this._scaleU;a[c+1]=.5*this._scaleV;c+=h;for(i=0;i<=this._pSegmentsW;++i){o=i*u;s=.5+.5*Math.cos(o);n=.5+.5*Math.sin(o);a[c]=s*this._scaleU;a[c+1]=n*this._scaleV;c+=h}}if(this._surfaceClosed){for(r=0;r<=this._pSegmentsH;++r){for(i=0;i<=this._pSegmentsW;++i){a[c]=i/this._pSegmentsW*this._scaleU;a[c+1]=r/this._pSegmentsH*this._scaleV;c+=h}}}}else if(e==X.ElementsType.LINE){}};return t}(s);var kt=function(h){g(t,h);function t(t,e,i,r,s,n,o,a){if(t===void 0){t=null}if(e===void 0){e="triangle"}if(i===void 0){i=50}if(r===void 0){r=100}if(s===void 0){s=16}if(n===void 0){n=1}if(o===void 0){o=true}if(a===void 0){a=true}return h.call(this,t,e,0,i,r,s,n,false,o,true,a)||this}Object.defineProperty(t.prototype,"radius",{get:function(){return this._pBottomRadius},set:function(t){this._pBottomRadius=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});return t}(Lt);var jt=function(l){g(t,l);function t(t,e,i,r,s,n,o,a){if(t===void 0){t=null}if(e===void 0){e="triangle"}if(i===void 0){i=100}if(r===void 0){r=100}if(s===void 0){s=1}if(n===void 0){n=1}if(o===void 0){o=true}if(a===void 0){a=false}var h=l.call(this,t,e)||this;h._segmentsW=s;h._segmentsH=n;h._yUp=o;h._width=i;h._height=r;h._doubleSided=a;return h}Object.defineProperty(t.prototype,"segmentsW",{get:function(){return this._segmentsW},set:function(t){this._segmentsW=t;this._pInvalidatePrimitive();this._pInvalidateUVs()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"segmentsH",{get:function(){return this._segmentsH},set:function(t){this._segmentsH=t;this._pInvalidatePrimitive();this._pInvalidateUVs()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"yUp",{get:function(){return this._yUp},set:function(t){this._yUp=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"doubleSided",{get:function(){return this._doubleSided},set:function(t){this._doubleSided=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});t.prototype._pBuildGraphics=function(t,e){var i;var r,s;var n;var o;var a;var h=this._segmentsW+1;var l,u;var c;var _;if(e==X.ElementsType.TRIANGLE){var f=t;var p=(this._segmentsH+1)*h;if(this._doubleSided)p*=2;n=this._segmentsH*this._segmentsW*6;if(this._doubleSided)n*=2;if(f.indices!=null&&n==f.indices.length){f.invalidateIndices()}else{f.setIndices(new Uint16Array(n));this._pInvalidateUVs()}i=f.indices.get(f.numElements);if(p==f.numVertices){f.invalidateVertices(f.positions);f.invalidateVertices(f.normals);f.invalidateVertices(f.tangents)}else{f.setPositions(new Float32Array(p*3));f.setNormals(new Float32Array(p*3));f.setTangents(new Float32Array(p*3));this._pInvalidateUVs()}var d=f.positions.get(p);var g=f.normals.get(p);var m=f.tangents.get(p);o=f.concatenatedBuffer.stride/4;u=0;l=0;for(_=0;_<=this._segmentsH;++_){for(c=0;c<=this._segmentsW;++c){r=(c/this._segmentsW-.5)*this._width;s=(_/this._segmentsH-.5)*this._height;d[l]=r;if(this._yUp){d[l+1]=0;d[l+2]=s}else{d[l+1]=s;d[l+2]=0}g[l]=0;if(this._yUp){g[l+1]=1;g[l+2]=0}else{g[l+1]=0;g[l+2]=-1}m[l]=1;m[l+1]=0;m[l+2]=0;l+=o;if(this._doubleSided){for(var v=l;v<l+3;++v){d[v]=d[v-3];g[v]=-g[v-3];m[v]=-m[v-3]}l+=o}if(c!=this._segmentsW&&_!=this._segmentsH){a=c+_*h;var y=this._doubleSided?2:1;i[u++]=a*y;i[u++]=(a+h)*y;i[u++]=(a+h+1)*y;i[u++]=a*y;i[u++]=(a+h+1)*y;i[u++]=(a+1)*y;if(this._doubleSided){i[u++]=(a+h+1)*y+1;i[u++]=(a+h)*y+1;i[u++]=a*y+1;i[u++]=(a+1)*y+1;i[u++]=(a+h+1)*y+1;i[u++]=a*y+1}}}}}else if(e==X.ElementsType.LINE){var b=t;var x=this._segmentsH+1+h;var w=this._width/2;var E=this._height/2;var d=new Float32Array(x*6);var S=new Float32Array(x);u=0;l=0;for(_=0;_<=this._segmentsH;++_){d[l++]=-w;d[l++]=0;d[l++]=_*this._height-E;d[l++]=w;d[l++]=0;d[l++]=_*this._height-E;S[u++]=1}for(c=0;c<=this._segmentsW;++c){d[l++]=c*this._width-w;d[l++]=0;d[l++]=-E;d[l++]=c*this._width-w;d[l++]=0;d[l++]=E;S[u++]=1}b.setPositions(d);b.setThickness(S)}};t.prototype._pBuildUVs=function(t,e){var i;var r;var s;if(e==X.ElementsType.TRIANGLE){s=(this._segmentsH+1)*(this._segmentsW+1);if(this._doubleSided)s*=2;var n=t;if(n.uvs&&s==n.numVertices){n.invalidateVertices(n.uvs)}else{n.setUVs(new Float32Array(s*2))}i=n.uvs.get(s);r=n.uvs.stride;var o=0;for(var a=0;a<=this._segmentsH;++a){for(var h=0;h<=this._segmentsW;++h){i[o]=h/this._segmentsW*this._scaleU;i[o+1]=(1-a/this._segmentsH)*this._scaleV;o+=r;if(this._doubleSided){i[o]=h/this._segmentsW*this._scaleU;i[o+1]=(1-a/this._segmentsH)*this._scaleV;o+=r}}}}else if(e==X.ElementsType.LINE){}};return t}(s);var Bt=function(n){g(t,n);function t(t,e,i,r,s){if(t===void 0){t=null}if(e===void 0){e="triangle"}if(i===void 0){i=100}if(r===void 0){r=16}if(s===void 0){s=true}return n.call(this,t,e,i,0,0,r,1,true,false,false,s)||this}Object.defineProperty(t.prototype,"radius",{get:function(){return this._pBottomRadius},set:function(t){this._pBottomRadius=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"sides",{get:function(){return this._pSegmentsW},set:function(t){this.setSegmentsW(t)},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"subdivisions",{get:function(){return this._pSegmentsH},set:function(t){this.setSegmentsH(t)},enumerable:true,configurable:true});return t}(Lt);var Ut=function(h){g(t,h);function t(t,e,i,r,s,n,o){if(t===void 0){t=null}if(e===void 0){e="triangle"}if(i===void 0){i=50}if(r===void 0){r=50}if(s===void 0){s=16}if(n===void 0){n=8}if(o===void 0){o=true}var a=h.call(this,t,e)||this;a._numVertices=0;a._radius=i;a._tubeRadius=r;a._segmentsR=s;a._segmentsT=n;a._yUp=o;return a}Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(t){this._radius=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"tubeRadius",{get:function(){return this._tubeRadius},set:function(t){this._tubeRadius=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"segmentsR",{get:function(){return this._segmentsR},set:function(t){this._segmentsR=t;this._pInvalidatePrimitive();this._pInvalidateUVs()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"segmentsT",{get:function(){return this._segmentsT},set:function(t){this._segmentsT=t;this._pInvalidatePrimitive();this._pInvalidateUVs()},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"yUp",{get:function(){return this._yUp},set:function(t){this._yUp=t;this._pInvalidatePrimitive()},enumerable:true,configurable:true});t.prototype._pBuildGraphics=function(t,e){var i;var r;var s;var n;var o;var a,h;var l,u,c,_,f,p,d,g;var m;var v;var y=0;if(e==X.ElementsType.TRIANGLE){var b=t;this._numVertices=(this._segmentsT+1)*(this._segmentsR+1);y=this._segmentsT*this._segmentsR*6;if(this._numVertices==b.numVertices){b.invalidateIndices();b.invalidateVertices(b.positions);b.invalidateVertices(b.normals);b.invalidateVertices(b.tangents)}else{b.setIndices(new Uint16Array(y));b.setPositions(new Float32Array(this._numVertices*3));b.setNormals(new Float32Array(this._numVertices*3));b.setTangents(new Float32Array(this._numVertices*3));this._pInvalidateUVs()}i=b.indices.get(b.numElements);r=b.positions.get(this._numVertices);s=b.normals.get(this._numVertices);n=b.tangents.get(this._numVertices);o=b.concatenatedBuffer.stride/4;m=0;v=0;var x=2*Math.PI/this._segmentsR;var w=2*Math.PI/this._segmentsT;var E=void 0,S=void 0;var A=void 0,T=void 0,P=void 0,D=void 0;var I=0;var C=0;var M=void 0,O=void 0,F=void 0,R=void 0,N;for(h=0;h<=this._segmentsT;++h){I=m;for(a=0;a<=this._segmentsR;++a){d=a*x;g=h*w;N=Math.cos(g);_=N*Math.cos(d);f=N*Math.sin(d);p=Math.sin(g);l=this._radius*Math.cos(d)+this._tubeRadius*_;u=this._radius*Math.sin(d)+this._tubeRadius*f;c=h==this._segmentsT?0:this._tubeRadius*p;if(this._yUp){P=-p;D=f;A=0;T=N?_/N:l/this._radius;E=-c;S=u}else{P=f;D=p;A=N?_/N:l/this._radius;T=0;E=u;S=c}if(a==this._segmentsR){r[m]=l;r[m+1]=r[I+1];r[m+2]=r[I+2]}else{r[m]=l;r[m+1]=E;r[m+2]=S}s[m]=_;s[m+1]=P;s[m+2]=D;n[m]=-(N?f/N:u/this._radius);n[m+1]=A;n[m+2]=T;m+=o;if(a>0&&h>0){M=C;O=C-1;F=O-this._segmentsR-1;R=M-this._segmentsR-1;i[v++]=M;i[v++]=O;i[v++]=F;i[v++]=M;i[v++]=F;i[v++]=R}C++}}}else if(e==X.ElementsType.LINE){}};t.prototype._pBuildUVs=function(t,e){var i,r;var s;var n;if(e==X.ElementsType.TRIANGLE){var o=t;if(o.uvs&&this._numVertices==o.numVertices){o.invalidateVertices(o.uvs)}else{o.setUVs(new Float32Array(this._numVertices*2))}s=o.uvs.get(this._numVertices);n=o.uvs.stride;var a=0;for(r=0;r<=this._segmentsT;++r){for(i=0;i<=this._segmentsR;++i){s[a]=i/this._segmentsR*this._scaleU;s[a+1]=r/this._segmentsT*this._scaleV;a+=n}}}else if(e==X.ElementsType.LINE){}};return t}(s);var Vt=function(){function t(){}t.ADVANCED="advanced";t.NORMAL="normal";return t}();var Ht=function(r){g(t,r);function t(t){var e=r.call(this,t)||this;var i=new G.PerspectiveProjection;i.coordinateSystem=G.CoordinateSystem.RIGHT_HANDED;i.originX=-1;i.originY=1;i.transform=new G.Transform;i.transform.moveTo(0,0,-1e3);i.transform.lookAt(new G.Vector3D);e._view=new o.View(i,e._stage);e._root=new c;e._renderer=X.RenderGroup.getInstance(X.DefaultRenderer).getRenderer(e._view.getNode(e._root).partition);e._renderer.view.projection=i;e._renderer.renderableSorter=null;return e}t.prototype.generate=function(t,e,i,r){var s;var n=[];var o;for(var a in t.font_styles){var h=t.font_styles[a].generateFNTTextures(r,i,e);for(var l=0;l<h.length;l++){o=e;var u=new f;u.graphics.addShape(h[l]);this._root.removeChildren(0,this._root.numChildren);this._root.addChild(u);this._renderer.view.projection.scale=1e3/e;var c=0;var _=this._stage.glVersion==1?e*2:e;s=new q.BitmapImage2D(_,_,true,0,true);n.push(s);t.font_styles[a].addFNTChannel(s);while(o>=1){this._view.backgroundAlpha=0;this._view.backgroundColor=0;this._view.target=s;this._renderer.render(true,0,c);if(this._stage.glVersion==1)break;o*=.5;c++}}}return n};return t}(nt);var Wt=function(){function t(){}t.NONE="none";t.PIXEL="pixel";t.SUBPIXEL="subpixel";return t}();var zt=function(){function t(){}t.NORMAL="normal";t.SELECTION="selection";return t}();var Gt=function(){function t(t,e,i){if(t===void 0){t=false}if(e===void 0){e=false}if(i===void 0){i=false}this._keepMaterial=t;this._disposeSources=e;this._objectSpace=i}Object.defineProperty(t.prototype,"disposeSources",{get:function(){return this._disposeSources},set:function(t){this._disposeSources=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"keepMaterial",{get:function(){return this._keepMaterial},set:function(t){this._keepMaterial=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"objectSpace",{get:function(){return this._objectSpace},set:function(t){this._objectSpace=t},enumerable:true,configurable:true});t.prototype.applyToContainer=function(t,e){this.reset();this.parseContainer(t,e);this.collect(t,false);this.merge(t,this._disposeSources)};t.prototype.applyToSprites=function(t,e){this.reset();if(!e.length)return;for(var i=0;i<e.length;i++)if(e[i]!=t)this.collect(e[i],this._disposeSources);this.collect(t,false);this.merge(t,this._disposeSources)};t.prototype.apply=function(t,e){this.reset();this.collect(e,this._disposeSources);this.collect(t,false);this.merge(t,this._disposeSources)};t.prototype.reset=function(){this._toDispose=new Array;this._shapeVOs=new Array};t.prototype.merge=function(t,e){var i;var r=t.graphics;var s=this._shapeVOs.length>1;for(i=0;i<this._shapeVOs.length;i++){var n=new X.TriangleElements(new q.AttributesBuffer);n.autoDeriveNormals=false;n.autoDeriveTangents=false;var o=this._shapeVOs[i];n.setIndices(o.indices);n.setPositions(o.vertices);n.setNormals(o.normals);n.setTangents(o.tangents);n.setUVs(o.uvs);if(this._keepMaterial&&s)r.addShape(Y.Shape.getShape(n,o.material));else r.addShape(Y.Shape.getShape(n))}if(this._keepMaterial&&!s&&this._shapeVOs.length)t.material=this._shapeVOs[0].material;if(e){var a=this._toDispose.length;for(i;i<a;i++)this._toDispose[i].dispose()}this._toDispose=null};t.prototype.collect=function(t,e){var i;var r;for(i=0;i<t.graphics.count;i++){var s=void 0;var n=void 0;var o=void 0,a=void 0,h=void 0,l=void 0;var u=t.graphics.getShapeAt(i).elements;var c=this.getShapeData(t.graphics.getShapeAt(i).material);var _=this._objectSpace?c.vertices:[];var f=this._objectSpace?c.normals:[];var p=this._objectSpace?c.tangents:[];a=_.length;h=f.length;l=p.length;var d=c.uvs.length;this.copyAttributes(u.positions,_,u.numVertices,a);this.copyAttributes(u.normals,f,u.numVertices,h);this.copyAttributes(u.tangents,p,u.numVertices,l);this.copyAttributes(u.uvs,c.uvs,u.numVertices,d);var g=!this._objectSpace?c.vertices.length/3:0;o=c.indices.length;n=u.numElements;var m=u.indices.get(n);for(s=0;s<n;s++){r=s*3;c.indices[o++]=m[r]+g;c.indices[o++]=m[r+1]+g;c.indices[o++]=m[r+2]+g}if(!this._objectSpace){t.transform.matrix3D.transformVectors(_,_);t.transform.matrix3D.deltaTransformVectors(f,f);t.transform.matrix3D.deltaTransformVectors(p,p);a=c.vertices.length;h=c.normals.length;l=c.tangents.length;n=_.length;for(s=0;s<n;s++){c.vertices[a++]=_[s];c.normals[h++]=f[s];c.tangents[l++]=p[s]}}}if(e)this._toDispose.push(t)};t.prototype.copyAttributes=function(t,e,i,r){var s=t.get(i);var n=t.dimensions;var o=t.stride;var a=i*o;for(var h=0;h<a;h+=o)for(var l=0;l<n;l++)e[r++]=s[h+l]};t.prototype.getShapeData=function(t){var e;if(this._keepMaterial){var i=void 0;var r=this._shapeVOs.length;for(i=0;i<r;i++){if(this._shapeVOs[i].material==t){e=this._shapeVOs[i];break}}}else if(this._shapeVOs.length){e=this._shapeVOs[0]}if(!e){e=new qt;e.vertices=new Array;e.normals=new Array;e.tangents=new Array;e.uvs=new Array;e.indices=new Array;e.material=t;this._shapeVOs.push(e)}return e};t.prototype.parseContainer=function(t,e){var i;var r;if(e instanceof f&&e!=t)this.collect(e,this._disposeSources);for(r=0;r<e.numChildren;++r){i=e.getChildAt(r);this.parseContainer(t,i)}};return t}();var qt=function(){function t(){}return t}();var Yt=function(){function i(){}i.string=function(t){if(typeof t=="function")t=new t;if(typeof t=="string")return t;return t};i.byteArray=function(t){if(typeof t=="function")t=new t;if(t instanceof G.ByteArray)return t;return t};i.isHex=function(t){var e=t.length;for(var i=0;i<e;++i){if(this._hexChars.indexOf(t.charAt(i))==-1)return false}return true};i.tryColor=function(t){if(typeof t=="number")return Math.floor(t);if(typeof t=="string"){if(t=="random")return Math.floor(Math.random()*16777216);if(this._colorNames==null){this._colorNames=new Object;this._colorNames["steelblue"]=4620980;this._colorNames["royalblue"]=267920;this._colorNames["cornflowerblue"]=6591981;this._colorNames["lightsteelblue"]=11584734;this._colorNames["mediumslateblue"]=8087790;this._colorNames["slateblue"]=6970061;this._colorNames["darkslateblue"]=4734347;this._colorNames["midnightblue"]=1644912;this._colorNames["navy"]=128;this._colorNames["darkblue"]=139;this._colorNames["mediumblue"]=205;this._colorNames["blue"]=255;this._colorNames["dodgerblue"]=2003199;this._colorNames["deepskyblue"]=49151;this._colorNames["lightskyblue"]=8900346;this._colorNames["skyblue"]=8900331;this._colorNames["lightblue"]=11393254;this._colorNames["powderblue"]=11591910;this._colorNames["azure"]=15794175;this._colorNames["lightcyan"]=14745599;this._colorNames["paleturquoise"]=11529966;this._colorNames["mediumturquoise"]=4772300;this._colorNames["lightseagreen"]=2142890;this._colorNames["darkcyan"]=35723;this._colorNames["teal"]=32896;this._colorNames["cadetblue"]=6266528;this._colorNames["darkturquoise"]=52945;this._colorNames["aqua"]=65535;this._colorNames["cyan"]=65535;this._colorNames["turquoise"]=4251856;this._colorNames["aquamarine"]=8388564;this._colorNames["mediumaquamarine"]=6737322;this._colorNames["darkseagreen"]=9419919;this._colorNames["mediumseagreen"]=3978097;this._colorNames["seagreen"]=3050327;this._colorNames["darkgreen"]=25600;this._colorNames["green"]=32768;this._colorNames["forestgreen"]=2263842;this._colorNames["limegreen"]=3329330;this._colorNames["lime"]=65280;this._colorNames["chartreuse"]=8388352;this._colorNames["lawngreen"]=8190976;this._colorNames["greenyellow"]=11403055;this._colorNames["yellowgreen"]=10145074;this._colorNames["palegreen"]=10025880;this._colorNames["lightgreen"]=9498256;this._colorNames["springgreen"]=65407;this._colorNames["mediumspringgreen"]=64154;this._colorNames["darkolivegreen"]=5597999;this._colorNames["olivedrab"]=7048739;this._colorNames["olive"]=8421376;this._colorNames["darkkhaki"]=12433259;this._colorNames["darkgoldenrod"]=12092939;this._colorNames["goldenrod"]=14329120;this._colorNames["gold"]=16766720;this._colorNames["yellow"]=16776960;this._colorNames["khaki"]=15787660;this._colorNames["palegoldenrod"]=15657130;this._colorNames["blanchedalmond"]=16772045;this._colorNames["moccasin"]=16770229;this._colorNames["wheat"]=16113331;this._colorNames["navajowhite"]=16768685;this._colorNames["burlywood"]=14596231;this._colorNames["tan"]=13808780;this._colorNames["rosybrown"]=12357519;this._colorNames["sienna"]=10506797;this._colorNames["saddlebrown"]=9127187;this._colorNames["chocolate"]=13789470;this._colorNames["peru"]=13468991;this._colorNames["sandybrown"]=16032864;this._colorNames["darkred"]=9109504;this._colorNames["maroon"]=8388608;this._colorNames["brown"]=10824234;this._colorNames["firebrick"]=11674146;this._colorNames["indianred"]=13458524;this._colorNames["lightcoral"]=15761536;this._colorNames["salmon"]=16416882;this._colorNames["darksalmon"]=15308410;this._colorNames["lightsalmon"]=16752762;this._colorNames["coral"]=16744272;this._colorNames["tomato"]=16737095;this._colorNames["darkorange"]=16747520;this._colorNames["orange"]=16753920;this._colorNames["orangered"]=16729344;this._colorNames["crimson"]=14423100;this._colorNames["red"]=16711680;this._colorNames["deeppink"]=16716947;this._colorNames["fuchsia"]=16711935;this._colorNames["magenta"]=16711935;this._colorNames["hotpink"]=16738740;this._colorNames["lightpink"]=16758465;this._colorNames["pink"]=16761035;this._colorNames["palevioletred"]=14381203;this._colorNames["mediumvioletred"]=13047173;this._colorNames["purple"]=8388736;this._colorNames["darkmagenta"]=9109643;this._colorNames["mediumpurple"]=9662683;this._colorNames["blueviolet"]=9055202;this._colorNames["indigo"]=4915330;this._colorNames["darkviolet"]=9699539;this._colorNames["darkorchid"]=10040012;this._colorNames["mediumorchid"]=12211667;this._colorNames["orchid"]=14315734;this._colorNames["violet"]=15631086;this._colorNames["plum"]=14524637;this._colorNames["thistle"]=14204888;this._colorNames["lavender"]=15132410;this._colorNames["ghostwhite"]=16316671;this._colorNames["aliceblue"]=15792383;this._colorNames["mintcream"]=16121850;this._colorNames["honeydew"]=15794160;this._colorNames["lightgoldenrodyellow"]=16448210;this._colorNames["lemonchiffon"]=16775885;this._colorNames["cornsilk"]=16775388;this._colorNames["lightyellow"]=16777184;this._colorNames["ivory"]=16777200;this._colorNames["floralwhite"]=16775920;this._colorNames["linen"]=16445670;this._colorNames["oldlace"]=16643558;this._colorNames["antiquewhite"]=16444375;this._colorNames["bisque"]=16770244;this._colorNames["peachpuff"]=16767673;this._colorNames["papayawhip"]=16773077;this._colorNames["beige"]=16119260;this._colorNames["seashell"]=16774638;this._colorNames["lavenderblush"]=16773365;this._colorNames["mistyrose"]=16770273;this._colorNames["snow"]=16775930;this._colorNames["white"]=16777215;this._colorNames["whitesmoke"]=16119285;this._colorNames["gainsboro"]=14474460;this._colorNames["lightgrey"]=13882323;this._colorNames["silver"]=12632256;this._colorNames["darkgrey"]=11119017;this._colorNames["grey"]=8421504;this._colorNames["lightslategrey"]=7833753;this._colorNames["slategrey"]=7372944;this._colorNames["dimgrey"]=6908265;this._colorNames["darkslategrey"]=3100495;this._colorNames["black"]=0;this._colorNames["transparent"]=4278190080}if(this._colorNames[t]!=null)return this._colorNames[t];if(t.length==6&&this.isHex(t))return parseInt("0x"+t)}return null};i.color=function(t){var e=this.tryColor(t);if(e==null)throw new Dt("Can't cast to color: "+t);return e};i.tryClass=function(t){if(this._notClasses[t])return t;var e=this._classes[t];if(e!=null)return e;try{e=window[t];this._classes[t]=e;return e}catch(t){}this._notClasses[t]=true;return t};i.image2D=function(e){if(e==null)return null;if(typeof e=="string")e=this.tryClass(e);if(typeof e=="function"){try{e=new e}catch(t){e=new e(0,0)}}if(e instanceof q.Image2D)return e;if(e instanceof X.ImageTexture2D)e=e.image;throw new Dt("Can't cast to BitmapImage2D: "+e)};i.bitmapTexture=function(e){if(e==null)return null;if(typeof e=="string")e=this.tryClass(e);if(typeof e=="function"){try{e=new e}catch(t){e=new e(0,0)}}if(e instanceof X.ImageTexture2D)return e;try{var t=i.image2D(e);return new X.ImageTexture2D(t)}catch(t){}throw new Dt("Can't cast to ImageTexture2D: "+e)};i._hexChars="0123456789abcdefABCDEF";i._notClasses=new Object;i._classes=new Object;return i}();var Xt=function(){function t(t,e,i,r){var s=this;if(t===void 0){t=null}if(e===void 0){e=null}if(i===void 0){i=null}if(r===void 0){r=null}this._time=0;this._deltaTime=0;this._onProjectionChangedDelegate=function(t){return s._onProjectionChanged(t)};this._rendererClass=r||X.DefaultRenderer;this._pickGroup=o.PickGroup.getInstance();this.view=i||new o.View;this.partition=t||this._view.getNode(new c).partition;this.camera=e||new R}Object.defineProperty(t.prototype,"partition",{get:function(){return this._partition},set:function(t){if(this._partition==t)return;if(this._mousePicker)this._mouseManager.unregisterPicker(this._mousePicker);this._partition=t;this._mousePicker=this._pickGroup.getRaycastPicker(this._partition);this._tabPicker=this._pickGroup.getTabPicker(this._partition);this._mousePicker.findClosestCollision=true;this._mouseManager.registerPicker(this._mousePicker);if(this._camera){this._camera.clear();this._partition.invalidateEntity(this._camera.getAbstraction(this._partition))}},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"view",{get:function(){return this._view},set:function(t){if(this._view==t)return;if(this._view){if(this._renderer){this._renderer.clear();this._renderer=null}if(this._mousePicker)this._mouseManager.unregisterPicker(this._mousePicker)}this._view=t;this._mouseManager=Rt.getInstance(this._view.stage);if(this._mousePicker)this._mouseManager.registerPicker(this._mousePicker);if(this._camera)this._view.projection=this._camera.projection},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"renderer",{get:function(){if(!this._renderer)this._renderer=X.RenderGroup.getInstance(this._rendererClass).getRenderer(this._partition);return this._renderer},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"mouseX",{get:function(){return this._mouseX},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"mouseY",{get:function(){return this._mouseY},enumerable:true,configurable:true});t.prototype.getLocalMouseX=function(t){return t.getInverseMatrix3D().transformVector(this._view.unproject(this._view.stage.screenX,this._view.stage.screenY,1e3)).x};t.prototype.getLocalMouseY=function(t){return t.getInverseMatrix3D().transformVector(this._view.unproject(this._view.stage.screenX,this._view.stage.screenY,1e3)).y};t.prototype.getLocalTouchPoints=function(t){var e;var i=new Array;var r=this._view.stage.touchPoints.length;for(var s=0;s<r;s++){e=t.getInverseMatrix3D().transformVector(this._view.unproject(this._view.stage.touchPoints[s].x,this._view.stage.touchPoints[s].y,1e3));i.push(new q.TouchPoint(e.x,e.y,this._view.stage.touchPoints[s].id))}return i};Object.defineProperty(t.prototype,"rendererClass",{get:function(){return this._rendererClass},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"rendererType",{set:function(t){if(this._rendererClass==t)return;if(this._renderer){this._renderer.clear();this._renderer=null}this._rendererClass=t},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"camera",{get:function(){return this._camera},set:function(t){if(this._camera==t)return;if(this._camera){this._camera.clear();this._camera.removeEventListener(F.PROJECTION_CHANGED,this._onProjectionChangedDelegate)}this._camera=t;this._camera.addEventListener(F.PROJECTION_CHANGED,this._onProjectionChangedDelegate);if(this._view)this._view.projection=this._camera.projection;this._partition.invalidateEntity(this._camera.getAbstraction(this._partition))},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"deltaTime",{get:function(){return this._deltaTime},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"mouseManager",{get:function(){return this._mouseManager},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"mousePicker",{get:function(){return this._mousePicker},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"tabPicker",{get:function(){return this._tabPicker},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"renderedFacesCount",{get:function(){return 0},enumerable:true,configurable:true});t.prototype.fireMouseEvents=function(){if(!this.disableMouseEvents)this._mouseManager.fireMouseEvents(this._mousePicker)};t.prototype.render=function(t){if(t===void 0){t=true}this._updateTime();if(t&&!this.disableMouseEvents)this._mouseManager.fireMouseEvents(this._mousePicker);if(this.beforeRenderCallback)this.beforeRenderCallback();this.renderer.render()};t.prototype._updateTime=function(){var t=G.getTimer();if(this._time==0)this._time=t;this._deltaTime=t-this._time;this._time=t};t.prototype.dispose=function(){if(this._renderer){this._renderer.clear();this._renderer=null}this._mouseManager.dispose();this._mouseManager=null};t.prototype._onProjectionChanged=function(t){this._view.projection=this._camera.projection};return t}();Y.MaterialManager.materialClass=h.MethodMaterial;Y.MaterialManager.textureClass=X.ImageTexture2D;console.debug("AwayJS - Scene - 0.13.251");d.Timeline=E;d.ControllerBase=S;d.FirstPersonController=A;d.FollowController=D;d.HoverController=P;d.LookAtController=T;d.SpringController=I;d.Billboard=C;d._Render_Billboard=M;d.Camera=R;d.DisplayObject=u;d.DisplayObjectContainer=c;d.LineSegment=L;d._Render_LineSegment=k;d.LoaderContainer=B;d.MorphSprite=p;d.MovieClip=H;d.SimpleButton=W;d.Skybox=Q;d._Render_Skybox=$;d._Render_SkyboxMaterial=J;d.Sprite=f;d.TextField=Pt;d.TextSprite=xt;d.CastError=Dt;d.CameraEvent=F;d.FocusEvent=It;d.KeyboardEvent=yt;d.MouseEvent=V;d.ResizeEvent=Ct;d.TextfieldEvent=bt;d.SkyboxElements=z;d._Render_SkyboxElements=K;d._Stage_SkyboxElements=Z;d.DefaultSceneGraphFactory=Mt;d.SceneImage2D=Ft;d.FrameScriptManager=U;d.DefaultFontManager=dt;d.DeviceFontManager=pt;d.MouseManager=Rt;d.PrefabBase=i;d.PrimitiveCapsulePrefab=Nt;d.PrimitiveConePrefab=kt;d.PrimitiveCubePrefab=n;d.PrimitiveCylinderPrefab=Lt;d.PrimitivePlanePrefab=jt;d.PrimitivePolygonPrefab=Bt;d.PrimitivePrefabBase=s;d.PrimitiveSpherePrefab=a;d.PrimitiveTorusPrefab=Ut;d.AntiAliasType=Vt;d.BitmapFontChar=ct;d.BitmapFontTable=_t;d.FNTGenerator=Ht;d.Font=ft;d.GridFitType=Wt;d.HTMLTextProcessor=St;d.TesselatedFontTable=ut;d.TesselatedFontChar=st;d.TextFieldAutoSize=et;d.TextFieldType=it;d.TextFormat=mt;d.TextFormatAlign=rt;d.TextInteractionMode=zt;d.TextLineMetrics=vt;d.Merge=Gt;d.Cast=Yt;d.Scene=Xt;d.Settings=b;Object.defineProperty(d,"__esModule",{value:true})});